UNPKG

3.76 MBJavaScriptView Raw
1module.exports =
2/******/ (function() { // webpackBootstrap
3/******/ var __webpack_modules__ = ({
4
5/***/ 90601:
6/***/ (function(module) {
7
8"use strict";
9module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"$id\":\"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#\",\"description\":\"Meta-schema for $data reference (JSON Schema extension proposal)\",\"type\":\"object\",\"required\":[\"$data\"],\"properties\":{\"$data\":{\"type\":\"string\",\"anyOf\":[{\"format\":\"relative-json-pointer\"},{\"format\":\"json-pointer\"}]}},\"additionalProperties\":false}");
10
11/***/ }),
12
13/***/ 98938:
14/***/ (function(module) {
15
16"use strict";
17module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"$id\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Core schema meta-schema\",\"definitions\":{\"schemaArray\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#\"}},\"nonNegativeInteger\":{\"type\":\"integer\",\"minimum\":0},\"nonNegativeIntegerDefault0\":{\"allOf\":[{\"$ref\":\"#/definitions/nonNegativeInteger\"},{\"default\":0}]},\"simpleTypes\":{\"enum\":[\"array\",\"boolean\",\"integer\",\"null\",\"number\",\"object\",\"string\"]},\"stringArray\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true,\"default\":[]}},\"type\":[\"object\",\"boolean\"],\"properties\":{\"$id\":{\"type\":\"string\",\"format\":\"uri-reference\"},\"$schema\":{\"type\":\"string\",\"format\":\"uri\"},\"$ref\":{\"type\":\"string\",\"format\":\"uri-reference\"},\"$comment\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"default\":true,\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":true},\"multipleOf\":{\"type\":\"number\",\"exclusiveMinimum\":0},\"maximum\":{\"type\":\"number\"},\"exclusiveMaximum\":{\"type\":\"number\"},\"minimum\":{\"type\":\"number\"},\"exclusiveMinimum\":{\"type\":\"number\"},\"maxLength\":{\"$ref\":\"#/definitions/nonNegativeInteger\"},\"minLength\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"pattern\":{\"type\":\"string\",\"format\":\"regex\"},\"additionalItems\":{\"$ref\":\"#\"},\"items\":{\"anyOf\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/schemaArray\"}],\"default\":true},\"maxItems\":{\"$ref\":\"#/definitions/nonNegativeInteger\"},\"minItems\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"uniqueItems\":{\"type\":\"boolean\",\"default\":false},\"contains\":{\"$ref\":\"#\"},\"maxProperties\":{\"$ref\":\"#/definitions/nonNegativeInteger\"},\"minProperties\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"required\":{\"$ref\":\"#/definitions/stringArray\"},\"additionalProperties\":{\"$ref\":\"#\"},\"definitions\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#\"},\"default\":{}},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#\"},\"propertyNames\":{\"format\":\"regex\"},\"default\":{}},\"dependencies\":{\"type\":\"object\",\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/stringArray\"}]}},\"propertyNames\":{\"$ref\":\"#\"},\"const\":true,\"enum\":{\"type\":\"array\",\"items\":true,\"minItems\":1,\"uniqueItems\":true},\"type\":{\"anyOf\":[{\"$ref\":\"#/definitions/simpleTypes\"},{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/simpleTypes\"},\"minItems\":1,\"uniqueItems\":true}]},\"format\":{\"type\":\"string\"},\"contentMediaType\":{\"type\":\"string\"},\"contentEncoding\":{\"type\":\"string\"},\"if\":{\"$ref\":\"#\"},\"then\":{\"$ref\":\"#\"},\"else\":{\"$ref\":\"#\"},\"allOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"anyOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"oneOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"not\":{\"$ref\":\"#\"}},\"default\":true}");
18
19/***/ }),
20
21/***/ 25916:
22/***/ (function(module) {
23
24"use strict";
25module.exports = {"version":"4.2.1"};
26
27/***/ }),
28
29/***/ 35464:
30/***/ (function(module) {
31
32"use strict";
33module.exports = {"i8":"4.3.0"};
34
35/***/ }),
36
37/***/ 11840:
38/***/ (function(module) {
39
40"use strict";
41module.exports = JSON.parse("{\"additionalProperties\":false,\"definitions\":{\"file-conditions\":{\"anyOf\":[{\"instanceof\":\"RegExp\"},{\"type\":\"string\"}]}},\"properties\":{\"test\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"},{\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"}]},\"type\":\"array\"}]},\"include\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"},{\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"}]},\"type\":\"array\"}]},\"exclude\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"},{\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/file-conditions\"}]},\"type\":\"array\"}]},\"chunkFilter\":{\"instanceof\":\"Function\"},\"cache\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"string\"}]},\"cacheKeys\":{\"instanceof\":\"Function\"},\"parallel\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"integer\"}]},\"sourceMap\":{\"type\":\"boolean\"},\"minify\":{\"instanceof\":\"Function\"},\"terserOptions\":{\"additionalProperties\":true,\"type\":\"object\"},\"extractComments\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"string\"},{\"instanceof\":\"RegExp\"},{\"instanceof\":\"Function\"},{\"additionalProperties\":false,\"properties\":{\"condition\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"string\"},{\"instanceof\":\"RegExp\"},{\"instanceof\":\"Function\"}]},\"filename\":{\"anyOf\":[{\"type\":\"string\"},{\"instanceof\":\"Function\"}]},\"banner\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"string\"},{\"instanceof\":\"Function\"}]}},\"type\":\"object\"}]},\"warningsFilter\":{\"instanceof\":\"Function\"}},\"type\":\"object\"}");
42
43/***/ }),
44
45/***/ 92203:
46/***/ (function(module) {
47
48"use strict";
49module.exports = JSON.parse("{\"name\":\"terser\",\"description\":\"JavaScript parser, mangler/compressor and beautifier toolkit for ES6+\",\"homepage\":\"https://terser.org\",\"author\":\"Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)\",\"license\":\"BSD-2-Clause\",\"version\":\"4.8.0\",\"engines\":{\"node\":\">=6.0.0\"},\"maintainers\":[\"Fábio Santos <fabiosantosart@gmail.com>\"],\"repository\":\"https://github.com/terser/terser\",\"main\":\"dist/bundle.min.js\",\"types\":\"tools/terser.d.ts\",\"bin\":{\"terser\":\"bin/terser\"},\"files\":[\"bin\",\"dist\",\"tools\",\"LICENSE\",\"README.md\",\"CHANGELOG.md\",\"PATRONS.md\"],\"dependencies\":{\"commander\":\"^2.20.0\",\"source-map\":\"~0.6.1\",\"source-map-support\":\"~0.5.12\"},\"devDependencies\":{\"acorn\":\"^7.1.1\",\"astring\":\"^1.4.1\",\"eslint\":\"^6.3.0\",\"eslump\":\"^2.0.0\",\"mocha\":\"^7.1.2\",\"mochallel\":\"^2.0.0\",\"pre-commit\":\"^1.2.2\",\"rimraf\":\"^3.0.0\",\"rollup\":\"2.0.6\",\"rollup-plugin-terser\":\"5.3.0\",\"semver\":\"^7.1.3\"},\"scripts\":{\"test\":\"npm run build -- --configTest && node test/run-tests.js\",\"test:compress\":\"npm run build -- --configTest && node test/compress.js\",\"test:mocha\":\"npm run build -- --configTest && node test/mocha.js\",\"lint\":\"eslint lib\",\"lint-fix\":\"eslint --fix lib\",\"build\":\"rimraf dist/* && rollup --config --silent\",\"prepare\":\"npm run build\",\"postversion\":\"echo 'Remember to update the changelog!'\"},\"keywords\":[\"uglify\",\"terser\",\"uglify-es\",\"uglify-js\",\"minify\",\"minifier\",\"javascript\",\"ecmascript\",\"es5\",\"es6\",\"es7\",\"es8\",\"es2015\",\"es2016\",\"es2017\",\"async\",\"await\"],\"eslintConfig\":{\"parserOptions\":{\"sourceType\":\"module\"},\"env\":{\"es6\":true},\"globals\":{\"describe\":false,\"it\":false,\"require\":false,\"global\":false,\"process\":false},\"rules\":{\"brace-style\":[\"error\",\"1tbs\",{\"allowSingleLine\":true}],\"quotes\":[\"error\",\"double\",\"avoid-escape\"],\"no-debugger\":\"error\",\"no-undef\":\"error\",\"no-unused-vars\":[\"error\",{\"varsIgnorePattern\":\"^_$\"}],\"no-tabs\":\"error\",\"semi\":[\"error\",\"always\"],\"no-extra-semi\":\"error\",\"no-irregular-whitespace\":\"error\",\"space-before-blocks\":[\"error\",\"always\"]}},\"pre-commit\":[\"lint-fix\",\"test\"]}");
50
51/***/ }),
52
53/***/ 9122:
54/***/ (function(module) {
55
56"use strict";
57module.exports = {"i8":"1.4.4"};
58
59/***/ }),
60
61/***/ 11335:
62/***/ (function(module) {
63
64"use strict";
65module.exports = {"i8":"4.0.3"};
66
67/***/ }),
68
69/***/ 71618:
70/***/ (function(module) {
71
72"use strict";
73module.exports = {"i8":"4.44.1"};
74
75/***/ }),
76
77/***/ 37863:
78/***/ (function(module) {
79
80"use strict";
81module.exports = JSON.parse("{\"definitions\":{\"ArrayOfStringOrStringArrayValues\":{\"type\":\"array\",\"items\":{\"description\":\"string or array of strings\",\"anyOf\":[{\"type\":\"string\",\"minLength\":1},{\"type\":\"array\",\"items\":{\"description\":\"A non-empty string\",\"type\":\"string\",\"minLength\":1}}]}},\"ArrayOfStringValues\":{\"type\":\"array\",\"items\":{\"description\":\"A non-empty string\",\"type\":\"string\",\"minLength\":1}},\"Entry\":{\"anyOf\":[{\"$ref\":\"#/definitions/EntryDynamic\"},{\"$ref\":\"#/definitions/EntryStatic\"}]},\"EntryDynamic\":{\"description\":\"A Function returning an entry object, an entry string, an entry array or a promise to these things.\",\"instanceof\":\"Function\",\"tsType\":\"(() => EntryStatic | Promise<EntryStatic>)\"},\"EntryItem\":{\"oneOf\":[{\"description\":\"An entry point without name. The string is resolved to a module which is loaded upon startup.\",\"type\":\"string\",\"minLength\":1},{\"description\":\"An entry point without name. All modules are loaded upon startup. The last one is exported.\",\"anyOf\":[{\"$ref\":\"#/definitions/NonEmptyArrayOfUniqueStringValues\"}]}]},\"EntryObject\":{\"description\":\"Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.\",\"type\":\"object\",\"additionalProperties\":{\"description\":\"An entry point with name\",\"oneOf\":[{\"description\":\"The string is resolved to a module which is loaded upon startup.\",\"type\":\"string\",\"minLength\":1},{\"description\":\"All modules are loaded upon startup. The last one is exported.\",\"anyOf\":[{\"$ref\":\"#/definitions/NonEmptyArrayOfUniqueStringValues\"}]}]},\"minProperties\":1},\"EntryStatic\":{\"oneOf\":[{\"$ref\":\"#/definitions/EntryObject\"},{\"$ref\":\"#/definitions/EntryItem\"}]},\"ExternalItem\":{\"anyOf\":[{\"description\":\"An exact matched dependency becomes external. The same string is used as external dependency.\",\"type\":\"string\"},{\"description\":\"If an dependency matches exactly a property of the object, the property value is used as dependency.\",\"type\":\"object\",\"additionalProperties\":{\"description\":\"The dependency used for the external\",\"anyOf\":[{\"type\":\"string\"},{\"type\":\"object\"},{\"$ref\":\"#/definitions/ArrayOfStringValues\"},{\"type\":\"boolean\"}]}},{\"description\":\"Every matched dependency becomes external.\",\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]},\"Externals\":{\"anyOf\":[{\"description\":\"`function(context, request, callback(err, result))` The function is called on each dependency.\",\"instanceof\":\"Function\",\"tsType\":\"((context: string, request: string, callback: (err?: Error, result?: string) => void) => void)\"},{\"$ref\":\"#/definitions/ExternalItem\"},{\"type\":\"array\",\"items\":{\"description\":\"External configuration\",\"anyOf\":[{\"description\":\"`function(context, request, callback(err, result))` The function is called on each dependency.\",\"instanceof\":\"Function\",\"tsType\":\"((context: string, request: string, callback: (err?: Error, result?: string) => void) => void)\"},{\"$ref\":\"#/definitions/ExternalItem\"}]}}]},\"FilterItemTypes\":{\"anyOf\":[{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"string\"},{\"instanceof\":\"Function\",\"tsType\":\"((value: string) => boolean)\"}]},\"FilterTypes\":{\"anyOf\":[{\"$ref\":\"#/definitions/FilterItemTypes\"},{\"type\":\"array\",\"items\":{\"description\":\"Rule to filter\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterItemTypes\"}]}}]},\"LibraryCustomUmdObject\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"amd\":{\"description\":\"Name of the exposed AMD library in the UMD\",\"type\":\"string\"},\"commonjs\":{\"description\":\"Name of the exposed commonjs export in the UMD\",\"type\":\"string\"},\"root\":{\"description\":\"Name of the property exposed globally by a UMD library\",\"anyOf\":[{\"type\":\"string\"},{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]}}},\"ModuleOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"defaultRules\":{\"description\":\"An array of rules applied by default for modules.\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetRules\"}]},\"exprContextCritical\":{\"description\":\"Enable warnings for full dynamic dependencies\",\"type\":\"boolean\"},\"exprContextRecursive\":{\"description\":\"Enable recursive directory lookup for full dynamic dependencies\",\"type\":\"boolean\"},\"exprContextRegExp\":{\"description\":\"Sets the default regular expression for full dynamic dependencies\",\"anyOf\":[{\"type\":\"boolean\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]},\"exprContextRequest\":{\"description\":\"Set the default request for full dynamic dependencies\",\"type\":\"string\"},\"noParse\":{\"description\":\"Don't parse files matching. It's matched against the full resolved request.\",\"anyOf\":[{\"type\":\"array\",\"items\":{\"description\":\"A regular expression, when matched the module is not parsed\",\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},\"minItems\":1},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"array\",\"items\":{\"description\":\"An absolute path, when the module starts with this path it is not parsed\",\"type\":\"string\",\"absolutePath\":true},\"minItems\":1},{\"type\":\"string\",\"absolutePath\":true}]},\"rules\":{\"description\":\"An array of rules applied for modules.\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetRules\"}]},\"strictExportPresence\":{\"description\":\"Emit errors instead of warnings when imported names don't exist in imported module\",\"type\":\"boolean\"},\"strictThisContextOnImports\":{\"description\":\"Handle the this context correctly according to the spec for namespace objects\",\"type\":\"boolean\"},\"unknownContextCritical\":{\"description\":\"Enable warnings when using the require function in a not statically analyse-able way\",\"type\":\"boolean\"},\"unknownContextRecursive\":{\"description\":\"Enable recursive directory lookup when using the require function in a not statically analyse-able way\",\"type\":\"boolean\"},\"unknownContextRegExp\":{\"description\":\"Sets the regular expression when using the require function in a not statically analyse-able way\",\"anyOf\":[{\"type\":\"boolean\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]},\"unknownContextRequest\":{\"description\":\"Sets the request when using the require function in a not statically analyse-able way\",\"type\":\"string\"},\"unsafeCache\":{\"description\":\"Cache the resolving of module requests\",\"anyOf\":[{\"type\":\"boolean\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"wrappedContextCritical\":{\"description\":\"Enable warnings for partial dynamic dependencies\",\"type\":\"boolean\"},\"wrappedContextRecursive\":{\"description\":\"Enable recursive directory lookup for partial dynamic dependencies\",\"type\":\"boolean\"},\"wrappedContextRegExp\":{\"description\":\"Set the inner regular expression for partial dynamic dependencies\",\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}}},\"NodeOptions\":{\"type\":\"object\",\"additionalProperties\":{\"description\":\"Include a polyfill for the node.js module\",\"enum\":[false,true,\"mock\",\"empty\"]},\"properties\":{\"Buffer\":{\"description\":\"Include a polyfill for the 'Buffer' variable\",\"enum\":[false,true,\"mock\"]},\"__dirname\":{\"description\":\"Include a polyfill for the '__dirname' variable\",\"enum\":[false,true,\"mock\"]},\"__filename\":{\"description\":\"Include a polyfill for the '__filename' variable\",\"enum\":[false,true,\"mock\"]},\"console\":{\"description\":\"Include a polyfill for the 'console' variable\",\"enum\":[false,true,\"mock\"]},\"global\":{\"description\":\"Include a polyfill for the 'global' variable\",\"type\":\"boolean\"},\"process\":{\"description\":\"Include a polyfill for the 'process' variable\",\"enum\":[false,true,\"mock\"]}}},\"NonEmptyArrayOfUniqueStringValues\":{\"description\":\"A non-empty array of non-empty strings\",\"type\":\"array\",\"items\":{\"description\":\"A non-empty string\",\"type\":\"string\",\"minLength\":1},\"minItems\":1,\"uniqueItems\":true},\"OptimizationOptions\":{\"description\":\"Enables/Disables integrated optimizations\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"checkWasmTypes\":{\"description\":\"Check for incompatible wasm types when importing/exporting from/to ESM\",\"type\":\"boolean\"},\"chunkIds\":{\"description\":\"Define the algorithm to choose chunk ids (named: readable ids for better debugging, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)\",\"enum\":[\"natural\",\"named\",\"size\",\"total-size\",false]},\"concatenateModules\":{\"description\":\"Concatenate modules when possible to generate less modules, more efficient code and enable more optimizations by the minimizer\",\"type\":\"boolean\"},\"flagIncludedChunks\":{\"description\":\"Also flag chunks as loaded which contain a subset of the modules\",\"type\":\"boolean\"},\"hashedModuleIds\":{\"description\":\"Use hashed module id instead module identifiers for better long term caching (deprecated, used moduleIds: hashed instead)\",\"type\":\"boolean\"},\"mangleWasmImports\":{\"description\":\"Reduce size of WASM by changing imports to shorter strings.\",\"type\":\"boolean\"},\"mergeDuplicateChunks\":{\"description\":\"Merge chunks which contain the same modules\",\"type\":\"boolean\"},\"minimize\":{\"description\":\"Enable minimizing the output. Uses optimization.minimizer.\",\"type\":\"boolean\"},\"minimizer\":{\"description\":\"Minimizer(s) to use for minimizing the output\",\"type\":\"array\",\"items\":{\"description\":\"Plugin of type object or instanceof Function\",\"anyOf\":[{\"$ref\":\"#/definitions/WebpackPluginInstance\"},{\"$ref\":\"#/definitions/WebpackPluginFunction\"}]}},\"moduleIds\":{\"description\":\"Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: short hashes as ids for better long term caching, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)\",\"enum\":[\"natural\",\"named\",\"hashed\",\"size\",\"total-size\",false]},\"namedChunks\":{\"description\":\"Use readable chunk identifiers for better debugging (deprecated, used chunkIds: named instead)\",\"type\":\"boolean\"},\"namedModules\":{\"description\":\"Use readable module identifiers for better debugging (deprecated, used moduleIds: named instead)\",\"type\":\"boolean\"},\"noEmitOnErrors\":{\"description\":\"Avoid emitting assets when errors occur\",\"type\":\"boolean\"},\"nodeEnv\":{\"description\":\"Set process.env.NODE_ENV to a specific value\",\"anyOf\":[{\"enum\":[false]},{\"type\":\"string\"}]},\"occurrenceOrder\":{\"description\":\"Figure out a order of modules which results in the smallest initial bundle\",\"type\":\"boolean\"},\"portableRecords\":{\"description\":\"Generate records with relative paths to be able to move the context folder\",\"type\":\"boolean\"},\"providedExports\":{\"description\":\"Figure out which exports are provided by modules to generate more efficient code\",\"type\":\"boolean\"},\"removeAvailableModules\":{\"description\":\"Removes modules from chunks when these modules are already included in all parents\",\"type\":\"boolean\"},\"removeEmptyChunks\":{\"description\":\"Remove chunks which are empty\",\"type\":\"boolean\"},\"runtimeChunk\":{\"description\":\"Create an additional chunk which contains only the webpack runtime and chunk hash maps\",\"oneOf\":[{\"type\":\"boolean\"},{\"enum\":[\"single\",\"multiple\"]},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"description\":\"The name or name factory for the runtime chunks\",\"oneOf\":[{\"type\":\"string\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]}}}]},\"sideEffects\":{\"description\":\"Skip over modules which are flagged to contain no side effects when exports are not used\",\"type\":\"boolean\"},\"splitChunks\":{\"description\":\"Optimize duplication and caching by splitting chunks by shared modules and cache group\",\"oneOf\":[{\"enum\":[false]},{\"$ref\":\"#/definitions/OptimizationSplitChunksOptions\"}]},\"usedExports\":{\"description\":\"Figure out which exports are used by modules to mangle export names, omit unused exports and generate more efficient code\",\"type\":\"boolean\"}}},\"OptimizationSplitChunksOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"automaticNameDelimiter\":{\"description\":\"Sets the name delimiter for created chunks\",\"type\":\"string\",\"minLength\":1},\"automaticNameMaxLength\":{\"description\":\"Sets the max length for the name of a created chunk\",\"type\":\"number\",\"minimum\":1},\"cacheGroups\":{\"description\":\"Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks)\",\"type\":\"object\",\"additionalProperties\":{\"description\":\"Configuration for a cache group\",\"anyOf\":[{\"enum\":[false]},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"automaticNameDelimiter\":{\"description\":\"Sets the name delimiter for created chunks\",\"type\":\"string\",\"minLength\":1},\"automaticNameMaxLength\":{\"description\":\"Sets the max length for the name of a created chunk\",\"type\":\"number\",\"minimum\":1},\"automaticNamePrefix\":{\"description\":\"Sets the name prefix for created chunks\",\"type\":\"string\"},\"chunks\":{\"description\":\"Select chunks for determining cache group content (defaults to \\\"initial\\\", \\\"initial\\\" and \\\"all\\\" requires adding these chunks to the HTML)\",\"oneOf\":[{\"enum\":[\"initial\",\"async\",\"all\"]},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"enforce\":{\"description\":\"Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group\",\"type\":\"boolean\"},\"enforceSizeThreshold\":{\"description\":\"Size threshold at which splitting is enforced and other restrictions (maxAsyncRequests, maxInitialRequests) are ignored.\",\"type\":\"number\"},\"filename\":{\"description\":\"Sets the template for the filename for created chunks (Only works for initial chunks)\",\"type\":\"string\",\"minLength\":1},\"maxAsyncRequests\":{\"description\":\"Maximum number of requests which are accepted for on-demand loading\",\"type\":\"number\",\"minimum\":1},\"maxInitialRequests\":{\"description\":\"Maximum number of initial chunks which are accepted for an entry point\",\"type\":\"number\",\"minimum\":1},\"maxSize\":{\"description\":\"Maximal size hint for the created chunks\",\"type\":\"number\",\"minimum\":0},\"minChunks\":{\"description\":\"Minimum number of times a module has to be duplicated until it's considered for splitting\",\"type\":\"number\",\"minimum\":1},\"minSize\":{\"description\":\"Minimal size for the created chunk\",\"type\":\"number\",\"minimum\":0},\"name\":{\"description\":\"Give chunks for this cache group a name (chunks with equal name are merged)\",\"oneOf\":[{\"type\":\"boolean\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\"}]},\"priority\":{\"description\":\"Priority of this cache group\",\"type\":\"number\"},\"reuseExistingChunk\":{\"description\":\"Try to reuse existing chunk (with name) when it has matching modules\",\"type\":\"boolean\"},\"test\":{\"description\":\"Assign modules to a cache group\",\"oneOf\":[{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]}}}]},\"not\":{\"description\":\"Using the cacheGroup shorthand syntax with a cache group named 'test' is a potential config error\\nDid you intent to define a cache group with a test instead?\\ncacheGroups: {\\n <name>: {\\n test: ...\\n }\\n}\",\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"test\":{\"description\":\"The test property is a cache group name, but using the test option of the cache group could be intended instead\",\"anyOf\":[{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]}},\"required\":[\"test\"]}},\"chunks\":{\"description\":\"Select chunks for determining shared modules (defaults to \\\"async\\\", \\\"initial\\\" and \\\"all\\\" requires adding these chunks to the HTML)\",\"oneOf\":[{\"enum\":[\"initial\",\"async\",\"all\"]},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"enforceSizeThreshold\":{\"description\":\"Size threshold at which splitting is enforced and other restrictions (maxAsyncRequests, maxInitialRequests) are ignored.\",\"type\":\"number\"},\"fallbackCacheGroup\":{\"description\":\"Options for modules not selected by any other cache group\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"automaticNameDelimiter\":{\"description\":\"Sets the name delimiter for created chunks\",\"type\":\"string\",\"minLength\":1},\"maxSize\":{\"description\":\"Maximal size hint for the created chunks\",\"type\":\"number\",\"minimum\":0},\"minSize\":{\"description\":\"Minimal size for the created chunk\",\"type\":\"number\",\"minimum\":0}}},\"filename\":{\"description\":\"Sets the template for the filename for created chunks (Only works for initial chunks)\",\"type\":\"string\",\"minLength\":1},\"hidePathInfo\":{\"description\":\"Prevents exposing path info when creating names for parts splitted by maxSize\",\"type\":\"boolean\"},\"maxAsyncRequests\":{\"description\":\"Maximum number of requests which are accepted for on-demand loading\",\"type\":\"number\",\"minimum\":1},\"maxInitialRequests\":{\"description\":\"Maximum number of initial chunks which are accepted for an entry point\",\"type\":\"number\",\"minimum\":1},\"maxSize\":{\"description\":\"Maximal size hint for the created chunks\",\"type\":\"number\",\"minimum\":0},\"minChunks\":{\"description\":\"Minimum number of times a module has to be duplicated until it's considered for splitting\",\"type\":\"number\",\"minimum\":1},\"minSize\":{\"description\":\"Minimal size for the created chunks\",\"type\":\"number\",\"minimum\":0},\"name\":{\"description\":\"Give chunks created a name (chunks with equal name are merged)\",\"oneOf\":[{\"type\":\"boolean\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\"}]}}},\"OutputOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"auxiliaryComment\":{\"description\":\"Add a comment in the UMD wrapper.\",\"anyOf\":[{\"description\":\"Append the same comment above each import style.\",\"type\":\"string\"},{\"description\":\"Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"amd\":{\"description\":\"Set comment for `amd` section in UMD\",\"type\":\"string\"},\"commonjs\":{\"description\":\"Set comment for `commonjs` (exports) section in UMD\",\"type\":\"string\"},\"commonjs2\":{\"description\":\"Set comment for `commonjs2` (module.exports) section in UMD\",\"type\":\"string\"},\"root\":{\"description\":\"Set comment for `root` (global variable) section in UMD\",\"type\":\"string\"}}}]},\"chunkCallbackName\":{\"description\":\"The callback function name used by webpack for loading of chunks in WebWorkers.\",\"type\":\"string\"},\"chunkFilename\":{\"description\":\"The filename of non-entry chunks as relative path inside the `output.path` directory.\",\"type\":\"string\",\"absolutePath\":false},\"chunkLoadTimeout\":{\"description\":\"Number of milliseconds before chunk request expires\",\"type\":\"number\"},\"crossOriginLoading\":{\"description\":\"This option enables cross-origin loading of chunks.\",\"enum\":[false,\"anonymous\",\"use-credentials\"]},\"devtoolFallbackModuleFilenameTemplate\":{\"description\":\"Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.\",\"anyOf\":[{\"type\":\"string\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"devtoolLineToLine\":{\"description\":\"Enable line to line mapped mode for all/specified modules. Line to line mapped mode uses a simple SourceMap where each line of the generated source is mapped to the same line of the original source. It’s a performance optimization. Only use it if your performance need to be better and you are sure that input lines match which generated lines.\",\"anyOf\":[{\"description\":\"`true` enables it for all modules (not recommended)\",\"type\":\"boolean\"},{\"description\":\"An object similar to `module.loaders` enables it for specific files.\",\"type\":\"object\"}]},\"devtoolModuleFilenameTemplate\":{\"description\":\"Filename template string of function for the sources array in a generated SourceMap.\",\"anyOf\":[{\"type\":\"string\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"devtoolNamespace\":{\"description\":\"Module namespace to use when interpolating filename template string for the sources array in a generated SourceMap. Defaults to `output.library` if not set. It's useful for avoiding runtime collisions in sourcemaps from multiple webpack projects built as libraries.\",\"type\":\"string\"},\"filename\":{\"description\":\"Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.\",\"anyOf\":[{\"type\":\"string\",\"absolutePath\":false},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"futureEmitAssets\":{\"description\":\"Use the future version of asset emitting logic, which allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version.\",\"type\":\"boolean\"},\"globalObject\":{\"description\":\"An expression which is used to address the global object/scope in runtime code\",\"type\":\"string\",\"minLength\":1},\"hashDigest\":{\"description\":\"Digest type used for the hash\",\"type\":\"string\"},\"hashDigestLength\":{\"description\":\"Number of chars which are used for the hash\",\"type\":\"number\",\"minimum\":1},\"hashFunction\":{\"description\":\"Algorithm used for generation the hash (see node.js crypto package)\",\"anyOf\":[{\"type\":\"string\",\"minLength\":1},{\"instanceof\":\"Function\",\"tsType\":\"import('../lib/util/createHash').HashConstructor\"}]},\"hashSalt\":{\"description\":\"Any string which is added to the hash to salt it\",\"type\":\"string\",\"minLength\":1},\"hotUpdateChunkFilename\":{\"description\":\"The filename of the Hot Update Chunks. They are inside the output.path directory.\",\"type\":\"string\",\"absolutePath\":false},\"hotUpdateFunction\":{\"description\":\"The JSONP function used by webpack for async loading of hot update chunks.\",\"type\":\"string\"},\"hotUpdateMainFilename\":{\"description\":\"The filename of the Hot Update Main File. It is inside the `output.path` directory.\",\"anyOf\":[{\"type\":\"string\",\"absolutePath\":false},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"jsonpFunction\":{\"description\":\"The JSONP function used by webpack for async loading of chunks.\",\"type\":\"string\"},\"jsonpScriptType\":{\"description\":\"This option enables loading async chunks via a custom script type, such as script type=\\\"module\\\"\",\"enum\":[false,\"text/javascript\",\"module\"]},\"library\":{\"description\":\"If set, export the bundle as library. `output.library` is the name.\",\"anyOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"description\":\"A part of the library name\",\"type\":\"string\"}},{\"$ref\":\"#/definitions/LibraryCustomUmdObject\"}]},\"libraryExport\":{\"description\":\"Specify which export should be exposed as library\",\"anyOf\":[{\"type\":\"string\"},{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"libraryTarget\":{\"description\":\"Type of library\",\"enum\":[\"var\",\"assign\",\"this\",\"window\",\"self\",\"global\",\"commonjs\",\"commonjs2\",\"commonjs-module\",\"amd\",\"amd-require\",\"umd\",\"umd2\",\"jsonp\",\"system\"]},\"path\":{\"description\":\"The output directory as **absolute path** (required).\",\"type\":\"string\",\"absolutePath\":true},\"pathinfo\":{\"description\":\"Include comments with information about the modules.\",\"type\":\"boolean\"},\"publicPath\":{\"description\":\"The `publicPath` specifies the public URL address of the output files when referenced in a browser.\",\"anyOf\":[{\"type\":\"string\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"}]},\"sourceMapFilename\":{\"description\":\"The filename of the SourceMaps for the JavaScript files. They are inside the `output.path` directory.\",\"type\":\"string\",\"absolutePath\":false},\"sourcePrefix\":{\"description\":\"Prefixes every line of the source in the bundle with this string.\",\"type\":\"string\"},\"strictModuleExceptionHandling\":{\"description\":\"Handles exceptions in module loading correctly at a performance cost.\",\"type\":\"boolean\"},\"umdNamedDefine\":{\"description\":\"If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.\",\"type\":\"boolean\"},\"webassemblyModuleFilename\":{\"description\":\"The filename of WebAssembly modules as relative path inside the `output.path` directory.\",\"type\":\"string\",\"absolutePath\":false}}},\"PerformanceOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"assetFilter\":{\"description\":\"Filter function to select assets that are checked\",\"instanceof\":\"Function\",\"tsType\":\"Function\"},\"hints\":{\"description\":\"Sets the format of the hints: warnings, errors or nothing at all\",\"enum\":[false,\"warning\",\"error\"]},\"maxAssetSize\":{\"description\":\"Filesize limit (in bytes) when exceeded, that webpack will provide performance hints\",\"type\":\"number\"},\"maxEntrypointSize\":{\"description\":\"Total size of an entry point (in bytes)\",\"type\":\"number\"}}},\"ResolveOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"alias\":{\"description\":\"Redirect module requests\",\"anyOf\":[{\"type\":\"object\",\"additionalProperties\":{\"description\":\"New request\",\"type\":\"string\"}},{\"type\":\"array\",\"items\":{\"description\":\"Alias configuration\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"alias\":{\"description\":\"New request\",\"type\":\"string\"},\"name\":{\"description\":\"Request to be redirected\",\"type\":\"string\"},\"onlyModule\":{\"description\":\"Redirect only exact matching request\",\"type\":\"boolean\"}}}}]},\"aliasFields\":{\"description\":\"Fields in the description file (package.json) which are used to redirect requests inside the module\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringOrStringArrayValues\"}]},\"cachePredicate\":{\"description\":\"Predicate function to decide which requests should be cached\",\"instanceof\":\"Function\",\"tsType\":\"Function\"},\"cacheWithContext\":{\"description\":\"Include the context information in the cache identifier when caching\",\"type\":\"boolean\"},\"concord\":{\"description\":\"Enable concord resolving extras\",\"type\":\"boolean\"},\"descriptionFiles\":{\"description\":\"Filenames used to find a description file\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"enforceExtension\":{\"description\":\"Enforce using one of the extensions from the extensions option\",\"type\":\"boolean\"},\"enforceModuleExtension\":{\"description\":\"Enforce using one of the module extensions from the moduleExtensions option\",\"type\":\"boolean\"},\"extensions\":{\"description\":\"Extensions added to the request when trying to find the file\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"fileSystem\":{\"description\":\"Filesystem for the resolver\"},\"mainFields\":{\"description\":\"Field names from the description file (package.json) which are used to find the default entry point\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringOrStringArrayValues\"}]},\"mainFiles\":{\"description\":\"Filenames used to find the default entry point if there is no description file or main field\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"moduleExtensions\":{\"description\":\"Extensions added to the module request when trying to find the module\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"modules\":{\"description\":\"Folder names or directory paths where to find modules\",\"anyOf\":[{\"$ref\":\"#/definitions/ArrayOfStringValues\"}]},\"plugins\":{\"description\":\"Plugins for the resolver\",\"type\":\"array\",\"items\":{\"description\":\"Plugin of type object or instanceof Function\",\"anyOf\":[{\"$ref\":\"#/definitions/WebpackPluginInstance\"},{\"$ref\":\"#/definitions/WebpackPluginFunction\"}]}},\"resolver\":{\"description\":\"Custom resolver\"},\"roots\":{\"description\":\"A list of directories in which requests that are server-relative URLs (starting with '/') are resolved. On non-windows system these requests are tried to resolve as absolute path first.\",\"type\":\"array\",\"items\":{\"description\":\"Directory in which requests that are server-relative URLs (starting with '/') are resolved.\",\"type\":\"string\"}},\"symlinks\":{\"description\":\"Enable resolving symlinks to the original location\",\"type\":\"boolean\"},\"unsafeCache\":{\"description\":\"Enable caching of successfully resolved requests\",\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\"object\",\"additionalProperties\":true}]},\"useSyncFileSystemCalls\":{\"description\":\"Use synchronous filesystem calls for the resolver\",\"type\":\"boolean\"}}},\"RuleSetCondition\":{\"anyOf\":[{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"string\",\"minLength\":1},{\"instanceof\":\"Function\",\"tsType\":\"((value: string) => boolean)\"},{\"$ref\":\"#/definitions/RuleSetConditions\"},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"and\":{\"description\":\"Logical AND\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditions\"}]},\"exclude\":{\"description\":\"Exclude all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditions\"}]},\"include\":{\"description\":\"Exclude all modules matching not any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditions\"}]},\"not\":{\"description\":\"Logical NOT\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditions\"}]},\"or\":{\"description\":\"Logical OR\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditions\"}]},\"test\":{\"description\":\"Exclude all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditions\"}]}}}]},\"RuleSetConditionAbsolute\":{\"anyOf\":[{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"string\",\"absolutePath\":true},{\"instanceof\":\"Function\",\"tsType\":\"((value: string) => boolean)\"},{\"$ref\":\"#/definitions/RuleSetConditionsAbsolute\"},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"and\":{\"description\":\"Logical AND\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionsAbsolute\"}]},\"exclude\":{\"description\":\"Exclude all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"include\":{\"description\":\"Exclude all modules matching not any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"not\":{\"description\":\"Logical NOT\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionsAbsolute\"}]},\"or\":{\"description\":\"Logical OR\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionsAbsolute\"}]},\"test\":{\"description\":\"Exclude all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]}}}]},\"RuleSetConditionOrConditions\":{\"description\":\"One or multiple rule conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetCondition\"},{\"$ref\":\"#/definitions/RuleSetConditions\"}]},\"RuleSetConditionOrConditionsAbsolute\":{\"description\":\"One or multiple rule conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionAbsolute\"},{\"$ref\":\"#/definitions/RuleSetConditionsAbsolute\"}]},\"RuleSetConditions\":{\"type\":\"array\",\"items\":{\"description\":\"A rule condition\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetCondition\"}]}},\"RuleSetConditionsAbsolute\":{\"type\":\"array\",\"items\":{\"description\":\"A rule condition\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionAbsolute\"}]}},\"RuleSetLoader\":{\"type\":\"string\",\"minLength\":1},\"RuleSetQuery\":{\"anyOf\":[{\"type\":\"object\"},{\"type\":\"string\"}]},\"RuleSetRule\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"compiler\":{\"description\":\"Match the child compiler name\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditions\"}]},\"enforce\":{\"description\":\"Enforce this rule as pre or post step\",\"enum\":[\"pre\",\"post\"]},\"exclude\":{\"description\":\"Shortcut for resource.exclude\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"include\":{\"description\":\"Shortcut for resource.include\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"issuer\":{\"description\":\"Match the issuer of the module (The module pointing to this module)\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"loader\":{\"description\":\"Shortcut for use.loader\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetLoader\"},{\"$ref\":\"#/definitions/RuleSetUse\"}]},\"loaders\":{\"description\":\"Shortcut for use.loader\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetUse\"}]},\"oneOf\":{\"description\":\"Only execute the first matching rule in this array\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetRules\"}]},\"options\":{\"description\":\"Shortcut for use.options\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetQuery\"}]},\"parser\":{\"description\":\"Options for parsing\",\"type\":\"object\",\"additionalProperties\":true},\"query\":{\"description\":\"Shortcut for use.query\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetQuery\"}]},\"realResource\":{\"description\":\"Match rules with custom resource name\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"resolve\":{\"description\":\"Options for the resolver\",\"type\":\"object\",\"anyOf\":[{\"$ref\":\"#/definitions/ResolveOptions\"}]},\"resource\":{\"description\":\"Match the resource path of the module\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"resourceQuery\":{\"description\":\"Match the resource query of the module\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditions\"}]},\"rules\":{\"description\":\"Match and execute these rules when this rule is matched\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetRules\"}]},\"sideEffects\":{\"description\":\"Flags a module as with or without side effects\",\"type\":\"boolean\"},\"test\":{\"description\":\"Shortcut for resource.test\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetConditionOrConditionsAbsolute\"}]},\"type\":{\"description\":\"Module type to use for the module\",\"enum\":[\"javascript/auto\",\"javascript/dynamic\",\"javascript/esm\",\"json\",\"webassembly/experimental\"]},\"use\":{\"description\":\"Modifiers applied to the module when rule is matched\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetUse\"}]}}},\"RuleSetRules\":{\"type\":\"array\",\"items\":{\"description\":\"A rule\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetRule\"}]}},\"RuleSetUse\":{\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetUseItem\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"array\",\"items\":{\"description\":\"An use item\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetUseItem\"}]}}]},\"RuleSetUseItem\":{\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetLoader\"},{\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"ident\":{\"description\":\"Unique loader identifier\",\"type\":\"string\"},\"loader\":{\"description\":\"Loader name\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetLoader\"}]},\"options\":{\"description\":\"Loader options\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetQuery\"}]},\"query\":{\"description\":\"Loader query\",\"anyOf\":[{\"$ref\":\"#/definitions/RuleSetQuery\"}]}}}]},\"StatsOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"all\":{\"description\":\"fallback value for stats options when an option is not defined (has precedence over local webpack defaults)\",\"type\":\"boolean\"},\"assets\":{\"description\":\"add assets information\",\"type\":\"boolean\"},\"assetsSort\":{\"description\":\"sort the assets by that field\",\"type\":\"string\"},\"builtAt\":{\"description\":\"add built at time information\",\"type\":\"boolean\"},\"cached\":{\"description\":\"add also information about cached (not built) modules\",\"type\":\"boolean\"},\"cachedAssets\":{\"description\":\"Show cached assets (setting this to `false` only shows emitted files)\",\"type\":\"boolean\"},\"children\":{\"description\":\"add children information\",\"type\":\"boolean\"},\"chunkGroups\":{\"description\":\"Display all chunk groups with the corresponding bundles\",\"type\":\"boolean\"},\"chunkModules\":{\"description\":\"add built modules information to chunk information\",\"type\":\"boolean\"},\"chunkOrigins\":{\"description\":\"add the origins of chunks and chunk merging info\",\"type\":\"boolean\"},\"chunks\":{\"description\":\"add chunk information\",\"type\":\"boolean\"},\"chunksSort\":{\"description\":\"sort the chunks by that field\",\"type\":\"string\"},\"colors\":{\"description\":\"Enables/Disables colorful output\",\"oneOf\":[{\"description\":\"`webpack --colors` equivalent\",\"type\":\"boolean\"},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"bold\":{\"description\":\"Custom color for bold text\",\"type\":\"string\"},\"cyan\":{\"description\":\"Custom color for cyan text\",\"type\":\"string\"},\"green\":{\"description\":\"Custom color for green text\",\"type\":\"string\"},\"magenta\":{\"description\":\"Custom color for magenta text\",\"type\":\"string\"},\"red\":{\"description\":\"Custom color for red text\",\"type\":\"string\"},\"yellow\":{\"description\":\"Custom color for yellow text\",\"type\":\"string\"}}}]},\"context\":{\"description\":\"context directory for request shortening\",\"type\":\"string\",\"absolutePath\":true},\"depth\":{\"description\":\"add module depth in module graph\",\"type\":\"boolean\"},\"entrypoints\":{\"description\":\"Display the entry points with the corresponding bundles\",\"type\":\"boolean\"},\"env\":{\"description\":\"add --env information\",\"type\":\"boolean\"},\"errorDetails\":{\"description\":\"add details to errors (like resolving log)\",\"type\":\"boolean\"},\"errors\":{\"description\":\"add errors\",\"type\":\"boolean\"},\"exclude\":{\"description\":\"Please use excludeModules instead.\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"},{\"type\":\"boolean\"}]},\"excludeAssets\":{\"description\":\"Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"}]},\"excludeModules\":{\"description\":\"Suppress modules that match the specified filters. Filters can be Strings, RegExps, Booleans or Functions\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"},{\"type\":\"boolean\"}]},\"hash\":{\"description\":\"add the hash of the compilation\",\"type\":\"boolean\"},\"logging\":{\"description\":\"add logging output\",\"anyOf\":[{\"description\":\"enable/disable logging output (true: shows normal logging output, loglevel: log)\",\"type\":\"boolean\"},{\"description\":\"specify log level of logging output\",\"enum\":[\"none\",\"error\",\"warn\",\"info\",\"log\",\"verbose\"]}]},\"loggingDebug\":{\"description\":\"Include debug logging of specified loggers (i. e. for plugins or loaders). Filters can be Strings, RegExps or Functions\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"},{\"description\":\"Enable/Disable debug logging for all loggers\",\"type\":\"boolean\"}]},\"loggingTrace\":{\"description\":\"add stack traces to logging output\",\"type\":\"boolean\"},\"maxModules\":{\"description\":\"Set the maximum number of modules to be shown\",\"type\":\"number\"},\"moduleAssets\":{\"description\":\"add information about assets inside modules\",\"type\":\"boolean\"},\"moduleTrace\":{\"description\":\"add dependencies and origin of warnings/errors\",\"type\":\"boolean\"},\"modules\":{\"description\":\"add built modules information\",\"type\":\"boolean\"},\"modulesSort\":{\"description\":\"sort the modules by that field\",\"type\":\"string\"},\"nestedModules\":{\"description\":\"add information about modules nested in other modules (like with module concatenation)\",\"type\":\"boolean\"},\"optimizationBailout\":{\"description\":\"show reasons why optimization bailed out for modules\",\"type\":\"boolean\"},\"outputPath\":{\"description\":\"Add output path information\",\"type\":\"boolean\"},\"performance\":{\"description\":\"add performance hint flags\",\"type\":\"boolean\"},\"providedExports\":{\"description\":\"show exports provided by modules\",\"type\":\"boolean\"},\"publicPath\":{\"description\":\"Add public path information\",\"type\":\"boolean\"},\"reasons\":{\"description\":\"add information about the reasons why modules are included\",\"type\":\"boolean\"},\"source\":{\"description\":\"add the source code of modules\",\"type\":\"boolean\"},\"timings\":{\"description\":\"add timing information\",\"type\":\"boolean\"},\"usedExports\":{\"description\":\"show exports used by modules\",\"type\":\"boolean\"},\"version\":{\"description\":\"add webpack version information\",\"type\":\"boolean\"},\"warnings\":{\"description\":\"add warnings\",\"type\":\"boolean\"},\"warningsFilter\":{\"description\":\"Suppress warnings that match the specified filters. Filters can be Strings, RegExps or Functions\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"}]}}},\"WebpackPluginFunction\":{\"description\":\"Function acting as plugin\",\"instanceof\":\"Function\",\"tsType\":\"(this: import('../lib/Compiler'), compiler: import('../lib/Compiler')) => void\"},\"WebpackPluginInstance\":{\"description\":\"Plugin instance\",\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"apply\":{\"description\":\"The run point of the plugin, required method.\",\"instanceof\":\"Function\",\"tsType\":\"(compiler: import('../lib/Compiler')) => void\"}},\"required\":[\"apply\"]}},\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"amd\":{\"description\":\"Set the value of `require.amd` and `define.amd`. Or disable AMD support.\",\"anyOf\":[{\"description\":\"You can pass `false` to disable AMD support.\",\"enum\":[false]},{\"description\":\"You can pass an object to set the value of `require.amd` and `define.amd`.\",\"type\":\"object\"}]},\"bail\":{\"description\":\"Report the first error as a hard error instead of tolerating it.\",\"type\":\"boolean\"},\"cache\":{\"description\":\"Cache generated modules and chunks to improve performance for multiple incremental builds.\",\"anyOf\":[{\"description\":\"You can pass `false` to disable it.\",\"type\":\"boolean\"},{\"description\":\"You can pass an object to enable it and let webpack use the passed object as cache. This way you can share the cache object between multiple compiler calls.\",\"type\":\"object\"}]},\"context\":{\"description\":\"The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.\",\"type\":\"string\",\"absolutePath\":true},\"dependencies\":{\"description\":\"References to other configurations to depend on.\",\"type\":\"array\",\"items\":{\"description\":\"References to another configuration to depend on.\",\"type\":\"string\"}},\"devServer\":{\"description\":\"Options for the webpack-dev-server\",\"type\":\"object\"},\"devtool\":{\"description\":\"A developer tool to enhance debugging.\",\"anyOf\":[{\"type\":\"string\"},{\"enum\":[false]}]},\"entry\":{\"description\":\"The entry point(s) of the compilation.\",\"anyOf\":[{\"$ref\":\"#/definitions/Entry\"}]},\"externals\":{\"description\":\"Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.\",\"anyOf\":[{\"$ref\":\"#/definitions/Externals\"}]},\"infrastructureLogging\":{\"description\":\"Options for infrastructure level logging\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"debug\":{\"description\":\"Enable debug logging for specific loggers\",\"anyOf\":[{\"$ref\":\"#/definitions/FilterTypes\"},{\"description\":\"Enable/Disable debug logging for all loggers\",\"type\":\"boolean\"}]},\"level\":{\"description\":\"Log level\",\"enum\":[\"none\",\"error\",\"warn\",\"info\",\"log\",\"verbose\"]}}},\"loader\":{\"description\":\"Custom values available in the loader context.\",\"type\":\"object\"},\"mode\":{\"description\":\"Enable production optimizations or development hints.\",\"enum\":[\"development\",\"production\",\"none\"]},\"module\":{\"description\":\"Options affecting the normal modules (`NormalModuleFactory`).\",\"anyOf\":[{\"$ref\":\"#/definitions/ModuleOptions\"}]},\"name\":{\"description\":\"Name of the configuration. Used when loading multiple configurations.\",\"type\":\"string\"},\"node\":{\"description\":\"Include polyfills or mocks for various node stuff.\",\"anyOf\":[{\"enum\":[false]},{\"$ref\":\"#/definitions/NodeOptions\"}]},\"optimization\":{\"description\":\"Enables/Disables integrated optimizations\",\"anyOf\":[{\"$ref\":\"#/definitions/OptimizationOptions\"}]},\"output\":{\"description\":\"Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.\",\"anyOf\":[{\"$ref\":\"#/definitions/OutputOptions\"}]},\"parallelism\":{\"description\":\"The number of parallel processed modules in the compilation.\",\"type\":\"number\",\"minimum\":1},\"performance\":{\"description\":\"Configuration for web performance recommendations.\",\"anyOf\":[{\"enum\":[false]},{\"$ref\":\"#/definitions/PerformanceOptions\"}]},\"plugins\":{\"description\":\"Add additional plugins to the compiler.\",\"type\":\"array\",\"items\":{\"description\":\"Plugin of type object or instanceof Function\",\"anyOf\":[{\"$ref\":\"#/definitions/WebpackPluginInstance\"},{\"$ref\":\"#/definitions/WebpackPluginFunction\"}]}},\"profile\":{\"description\":\"Capture timing information for each module.\",\"type\":\"boolean\"},\"recordsInputPath\":{\"description\":\"Store compiler state to a json file.\",\"type\":\"string\",\"absolutePath\":true},\"recordsOutputPath\":{\"description\":\"Load compiler state from a json file.\",\"type\":\"string\",\"absolutePath\":true},\"recordsPath\":{\"description\":\"Store/Load compiler state from/to a json file. This will result in persistent ids of modules and chunks. An absolute path is expected. `recordsPath` is used for `recordsInputPath` and `recordsOutputPath` if they left undefined.\",\"type\":\"string\",\"absolutePath\":true},\"resolve\":{\"description\":\"Options for the resolver\",\"anyOf\":[{\"$ref\":\"#/definitions/ResolveOptions\"}]},\"resolveLoader\":{\"description\":\"Options for the resolver when resolving loaders\",\"anyOf\":[{\"$ref\":\"#/definitions/ResolveOptions\"}]},\"serve\":{\"description\":\"Options for webpack-serve\",\"type\":\"object\"},\"stats\":{\"description\":\"Used by the webpack CLI program to pass stats options.\",\"anyOf\":[{\"$ref\":\"#/definitions/StatsOptions\"},{\"type\":\"boolean\"},{\"enum\":[\"none\",\"errors-only\",\"minimal\",\"normal\",\"detailed\",\"verbose\",\"errors-warnings\"]}]},\"target\":{\"description\":\"Environment to build for\",\"anyOf\":[{\"enum\":[\"web\",\"webworker\",\"node\",\"async-node\",\"node-webkit\",\"electron-main\",\"electron-renderer\",\"electron-preload\"]},{\"instanceof\":\"Function\",\"tsType\":\"((compiler: import('../lib/Compiler')) => void)\"}]},\"watch\":{\"description\":\"Enter watch mode, which rebuilds on file change.\",\"type\":\"boolean\"},\"watchOptions\":{\"description\":\"Options for the watcher\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"aggregateTimeout\":{\"description\":\"Delay the rebuilt after the first change. Value is a time in ms.\",\"type\":\"number\"},\"ignored\":{\"description\":\"Ignore some files from watching\"},\"poll\":{\"description\":\"Enable polling mode for watching\",\"anyOf\":[{\"description\":\"`true`: use polling.\",\"type\":\"boolean\"},{\"description\":\"`number`: use polling with specified interval.\",\"type\":\"number\"}]},\"stdin\":{\"description\":\"Stop watching when stdin stream has ended\",\"type\":\"boolean\"}}}}}");
82
83/***/ }),
84
85/***/ 10171:
86/***/ (function(module) {
87
88"use strict";
89module.exports = JSON.parse("{\"definitions\":{\"BannerFunction\":{\"description\":\"The banner as function, it will be wrapped in a comment\",\"instanceof\":\"Function\",\"tsType\":\"(data: { hash: string, chunk: import('../../lib/Chunk'), filename: string, basename: string, query: string}) => string\"},\"Rule\":{\"oneOf\":[{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"string\",\"minLength\":1}]},\"Rules\":{\"oneOf\":[{\"type\":\"array\",\"items\":{\"description\":\"A rule condition\",\"anyOf\":[{\"$ref\":\"#/definitions/Rule\"}]}},{\"$ref\":\"#/definitions/Rule\"}]}},\"title\":\"BannerPluginArgument\",\"oneOf\":[{\"title\":\"BannerPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"banner\":{\"description\":\"Specifies the banner\",\"anyOf\":[{\"$ref\":\"#/definitions/BannerFunction\"},{\"type\":\"string\"}]},\"entryOnly\":{\"description\":\"If true, the banner will only be added to the entry chunks\",\"type\":\"boolean\"},\"exclude\":{\"description\":\"Exclude all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/Rules\"}]},\"include\":{\"description\":\"Include all modules matching any of these conditions\",\"anyOf\":[{\"$ref\":\"#/definitions/Rules\"}]},\"raw\":{\"description\":\"If true, banner will not be wrapped in a comment\",\"type\":\"boolean\"},\"test\":{\"description\":\"Include all modules that pass test assertion\",\"anyOf\":[{\"$ref\":\"#/definitions/Rules\"}]}},\"required\":[\"banner\"]},{\"$ref\":\"#/definitions/BannerFunction\"},{\"description\":\"The banner as string, it will be wrapped in a comment\",\"type\":\"string\",\"minLength\":1}]}");
90
91/***/ }),
92
93/***/ 7303:
94/***/ (function(module) {
95
96"use strict";
97module.exports = JSON.parse("{\"title\":\"DllPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"context\":{\"description\":\"Context of requests in the manifest file (defaults to the webpack context)\",\"type\":\"string\",\"minLength\":1},\"entryOnly\":{\"description\":\"If true, only entry points will be exposed\",\"type\":\"boolean\"},\"format\":{\"description\":\"If true, manifest json file (output) will be formatted\",\"type\":\"boolean\"},\"name\":{\"description\":\"Name of the exposed dll function (external name, use value of 'output.library')\",\"type\":\"string\",\"minLength\":1},\"path\":{\"description\":\"Absolute path to the manifest json file (output)\",\"type\":\"string\",\"minLength\":1},\"type\":{\"description\":\"Type of the dll bundle (external type, use value of 'output.libraryTarget')\",\"type\":\"string\",\"minLength\":1}},\"required\":[\"path\"]}");
98
99/***/ }),
100
101/***/ 61112:
102/***/ (function(module) {
103
104"use strict";
105module.exports = JSON.parse("{\"definitions\":{\"DllReferencePluginOptionsContent\":{\"description\":\"The mappings from request to module info\",\"type\":\"object\",\"additionalProperties\":{\"description\":\"Module info\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"buildMeta\":{\"description\":\"Meta information about the module\",\"type\":\"object\"},\"exports\":{\"description\":\"Information about the provided exports of the module\",\"anyOf\":[{\"description\":\"Exports unknown/dynamic\",\"enum\":[true]},{\"description\":\"List of provided exports of the module\",\"type\":\"array\",\"items\":{\"description\":\"Name of the export\",\"type\":\"string\",\"minLength\":1}}]},\"id\":{\"description\":\"Module ID\",\"anyOf\":[{\"type\":\"number\"},{\"type\":\"string\",\"minLength\":1}]}},\"required\":[\"id\"]},\"minProperties\":1},\"DllReferencePluginOptionsManifest\":{\"description\":\"An object containing content, name and type\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"content\":{\"description\":\"The mappings from request to module info\",\"anyOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsContent\"}]},\"name\":{\"description\":\"The name where the dll is exposed (external name)\",\"type\":\"string\",\"minLength\":1},\"type\":{\"description\":\"The type how the dll is exposed (external type)\",\"anyOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsSourceType\"}]}},\"required\":[\"content\"]},\"DllReferencePluginOptionsSourceType\":{\"description\":\"The type how the dll is exposed (external type)\",\"enum\":[\"var\",\"assign\",\"this\",\"window\",\"global\",\"commonjs\",\"commonjs2\",\"commonjs-module\",\"amd\",\"amd-require\",\"umd\",\"umd2\",\"jsonp\"]}},\"title\":\"DllReferencePluginOptions\",\"anyOf\":[{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"context\":{\"description\":\"(absolute path) context of requests in the manifest (or content property)\",\"type\":\"string\",\"absolutePath\":true},\"extensions\":{\"description\":\"Extensions used to resolve modules in the dll bundle (only used when using 'scope')\",\"type\":\"array\",\"items\":{\"description\":\"An extension\",\"type\":\"string\"}},\"manifest\":{\"description\":\"An object containing content and name or a string to the absolute path of the JSON manifest to be loaded upon compilation\",\"oneOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsManifest\"},{\"type\":\"string\",\"absolutePath\":true}]},\"name\":{\"description\":\"The name where the dll is exposed (external name, defaults to manifest.name)\",\"type\":\"string\",\"minLength\":1},\"scope\":{\"description\":\"Prefix which is used for accessing the content of the dll\",\"type\":\"string\",\"minLength\":1},\"sourceType\":{\"description\":\"How the dll is exposed (libraryTarget, defaults to manifest.type)\",\"anyOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsSourceType\"}]},\"type\":{\"description\":\"The way how the export of the dll bundle is used\",\"enum\":[\"require\",\"object\"]}},\"required\":[\"manifest\"]},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"content\":{\"description\":\"The mappings from request to module info\",\"anyOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsContent\"}]},\"context\":{\"description\":\"(absolute path) context of requests in the manifest (or content property)\",\"type\":\"string\",\"absolutePath\":true},\"extensions\":{\"description\":\"Extensions used to resolve modules in the dll bundle (only used when using 'scope')\",\"type\":\"array\",\"items\":{\"description\":\"An extension\",\"type\":\"string\"}},\"name\":{\"description\":\"The name where the dll is exposed (external name)\",\"type\":\"string\",\"minLength\":1},\"scope\":{\"description\":\"Prefix which is used for accessing the content of the dll\",\"type\":\"string\",\"minLength\":1},\"sourceType\":{\"description\":\"How the dll is exposed (libraryTarget)\",\"anyOf\":[{\"$ref\":\"#/definitions/DllReferencePluginOptionsSourceType\"}]},\"type\":{\"description\":\"The way how the export of the dll bundle is used\",\"enum\":[\"require\",\"object\"]}},\"required\":[\"content\",\"name\"]}]}");
106
107/***/ }),
108
109/***/ 45843:
110/***/ (function(module) {
111
112"use strict";
113module.exports = JSON.parse("{\"title\":\"HashedModuleIdsPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"context\":{\"description\":\"The context directory for creating names.\",\"type\":\"string\",\"absolutePath\":true},\"hashDigest\":{\"description\":\"The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.\",\"enum\":[\"hex\",\"latin1\",\"base64\"]},\"hashDigestLength\":{\"description\":\"The prefix length of the hash digest to use, defaults to 4.\",\"type\":\"number\",\"minimum\":1},\"hashFunction\":{\"description\":\"The hashing algorithm to use, defaults to 'md5'. All functions from Node.JS' crypto.createHash are supported.\",\"type\":\"string\",\"minLength\":1}}}");
114
115/***/ }),
116
117/***/ 69667:
118/***/ (function(module) {
119
120"use strict";
121module.exports = JSON.parse("{\"title\":\"IgnorePluginOptions\",\"oneOf\":[{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"contextRegExp\":{\"description\":\"A RegExp to test the context (directory) against\",\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},\"resourceRegExp\":{\"description\":\"A RegExp to test the request against\",\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}}},{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"checkContext\":{\"description\":\"A filter function for context\",\"instanceof\":\"Function\",\"tsType\":\"((context: string) => boolean)\"},\"checkResource\":{\"description\":\"A filter function for resource and context\",\"instanceof\":\"Function\",\"tsType\":\"((resource: string, context: string) => boolean)\"}}}]}");
122
123/***/ }),
124
125/***/ 4994:
126/***/ (function(module) {
127
128"use strict";
129module.exports = JSON.parse("{\"title\":\"LoaderOptionsPluginOptions\",\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"debug\":{\"description\":\"Whether loaders should be in debug mode or not. debug will be removed as of webpack 3\",\"type\":\"boolean\"},\"minimize\":{\"description\":\"Where loaders can be switched to minimize mode\",\"type\":\"boolean\"},\"options\":{\"description\":\"A configuration object that can be used to configure older loaders\",\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"context\":{\"description\":\"The context that can be used to configure older loaders\",\"type\":\"string\",\"absolutePath\":true}}}}}");
130
131/***/ }),
132
133/***/ 26336:
134/***/ (function(module) {
135
136"use strict";
137module.exports = JSON.parse("{\"definitions\":{\"HandlerFunction\":{\"description\":\"Function that executes for every progress step\",\"instanceof\":\"Function\",\"tsType\":\"((percentage: number, msg: string, ...args: string[]) => void)\"},\"ProgressPluginOptions\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"activeModules\":{\"description\":\"Show active modules count and one active module in progress message\",\"type\":\"boolean\"},\"entries\":{\"description\":\"Show entries count in progress message\",\"type\":\"boolean\"},\"handler\":{\"description\":\"Function that executes for every progress step\",\"anyOf\":[{\"$ref\":\"#/definitions/HandlerFunction\"}]},\"modules\":{\"description\":\"Show modules count in progress message\",\"type\":\"boolean\"},\"modulesCount\":{\"description\":\"Minimum modules count to start with. Only for mode=modules. Default: 500\",\"type\":\"number\"},\"profile\":{\"description\":\"Collect profile data for progress steps. Default: false\",\"enum\":[true,false,null]}}}},\"title\":\"ProgressPluginArgument\",\"oneOf\":[{\"$ref\":\"#/definitions/ProgressPluginOptions\"},{\"$ref\":\"#/definitions/HandlerFunction\"}]}");
138
139/***/ }),
140
141/***/ 7368:
142/***/ (function(module) {
143
144"use strict";
145module.exports = JSON.parse("{\"definitions\":{\"rule\":{\"oneOf\":[{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"},{\"type\":\"string\",\"minLength\":1}]},\"rules\":{\"oneOf\":[{\"type\":\"array\",\"items\":{\"description\":\"A rule condition\",\"anyOf\":[{\"$ref\":\"#/definitions/rule\"}]}},{\"$ref\":\"#/definitions/rule\"}]}},\"title\":\"SourceMapDevToolPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"append\":{\"description\":\"Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending\",\"oneOf\":[{\"description\":\"Append no SourceMap comment to the bundle, but still generate SourceMaps\",\"enum\":[false,null]},{\"type\":\"string\",\"minLength\":1}]},\"columns\":{\"description\":\"Indicates whether column mappings should be used (defaults to true)\",\"type\":\"boolean\"},\"exclude\":{\"description\":\"Exclude modules that match the given value from source map generation\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]},\"fallbackModuleFilenameTemplate\":{\"description\":\"Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict\",\"oneOf\":[{\"description\":\"Custom function generating the identifer\",\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\",\"minLength\":1}]},\"fileContext\":{\"description\":\"Path prefix to which the [file] placeholder is relative to\",\"type\":\"string\"},\"filename\":{\"description\":\"Defines the output filename of the SourceMap (will be inlined if no value is provided)\",\"oneOf\":[{\"description\":\"Disable separate SourceMap file and inline SourceMap as DataUrl\",\"enum\":[false,null]},{\"type\":\"string\",\"absolutePath\":false,\"minLength\":1}]},\"include\":{\"description\":\"Include source maps for module paths that match the given value\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]},\"lineToLine\":{\"description\":\"(deprecated) try to map original files line to line to generated files\",\"anyOf\":[{\"type\":\"boolean\"},{\"description\":\"Simplify and speed up source mapping by using line to line source mappings for matched modules\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"exclude\":{\"description\":\"Exclude modules that match the given value from source map generation\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]},\"include\":{\"description\":\"Include source maps for module paths that match the given value\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]},\"test\":{\"description\":\"Include source maps for modules based on their extension (defaults to .js and .css)\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]}}}]},\"module\":{\"description\":\"Indicates whether SourceMaps from loaders should be used (defaults to true)\",\"type\":\"boolean\"},\"moduleFilenameTemplate\":{\"description\":\"Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap\",\"oneOf\":[{\"description\":\"Custom function generating the identifer\",\"instanceof\":\"Function\",\"tsType\":\"Function\"},{\"type\":\"string\",\"minLength\":1}]},\"namespace\":{\"description\":\"Namespace prefix to allow multiple webpack roots in the devtools\",\"type\":\"string\"},\"noSources\":{\"description\":\"Omit the 'sourceContents' array from the SourceMap\",\"type\":\"boolean\"},\"publicPath\":{\"description\":\"Provide a custom public path for the SourceMapping comment\",\"type\":\"string\"},\"sourceRoot\":{\"description\":\"Provide a custom value for the 'sourceRoot' property in the SourceMap\",\"type\":\"string\"},\"test\":{\"description\":\"Include source maps for modules based on their extension (defaults to .js and .css)\",\"anyOf\":[{\"$ref\":\"#/definitions/rules\"}]}}}");
146
147/***/ }),
148
149/***/ 97009:
150/***/ (function(module) {
151
152"use strict";
153module.exports = JSON.parse("{\"title\":\"WatchIgnorePluginOptions\",\"description\":\"A list of RegExps or absolute paths to directories or files that should be ignored\",\"type\":\"array\",\"items\":{\"description\":\"RegExp or absolute path to directories or files that should be ignored\",\"oneOf\":[{\"type\":\"string\"},{\"instanceof\":\"RegExp\",\"tsType\":\"RegExp\"}]},\"minItems\":1}");
154
155/***/ }),
156
157/***/ 49049:
158/***/ (function(module) {
159
160"use strict";
161module.exports = JSON.parse("{\"title\":\"ProfilingPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"outputPath\":{\"description\":\"Path to the output file e.g. `profiling/events.json`. Defaults to `events.json`.\",\"type\":\"string\",\"absolutePath\":false,\"minLength\":4}}}");
162
163/***/ }),
164
165/***/ 71884:
166/***/ (function(module) {
167
168"use strict";
169module.exports = JSON.parse("{\"title\":\"AggressiveSplittingPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"chunkOverhead\":{\"description\":\"Default: 0\",\"type\":\"number\"},\"entryChunkMultiplicator\":{\"description\":\"Default: 1\",\"type\":\"number\"},\"maxSize\":{\"description\":\"Byte, maxsize of per file. Default: 51200\",\"type\":\"number\"},\"minSize\":{\"description\":\"Byte, split point. Default: 30720\",\"type\":\"number\"}}}");
170
171/***/ }),
172
173/***/ 27993:
174/***/ (function(module) {
175
176"use strict";
177module.exports = JSON.parse("{\"title\":\"LimitChunkCountPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"maxChunks\":{\"description\":\"Limit the maximum number of chunks using a value greater greater than or equal to 1\",\"type\":\"number\",\"minimum\":1},\"minChunkSize\":{\"description\":\"Set a minimum chunk size\",\"type\":\"number\"}}}");
178
179/***/ }),
180
181/***/ 8670:
182/***/ (function(module) {
183
184"use strict";
185module.exports = JSON.parse("{\"title\":\"MinChunkSizePluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"minChunkSize\":{\"description\":\"Minimum number of characters\",\"type\":\"number\"}},\"required\":[\"minChunkSize\"]}");
186
187/***/ }),
188
189/***/ 88771:
190/***/ (function(module) {
191
192"use strict";
193module.exports = JSON.parse("{\"title\":\"OccurrenceOrderChunkIdsPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"prioritiseInitial\":{\"description\":\"Prioritise initial size over total size\",\"type\":\"boolean\"}}}");
194
195/***/ }),
196
197/***/ 81430:
198/***/ (function(module) {
199
200"use strict";
201module.exports = JSON.parse("{\"title\":\"OccurrenceOrderModuleIdsPluginOptions\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"prioritiseInitial\":{\"description\":\"Prioritise initial size over total size\",\"type\":\"boolean\"}}}");
202
203/***/ }),
204
205/***/ 48333:
206/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
207
208"use strict";
209
210
211Object.defineProperty(exports, "__esModule", ({
212 value: true
213}));
214exports.codeFrameFromAst = codeFrameFromAst;
215exports.codeFrameFromSource = codeFrameFromSource;
216
217var _wastPrinter = __webpack_require__(45378);
218
219function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
220
221var SHOW_LINES_AROUND_POINTER = 5;
222
223function repeat(char, nb) {
224 return Array(nb).fill(char).join("");
225} // TODO(sven): allow arbitrary ast nodes
226
227
228function codeFrameFromAst(ast, loc) {
229 return codeFrameFromSource((0, _wastPrinter.print)(ast), loc);
230}
231
232function codeFrameFromSource(source, loc) {
233 var start = loc.start,
234 end = loc.end;
235 var length = 1;
236
237 if (_typeof(end) === "object") {
238 length = end.column - start.column + 1;
239 }
240
241 return source.split("\n").reduce(function (acc, line, lineNbr) {
242 if (Math.abs(start.line - lineNbr) < SHOW_LINES_AROUND_POINTER) {
243 acc += line + "\n";
244 } // Add a new line with the pointer padded left
245
246
247 if (lineNbr === start.line - 1) {
248 acc += repeat(" ", start.column - 1);
249 acc += repeat("^", length);
250 acc += "\n";
251 }
252
253 return acc;
254 }, "");
255}
256
257/***/ }),
258
259/***/ 38902:
260/***/ (function(__unused_webpack_module, exports) {
261
262"use strict";
263
264
265Object.defineProperty(exports, "__esModule", ({
266 value: true
267}));
268exports.makeTransition = makeTransition;
269exports.FSM = void 0;
270
271function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
272
273function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
274
275function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
276
277function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
278
279function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
280
281var STOP = Symbol("STOP");
282
283function makeTransition(regex, nextState) {
284 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
285 _ref$n = _ref.n,
286 n = _ref$n === void 0 ? 1 : _ref$n,
287 allowedSeparator = _ref.allowedSeparator;
288
289 return function (instance) {
290 if (allowedSeparator) {
291 if (instance.input[instance.ptr] === allowedSeparator) {
292 if (regex.test(instance.input.substring(instance.ptr - 1, instance.ptr))) {
293 // Consume the separator and stay in current state
294 return [instance.currentState, 1];
295 } else {
296 return [instance.terminatingState, 0];
297 }
298 }
299 }
300
301 if (regex.test(instance.input.substring(instance.ptr, instance.ptr + n))) {
302 return [nextState, n];
303 }
304
305 return false;
306 };
307}
308
309function combineTransitions(transitions) {
310 return function () {
311 var match = false;
312 var currentTransitions = transitions[this.currentState] || [];
313
314 for (var i = 0; i < currentTransitions.length; ++i) {
315 match = currentTransitions[i](this);
316
317 if (match !== false) {
318 break;
319 }
320 }
321
322 return match || [this.terminatingState, 0];
323 };
324}
325
326var FSM =
327/*#__PURE__*/
328function () {
329 function FSM(transitions, initialState) {
330 var terminatingState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STOP;
331
332 _classCallCheck(this, FSM);
333
334 this.initialState = initialState;
335 this.terminatingState = terminatingState;
336
337 if (terminatingState === STOP || !transitions[terminatingState]) {
338 transitions[terminatingState] = [];
339 }
340
341 this.transitionFunction = combineTransitions.call(this, transitions);
342 }
343
344 _createClass(FSM, [{
345 key: "run",
346 value: function run(input) {
347 this.input = input;
348 this.ptr = 0;
349 this.currentState = this.initialState;
350 var value = "";
351 var eatLength, nextState;
352
353 while (this.currentState !== this.terminatingState && this.ptr < this.input.length) {
354 var _transitionFunction = this.transitionFunction();
355
356 var _transitionFunction2 = _slicedToArray(_transitionFunction, 2);
357
358 nextState = _transitionFunction2[0];
359 eatLength = _transitionFunction2[1];
360 value += this.input.substring(this.ptr, this.ptr += eatLength);
361 this.currentState = nextState;
362 }
363
364 return value;
365 }
366 }]);
367
368 return FSM;
369}();
370
371exports.FSM = FSM;
372
373/***/ }),
374
375/***/ 71234:
376/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
377
378"use strict";
379
380
381Object.defineProperty(exports, "__esModule", ({
382 value: true
383}));
384exports.moduleContextFromModuleAST = moduleContextFromModuleAST;
385exports.ModuleContext = void 0;
386
387var _ast = __webpack_require__(80412);
388
389function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
390
391function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
392
393function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
394
395function moduleContextFromModuleAST(m) {
396 var moduleContext = new ModuleContext();
397
398 if (!(m.type === "Module")) {
399 throw new Error('m.type === "Module"' + " error: " + (undefined || "unknown"));
400 }
401
402 m.fields.forEach(function (field) {
403 switch (field.type) {
404 case "Start":
405 {
406 moduleContext.setStart(field.index);
407 break;
408 }
409
410 case "TypeInstruction":
411 {
412 moduleContext.addType(field);
413 break;
414 }
415
416 case "Func":
417 {
418 moduleContext.addFunction(field);
419 break;
420 }
421
422 case "Global":
423 {
424 moduleContext.defineGlobal(field);
425 break;
426 }
427
428 case "ModuleImport":
429 {
430 switch (field.descr.type) {
431 case "GlobalType":
432 {
433 moduleContext.importGlobal(field.descr.valtype, field.descr.mutability);
434 break;
435 }
436
437 case "Memory":
438 {
439 moduleContext.addMemory(field.descr.limits.min, field.descr.limits.max);
440 break;
441 }
442
443 case "FuncImportDescr":
444 {
445 moduleContext.importFunction(field.descr);
446 break;
447 }
448
449 case "Table":
450 {
451 // FIXME(sven): not implemented yet
452 break;
453 }
454
455 default:
456 throw new Error("Unsupported ModuleImport of type " + JSON.stringify(field.descr.type));
457 }
458
459 break;
460 }
461
462 case "Memory":
463 {
464 moduleContext.addMemory(field.limits.min, field.limits.max);
465 break;
466 }
467 }
468 });
469 return moduleContext;
470}
471/**
472 * Module context for type checking
473 */
474
475
476var ModuleContext =
477/*#__PURE__*/
478function () {
479 function ModuleContext() {
480 _classCallCheck(this, ModuleContext);
481
482 this.funcs = [];
483 this.funcsOffsetByIdentifier = [];
484 this.types = [];
485 this.globals = [];
486 this.globalsOffsetByIdentifier = [];
487 this.mems = []; // Current stack frame
488
489 this.locals = [];
490 this.labels = [];
491 this.return = [];
492 this.debugName = "unknown";
493 this.start = null;
494 }
495 /**
496 * Set start segment
497 */
498
499
500 _createClass(ModuleContext, [{
501 key: "setStart",
502 value: function setStart(index) {
503 this.start = index.value;
504 }
505 /**
506 * Get start function
507 */
508
509 }, {
510 key: "getStart",
511 value: function getStart() {
512 return this.start;
513 }
514 /**
515 * Reset the active stack frame
516 */
517
518 }, {
519 key: "newContext",
520 value: function newContext(debugName, expectedResult) {
521 this.locals = [];
522 this.labels = [expectedResult];
523 this.return = expectedResult;
524 this.debugName = debugName;
525 }
526 /**
527 * Functions
528 */
529
530 }, {
531 key: "addFunction",
532 value: function addFunction(func
533 /*: Func*/
534 ) {
535 // eslint-disable-next-line prefer-const
536 var _ref = func.signature || {},
537 _ref$params = _ref.params,
538 args = _ref$params === void 0 ? [] : _ref$params,
539 _ref$results = _ref.results,
540 result = _ref$results === void 0 ? [] : _ref$results;
541
542 args = args.map(function (arg) {
543 return arg.valtype;
544 });
545 this.funcs.push({
546 args: args,
547 result: result
548 });
549
550 if (typeof func.name !== "undefined") {
551 this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1;
552 }
553 }
554 }, {
555 key: "importFunction",
556 value: function importFunction(funcimport) {
557 if ((0, _ast.isSignature)(funcimport.signature)) {
558 // eslint-disable-next-line prefer-const
559 var _funcimport$signature = funcimport.signature,
560 args = _funcimport$signature.params,
561 result = _funcimport$signature.results;
562 args = args.map(function (arg) {
563 return arg.valtype;
564 });
565 this.funcs.push({
566 args: args,
567 result: result
568 });
569 } else {
570 if (!(0, _ast.isNumberLiteral)(funcimport.signature)) {
571 throw new Error('isNumberLiteral(funcimport.signature)' + " error: " + (undefined || "unknown"));
572 }
573
574 var typeId = funcimport.signature.value;
575
576 if (!this.hasType(typeId)) {
577 throw new Error('this.hasType(typeId)' + " error: " + (undefined || "unknown"));
578 }
579
580 var signature = this.getType(typeId);
581 this.funcs.push({
582 args: signature.params.map(function (arg) {
583 return arg.valtype;
584 }),
585 result: signature.results
586 });
587 }
588
589 if (typeof funcimport.id !== "undefined") {
590 // imports are first, we can assume their index in the array
591 this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1;
592 }
593 }
594 }, {
595 key: "hasFunction",
596 value: function hasFunction(index) {
597 return typeof this.getFunction(index) !== "undefined";
598 }
599 }, {
600 key: "getFunction",
601 value: function getFunction(index) {
602 if (typeof index !== "number") {
603 throw new Error("getFunction only supported for number index");
604 }
605
606 return this.funcs[index];
607 }
608 }, {
609 key: "getFunctionOffsetByIdentifier",
610 value: function getFunctionOffsetByIdentifier(name) {
611 if (!(typeof name === "string")) {
612 throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
613 }
614
615 return this.funcsOffsetByIdentifier[name];
616 }
617 /**
618 * Labels
619 */
620
621 }, {
622 key: "addLabel",
623 value: function addLabel(result) {
624 this.labels.unshift(result);
625 }
626 }, {
627 key: "hasLabel",
628 value: function hasLabel(index) {
629 return this.labels.length > index && index >= 0;
630 }
631 }, {
632 key: "getLabel",
633 value: function getLabel(index) {
634 return this.labels[index];
635 }
636 }, {
637 key: "popLabel",
638 value: function popLabel() {
639 this.labels.shift();
640 }
641 /**
642 * Locals
643 */
644
645 }, {
646 key: "hasLocal",
647 value: function hasLocal(index) {
648 return typeof this.getLocal(index) !== "undefined";
649 }
650 }, {
651 key: "getLocal",
652 value: function getLocal(index) {
653 return this.locals[index];
654 }
655 }, {
656 key: "addLocal",
657 value: function addLocal(type) {
658 this.locals.push(type);
659 }
660 /**
661 * Types
662 */
663
664 }, {
665 key: "addType",
666 value: function addType(type) {
667 if (!(type.functype.type === "Signature")) {
668 throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown"));
669 }
670
671 this.types.push(type.functype);
672 }
673 }, {
674 key: "hasType",
675 value: function hasType(index) {
676 return this.types[index] !== undefined;
677 }
678 }, {
679 key: "getType",
680 value: function getType(index) {
681 return this.types[index];
682 }
683 /**
684 * Globals
685 */
686
687 }, {
688 key: "hasGlobal",
689 value: function hasGlobal(index) {
690 return this.globals.length > index && index >= 0;
691 }
692 }, {
693 key: "getGlobal",
694 value: function getGlobal(index) {
695 return this.globals[index].type;
696 }
697 }, {
698 key: "getGlobalOffsetByIdentifier",
699 value: function getGlobalOffsetByIdentifier(name) {
700 if (!(typeof name === "string")) {
701 throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
702 }
703
704 return this.globalsOffsetByIdentifier[name];
705 }
706 }, {
707 key: "defineGlobal",
708 value: function defineGlobal(global
709 /*: Global*/
710 ) {
711 var type = global.globalType.valtype;
712 var mutability = global.globalType.mutability;
713 this.globals.push({
714 type: type,
715 mutability: mutability
716 });
717
718 if (typeof global.name !== "undefined") {
719 this.globalsOffsetByIdentifier[global.name.value] = this.globals.length - 1;
720 }
721 }
722 }, {
723 key: "importGlobal",
724 value: function importGlobal(type, mutability) {
725 this.globals.push({
726 type: type,
727 mutability: mutability
728 });
729 }
730 }, {
731 key: "isMutableGlobal",
732 value: function isMutableGlobal(index) {
733 return this.globals[index].mutability === "var";
734 }
735 }, {
736 key: "isImmutableGlobal",
737 value: function isImmutableGlobal(index) {
738 return this.globals[index].mutability === "const";
739 }
740 /**
741 * Memories
742 */
743
744 }, {
745 key: "hasMemory",
746 value: function hasMemory(index) {
747 return this.mems.length > index && index >= 0;
748 }
749 }, {
750 key: "addMemory",
751 value: function addMemory(min, max) {
752 this.mems.push({
753 min: min,
754 max: max
755 });
756 }
757 }, {
758 key: "getMemory",
759 value: function getMemory(index) {
760 return this.mems[index];
761 }
762 }]);
763
764 return ModuleContext;
765}();
766
767exports.ModuleContext = ModuleContext;
768
769/***/ }),
770
771/***/ 77065:
772/***/ (function(__unused_webpack_module, exports) {
773
774"use strict";
775
776
777Object.defineProperty(exports, "__esModule", ({
778 value: true
779}));
780exports.cloneNode = cloneNode;
781
782function cloneNode(n) {
783 // $FlowIgnore
784 var newObj = {};
785
786 for (var k in n) {
787 newObj[k] = n[k];
788 }
789
790 return newObj;
791}
792
793/***/ }),
794
795/***/ 80412:
796/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
797
798"use strict";
799
800
801Object.defineProperty(exports, "__esModule", ({
802 value: true
803}));
804var _exportNames = {
805 numberLiteralFromRaw: true,
806 withLoc: true,
807 withRaw: true,
808 funcParam: true,
809 indexLiteral: true,
810 memIndexLiteral: true,
811 instruction: true,
812 objectInstruction: true,
813 traverse: true,
814 signatures: true,
815 cloneNode: true
816};
817Object.defineProperty(exports, "numberLiteralFromRaw", ({
818 enumerable: true,
819 get: function get() {
820 return _nodeHelpers.numberLiteralFromRaw;
821 }
822}));
823Object.defineProperty(exports, "withLoc", ({
824 enumerable: true,
825 get: function get() {
826 return _nodeHelpers.withLoc;
827 }
828}));
829Object.defineProperty(exports, "withRaw", ({
830 enumerable: true,
831 get: function get() {
832 return _nodeHelpers.withRaw;
833 }
834}));
835Object.defineProperty(exports, "funcParam", ({
836 enumerable: true,
837 get: function get() {
838 return _nodeHelpers.funcParam;
839 }
840}));
841Object.defineProperty(exports, "indexLiteral", ({
842 enumerable: true,
843 get: function get() {
844 return _nodeHelpers.indexLiteral;
845 }
846}));
847Object.defineProperty(exports, "memIndexLiteral", ({
848 enumerable: true,
849 get: function get() {
850 return _nodeHelpers.memIndexLiteral;
851 }
852}));
853Object.defineProperty(exports, "instruction", ({
854 enumerable: true,
855 get: function get() {
856 return _nodeHelpers.instruction;
857 }
858}));
859Object.defineProperty(exports, "objectInstruction", ({
860 enumerable: true,
861 get: function get() {
862 return _nodeHelpers.objectInstruction;
863 }
864}));
865Object.defineProperty(exports, "traverse", ({
866 enumerable: true,
867 get: function get() {
868 return _traverse.traverse;
869 }
870}));
871Object.defineProperty(exports, "signatures", ({
872 enumerable: true,
873 get: function get() {
874 return _signatures.signatures;
875 }
876}));
877Object.defineProperty(exports, "cloneNode", ({
878 enumerable: true,
879 get: function get() {
880 return _clone.cloneNode;
881 }
882}));
883
884var _nodes = __webpack_require__(47518);
885
886Object.keys(_nodes).forEach(function (key) {
887 if (key === "default" || key === "__esModule") return;
888 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
889 Object.defineProperty(exports, key, {
890 enumerable: true,
891 get: function get() {
892 return _nodes[key];
893 }
894 });
895});
896
897var _nodeHelpers = __webpack_require__(13436);
898
899var _traverse = __webpack_require__(47293);
900
901var _signatures = __webpack_require__(13003);
902
903var _utils = __webpack_require__(89673);
904
905Object.keys(_utils).forEach(function (key) {
906 if (key === "default" || key === "__esModule") return;
907 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
908 Object.defineProperty(exports, key, {
909 enumerable: true,
910 get: function get() {
911 return _utils[key];
912 }
913 });
914});
915
916var _clone = __webpack_require__(77065);
917
918/***/ }),
919
920/***/ 13436:
921/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
922
923"use strict";
924
925
926Object.defineProperty(exports, "__esModule", ({
927 value: true
928}));
929exports.numberLiteralFromRaw = numberLiteralFromRaw;
930exports.instruction = instruction;
931exports.objectInstruction = objectInstruction;
932exports.withLoc = withLoc;
933exports.withRaw = withRaw;
934exports.funcParam = funcParam;
935exports.indexLiteral = indexLiteral;
936exports.memIndexLiteral = memIndexLiteral;
937
938var _wastParser = __webpack_require__(9016);
939
940var _nodes = __webpack_require__(47518);
941
942function numberLiteralFromRaw(rawValue) {
943 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
944 var original = rawValue; // Remove numeric separators _
945
946 if (typeof rawValue === "string") {
947 rawValue = rawValue.replace(/_/g, "");
948 }
949
950 if (typeof rawValue === "number") {
951 return (0, _nodes.numberLiteral)(rawValue, String(original));
952 } else {
953 switch (instructionType) {
954 case "i32":
955 {
956 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
957 }
958
959 case "u32":
960 {
961 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
962 }
963
964 case "i64":
965 {
966 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
967 }
968
969 case "f32":
970 {
971 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
972 }
973 // f64
974
975 default:
976 {
977 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
978 }
979 }
980 }
981}
982
983function instruction(id) {
984 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
985 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
986 return (0, _nodes.instr)(id, undefined, args, namedArgs);
987}
988
989function objectInstruction(id, object) {
990 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
991 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
992 return (0, _nodes.instr)(id, object, args, namedArgs);
993}
994/**
995 * Decorators
996 */
997
998
999function withLoc(n, end, start) {
1000 var loc = {
1001 start: start,
1002 end: end
1003 };
1004 n.loc = loc;
1005 return n;
1006}
1007
1008function withRaw(n, raw) {
1009 n.raw = raw;
1010 return n;
1011}
1012
1013function funcParam(valtype, id) {
1014 return {
1015 id: id,
1016 valtype: valtype
1017 };
1018}
1019
1020function indexLiteral(value) {
1021 // $FlowIgnore
1022 var x = numberLiteralFromRaw(value, "u32");
1023 return x;
1024}
1025
1026function memIndexLiteral(value) {
1027 // $FlowIgnore
1028 var x = numberLiteralFromRaw(value, "u32");
1029 return x;
1030}
1031
1032/***/ }),
1033
1034/***/ 7544:
1035/***/ (function(__unused_webpack_module, exports) {
1036
1037"use strict";
1038
1039
1040Object.defineProperty(exports, "__esModule", ({
1041 value: true
1042}));
1043exports.createPath = createPath;
1044
1045function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1046
1047function findParent(_ref, cb) {
1048 var parentPath = _ref.parentPath;
1049
1050 if (parentPath == null) {
1051 throw new Error("node is root");
1052 }
1053
1054 var currentPath = parentPath;
1055
1056 while (cb(currentPath) !== false) {
1057 // Hit the root node, stop
1058 // $FlowIgnore
1059 if (currentPath.parentPath == null) {
1060 return null;
1061 } // $FlowIgnore
1062
1063
1064 currentPath = currentPath.parentPath;
1065 }
1066
1067 return currentPath.node;
1068}
1069
1070function insertBefore(context, newNode) {
1071 return insert(context, newNode);
1072}
1073
1074function insertAfter(context, newNode) {
1075 return insert(context, newNode, 1);
1076}
1077
1078function insert(_ref2, newNode) {
1079 var node = _ref2.node,
1080 inList = _ref2.inList,
1081 parentPath = _ref2.parentPath,
1082 parentKey = _ref2.parentKey;
1083 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1084
1085 if (!inList) {
1086 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
1087 }
1088
1089 if (!(parentPath != null)) {
1090 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
1091 }
1092
1093 // $FlowIgnore
1094 var parentList = parentPath.node[parentKey];
1095 var indexInList = parentList.findIndex(function (n) {
1096 return n === node;
1097 });
1098 parentList.splice(indexInList + indexOffset, 0, newNode);
1099}
1100
1101function remove(_ref3) {
1102 var node = _ref3.node,
1103 parentKey = _ref3.parentKey,
1104 parentPath = _ref3.parentPath;
1105
1106 if (!(parentPath != null)) {
1107 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
1108 }
1109
1110 // $FlowIgnore
1111 var parentNode = parentPath.node; // $FlowIgnore
1112
1113 var parentProperty = parentNode[parentKey];
1114
1115 if (Array.isArray(parentProperty)) {
1116 // $FlowIgnore
1117 parentNode[parentKey] = parentProperty.filter(function (n) {
1118 return n !== node;
1119 });
1120 } else {
1121 // $FlowIgnore
1122 delete parentNode[parentKey];
1123 }
1124
1125 node._deleted = true;
1126}
1127
1128function stop(context) {
1129 context.shouldStop = true;
1130}
1131
1132function replaceWith(context, newNode) {
1133 // $FlowIgnore
1134 var parentNode = context.parentPath.node; // $FlowIgnore
1135
1136 var parentProperty = parentNode[context.parentKey];
1137
1138 if (Array.isArray(parentProperty)) {
1139 var indexInList = parentProperty.findIndex(function (n) {
1140 return n === context.node;
1141 });
1142 parentProperty.splice(indexInList, 1, newNode);
1143 } else {
1144 // $FlowIgnore
1145 parentNode[context.parentKey] = newNode;
1146 }
1147
1148 context.node._deleted = true;
1149 context.node = newNode;
1150} // bind the context to the first argument of node operations
1151
1152
1153function bindNodeOperations(operations, context) {
1154 var keys = Object.keys(operations);
1155 var boundOperations = {};
1156 keys.forEach(function (key) {
1157 boundOperations[key] = operations[key].bind(null, context);
1158 });
1159 return boundOperations;
1160}
1161
1162function createPathOperations(context) {
1163 // $FlowIgnore
1164 return bindNodeOperations({
1165 findParent: findParent,
1166 replaceWith: replaceWith,
1167 remove: remove,
1168 insertBefore: insertBefore,
1169 insertAfter: insertAfter,
1170 stop: stop
1171 }, context);
1172}
1173
1174function createPath(context) {
1175 var path = _extends({}, context); // $FlowIgnore
1176
1177
1178 Object.assign(path, createPathOperations(path)); // $FlowIgnore
1179
1180 return path;
1181}
1182
1183/***/ }),
1184
1185/***/ 47518:
1186/***/ (function(__unused_webpack_module, exports) {
1187
1188"use strict";
1189
1190
1191Object.defineProperty(exports, "__esModule", ({
1192 value: true
1193}));
1194exports.module = _module;
1195exports.moduleMetadata = moduleMetadata;
1196exports.moduleNameMetadata = moduleNameMetadata;
1197exports.functionNameMetadata = functionNameMetadata;
1198exports.localNameMetadata = localNameMetadata;
1199exports.binaryModule = binaryModule;
1200exports.quoteModule = quoteModule;
1201exports.sectionMetadata = sectionMetadata;
1202exports.producersSectionMetadata = producersSectionMetadata;
1203exports.producerMetadata = producerMetadata;
1204exports.producerMetadataVersionedName = producerMetadataVersionedName;
1205exports.loopInstruction = loopInstruction;
1206exports.instr = instr;
1207exports.ifInstruction = ifInstruction;
1208exports.stringLiteral = stringLiteral;
1209exports.numberLiteral = numberLiteral;
1210exports.longNumberLiteral = longNumberLiteral;
1211exports.floatLiteral = floatLiteral;
1212exports.elem = elem;
1213exports.indexInFuncSection = indexInFuncSection;
1214exports.valtypeLiteral = valtypeLiteral;
1215exports.typeInstruction = typeInstruction;
1216exports.start = start;
1217exports.globalType = globalType;
1218exports.leadingComment = leadingComment;
1219exports.blockComment = blockComment;
1220exports.data = data;
1221exports.global = global;
1222exports.table = table;
1223exports.memory = memory;
1224exports.funcImportDescr = funcImportDescr;
1225exports.moduleImport = moduleImport;
1226exports.moduleExportDescr = moduleExportDescr;
1227exports.moduleExport = moduleExport;
1228exports.limit = limit;
1229exports.signature = signature;
1230exports.program = program;
1231exports.identifier = identifier;
1232exports.blockInstruction = blockInstruction;
1233exports.callInstruction = callInstruction;
1234exports.callIndirectInstruction = callIndirectInstruction;
1235exports.byteArray = byteArray;
1236exports.func = func;
1237exports.internalBrUnless = internalBrUnless;
1238exports.internalGoto = internalGoto;
1239exports.internalCallExtern = internalCallExtern;
1240exports.internalEndAndReturn = internalEndAndReturn;
1241exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
1242exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
1243
1244function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1245
1246// THIS FILE IS AUTOGENERATED
1247// see scripts/generateNodeUtils.js
1248function isTypeOf(t) {
1249 return function (n) {
1250 return n.type === t;
1251 };
1252}
1253
1254function assertTypeOf(t) {
1255 return function (n) {
1256 return function () {
1257 if (!(n.type === t)) {
1258 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
1259 }
1260 }();
1261 };
1262}
1263
1264function _module(id, fields, metadata) {
1265 if (id !== null && id !== undefined) {
1266 if (!(typeof id === "string")) {
1267 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
1268 }
1269 }
1270
1271 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
1272 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
1273 }
1274
1275 var node = {
1276 type: "Module",
1277 id: id,
1278 fields: fields
1279 };
1280
1281 if (typeof metadata !== "undefined") {
1282 node.metadata = metadata;
1283 }
1284
1285 return node;
1286}
1287
1288function moduleMetadata(sections, functionNames, localNames, producers) {
1289 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
1290 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
1291 }
1292
1293 if (functionNames !== null && functionNames !== undefined) {
1294 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
1295 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
1296 }
1297 }
1298
1299 if (localNames !== null && localNames !== undefined) {
1300 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
1301 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
1302 }
1303 }
1304
1305 if (producers !== null && producers !== undefined) {
1306 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
1307 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
1308 }
1309 }
1310
1311 var node = {
1312 type: "ModuleMetadata",
1313 sections: sections
1314 };
1315
1316 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
1317 node.functionNames = functionNames;
1318 }
1319
1320 if (typeof localNames !== "undefined" && localNames.length > 0) {
1321 node.localNames = localNames;
1322 }
1323
1324 if (typeof producers !== "undefined" && producers.length > 0) {
1325 node.producers = producers;
1326 }
1327
1328 return node;
1329}
1330
1331function moduleNameMetadata(value) {
1332 if (!(typeof value === "string")) {
1333 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1334 }
1335
1336 var node = {
1337 type: "ModuleNameMetadata",
1338 value: value
1339 };
1340 return node;
1341}
1342
1343function functionNameMetadata(value, index) {
1344 if (!(typeof value === "string")) {
1345 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1346 }
1347
1348 if (!(typeof index === "number")) {
1349 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
1350 }
1351
1352 var node = {
1353 type: "FunctionNameMetadata",
1354 value: value,
1355 index: index
1356 };
1357 return node;
1358}
1359
1360function localNameMetadata(value, localIndex, functionIndex) {
1361 if (!(typeof value === "string")) {
1362 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1363 }
1364
1365 if (!(typeof localIndex === "number")) {
1366 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
1367 }
1368
1369 if (!(typeof functionIndex === "number")) {
1370 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
1371 }
1372
1373 var node = {
1374 type: "LocalNameMetadata",
1375 value: value,
1376 localIndex: localIndex,
1377 functionIndex: functionIndex
1378 };
1379 return node;
1380}
1381
1382function binaryModule(id, blob) {
1383 if (id !== null && id !== undefined) {
1384 if (!(typeof id === "string")) {
1385 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
1386 }
1387 }
1388
1389 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
1390 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
1391 }
1392
1393 var node = {
1394 type: "BinaryModule",
1395 id: id,
1396 blob: blob
1397 };
1398 return node;
1399}
1400
1401function quoteModule(id, string) {
1402 if (id !== null && id !== undefined) {
1403 if (!(typeof id === "string")) {
1404 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
1405 }
1406 }
1407
1408 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
1409 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
1410 }
1411
1412 var node = {
1413 type: "QuoteModule",
1414 id: id,
1415 string: string
1416 };
1417 return node;
1418}
1419
1420function sectionMetadata(section, startOffset, size, vectorOfSize) {
1421 if (!(typeof startOffset === "number")) {
1422 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
1423 }
1424
1425 var node = {
1426 type: "SectionMetadata",
1427 section: section,
1428 startOffset: startOffset,
1429 size: size,
1430 vectorOfSize: vectorOfSize
1431 };
1432 return node;
1433}
1434
1435function producersSectionMetadata(producers) {
1436 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
1437 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
1438 }
1439
1440 var node = {
1441 type: "ProducersSectionMetadata",
1442 producers: producers
1443 };
1444 return node;
1445}
1446
1447function producerMetadata(language, processedBy, sdk) {
1448 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
1449 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
1450 }
1451
1452 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
1453 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
1454 }
1455
1456 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
1457 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
1458 }
1459
1460 var node = {
1461 type: "ProducerMetadata",
1462 language: language,
1463 processedBy: processedBy,
1464 sdk: sdk
1465 };
1466 return node;
1467}
1468
1469function producerMetadataVersionedName(name, version) {
1470 if (!(typeof name === "string")) {
1471 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
1472 }
1473
1474 if (!(typeof version === "string")) {
1475 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
1476 }
1477
1478 var node = {
1479 type: "ProducerMetadataVersionedName",
1480 name: name,
1481 version: version
1482 };
1483 return node;
1484}
1485
1486function loopInstruction(label, resulttype, instr) {
1487 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
1488 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
1489 }
1490
1491 var node = {
1492 type: "LoopInstruction",
1493 id: "loop",
1494 label: label,
1495 resulttype: resulttype,
1496 instr: instr
1497 };
1498 return node;
1499}
1500
1501function instr(id, object, args, namedArgs) {
1502 if (!(typeof id === "string")) {
1503 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
1504 }
1505
1506 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
1507 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
1508 }
1509
1510 var node = {
1511 type: "Instr",
1512 id: id,
1513 args: args
1514 };
1515
1516 if (typeof object !== "undefined") {
1517 node.object = object;
1518 }
1519
1520 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
1521 node.namedArgs = namedArgs;
1522 }
1523
1524 return node;
1525}
1526
1527function ifInstruction(testLabel, test, result, consequent, alternate) {
1528 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
1529 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
1530 }
1531
1532 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
1533 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
1534 }
1535
1536 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
1537 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
1538 }
1539
1540 var node = {
1541 type: "IfInstruction",
1542 id: "if",
1543 testLabel: testLabel,
1544 test: test,
1545 result: result,
1546 consequent: consequent,
1547 alternate: alternate
1548 };
1549 return node;
1550}
1551
1552function stringLiteral(value) {
1553 if (!(typeof value === "string")) {
1554 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1555 }
1556
1557 var node = {
1558 type: "StringLiteral",
1559 value: value
1560 };
1561 return node;
1562}
1563
1564function numberLiteral(value, raw) {
1565 if (!(typeof value === "number")) {
1566 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
1567 }
1568
1569 if (!(typeof raw === "string")) {
1570 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
1571 }
1572
1573 var node = {
1574 type: "NumberLiteral",
1575 value: value,
1576 raw: raw
1577 };
1578 return node;
1579}
1580
1581function longNumberLiteral(value, raw) {
1582 if (!(typeof raw === "string")) {
1583 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
1584 }
1585
1586 var node = {
1587 type: "LongNumberLiteral",
1588 value: value,
1589 raw: raw
1590 };
1591 return node;
1592}
1593
1594function floatLiteral(value, nan, inf, raw) {
1595 if (!(typeof value === "number")) {
1596 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
1597 }
1598
1599 if (nan !== null && nan !== undefined) {
1600 if (!(typeof nan === "boolean")) {
1601 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
1602 }
1603 }
1604
1605 if (inf !== null && inf !== undefined) {
1606 if (!(typeof inf === "boolean")) {
1607 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
1608 }
1609 }
1610
1611 if (!(typeof raw === "string")) {
1612 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
1613 }
1614
1615 var node = {
1616 type: "FloatLiteral",
1617 value: value,
1618 raw: raw
1619 };
1620
1621 if (nan === true) {
1622 node.nan = true;
1623 }
1624
1625 if (inf === true) {
1626 node.inf = true;
1627 }
1628
1629 return node;
1630}
1631
1632function elem(table, offset, funcs) {
1633 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
1634 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
1635 }
1636
1637 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
1638 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
1639 }
1640
1641 var node = {
1642 type: "Elem",
1643 table: table,
1644 offset: offset,
1645 funcs: funcs
1646 };
1647 return node;
1648}
1649
1650function indexInFuncSection(index) {
1651 var node = {
1652 type: "IndexInFuncSection",
1653 index: index
1654 };
1655 return node;
1656}
1657
1658function valtypeLiteral(name) {
1659 var node = {
1660 type: "ValtypeLiteral",
1661 name: name
1662 };
1663 return node;
1664}
1665
1666function typeInstruction(id, functype) {
1667 var node = {
1668 type: "TypeInstruction",
1669 id: id,
1670 functype: functype
1671 };
1672 return node;
1673}
1674
1675function start(index) {
1676 var node = {
1677 type: "Start",
1678 index: index
1679 };
1680 return node;
1681}
1682
1683function globalType(valtype, mutability) {
1684 var node = {
1685 type: "GlobalType",
1686 valtype: valtype,
1687 mutability: mutability
1688 };
1689 return node;
1690}
1691
1692function leadingComment(value) {
1693 if (!(typeof value === "string")) {
1694 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1695 }
1696
1697 var node = {
1698 type: "LeadingComment",
1699 value: value
1700 };
1701 return node;
1702}
1703
1704function blockComment(value) {
1705 if (!(typeof value === "string")) {
1706 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1707 }
1708
1709 var node = {
1710 type: "BlockComment",
1711 value: value
1712 };
1713 return node;
1714}
1715
1716function data(memoryIndex, offset, init) {
1717 var node = {
1718 type: "Data",
1719 memoryIndex: memoryIndex,
1720 offset: offset,
1721 init: init
1722 };
1723 return node;
1724}
1725
1726function global(globalType, init, name) {
1727 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
1728 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
1729 }
1730
1731 var node = {
1732 type: "Global",
1733 globalType: globalType,
1734 init: init,
1735 name: name
1736 };
1737 return node;
1738}
1739
1740function table(elementType, limits, name, elements) {
1741 if (!(limits.type === "Limit")) {
1742 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
1743 }
1744
1745 if (elements !== null && elements !== undefined) {
1746 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
1747 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
1748 }
1749 }
1750
1751 var node = {
1752 type: "Table",
1753 elementType: elementType,
1754 limits: limits,
1755 name: name
1756 };
1757
1758 if (typeof elements !== "undefined" && elements.length > 0) {
1759 node.elements = elements;
1760 }
1761
1762 return node;
1763}
1764
1765function memory(limits, id) {
1766 var node = {
1767 type: "Memory",
1768 limits: limits,
1769 id: id
1770 };
1771 return node;
1772}
1773
1774function funcImportDescr(id, signature) {
1775 var node = {
1776 type: "FuncImportDescr",
1777 id: id,
1778 signature: signature
1779 };
1780 return node;
1781}
1782
1783function moduleImport(module, name, descr) {
1784 if (!(typeof module === "string")) {
1785 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
1786 }
1787
1788 if (!(typeof name === "string")) {
1789 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
1790 }
1791
1792 var node = {
1793 type: "ModuleImport",
1794 module: module,
1795 name: name,
1796 descr: descr
1797 };
1798 return node;
1799}
1800
1801function moduleExportDescr(exportType, id) {
1802 var node = {
1803 type: "ModuleExportDescr",
1804 exportType: exportType,
1805 id: id
1806 };
1807 return node;
1808}
1809
1810function moduleExport(name, descr) {
1811 if (!(typeof name === "string")) {
1812 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
1813 }
1814
1815 var node = {
1816 type: "ModuleExport",
1817 name: name,
1818 descr: descr
1819 };
1820 return node;
1821}
1822
1823function limit(min, max) {
1824 if (!(typeof min === "number")) {
1825 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
1826 }
1827
1828 if (max !== null && max !== undefined) {
1829 if (!(typeof max === "number")) {
1830 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
1831 }
1832 }
1833
1834 var node = {
1835 type: "Limit",
1836 min: min
1837 };
1838
1839 if (typeof max !== "undefined") {
1840 node.max = max;
1841 }
1842
1843 return node;
1844}
1845
1846function signature(params, results) {
1847 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
1848 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
1849 }
1850
1851 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
1852 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
1853 }
1854
1855 var node = {
1856 type: "Signature",
1857 params: params,
1858 results: results
1859 };
1860 return node;
1861}
1862
1863function program(body) {
1864 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
1865 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
1866 }
1867
1868 var node = {
1869 type: "Program",
1870 body: body
1871 };
1872 return node;
1873}
1874
1875function identifier(value, raw) {
1876 if (!(typeof value === "string")) {
1877 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
1878 }
1879
1880 if (raw !== null && raw !== undefined) {
1881 if (!(typeof raw === "string")) {
1882 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
1883 }
1884 }
1885
1886 var node = {
1887 type: "Identifier",
1888 value: value
1889 };
1890
1891 if (typeof raw !== "undefined") {
1892 node.raw = raw;
1893 }
1894
1895 return node;
1896}
1897
1898function blockInstruction(label, instr, result) {
1899 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
1900 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
1901 }
1902
1903 var node = {
1904 type: "BlockInstruction",
1905 id: "block",
1906 label: label,
1907 instr: instr,
1908 result: result
1909 };
1910 return node;
1911}
1912
1913function callInstruction(index, instrArgs, numeric) {
1914 if (instrArgs !== null && instrArgs !== undefined) {
1915 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
1916 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
1917 }
1918 }
1919
1920 var node = {
1921 type: "CallInstruction",
1922 id: "call",
1923 index: index
1924 };
1925
1926 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
1927 node.instrArgs = instrArgs;
1928 }
1929
1930 if (typeof numeric !== "undefined") {
1931 node.numeric = numeric;
1932 }
1933
1934 return node;
1935}
1936
1937function callIndirectInstruction(signature, intrs) {
1938 if (intrs !== null && intrs !== undefined) {
1939 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
1940 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
1941 }
1942 }
1943
1944 var node = {
1945 type: "CallIndirectInstruction",
1946 id: "call_indirect",
1947 signature: signature
1948 };
1949
1950 if (typeof intrs !== "undefined" && intrs.length > 0) {
1951 node.intrs = intrs;
1952 }
1953
1954 return node;
1955}
1956
1957function byteArray(values) {
1958 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
1959 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
1960 }
1961
1962 var node = {
1963 type: "ByteArray",
1964 values: values
1965 };
1966 return node;
1967}
1968
1969function func(name, signature, body, isExternal, metadata) {
1970 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
1971 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
1972 }
1973
1974 if (isExternal !== null && isExternal !== undefined) {
1975 if (!(typeof isExternal === "boolean")) {
1976 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
1977 }
1978 }
1979
1980 var node = {
1981 type: "Func",
1982 name: name,
1983 signature: signature,
1984 body: body
1985 };
1986
1987 if (isExternal === true) {
1988 node.isExternal = true;
1989 }
1990
1991 if (typeof metadata !== "undefined") {
1992 node.metadata = metadata;
1993 }
1994
1995 return node;
1996}
1997
1998function internalBrUnless(target) {
1999 if (!(typeof target === "number")) {
2000 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
2001 }
2002
2003 var node = {
2004 type: "InternalBrUnless",
2005 target: target
2006 };
2007 return node;
2008}
2009
2010function internalGoto(target) {
2011 if (!(typeof target === "number")) {
2012 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
2013 }
2014
2015 var node = {
2016 type: "InternalGoto",
2017 target: target
2018 };
2019 return node;
2020}
2021
2022function internalCallExtern(target) {
2023 if (!(typeof target === "number")) {
2024 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
2025 }
2026
2027 var node = {
2028 type: "InternalCallExtern",
2029 target: target
2030 };
2031 return node;
2032}
2033
2034function internalEndAndReturn() {
2035 var node = {
2036 type: "InternalEndAndReturn"
2037 };
2038 return node;
2039}
2040
2041var isModule = isTypeOf("Module");
2042exports.isModule = isModule;
2043var isModuleMetadata = isTypeOf("ModuleMetadata");
2044exports.isModuleMetadata = isModuleMetadata;
2045var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
2046exports.isModuleNameMetadata = isModuleNameMetadata;
2047var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
2048exports.isFunctionNameMetadata = isFunctionNameMetadata;
2049var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
2050exports.isLocalNameMetadata = isLocalNameMetadata;
2051var isBinaryModule = isTypeOf("BinaryModule");
2052exports.isBinaryModule = isBinaryModule;
2053var isQuoteModule = isTypeOf("QuoteModule");
2054exports.isQuoteModule = isQuoteModule;
2055var isSectionMetadata = isTypeOf("SectionMetadata");
2056exports.isSectionMetadata = isSectionMetadata;
2057var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
2058exports.isProducersSectionMetadata = isProducersSectionMetadata;
2059var isProducerMetadata = isTypeOf("ProducerMetadata");
2060exports.isProducerMetadata = isProducerMetadata;
2061var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
2062exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
2063var isLoopInstruction = isTypeOf("LoopInstruction");
2064exports.isLoopInstruction = isLoopInstruction;
2065var isInstr = isTypeOf("Instr");
2066exports.isInstr = isInstr;
2067var isIfInstruction = isTypeOf("IfInstruction");
2068exports.isIfInstruction = isIfInstruction;
2069var isStringLiteral = isTypeOf("StringLiteral");
2070exports.isStringLiteral = isStringLiteral;
2071var isNumberLiteral = isTypeOf("NumberLiteral");
2072exports.isNumberLiteral = isNumberLiteral;
2073var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
2074exports.isLongNumberLiteral = isLongNumberLiteral;
2075var isFloatLiteral = isTypeOf("FloatLiteral");
2076exports.isFloatLiteral = isFloatLiteral;
2077var isElem = isTypeOf("Elem");
2078exports.isElem = isElem;
2079var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
2080exports.isIndexInFuncSection = isIndexInFuncSection;
2081var isValtypeLiteral = isTypeOf("ValtypeLiteral");
2082exports.isValtypeLiteral = isValtypeLiteral;
2083var isTypeInstruction = isTypeOf("TypeInstruction");
2084exports.isTypeInstruction = isTypeInstruction;
2085var isStart = isTypeOf("Start");
2086exports.isStart = isStart;
2087var isGlobalType = isTypeOf("GlobalType");
2088exports.isGlobalType = isGlobalType;
2089var isLeadingComment = isTypeOf("LeadingComment");
2090exports.isLeadingComment = isLeadingComment;
2091var isBlockComment = isTypeOf("BlockComment");
2092exports.isBlockComment = isBlockComment;
2093var isData = isTypeOf("Data");
2094exports.isData = isData;
2095var isGlobal = isTypeOf("Global");
2096exports.isGlobal = isGlobal;
2097var isTable = isTypeOf("Table");
2098exports.isTable = isTable;
2099var isMemory = isTypeOf("Memory");
2100exports.isMemory = isMemory;
2101var isFuncImportDescr = isTypeOf("FuncImportDescr");
2102exports.isFuncImportDescr = isFuncImportDescr;
2103var isModuleImport = isTypeOf("ModuleImport");
2104exports.isModuleImport = isModuleImport;
2105var isModuleExportDescr = isTypeOf("ModuleExportDescr");
2106exports.isModuleExportDescr = isModuleExportDescr;
2107var isModuleExport = isTypeOf("ModuleExport");
2108exports.isModuleExport = isModuleExport;
2109var isLimit = isTypeOf("Limit");
2110exports.isLimit = isLimit;
2111var isSignature = isTypeOf("Signature");
2112exports.isSignature = isSignature;
2113var isProgram = isTypeOf("Program");
2114exports.isProgram = isProgram;
2115var isIdentifier = isTypeOf("Identifier");
2116exports.isIdentifier = isIdentifier;
2117var isBlockInstruction = isTypeOf("BlockInstruction");
2118exports.isBlockInstruction = isBlockInstruction;
2119var isCallInstruction = isTypeOf("CallInstruction");
2120exports.isCallInstruction = isCallInstruction;
2121var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
2122exports.isCallIndirectInstruction = isCallIndirectInstruction;
2123var isByteArray = isTypeOf("ByteArray");
2124exports.isByteArray = isByteArray;
2125var isFunc = isTypeOf("Func");
2126exports.isFunc = isFunc;
2127var isInternalBrUnless = isTypeOf("InternalBrUnless");
2128exports.isInternalBrUnless = isInternalBrUnless;
2129var isInternalGoto = isTypeOf("InternalGoto");
2130exports.isInternalGoto = isInternalGoto;
2131var isInternalCallExtern = isTypeOf("InternalCallExtern");
2132exports.isInternalCallExtern = isInternalCallExtern;
2133var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
2134exports.isInternalEndAndReturn = isInternalEndAndReturn;
2135
2136var isNode = function isNode(node) {
2137 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
2138};
2139
2140exports.isNode = isNode;
2141
2142var isBlock = function isBlock(node) {
2143 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
2144};
2145
2146exports.isBlock = isBlock;
2147
2148var isInstruction = function isInstruction(node) {
2149 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
2150};
2151
2152exports.isInstruction = isInstruction;
2153
2154var isExpression = function isExpression(node) {
2155 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
2156};
2157
2158exports.isExpression = isExpression;
2159
2160var isNumericLiteral = function isNumericLiteral(node) {
2161 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
2162};
2163
2164exports.isNumericLiteral = isNumericLiteral;
2165
2166var isImportDescr = function isImportDescr(node) {
2167 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
2168};
2169
2170exports.isImportDescr = isImportDescr;
2171
2172var isIntrinsic = function isIntrinsic(node) {
2173 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
2174};
2175
2176exports.isIntrinsic = isIntrinsic;
2177var assertModule = assertTypeOf("Module");
2178exports.assertModule = assertModule;
2179var assertModuleMetadata = assertTypeOf("ModuleMetadata");
2180exports.assertModuleMetadata = assertModuleMetadata;
2181var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
2182exports.assertModuleNameMetadata = assertModuleNameMetadata;
2183var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
2184exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
2185var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
2186exports.assertLocalNameMetadata = assertLocalNameMetadata;
2187var assertBinaryModule = assertTypeOf("BinaryModule");
2188exports.assertBinaryModule = assertBinaryModule;
2189var assertQuoteModule = assertTypeOf("QuoteModule");
2190exports.assertQuoteModule = assertQuoteModule;
2191var assertSectionMetadata = assertTypeOf("SectionMetadata");
2192exports.assertSectionMetadata = assertSectionMetadata;
2193var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
2194exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
2195var assertProducerMetadata = assertTypeOf("ProducerMetadata");
2196exports.assertProducerMetadata = assertProducerMetadata;
2197var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
2198exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
2199var assertLoopInstruction = assertTypeOf("LoopInstruction");
2200exports.assertLoopInstruction = assertLoopInstruction;
2201var assertInstr = assertTypeOf("Instr");
2202exports.assertInstr = assertInstr;
2203var assertIfInstruction = assertTypeOf("IfInstruction");
2204exports.assertIfInstruction = assertIfInstruction;
2205var assertStringLiteral = assertTypeOf("StringLiteral");
2206exports.assertStringLiteral = assertStringLiteral;
2207var assertNumberLiteral = assertTypeOf("NumberLiteral");
2208exports.assertNumberLiteral = assertNumberLiteral;
2209var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
2210exports.assertLongNumberLiteral = assertLongNumberLiteral;
2211var assertFloatLiteral = assertTypeOf("FloatLiteral");
2212exports.assertFloatLiteral = assertFloatLiteral;
2213var assertElem = assertTypeOf("Elem");
2214exports.assertElem = assertElem;
2215var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
2216exports.assertIndexInFuncSection = assertIndexInFuncSection;
2217var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
2218exports.assertValtypeLiteral = assertValtypeLiteral;
2219var assertTypeInstruction = assertTypeOf("TypeInstruction");
2220exports.assertTypeInstruction = assertTypeInstruction;
2221var assertStart = assertTypeOf("Start");
2222exports.assertStart = assertStart;
2223var assertGlobalType = assertTypeOf("GlobalType");
2224exports.assertGlobalType = assertGlobalType;
2225var assertLeadingComment = assertTypeOf("LeadingComment");
2226exports.assertLeadingComment = assertLeadingComment;
2227var assertBlockComment = assertTypeOf("BlockComment");
2228exports.assertBlockComment = assertBlockComment;
2229var assertData = assertTypeOf("Data");
2230exports.assertData = assertData;
2231var assertGlobal = assertTypeOf("Global");
2232exports.assertGlobal = assertGlobal;
2233var assertTable = assertTypeOf("Table");
2234exports.assertTable = assertTable;
2235var assertMemory = assertTypeOf("Memory");
2236exports.assertMemory = assertMemory;
2237var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
2238exports.assertFuncImportDescr = assertFuncImportDescr;
2239var assertModuleImport = assertTypeOf("ModuleImport");
2240exports.assertModuleImport = assertModuleImport;
2241var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
2242exports.assertModuleExportDescr = assertModuleExportDescr;
2243var assertModuleExport = assertTypeOf("ModuleExport");
2244exports.assertModuleExport = assertModuleExport;
2245var assertLimit = assertTypeOf("Limit");
2246exports.assertLimit = assertLimit;
2247var assertSignature = assertTypeOf("Signature");
2248exports.assertSignature = assertSignature;
2249var assertProgram = assertTypeOf("Program");
2250exports.assertProgram = assertProgram;
2251var assertIdentifier = assertTypeOf("Identifier");
2252exports.assertIdentifier = assertIdentifier;
2253var assertBlockInstruction = assertTypeOf("BlockInstruction");
2254exports.assertBlockInstruction = assertBlockInstruction;
2255var assertCallInstruction = assertTypeOf("CallInstruction");
2256exports.assertCallInstruction = assertCallInstruction;
2257var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
2258exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
2259var assertByteArray = assertTypeOf("ByteArray");
2260exports.assertByteArray = assertByteArray;
2261var assertFunc = assertTypeOf("Func");
2262exports.assertFunc = assertFunc;
2263var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
2264exports.assertInternalBrUnless = assertInternalBrUnless;
2265var assertInternalGoto = assertTypeOf("InternalGoto");
2266exports.assertInternalGoto = assertInternalGoto;
2267var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
2268exports.assertInternalCallExtern = assertInternalCallExtern;
2269var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
2270exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
2271var unionTypesMap = {
2272 Module: ["Node"],
2273 ModuleMetadata: ["Node"],
2274 ModuleNameMetadata: ["Node"],
2275 FunctionNameMetadata: ["Node"],
2276 LocalNameMetadata: ["Node"],
2277 BinaryModule: ["Node"],
2278 QuoteModule: ["Node"],
2279 SectionMetadata: ["Node"],
2280 ProducersSectionMetadata: ["Node"],
2281 ProducerMetadata: ["Node"],
2282 ProducerMetadataVersionedName: ["Node"],
2283 LoopInstruction: ["Node", "Block", "Instruction"],
2284 Instr: ["Node", "Expression", "Instruction"],
2285 IfInstruction: ["Node", "Instruction"],
2286 StringLiteral: ["Node", "Expression"],
2287 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
2288 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
2289 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
2290 Elem: ["Node"],
2291 IndexInFuncSection: ["Node"],
2292 ValtypeLiteral: ["Node", "Expression"],
2293 TypeInstruction: ["Node", "Instruction"],
2294 Start: ["Node"],
2295 GlobalType: ["Node", "ImportDescr"],
2296 LeadingComment: ["Node"],
2297 BlockComment: ["Node"],
2298 Data: ["Node"],
2299 Global: ["Node"],
2300 Table: ["Node", "ImportDescr"],
2301 Memory: ["Node", "ImportDescr"],
2302 FuncImportDescr: ["Node", "ImportDescr"],
2303 ModuleImport: ["Node"],
2304 ModuleExportDescr: ["Node"],
2305 ModuleExport: ["Node"],
2306 Limit: ["Node"],
2307 Signature: ["Node"],
2308 Program: ["Node"],
2309 Identifier: ["Node", "Expression"],
2310 BlockInstruction: ["Node", "Block", "Instruction"],
2311 CallInstruction: ["Node", "Instruction"],
2312 CallIndirectInstruction: ["Node", "Instruction"],
2313 ByteArray: ["Node"],
2314 Func: ["Node", "Block"],
2315 InternalBrUnless: ["Node", "Intrinsic"],
2316 InternalGoto: ["Node", "Intrinsic"],
2317 InternalCallExtern: ["Node", "Intrinsic"],
2318 InternalEndAndReturn: ["Node", "Intrinsic"]
2319};
2320exports.unionTypesMap = unionTypesMap;
2321var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
2322exports.nodeAndUnionTypes = nodeAndUnionTypes;
2323
2324/***/ }),
2325
2326/***/ 13003:
2327/***/ (function(__unused_webpack_module, exports) {
2328
2329"use strict";
2330
2331
2332Object.defineProperty(exports, "__esModule", ({
2333 value: true
2334}));
2335exports.signatures = void 0;
2336
2337function sign(input, output) {
2338 return [input, output];
2339}
2340
2341var u32 = "u32";
2342var i32 = "i32";
2343var i64 = "i64";
2344var f32 = "f32";
2345var f64 = "f64";
2346
2347var vector = function vector(t) {
2348 var vecType = [t]; // $FlowIgnore
2349
2350 vecType.vector = true;
2351 return vecType;
2352};
2353
2354var controlInstructions = {
2355 unreachable: sign([], []),
2356 nop: sign([], []),
2357 // block ?
2358 // loop ?
2359 // if ?
2360 // if else ?
2361 br: sign([u32], []),
2362 br_if: sign([u32], []),
2363 br_table: sign(vector(u32), []),
2364 return: sign([], []),
2365 call: sign([u32], []),
2366 call_indirect: sign([u32], [])
2367};
2368var parametricInstructions = {
2369 drop: sign([], []),
2370 select: sign([], [])
2371};
2372var variableInstructions = {
2373 get_local: sign([u32], []),
2374 set_local: sign([u32], []),
2375 tee_local: sign([u32], []),
2376 get_global: sign([u32], []),
2377 set_global: sign([u32], [])
2378};
2379var memoryInstructions = {
2380 "i32.load": sign([u32, u32], [i32]),
2381 "i64.load": sign([u32, u32], []),
2382 "f32.load": sign([u32, u32], []),
2383 "f64.load": sign([u32, u32], []),
2384 "i32.load8_s": sign([u32, u32], [i32]),
2385 "i32.load8_u": sign([u32, u32], [i32]),
2386 "i32.load16_s": sign([u32, u32], [i32]),
2387 "i32.load16_u": sign([u32, u32], [i32]),
2388 "i64.load8_s": sign([u32, u32], [i64]),
2389 "i64.load8_u": sign([u32, u32], [i64]),
2390 "i64.load16_s": sign([u32, u32], [i64]),
2391 "i64.load16_u": sign([u32, u32], [i64]),
2392 "i64.load32_s": sign([u32, u32], [i64]),
2393 "i64.load32_u": sign([u32, u32], [i64]),
2394 "i32.store": sign([u32, u32], []),
2395 "i64.store": sign([u32, u32], []),
2396 "f32.store": sign([u32, u32], []),
2397 "f64.store": sign([u32, u32], []),
2398 "i32.store8": sign([u32, u32], []),
2399 "i32.store16": sign([u32, u32], []),
2400 "i64.store8": sign([u32, u32], []),
2401 "i64.store16": sign([u32, u32], []),
2402 "i64.store32": sign([u32, u32], []),
2403 current_memory: sign([], []),
2404 grow_memory: sign([], [])
2405};
2406var numericInstructions = {
2407 "i32.const": sign([i32], [i32]),
2408 "i64.const": sign([i64], [i64]),
2409 "f32.const": sign([f32], [f32]),
2410 "f64.const": sign([f64], [f64]),
2411 "i32.eqz": sign([i32], [i32]),
2412 "i32.eq": sign([i32, i32], [i32]),
2413 "i32.ne": sign([i32, i32], [i32]),
2414 "i32.lt_s": sign([i32, i32], [i32]),
2415 "i32.lt_u": sign([i32, i32], [i32]),
2416 "i32.gt_s": sign([i32, i32], [i32]),
2417 "i32.gt_u": sign([i32, i32], [i32]),
2418 "i32.le_s": sign([i32, i32], [i32]),
2419 "i32.le_u": sign([i32, i32], [i32]),
2420 "i32.ge_s": sign([i32, i32], [i32]),
2421 "i32.ge_u": sign([i32, i32], [i32]),
2422 "i64.eqz": sign([i64], [i64]),
2423 "i64.eq": sign([i64, i64], [i32]),
2424 "i64.ne": sign([i64, i64], [i32]),
2425 "i64.lt_s": sign([i64, i64], [i32]),
2426 "i64.lt_u": sign([i64, i64], [i32]),
2427 "i64.gt_s": sign([i64, i64], [i32]),
2428 "i64.gt_u": sign([i64, i64], [i32]),
2429 "i64.le_s": sign([i64, i64], [i32]),
2430 "i64.le_u": sign([i64, i64], [i32]),
2431 "i64.ge_s": sign([i64, i64], [i32]),
2432 "i64.ge_u": sign([i64, i64], [i32]),
2433 "f32.eq": sign([f32, f32], [i32]),
2434 "f32.ne": sign([f32, f32], [i32]),
2435 "f32.lt": sign([f32, f32], [i32]),
2436 "f32.gt": sign([f32, f32], [i32]),
2437 "f32.le": sign([f32, f32], [i32]),
2438 "f32.ge": sign([f32, f32], [i32]),
2439 "f64.eq": sign([f64, f64], [i32]),
2440 "f64.ne": sign([f64, f64], [i32]),
2441 "f64.lt": sign([f64, f64], [i32]),
2442 "f64.gt": sign([f64, f64], [i32]),
2443 "f64.le": sign([f64, f64], [i32]),
2444 "f64.ge": sign([f64, f64], [i32]),
2445 "i32.clz": sign([i32], [i32]),
2446 "i32.ctz": sign([i32], [i32]),
2447 "i32.popcnt": sign([i32], [i32]),
2448 "i32.add": sign([i32, i32], [i32]),
2449 "i32.sub": sign([i32, i32], [i32]),
2450 "i32.mul": sign([i32, i32], [i32]),
2451 "i32.div_s": sign([i32, i32], [i32]),
2452 "i32.div_u": sign([i32, i32], [i32]),
2453 "i32.rem_s": sign([i32, i32], [i32]),
2454 "i32.rem_u": sign([i32, i32], [i32]),
2455 "i32.and": sign([i32, i32], [i32]),
2456 "i32.or": sign([i32, i32], [i32]),
2457 "i32.xor": sign([i32, i32], [i32]),
2458 "i32.shl": sign([i32, i32], [i32]),
2459 "i32.shr_s": sign([i32, i32], [i32]),
2460 "i32.shr_u": sign([i32, i32], [i32]),
2461 "i32.rotl": sign([i32, i32], [i32]),
2462 "i32.rotr": sign([i32, i32], [i32]),
2463 "i64.clz": sign([i64], [i64]),
2464 "i64.ctz": sign([i64], [i64]),
2465 "i64.popcnt": sign([i64], [i64]),
2466 "i64.add": sign([i64, i64], [i64]),
2467 "i64.sub": sign([i64, i64], [i64]),
2468 "i64.mul": sign([i64, i64], [i64]),
2469 "i64.div_s": sign([i64, i64], [i64]),
2470 "i64.div_u": sign([i64, i64], [i64]),
2471 "i64.rem_s": sign([i64, i64], [i64]),
2472 "i64.rem_u": sign([i64, i64], [i64]),
2473 "i64.and": sign([i64, i64], [i64]),
2474 "i64.or": sign([i64, i64], [i64]),
2475 "i64.xor": sign([i64, i64], [i64]),
2476 "i64.shl": sign([i64, i64], [i64]),
2477 "i64.shr_s": sign([i64, i64], [i64]),
2478 "i64.shr_u": sign([i64, i64], [i64]),
2479 "i64.rotl": sign([i64, i64], [i64]),
2480 "i64.rotr": sign([i64, i64], [i64]),
2481 "f32.abs": sign([f32], [f32]),
2482 "f32.neg": sign([f32], [f32]),
2483 "f32.ceil": sign([f32], [f32]),
2484 "f32.floor": sign([f32], [f32]),
2485 "f32.trunc": sign([f32], [f32]),
2486 "f32.nearest": sign([f32], [f32]),
2487 "f32.sqrt": sign([f32], [f32]),
2488 "f32.add": sign([f32, f32], [f32]),
2489 "f32.sub": sign([f32, f32], [f32]),
2490 "f32.mul": sign([f32, f32], [f32]),
2491 "f32.div": sign([f32, f32], [f32]),
2492 "f32.min": sign([f32, f32], [f32]),
2493 "f32.max": sign([f32, f32], [f32]),
2494 "f32.copysign": sign([f32, f32], [f32]),
2495 "f64.abs": sign([f64], [f64]),
2496 "f64.neg": sign([f64], [f64]),
2497 "f64.ceil": sign([f64], [f64]),
2498 "f64.floor": sign([f64], [f64]),
2499 "f64.trunc": sign([f64], [f64]),
2500 "f64.nearest": sign([f64], [f64]),
2501 "f64.sqrt": sign([f64], [f64]),
2502 "f64.add": sign([f64, f64], [f64]),
2503 "f64.sub": sign([f64, f64], [f64]),
2504 "f64.mul": sign([f64, f64], [f64]),
2505 "f64.div": sign([f64, f64], [f64]),
2506 "f64.min": sign([f64, f64], [f64]),
2507 "f64.max": sign([f64, f64], [f64]),
2508 "f64.copysign": sign([f64, f64], [f64]),
2509 "i32.wrap/i64": sign([i64], [i32]),
2510 "i32.trunc_s/f32": sign([f32], [i32]),
2511 "i32.trunc_u/f32": sign([f32], [i32]),
2512 "i32.trunc_s/f64": sign([f32], [i32]),
2513 "i32.trunc_u/f64": sign([f64], [i32]),
2514 "i64.extend_s/i32": sign([i32], [i64]),
2515 "i64.extend_u/i32": sign([i32], [i64]),
2516 "i64.trunc_s/f32": sign([f32], [i64]),
2517 "i64.trunc_u/f32": sign([f32], [i64]),
2518 "i64.trunc_s/f64": sign([f64], [i64]),
2519 "i64.trunc_u/f64": sign([f64], [i64]),
2520 "f32.convert_s/i32": sign([i32], [f32]),
2521 "f32.convert_u/i32": sign([i32], [f32]),
2522 "f32.convert_s/i64": sign([i64], [f32]),
2523 "f32.convert_u/i64": sign([i64], [f32]),
2524 "f32.demote/f64": sign([f64], [f32]),
2525 "f64.convert_s/i32": sign([i32], [f64]),
2526 "f64.convert_u/i32": sign([i32], [f64]),
2527 "f64.convert_s/i64": sign([i64], [f64]),
2528 "f64.convert_u/i64": sign([i64], [f64]),
2529 "f64.promote/f32": sign([f32], [f64]),
2530 "i32.reinterpret/f32": sign([f32], [i32]),
2531 "i64.reinterpret/f64": sign([f64], [i64]),
2532 "f32.reinterpret/i32": sign([i32], [f32]),
2533 "f64.reinterpret/i64": sign([i64], [f64])
2534};
2535var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
2536exports.signatures = signatures;
2537
2538/***/ }),
2539
2540/***/ 47293:
2541/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2542
2543"use strict";
2544
2545
2546Object.defineProperty(exports, "__esModule", ({
2547 value: true
2548}));
2549exports.traverse = traverse;
2550
2551var _nodePath = __webpack_require__(7544);
2552
2553var _nodes = __webpack_require__(47518);
2554
2555// recursively walks the AST starting at the given node. The callback is invoked for
2556// and object that has a 'type' property.
2557function walk(context, callback) {
2558 var stop = false;
2559
2560 function innerWalk(context, callback) {
2561 if (stop) {
2562 return;
2563 }
2564
2565 var node = context.node;
2566
2567 if (node === undefined) {
2568 console.warn("traversing with an empty context");
2569 return;
2570 }
2571
2572 if (node._deleted === true) {
2573 return;
2574 }
2575
2576 var path = (0, _nodePath.createPath)(context);
2577 callback(node.type, path);
2578
2579 if (path.shouldStop) {
2580 stop = true;
2581 return;
2582 }
2583
2584 Object.keys(node).forEach(function (prop) {
2585 var value = node[prop];
2586
2587 if (value === null || value === undefined) {
2588 return;
2589 }
2590
2591 var valueAsArray = Array.isArray(value) ? value : [value];
2592 valueAsArray.forEach(function (childNode) {
2593 if (typeof childNode.type === "string") {
2594 var childContext = {
2595 node: childNode,
2596 parentKey: prop,
2597 parentPath: path,
2598 shouldStop: false,
2599 inList: Array.isArray(value)
2600 };
2601 innerWalk(childContext, callback);
2602 }
2603 });
2604 });
2605 }
2606
2607 innerWalk(context, callback);
2608}
2609
2610var noop = function noop() {};
2611
2612function traverse(node, visitors) {
2613 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
2614 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
2615 Object.keys(visitors).forEach(function (visitor) {
2616 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
2617 throw new Error("Unexpected visitor ".concat(visitor));
2618 }
2619 });
2620 var context = {
2621 node: node,
2622 inList: false,
2623 shouldStop: false,
2624 parentPath: null,
2625 parentKey: null
2626 };
2627 walk(context, function (type, path) {
2628 if (typeof visitors[type] === "function") {
2629 before(type, path);
2630 visitors[type](path);
2631 after(type, path);
2632 }
2633
2634 var unionTypes = _nodes.unionTypesMap[type];
2635
2636 if (!unionTypes) {
2637 throw new Error("Unexpected node type ".concat(type));
2638 }
2639
2640 unionTypes.forEach(function (unionType) {
2641 if (typeof visitors[unionType] === "function") {
2642 before(unionType, path);
2643 visitors[unionType](path);
2644 after(unionType, path);
2645 }
2646 });
2647 });
2648}
2649
2650/***/ }),
2651
2652/***/ 89673:
2653/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2654
2655"use strict";
2656
2657
2658Object.defineProperty(exports, "__esModule", ({
2659 value: true
2660}));
2661exports.isAnonymous = isAnonymous;
2662exports.getSectionMetadata = getSectionMetadata;
2663exports.getSectionMetadatas = getSectionMetadatas;
2664exports.sortSectionMetadata = sortSectionMetadata;
2665exports.orderedInsertNode = orderedInsertNode;
2666exports.assertHasLoc = assertHasLoc;
2667exports.getEndOfSection = getEndOfSection;
2668exports.shiftLoc = shiftLoc;
2669exports.shiftSection = shiftSection;
2670exports.signatureForOpcode = signatureForOpcode;
2671exports.getUniqueNameGenerator = getUniqueNameGenerator;
2672exports.getStartByteOffset = getStartByteOffset;
2673exports.getEndByteOffset = getEndByteOffset;
2674exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
2675exports.getEndBlockByteOffset = getEndBlockByteOffset;
2676exports.getStartBlockByteOffset = getStartBlockByteOffset;
2677
2678var _signatures = __webpack_require__(13003);
2679
2680var _traverse = __webpack_require__(47293);
2681
2682var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(60436));
2683
2684function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
2685
2686function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2687
2688function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
2689
2690function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2691
2692function isAnonymous(ident) {
2693 return ident.raw === "";
2694}
2695
2696function getSectionMetadata(ast, name) {
2697 var section;
2698 (0, _traverse.traverse)(ast, {
2699 SectionMetadata: function (_SectionMetadata) {
2700 function SectionMetadata(_x) {
2701 return _SectionMetadata.apply(this, arguments);
2702 }
2703
2704 SectionMetadata.toString = function () {
2705 return _SectionMetadata.toString();
2706 };
2707
2708 return SectionMetadata;
2709 }(function (_ref) {
2710 var node = _ref.node;
2711
2712 if (node.section === name) {
2713 section = node;
2714 }
2715 })
2716 });
2717 return section;
2718}
2719
2720function getSectionMetadatas(ast, name) {
2721 var sections = [];
2722 (0, _traverse.traverse)(ast, {
2723 SectionMetadata: function (_SectionMetadata2) {
2724 function SectionMetadata(_x2) {
2725 return _SectionMetadata2.apply(this, arguments);
2726 }
2727
2728 SectionMetadata.toString = function () {
2729 return _SectionMetadata2.toString();
2730 };
2731
2732 return SectionMetadata;
2733 }(function (_ref2) {
2734 var node = _ref2.node;
2735
2736 if (node.section === name) {
2737 sections.push(node);
2738 }
2739 })
2740 });
2741 return sections;
2742}
2743
2744function sortSectionMetadata(m) {
2745 if (m.metadata == null) {
2746 console.warn("sortSectionMetadata: no metadata to sort");
2747 return;
2748 } // $FlowIgnore
2749
2750
2751 m.metadata.sections.sort(function (a, b) {
2752 var aId = _helperWasmBytecode.default.sections[a.section];
2753 var bId = _helperWasmBytecode.default.sections[b.section];
2754
2755 if (typeof aId !== "number" || typeof bId !== "number") {
2756 throw new Error("Section id not found");
2757 }
2758
2759 return aId - bId;
2760 });
2761}
2762
2763function orderedInsertNode(m, n) {
2764 assertHasLoc(n);
2765 var didInsert = false;
2766
2767 if (n.type === "ModuleExport") {
2768 m.fields.push(n);
2769 return;
2770 }
2771
2772 m.fields = m.fields.reduce(function (acc, field) {
2773 var fieldEndCol = Infinity;
2774
2775 if (field.loc != null) {
2776 // $FlowIgnore
2777 fieldEndCol = field.loc.end.column;
2778 } // $FlowIgnore: assertHasLoc ensures that
2779
2780
2781 if (didInsert === false && n.loc.start.column < fieldEndCol) {
2782 didInsert = true;
2783 acc.push(n);
2784 }
2785
2786 acc.push(field);
2787 return acc;
2788 }, []); // Handles empty modules or n is the last element
2789
2790 if (didInsert === false) {
2791 m.fields.push(n);
2792 }
2793}
2794
2795function assertHasLoc(n) {
2796 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
2797 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
2798 }
2799}
2800
2801function getEndOfSection(s) {
2802 assertHasLoc(s.size);
2803 return s.startOffset + s.size.value + ( // $FlowIgnore
2804 s.size.loc.end.column - s.size.loc.start.column);
2805}
2806
2807function shiftLoc(node, delta) {
2808 // $FlowIgnore
2809 node.loc.start.column += delta; // $FlowIgnore
2810
2811 node.loc.end.column += delta;
2812}
2813
2814function shiftSection(ast, node, delta) {
2815 if (node.type !== "SectionMetadata") {
2816 throw new Error("Can not shift node " + JSON.stringify(node.type));
2817 }
2818
2819 node.startOffset += delta;
2820
2821 if (_typeof(node.size.loc) === "object") {
2822 shiftLoc(node.size, delta);
2823 } // Custom sections doesn't have vectorOfSize
2824
2825
2826 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
2827 shiftLoc(node.vectorOfSize, delta);
2828 }
2829
2830 var sectionName = node.section; // shift node locations within that section
2831
2832 (0, _traverse.traverse)(ast, {
2833 Node: function Node(_ref3) {
2834 var node = _ref3.node;
2835 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
2836
2837 if (section === sectionName && _typeof(node.loc) === "object") {
2838 shiftLoc(node, delta);
2839 }
2840 }
2841 });
2842}
2843
2844function signatureForOpcode(object, name) {
2845 var opcodeName = name;
2846
2847 if (object !== undefined && object !== "") {
2848 opcodeName = object + "." + name;
2849 }
2850
2851 var sign = _signatures.signatures[opcodeName];
2852
2853 if (sign == undefined) {
2854 // TODO: Uncomment this when br_table and others has been done
2855 //throw new Error("Invalid opcode: "+opcodeName);
2856 return [object, object];
2857 }
2858
2859 return sign[0];
2860}
2861
2862function getUniqueNameGenerator() {
2863 var inc = {};
2864 return function () {
2865 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
2866
2867 if (!(prefix in inc)) {
2868 inc[prefix] = 0;
2869 } else {
2870 inc[prefix] = inc[prefix] + 1;
2871 }
2872
2873 return prefix + "_" + inc[prefix];
2874 };
2875}
2876
2877function getStartByteOffset(n) {
2878 // $FlowIgnore
2879 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
2880 throw new Error( // $FlowIgnore
2881 "Can not get byte offset without loc informations, node: " + String(n.id));
2882 }
2883
2884 return n.loc.start.column;
2885}
2886
2887function getEndByteOffset(n) {
2888 // $FlowIgnore
2889 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
2890 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
2891 }
2892
2893 return n.loc.end.column;
2894}
2895
2896function getFunctionBeginingByteOffset(n) {
2897 if (!(n.body.length > 0)) {
2898 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
2899 }
2900
2901 var _n$body = _slicedToArray(n.body, 1),
2902 firstInstruction = _n$body[0];
2903
2904 return getStartByteOffset(firstInstruction);
2905}
2906
2907function getEndBlockByteOffset(n) {
2908 // $FlowIgnore
2909 if (!(n.instr.length > 0 || n.body.length > 0)) {
2910 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
2911 }
2912
2913 var lastInstruction;
2914
2915 if (n.instr) {
2916 // $FlowIgnore
2917 lastInstruction = n.instr[n.instr.length - 1];
2918 }
2919
2920 if (n.body) {
2921 // $FlowIgnore
2922 lastInstruction = n.body[n.body.length - 1];
2923 }
2924
2925 if (!(_typeof(lastInstruction) === "object")) {
2926 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
2927 }
2928
2929 // $FlowIgnore
2930 return getStartByteOffset(lastInstruction);
2931}
2932
2933function getStartBlockByteOffset(n) {
2934 // $FlowIgnore
2935 if (!(n.instr.length > 0 || n.body.length > 0)) {
2936 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
2937 }
2938
2939 var fistInstruction;
2940
2941 if (n.instr) {
2942 // $FlowIgnore
2943 var _n$instr = _slicedToArray(n.instr, 1);
2944
2945 fistInstruction = _n$instr[0];
2946 }
2947
2948 if (n.body) {
2949 // $FlowIgnore
2950 var _n$body2 = _slicedToArray(n.body, 1);
2951
2952 fistInstruction = _n$body2[0];
2953 }
2954
2955 if (!(_typeof(fistInstruction) === "object")) {
2956 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
2957 }
2958
2959 // $FlowIgnore
2960 return getStartByteOffset(fistInstruction);
2961}
2962
2963/***/ }),
2964
2965/***/ 60436:
2966/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2967
2968"use strict";
2969
2970
2971Object.defineProperty(exports, "__esModule", ({
2972 value: true
2973}));
2974Object.defineProperty(exports, "getSectionForNode", ({
2975 enumerable: true,
2976 get: function get() {
2977 return _section.getSectionForNode;
2978 }
2979}));
2980exports.default = void 0;
2981
2982var _section = __webpack_require__(24883);
2983
2984var illegalop = "illegal";
2985var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
2986var moduleVersion = [0x01, 0x00, 0x00, 0x00];
2987
2988function invertMap(obj) {
2989 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
2990 return k;
2991 };
2992 var result = {};
2993 var keys = Object.keys(obj);
2994
2995 for (var i = 0, length = keys.length; i < length; i++) {
2996 result[keyModifierFn(obj[keys[i]])] = keys[i];
2997 }
2998
2999 return result;
3000}
3001
3002function createSymbolObject(name
3003/*: string */
3004, object
3005/*: string */
3006)
3007/*: Symbol*/
3008{
3009 var numberOfArgs
3010 /*: number*/
3011 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
3012 return {
3013 name: name,
3014 object: object,
3015 numberOfArgs: numberOfArgs
3016 };
3017}
3018
3019function createSymbol(name
3020/*: string */
3021)
3022/*: Symbol*/
3023{
3024 var numberOfArgs
3025 /*: number*/
3026 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3027 return {
3028 name: name,
3029 numberOfArgs: numberOfArgs
3030 };
3031}
3032
3033var types = {
3034 func: 0x60,
3035 result: 0x40
3036};
3037var exportTypes = {
3038 0x00: "Func",
3039 0x01: "Table",
3040 0x02: "Mem",
3041 0x03: "Global"
3042};
3043var exportTypesByName = invertMap(exportTypes);
3044var valtypes = {
3045 0x7f: "i32",
3046 0x7e: "i64",
3047 0x7d: "f32",
3048 0x7c: "f64",
3049 0x7b: "v128"
3050};
3051var valtypesByString = invertMap(valtypes);
3052var tableTypes = {
3053 0x70: "anyfunc"
3054};
3055var blockTypes = Object.assign({}, valtypes, {
3056 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
3057 0x40: null,
3058 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
3059 0x7f: "i32",
3060 0x7e: "i64",
3061 0x7d: "f32",
3062 0x7c: "f64"
3063});
3064var globalTypes = {
3065 0x00: "const",
3066 0x01: "var"
3067};
3068var globalTypesByString = invertMap(globalTypes);
3069var importTypes = {
3070 0x00: "func",
3071 0x01: "table",
3072 0x02: "mem",
3073 0x03: "global"
3074};
3075var sections = {
3076 custom: 0,
3077 type: 1,
3078 import: 2,
3079 func: 3,
3080 table: 4,
3081 memory: 5,
3082 global: 6,
3083 export: 7,
3084 start: 8,
3085 element: 9,
3086 code: 10,
3087 data: 11
3088};
3089var symbolsByByte = {
3090 0x00: createSymbol("unreachable"),
3091 0x01: createSymbol("nop"),
3092 0x02: createSymbol("block"),
3093 0x03: createSymbol("loop"),
3094 0x04: createSymbol("if"),
3095 0x05: createSymbol("else"),
3096 0x06: illegalop,
3097 0x07: illegalop,
3098 0x08: illegalop,
3099 0x09: illegalop,
3100 0x0a: illegalop,
3101 0x0b: createSymbol("end"),
3102 0x0c: createSymbol("br", 1),
3103 0x0d: createSymbol("br_if", 1),
3104 0x0e: createSymbol("br_table"),
3105 0x0f: createSymbol("return"),
3106 0x10: createSymbol("call", 1),
3107 0x11: createSymbol("call_indirect", 2),
3108 0x12: illegalop,
3109 0x13: illegalop,
3110 0x14: illegalop,
3111 0x15: illegalop,
3112 0x16: illegalop,
3113 0x17: illegalop,
3114 0x18: illegalop,
3115 0x19: illegalop,
3116 0x1a: createSymbol("drop"),
3117 0x1b: createSymbol("select"),
3118 0x1c: illegalop,
3119 0x1d: illegalop,
3120 0x1e: illegalop,
3121 0x1f: illegalop,
3122 0x20: createSymbol("get_local", 1),
3123 0x21: createSymbol("set_local", 1),
3124 0x22: createSymbol("tee_local", 1),
3125 0x23: createSymbol("get_global", 1),
3126 0x24: createSymbol("set_global", 1),
3127 0x25: illegalop,
3128 0x26: illegalop,
3129 0x27: illegalop,
3130 0x28: createSymbolObject("load", "u32", 1),
3131 0x29: createSymbolObject("load", "u64", 1),
3132 0x2a: createSymbolObject("load", "f32", 1),
3133 0x2b: createSymbolObject("load", "f64", 1),
3134 0x2c: createSymbolObject("load8_s", "u32", 1),
3135 0x2d: createSymbolObject("load8_u", "u32", 1),
3136 0x2e: createSymbolObject("load16_s", "u32", 1),
3137 0x2f: createSymbolObject("load16_u", "u32", 1),
3138 0x30: createSymbolObject("load8_s", "u64", 1),
3139 0x31: createSymbolObject("load8_u", "u64", 1),
3140 0x32: createSymbolObject("load16_s", "u64", 1),
3141 0x33: createSymbolObject("load16_u", "u64", 1),
3142 0x34: createSymbolObject("load32_s", "u64", 1),
3143 0x35: createSymbolObject("load32_u", "u64", 1),
3144 0x36: createSymbolObject("store", "u32", 1),
3145 0x37: createSymbolObject("store", "u64", 1),
3146 0x38: createSymbolObject("store", "f32", 1),
3147 0x39: createSymbolObject("store", "f64", 1),
3148 0x3a: createSymbolObject("store8", "u32", 1),
3149 0x3b: createSymbolObject("store16", "u32", 1),
3150 0x3c: createSymbolObject("store8", "u64", 1),
3151 0x3d: createSymbolObject("store16", "u64", 1),
3152 0x3e: createSymbolObject("store32", "u64", 1),
3153 0x3f: createSymbolObject("current_memory"),
3154 0x40: createSymbolObject("grow_memory"),
3155 0x41: createSymbolObject("const", "i32", 1),
3156 0x42: createSymbolObject("const", "i64", 1),
3157 0x43: createSymbolObject("const", "f32", 1),
3158 0x44: createSymbolObject("const", "f64", 1),
3159 0x45: createSymbolObject("eqz", "i32"),
3160 0x46: createSymbolObject("eq", "i32"),
3161 0x47: createSymbolObject("ne", "i32"),
3162 0x48: createSymbolObject("lt_s", "i32"),
3163 0x49: createSymbolObject("lt_u", "i32"),
3164 0x4a: createSymbolObject("gt_s", "i32"),
3165 0x4b: createSymbolObject("gt_u", "i32"),
3166 0x4c: createSymbolObject("le_s", "i32"),
3167 0x4d: createSymbolObject("le_u", "i32"),
3168 0x4e: createSymbolObject("ge_s", "i32"),
3169 0x4f: createSymbolObject("ge_u", "i32"),
3170 0x50: createSymbolObject("eqz", "i64"),
3171 0x51: createSymbolObject("eq", "i64"),
3172 0x52: createSymbolObject("ne", "i64"),
3173 0x53: createSymbolObject("lt_s", "i64"),
3174 0x54: createSymbolObject("lt_u", "i64"),
3175 0x55: createSymbolObject("gt_s", "i64"),
3176 0x56: createSymbolObject("gt_u", "i64"),
3177 0x57: createSymbolObject("le_s", "i64"),
3178 0x58: createSymbolObject("le_u", "i64"),
3179 0x59: createSymbolObject("ge_s", "i64"),
3180 0x5a: createSymbolObject("ge_u", "i64"),
3181 0x5b: createSymbolObject("eq", "f32"),
3182 0x5c: createSymbolObject("ne", "f32"),
3183 0x5d: createSymbolObject("lt", "f32"),
3184 0x5e: createSymbolObject("gt", "f32"),
3185 0x5f: createSymbolObject("le", "f32"),
3186 0x60: createSymbolObject("ge", "f32"),
3187 0x61: createSymbolObject("eq", "f64"),
3188 0x62: createSymbolObject("ne", "f64"),
3189 0x63: createSymbolObject("lt", "f64"),
3190 0x64: createSymbolObject("gt", "f64"),
3191 0x65: createSymbolObject("le", "f64"),
3192 0x66: createSymbolObject("ge", "f64"),
3193 0x67: createSymbolObject("clz", "i32"),
3194 0x68: createSymbolObject("ctz", "i32"),
3195 0x69: createSymbolObject("popcnt", "i32"),
3196 0x6a: createSymbolObject("add", "i32"),
3197 0x6b: createSymbolObject("sub", "i32"),
3198 0x6c: createSymbolObject("mul", "i32"),
3199 0x6d: createSymbolObject("div_s", "i32"),
3200 0x6e: createSymbolObject("div_u", "i32"),
3201 0x6f: createSymbolObject("rem_s", "i32"),
3202 0x70: createSymbolObject("rem_u", "i32"),
3203 0x71: createSymbolObject("and", "i32"),
3204 0x72: createSymbolObject("or", "i32"),
3205 0x73: createSymbolObject("xor", "i32"),
3206 0x74: createSymbolObject("shl", "i32"),
3207 0x75: createSymbolObject("shr_s", "i32"),
3208 0x76: createSymbolObject("shr_u", "i32"),
3209 0x77: createSymbolObject("rotl", "i32"),
3210 0x78: createSymbolObject("rotr", "i32"),
3211 0x79: createSymbolObject("clz", "i64"),
3212 0x7a: createSymbolObject("ctz", "i64"),
3213 0x7b: createSymbolObject("popcnt", "i64"),
3214 0x7c: createSymbolObject("add", "i64"),
3215 0x7d: createSymbolObject("sub", "i64"),
3216 0x7e: createSymbolObject("mul", "i64"),
3217 0x7f: createSymbolObject("div_s", "i64"),
3218 0x80: createSymbolObject("div_u", "i64"),
3219 0x81: createSymbolObject("rem_s", "i64"),
3220 0x82: createSymbolObject("rem_u", "i64"),
3221 0x83: createSymbolObject("and", "i64"),
3222 0x84: createSymbolObject("or", "i64"),
3223 0x85: createSymbolObject("xor", "i64"),
3224 0x86: createSymbolObject("shl", "i64"),
3225 0x87: createSymbolObject("shr_s", "i64"),
3226 0x88: createSymbolObject("shr_u", "i64"),
3227 0x89: createSymbolObject("rotl", "i64"),
3228 0x8a: createSymbolObject("rotr", "i64"),
3229 0x8b: createSymbolObject("abs", "f32"),
3230 0x8c: createSymbolObject("neg", "f32"),
3231 0x8d: createSymbolObject("ceil", "f32"),
3232 0x8e: createSymbolObject("floor", "f32"),
3233 0x8f: createSymbolObject("trunc", "f32"),
3234 0x90: createSymbolObject("nearest", "f32"),
3235 0x91: createSymbolObject("sqrt", "f32"),
3236 0x92: createSymbolObject("add", "f32"),
3237 0x93: createSymbolObject("sub", "f32"),
3238 0x94: createSymbolObject("mul", "f32"),
3239 0x95: createSymbolObject("div", "f32"),
3240 0x96: createSymbolObject("min", "f32"),
3241 0x97: createSymbolObject("max", "f32"),
3242 0x98: createSymbolObject("copysign", "f32"),
3243 0x99: createSymbolObject("abs", "f64"),
3244 0x9a: createSymbolObject("neg", "f64"),
3245 0x9b: createSymbolObject("ceil", "f64"),
3246 0x9c: createSymbolObject("floor", "f64"),
3247 0x9d: createSymbolObject("trunc", "f64"),
3248 0x9e: createSymbolObject("nearest", "f64"),
3249 0x9f: createSymbolObject("sqrt", "f64"),
3250 0xa0: createSymbolObject("add", "f64"),
3251 0xa1: createSymbolObject("sub", "f64"),
3252 0xa2: createSymbolObject("mul", "f64"),
3253 0xa3: createSymbolObject("div", "f64"),
3254 0xa4: createSymbolObject("min", "f64"),
3255 0xa5: createSymbolObject("max", "f64"),
3256 0xa6: createSymbolObject("copysign", "f64"),
3257 0xa7: createSymbolObject("wrap/i64", "i32"),
3258 0xa8: createSymbolObject("trunc_s/f32", "i32"),
3259 0xa9: createSymbolObject("trunc_u/f32", "i32"),
3260 0xaa: createSymbolObject("trunc_s/f64", "i32"),
3261 0xab: createSymbolObject("trunc_u/f64", "i32"),
3262 0xac: createSymbolObject("extend_s/i32", "i64"),
3263 0xad: createSymbolObject("extend_u/i32", "i64"),
3264 0xae: createSymbolObject("trunc_s/f32", "i64"),
3265 0xaf: createSymbolObject("trunc_u/f32", "i64"),
3266 0xb0: createSymbolObject("trunc_s/f64", "i64"),
3267 0xb1: createSymbolObject("trunc_u/f64", "i64"),
3268 0xb2: createSymbolObject("convert_s/i32", "f32"),
3269 0xb3: createSymbolObject("convert_u/i32", "f32"),
3270 0xb4: createSymbolObject("convert_s/i64", "f32"),
3271 0xb5: createSymbolObject("convert_u/i64", "f32"),
3272 0xb6: createSymbolObject("demote/f64", "f32"),
3273 0xb7: createSymbolObject("convert_s/i32", "f64"),
3274 0xb8: createSymbolObject("convert_u/i32", "f64"),
3275 0xb9: createSymbolObject("convert_s/i64", "f64"),
3276 0xba: createSymbolObject("convert_u/i64", "f64"),
3277 0xbb: createSymbolObject("promote/f32", "f64"),
3278 0xbc: createSymbolObject("reinterpret/f32", "i32"),
3279 0xbd: createSymbolObject("reinterpret/f64", "i64"),
3280 0xbe: createSymbolObject("reinterpret/i32", "f32"),
3281 0xbf: createSymbolObject("reinterpret/i64", "f64")
3282};
3283var symbolsByName = invertMap(symbolsByByte, function (obj) {
3284 if (typeof obj.object === "string") {
3285 return "".concat(obj.object, ".").concat(obj.name);
3286 }
3287
3288 return obj.name;
3289});
3290var _default = {
3291 symbolsByByte: symbolsByByte,
3292 sections: sections,
3293 magicModuleHeader: magicModuleHeader,
3294 moduleVersion: moduleVersion,
3295 types: types,
3296 valtypes: valtypes,
3297 exportTypes: exportTypes,
3298 blockTypes: blockTypes,
3299 tableTypes: tableTypes,
3300 globalTypes: globalTypes,
3301 importTypes: importTypes,
3302 valtypesByString: valtypesByString,
3303 globalTypesByString: globalTypesByString,
3304 exportTypesByName: exportTypesByName,
3305 symbolsByName: symbolsByName
3306};
3307exports.default = _default;
3308
3309/***/ }),
3310
3311/***/ 24883:
3312/***/ (function(__unused_webpack_module, exports) {
3313
3314"use strict";
3315
3316
3317Object.defineProperty(exports, "__esModule", ({
3318 value: true
3319}));
3320exports.getSectionForNode = getSectionForNode;
3321
3322function getSectionForNode(n) {
3323 switch (n.type) {
3324 case "ModuleImport":
3325 return "import";
3326
3327 case "CallInstruction":
3328 case "CallIndirectInstruction":
3329 case "Func":
3330 case "Instr":
3331 return "code";
3332
3333 case "ModuleExport":
3334 return "export";
3335
3336 case "Start":
3337 return "start";
3338
3339 case "TypeInstruction":
3340 return "type";
3341
3342 case "IndexInFuncSection":
3343 return "func";
3344
3345 case "Global":
3346 return "global";
3347 // No section
3348
3349 default:
3350 return;
3351 }
3352}
3353
3354/***/ }),
3355
3356/***/ 30368:
3357/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3358
3359"use strict";
3360
3361
3362Object.defineProperty(exports, "__esModule", ({
3363 value: true
3364}));
3365exports.createEmptySection = createEmptySection;
3366
3367var _wasmGen = __webpack_require__(71119);
3368
3369var _helperBuffer = __webpack_require__(50391);
3370
3371var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(19015));
3372
3373var t = _interopRequireWildcard(__webpack_require__(51475));
3374
3375function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
3376
3377function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3378
3379function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3380
3381function findLastSection(ast, forSection) {
3382 var targetSectionId = _helperWasmBytecode.default.sections[forSection]; // $FlowIgnore: metadata can not be empty
3383
3384 var moduleSections = ast.body[0].metadata.sections;
3385 var lastSection;
3386 var lastId = 0;
3387
3388 for (var i = 0, len = moduleSections.length; i < len; i++) {
3389 var section = moduleSections[i]; // Ignore custom section since they can actually occur everywhere
3390
3391 if (section.section === "custom") {
3392 continue;
3393 }
3394
3395 var sectionId = _helperWasmBytecode.default.sections[section.section];
3396
3397 if (targetSectionId > lastId && targetSectionId < sectionId) {
3398 return lastSection;
3399 }
3400
3401 lastId = sectionId;
3402 lastSection = section;
3403 }
3404
3405 return lastSection;
3406}
3407
3408function createEmptySection(ast, uint8Buffer, section) {
3409 // previous section after which we are going to insert our section
3410 var lastSection = findLastSection(ast, section);
3411 var start, end;
3412 /**
3413 * It's the first section
3414 */
3415
3416 if (lastSection == null || lastSection.section === "custom") {
3417 start = 8
3418 /* wasm header size */
3419 ;
3420 end = start;
3421 } else {
3422 start = lastSection.startOffset + lastSection.size.value + 1;
3423 end = start;
3424 } // section id
3425
3426
3427 start += 1;
3428 var sizeStartLoc = {
3429 line: -1,
3430 column: start
3431 };
3432 var sizeEndLoc = {
3433 line: -1,
3434 column: start + 1
3435 }; // 1 byte for the empty vector
3436
3437 var size = t.withLoc(t.numberLiteralFromRaw(1), sizeEndLoc, sizeStartLoc);
3438 var vectorOfSizeStartLoc = {
3439 line: -1,
3440 column: sizeEndLoc.column
3441 };
3442 var vectorOfSizeEndLoc = {
3443 line: -1,
3444 column: sizeEndLoc.column + 1
3445 };
3446 var vectorOfSize = t.withLoc(t.numberLiteralFromRaw(0), vectorOfSizeEndLoc, vectorOfSizeStartLoc);
3447 var sectionMetadata = t.sectionMetadata(section, start, size, vectorOfSize);
3448 var sectionBytes = (0, _wasmGen.encodeNode)(sectionMetadata);
3449 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start - 1, end, sectionBytes); // Add section into the AST for later lookups
3450
3451 if (_typeof(ast.body[0].metadata) === "object") {
3452 // $FlowIgnore: metadata can not be empty
3453 ast.body[0].metadata.sections.push(sectionMetadata);
3454 t.sortSectionMetadata(ast.body[0]);
3455 }
3456 /**
3457 * Update AST
3458 */
3459 // Once we hit our section every that is after needs to be shifted by the delta
3460
3461
3462 var deltaBytes = +sectionBytes.length;
3463 var encounteredSection = false;
3464 t.traverse(ast, {
3465 SectionMetadata: function SectionMetadata(path) {
3466 if (path.node.section === section) {
3467 encounteredSection = true;
3468 return;
3469 }
3470
3471 if (encounteredSection === true) {
3472 t.shiftSection(ast, path.node, deltaBytes);
3473 }
3474 }
3475 });
3476 return {
3477 uint8Buffer: uint8Buffer,
3478 sectionMetadata: sectionMetadata
3479 };
3480}
3481
3482/***/ }),
3483
3484/***/ 37427:
3485/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3486
3487"use strict";
3488
3489
3490Object.defineProperty(exports, "__esModule", ({
3491 value: true
3492}));
3493Object.defineProperty(exports, "resizeSectionByteSize", ({
3494 enumerable: true,
3495 get: function get() {
3496 return _resize.resizeSectionByteSize;
3497 }
3498}));
3499Object.defineProperty(exports, "resizeSectionVecSize", ({
3500 enumerable: true,
3501 get: function get() {
3502 return _resize.resizeSectionVecSize;
3503 }
3504}));
3505Object.defineProperty(exports, "createEmptySection", ({
3506 enumerable: true,
3507 get: function get() {
3508 return _create.createEmptySection;
3509 }
3510}));
3511Object.defineProperty(exports, "removeSections", ({
3512 enumerable: true,
3513 get: function get() {
3514 return _remove.removeSections;
3515 }
3516}));
3517
3518var _resize = __webpack_require__(32230);
3519
3520var _create = __webpack_require__(30368);
3521
3522var _remove = __webpack_require__(70140);
3523
3524/***/ }),
3525
3526/***/ 70140:
3527/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3528
3529"use strict";
3530
3531
3532Object.defineProperty(exports, "__esModule", ({
3533 value: true
3534}));
3535exports.removeSections = removeSections;
3536
3537var _ast = __webpack_require__(51475);
3538
3539var _helperBuffer = __webpack_require__(50391);
3540
3541function removeSections(ast, uint8Buffer, section) {
3542 var sectionMetadatas = (0, _ast.getSectionMetadatas)(ast, section);
3543
3544 if (sectionMetadatas.length === 0) {
3545 throw new Error("Section metadata not found");
3546 }
3547
3548 return sectionMetadatas.reverse().reduce(function (uint8Buffer, sectionMetadata) {
3549 var startsIncludingId = sectionMetadata.startOffset - 1;
3550 var ends = section === "start" ? sectionMetadata.size.loc.end.column + 1 : sectionMetadata.startOffset + sectionMetadata.size.value + 1;
3551 var delta = -(ends - startsIncludingId);
3552 /**
3553 * update AST
3554 */
3555 // Once we hit our section every that is after needs to be shifted by the delta
3556
3557 var encounteredSection = false;
3558 (0, _ast.traverse)(ast, {
3559 SectionMetadata: function SectionMetadata(path) {
3560 if (path.node.section === section) {
3561 encounteredSection = true;
3562 return path.remove();
3563 }
3564
3565 if (encounteredSection === true) {
3566 (0, _ast.shiftSection)(ast, path.node, delta);
3567 }
3568 }
3569 }); // replacement is nothing
3570
3571 var replacement = [];
3572 return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, startsIncludingId, ends, replacement);
3573 }, uint8Buffer);
3574}
3575
3576/***/ }),
3577
3578/***/ 32230:
3579/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3580
3581"use strict";
3582
3583
3584Object.defineProperty(exports, "__esModule", ({
3585 value: true
3586}));
3587exports.resizeSectionByteSize = resizeSectionByteSize;
3588exports.resizeSectionVecSize = resizeSectionVecSize;
3589
3590var _wasmGen = __webpack_require__(71119);
3591
3592var _ast = __webpack_require__(51475);
3593
3594var _helperBuffer = __webpack_require__(50391);
3595
3596function resizeSectionByteSize(ast, uint8Buffer, section, deltaBytes) {
3597 var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section);
3598
3599 if (typeof sectionMetadata === "undefined") {
3600 throw new Error("Section metadata not found");
3601 }
3602
3603 if (typeof sectionMetadata.size.loc === "undefined") {
3604 throw new Error("SectionMetadata " + section + " has no loc");
3605 } // keep old node location to be overriden
3606
3607
3608 var start = sectionMetadata.size.loc.start.column;
3609 var end = sectionMetadata.size.loc.end.column;
3610 var newSectionSize = sectionMetadata.size.value + deltaBytes;
3611 var newBytes = (0, _wasmGen.encodeU32)(newSectionSize);
3612 /**
3613 * update AST
3614 */
3615
3616 sectionMetadata.size.value = newSectionSize;
3617 var oldu32EncodedLen = end - start;
3618 var newu32EncodedLen = newBytes.length; // the new u32 has a different encoded length
3619
3620 if (newu32EncodedLen !== oldu32EncodedLen) {
3621 var deltaInSizeEncoding = newu32EncodedLen - oldu32EncodedLen;
3622 sectionMetadata.size.loc.end.column = start + newu32EncodedLen;
3623 deltaBytes += deltaInSizeEncoding; // move the vec size pointer size the section size is now smaller
3624
3625 sectionMetadata.vectorOfSize.loc.start.column += deltaInSizeEncoding;
3626 sectionMetadata.vectorOfSize.loc.end.column += deltaInSizeEncoding;
3627 } // Once we hit our section every that is after needs to be shifted by the delta
3628
3629
3630 var encounteredSection = false;
3631 (0, _ast.traverse)(ast, {
3632 SectionMetadata: function SectionMetadata(path) {
3633 if (path.node.section === section) {
3634 encounteredSection = true;
3635 return;
3636 }
3637
3638 if (encounteredSection === true) {
3639 (0, _ast.shiftSection)(ast, path.node, deltaBytes);
3640 }
3641 }
3642 });
3643 return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes);
3644}
3645
3646function resizeSectionVecSize(ast, uint8Buffer, section, deltaElements) {
3647 var sectionMetadata = (0, _ast.getSectionMetadata)(ast, section);
3648
3649 if (typeof sectionMetadata === "undefined") {
3650 throw new Error("Section metadata not found");
3651 }
3652
3653 if (typeof sectionMetadata.vectorOfSize.loc === "undefined") {
3654 throw new Error("SectionMetadata " + section + " has no loc");
3655 } // Section has no vector
3656
3657
3658 if (sectionMetadata.vectorOfSize.value === -1) {
3659 return uint8Buffer;
3660 } // keep old node location to be overriden
3661
3662
3663 var start = sectionMetadata.vectorOfSize.loc.start.column;
3664 var end = sectionMetadata.vectorOfSize.loc.end.column;
3665 var newValue = sectionMetadata.vectorOfSize.value + deltaElements;
3666 var newBytes = (0, _wasmGen.encodeU32)(newValue); // Update AST
3667
3668 sectionMetadata.vectorOfSize.value = newValue;
3669 sectionMetadata.vectorOfSize.loc.end.column = start + newBytes.length;
3670 return (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newBytes);
3671}
3672
3673/***/ }),
3674
3675/***/ 86264:
3676/***/ (function(__unused_webpack_module, exports) {
3677
3678"use strict";
3679
3680
3681Object.defineProperty(exports, "__esModule", ({
3682 value: true
3683}));
3684exports.cloneNode = cloneNode;
3685
3686function cloneNode(n) {
3687 // $FlowIgnore
3688 var newObj = {};
3689
3690 for (var k in n) {
3691 newObj[k] = n[k];
3692 }
3693
3694 return newObj;
3695}
3696
3697/***/ }),
3698
3699/***/ 51475:
3700/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3701
3702"use strict";
3703
3704
3705Object.defineProperty(exports, "__esModule", ({
3706 value: true
3707}));
3708var _exportNames = {
3709 numberLiteralFromRaw: true,
3710 withLoc: true,
3711 withRaw: true,
3712 funcParam: true,
3713 indexLiteral: true,
3714 memIndexLiteral: true,
3715 instruction: true,
3716 objectInstruction: true,
3717 traverse: true,
3718 signatures: true,
3719 cloneNode: true
3720};
3721Object.defineProperty(exports, "numberLiteralFromRaw", ({
3722 enumerable: true,
3723 get: function get() {
3724 return _nodeHelpers.numberLiteralFromRaw;
3725 }
3726}));
3727Object.defineProperty(exports, "withLoc", ({
3728 enumerable: true,
3729 get: function get() {
3730 return _nodeHelpers.withLoc;
3731 }
3732}));
3733Object.defineProperty(exports, "withRaw", ({
3734 enumerable: true,
3735 get: function get() {
3736 return _nodeHelpers.withRaw;
3737 }
3738}));
3739Object.defineProperty(exports, "funcParam", ({
3740 enumerable: true,
3741 get: function get() {
3742 return _nodeHelpers.funcParam;
3743 }
3744}));
3745Object.defineProperty(exports, "indexLiteral", ({
3746 enumerable: true,
3747 get: function get() {
3748 return _nodeHelpers.indexLiteral;
3749 }
3750}));
3751Object.defineProperty(exports, "memIndexLiteral", ({
3752 enumerable: true,
3753 get: function get() {
3754 return _nodeHelpers.memIndexLiteral;
3755 }
3756}));
3757Object.defineProperty(exports, "instruction", ({
3758 enumerable: true,
3759 get: function get() {
3760 return _nodeHelpers.instruction;
3761 }
3762}));
3763Object.defineProperty(exports, "objectInstruction", ({
3764 enumerable: true,
3765 get: function get() {
3766 return _nodeHelpers.objectInstruction;
3767 }
3768}));
3769Object.defineProperty(exports, "traverse", ({
3770 enumerable: true,
3771 get: function get() {
3772 return _traverse.traverse;
3773 }
3774}));
3775Object.defineProperty(exports, "signatures", ({
3776 enumerable: true,
3777 get: function get() {
3778 return _signatures.signatures;
3779 }
3780}));
3781Object.defineProperty(exports, "cloneNode", ({
3782 enumerable: true,
3783 get: function get() {
3784 return _clone.cloneNode;
3785 }
3786}));
3787
3788var _nodes = __webpack_require__(36924);
3789
3790Object.keys(_nodes).forEach(function (key) {
3791 if (key === "default" || key === "__esModule") return;
3792 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
3793 Object.defineProperty(exports, key, {
3794 enumerable: true,
3795 get: function get() {
3796 return _nodes[key];
3797 }
3798 });
3799});
3800
3801var _nodeHelpers = __webpack_require__(24227);
3802
3803var _traverse = __webpack_require__(42411);
3804
3805var _signatures = __webpack_require__(37240);
3806
3807var _utils = __webpack_require__(55594);
3808
3809Object.keys(_utils).forEach(function (key) {
3810 if (key === "default" || key === "__esModule") return;
3811 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
3812 Object.defineProperty(exports, key, {
3813 enumerable: true,
3814 get: function get() {
3815 return _utils[key];
3816 }
3817 });
3818});
3819
3820var _clone = __webpack_require__(86264);
3821
3822/***/ }),
3823
3824/***/ 24227:
3825/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3826
3827"use strict";
3828
3829
3830Object.defineProperty(exports, "__esModule", ({
3831 value: true
3832}));
3833exports.numberLiteralFromRaw = numberLiteralFromRaw;
3834exports.instruction = instruction;
3835exports.objectInstruction = objectInstruction;
3836exports.withLoc = withLoc;
3837exports.withRaw = withRaw;
3838exports.funcParam = funcParam;
3839exports.indexLiteral = indexLiteral;
3840exports.memIndexLiteral = memIndexLiteral;
3841
3842var _wastParser = __webpack_require__(9016);
3843
3844var _nodes = __webpack_require__(36924);
3845
3846function numberLiteralFromRaw(rawValue) {
3847 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
3848 var original = rawValue; // Remove numeric separators _
3849
3850 if (typeof rawValue === "string") {
3851 rawValue = rawValue.replace(/_/g, "");
3852 }
3853
3854 if (typeof rawValue === "number") {
3855 return (0, _nodes.numberLiteral)(rawValue, String(original));
3856 } else {
3857 switch (instructionType) {
3858 case "i32":
3859 {
3860 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
3861 }
3862
3863 case "u32":
3864 {
3865 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
3866 }
3867
3868 case "i64":
3869 {
3870 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
3871 }
3872
3873 case "f32":
3874 {
3875 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
3876 }
3877 // f64
3878
3879 default:
3880 {
3881 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
3882 }
3883 }
3884 }
3885}
3886
3887function instruction(id) {
3888 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
3889 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3890 return (0, _nodes.instr)(id, undefined, args, namedArgs);
3891}
3892
3893function objectInstruction(id, object) {
3894 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3895 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3896 return (0, _nodes.instr)(id, object, args, namedArgs);
3897}
3898/**
3899 * Decorators
3900 */
3901
3902
3903function withLoc(n, end, start) {
3904 var loc = {
3905 start: start,
3906 end: end
3907 };
3908 n.loc = loc;
3909 return n;
3910}
3911
3912function withRaw(n, raw) {
3913 n.raw = raw;
3914 return n;
3915}
3916
3917function funcParam(valtype, id) {
3918 return {
3919 id: id,
3920 valtype: valtype
3921 };
3922}
3923
3924function indexLiteral(value) {
3925 // $FlowIgnore
3926 var x = numberLiteralFromRaw(value, "u32");
3927 return x;
3928}
3929
3930function memIndexLiteral(value) {
3931 // $FlowIgnore
3932 var x = numberLiteralFromRaw(value, "u32");
3933 return x;
3934}
3935
3936/***/ }),
3937
3938/***/ 76953:
3939/***/ (function(__unused_webpack_module, exports) {
3940
3941"use strict";
3942
3943
3944Object.defineProperty(exports, "__esModule", ({
3945 value: true
3946}));
3947exports.createPath = createPath;
3948
3949function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3950
3951function findParent(_ref, cb) {
3952 var parentPath = _ref.parentPath;
3953
3954 if (parentPath == null) {
3955 throw new Error("node is root");
3956 }
3957
3958 var currentPath = parentPath;
3959
3960 while (cb(currentPath) !== false) {
3961 // Hit the root node, stop
3962 // $FlowIgnore
3963 if (currentPath.parentPath == null) {
3964 return null;
3965 } // $FlowIgnore
3966
3967
3968 currentPath = currentPath.parentPath;
3969 }
3970
3971 return currentPath.node;
3972}
3973
3974function insertBefore(context, newNode) {
3975 return insert(context, newNode);
3976}
3977
3978function insertAfter(context, newNode) {
3979 return insert(context, newNode, 1);
3980}
3981
3982function insert(_ref2, newNode) {
3983 var node = _ref2.node,
3984 inList = _ref2.inList,
3985 parentPath = _ref2.parentPath,
3986 parentKey = _ref2.parentKey;
3987 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
3988
3989 if (!inList) {
3990 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
3991 }
3992
3993 if (!(parentPath != null)) {
3994 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
3995 }
3996
3997 // $FlowIgnore
3998 var parentList = parentPath.node[parentKey];
3999 var indexInList = parentList.findIndex(function (n) {
4000 return n === node;
4001 });
4002 parentList.splice(indexInList + indexOffset, 0, newNode);
4003}
4004
4005function remove(_ref3) {
4006 var node = _ref3.node,
4007 parentKey = _ref3.parentKey,
4008 parentPath = _ref3.parentPath;
4009
4010 if (!(parentPath != null)) {
4011 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
4012 }
4013
4014 // $FlowIgnore
4015 var parentNode = parentPath.node; // $FlowIgnore
4016
4017 var parentProperty = parentNode[parentKey];
4018
4019 if (Array.isArray(parentProperty)) {
4020 // $FlowIgnore
4021 parentNode[parentKey] = parentProperty.filter(function (n) {
4022 return n !== node;
4023 });
4024 } else {
4025 // $FlowIgnore
4026 delete parentNode[parentKey];
4027 }
4028
4029 node._deleted = true;
4030}
4031
4032function stop(context) {
4033 context.shouldStop = true;
4034}
4035
4036function replaceWith(context, newNode) {
4037 // $FlowIgnore
4038 var parentNode = context.parentPath.node; // $FlowIgnore
4039
4040 var parentProperty = parentNode[context.parentKey];
4041
4042 if (Array.isArray(parentProperty)) {
4043 var indexInList = parentProperty.findIndex(function (n) {
4044 return n === context.node;
4045 });
4046 parentProperty.splice(indexInList, 1, newNode);
4047 } else {
4048 // $FlowIgnore
4049 parentNode[context.parentKey] = newNode;
4050 }
4051
4052 context.node._deleted = true;
4053 context.node = newNode;
4054} // bind the context to the first argument of node operations
4055
4056
4057function bindNodeOperations(operations, context) {
4058 var keys = Object.keys(operations);
4059 var boundOperations = {};
4060 keys.forEach(function (key) {
4061 boundOperations[key] = operations[key].bind(null, context);
4062 });
4063 return boundOperations;
4064}
4065
4066function createPathOperations(context) {
4067 // $FlowIgnore
4068 return bindNodeOperations({
4069 findParent: findParent,
4070 replaceWith: replaceWith,
4071 remove: remove,
4072 insertBefore: insertBefore,
4073 insertAfter: insertAfter,
4074 stop: stop
4075 }, context);
4076}
4077
4078function createPath(context) {
4079 var path = _extends({}, context); // $FlowIgnore
4080
4081
4082 Object.assign(path, createPathOperations(path)); // $FlowIgnore
4083
4084 return path;
4085}
4086
4087/***/ }),
4088
4089/***/ 36924:
4090/***/ (function(__unused_webpack_module, exports) {
4091
4092"use strict";
4093
4094
4095Object.defineProperty(exports, "__esModule", ({
4096 value: true
4097}));
4098exports.module = _module;
4099exports.moduleMetadata = moduleMetadata;
4100exports.moduleNameMetadata = moduleNameMetadata;
4101exports.functionNameMetadata = functionNameMetadata;
4102exports.localNameMetadata = localNameMetadata;
4103exports.binaryModule = binaryModule;
4104exports.quoteModule = quoteModule;
4105exports.sectionMetadata = sectionMetadata;
4106exports.producersSectionMetadata = producersSectionMetadata;
4107exports.producerMetadata = producerMetadata;
4108exports.producerMetadataVersionedName = producerMetadataVersionedName;
4109exports.loopInstruction = loopInstruction;
4110exports.instr = instr;
4111exports.ifInstruction = ifInstruction;
4112exports.stringLiteral = stringLiteral;
4113exports.numberLiteral = numberLiteral;
4114exports.longNumberLiteral = longNumberLiteral;
4115exports.floatLiteral = floatLiteral;
4116exports.elem = elem;
4117exports.indexInFuncSection = indexInFuncSection;
4118exports.valtypeLiteral = valtypeLiteral;
4119exports.typeInstruction = typeInstruction;
4120exports.start = start;
4121exports.globalType = globalType;
4122exports.leadingComment = leadingComment;
4123exports.blockComment = blockComment;
4124exports.data = data;
4125exports.global = global;
4126exports.table = table;
4127exports.memory = memory;
4128exports.funcImportDescr = funcImportDescr;
4129exports.moduleImport = moduleImport;
4130exports.moduleExportDescr = moduleExportDescr;
4131exports.moduleExport = moduleExport;
4132exports.limit = limit;
4133exports.signature = signature;
4134exports.program = program;
4135exports.identifier = identifier;
4136exports.blockInstruction = blockInstruction;
4137exports.callInstruction = callInstruction;
4138exports.callIndirectInstruction = callIndirectInstruction;
4139exports.byteArray = byteArray;
4140exports.func = func;
4141exports.internalBrUnless = internalBrUnless;
4142exports.internalGoto = internalGoto;
4143exports.internalCallExtern = internalCallExtern;
4144exports.internalEndAndReturn = internalEndAndReturn;
4145exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
4146exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
4147
4148function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4149
4150// THIS FILE IS AUTOGENERATED
4151// see scripts/generateNodeUtils.js
4152function isTypeOf(t) {
4153 return function (n) {
4154 return n.type === t;
4155 };
4156}
4157
4158function assertTypeOf(t) {
4159 return function (n) {
4160 return function () {
4161 if (!(n.type === t)) {
4162 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
4163 }
4164 }();
4165 };
4166}
4167
4168function _module(id, fields, metadata) {
4169 if (id !== null && id !== undefined) {
4170 if (!(typeof id === "string")) {
4171 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
4172 }
4173 }
4174
4175 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
4176 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
4177 }
4178
4179 var node = {
4180 type: "Module",
4181 id: id,
4182 fields: fields
4183 };
4184
4185 if (typeof metadata !== "undefined") {
4186 node.metadata = metadata;
4187 }
4188
4189 return node;
4190}
4191
4192function moduleMetadata(sections, functionNames, localNames, producers) {
4193 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
4194 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
4195 }
4196
4197 if (functionNames !== null && functionNames !== undefined) {
4198 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
4199 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
4200 }
4201 }
4202
4203 if (localNames !== null && localNames !== undefined) {
4204 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
4205 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
4206 }
4207 }
4208
4209 if (producers !== null && producers !== undefined) {
4210 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
4211 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
4212 }
4213 }
4214
4215 var node = {
4216 type: "ModuleMetadata",
4217 sections: sections
4218 };
4219
4220 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
4221 node.functionNames = functionNames;
4222 }
4223
4224 if (typeof localNames !== "undefined" && localNames.length > 0) {
4225 node.localNames = localNames;
4226 }
4227
4228 if (typeof producers !== "undefined" && producers.length > 0) {
4229 node.producers = producers;
4230 }
4231
4232 return node;
4233}
4234
4235function moduleNameMetadata(value) {
4236 if (!(typeof value === "string")) {
4237 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4238 }
4239
4240 var node = {
4241 type: "ModuleNameMetadata",
4242 value: value
4243 };
4244 return node;
4245}
4246
4247function functionNameMetadata(value, index) {
4248 if (!(typeof value === "string")) {
4249 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4250 }
4251
4252 if (!(typeof index === "number")) {
4253 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
4254 }
4255
4256 var node = {
4257 type: "FunctionNameMetadata",
4258 value: value,
4259 index: index
4260 };
4261 return node;
4262}
4263
4264function localNameMetadata(value, localIndex, functionIndex) {
4265 if (!(typeof value === "string")) {
4266 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4267 }
4268
4269 if (!(typeof localIndex === "number")) {
4270 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
4271 }
4272
4273 if (!(typeof functionIndex === "number")) {
4274 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
4275 }
4276
4277 var node = {
4278 type: "LocalNameMetadata",
4279 value: value,
4280 localIndex: localIndex,
4281 functionIndex: functionIndex
4282 };
4283 return node;
4284}
4285
4286function binaryModule(id, blob) {
4287 if (id !== null && id !== undefined) {
4288 if (!(typeof id === "string")) {
4289 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
4290 }
4291 }
4292
4293 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
4294 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
4295 }
4296
4297 var node = {
4298 type: "BinaryModule",
4299 id: id,
4300 blob: blob
4301 };
4302 return node;
4303}
4304
4305function quoteModule(id, string) {
4306 if (id !== null && id !== undefined) {
4307 if (!(typeof id === "string")) {
4308 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
4309 }
4310 }
4311
4312 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
4313 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
4314 }
4315
4316 var node = {
4317 type: "QuoteModule",
4318 id: id,
4319 string: string
4320 };
4321 return node;
4322}
4323
4324function sectionMetadata(section, startOffset, size, vectorOfSize) {
4325 if (!(typeof startOffset === "number")) {
4326 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
4327 }
4328
4329 var node = {
4330 type: "SectionMetadata",
4331 section: section,
4332 startOffset: startOffset,
4333 size: size,
4334 vectorOfSize: vectorOfSize
4335 };
4336 return node;
4337}
4338
4339function producersSectionMetadata(producers) {
4340 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
4341 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
4342 }
4343
4344 var node = {
4345 type: "ProducersSectionMetadata",
4346 producers: producers
4347 };
4348 return node;
4349}
4350
4351function producerMetadata(language, processedBy, sdk) {
4352 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
4353 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
4354 }
4355
4356 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
4357 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
4358 }
4359
4360 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
4361 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
4362 }
4363
4364 var node = {
4365 type: "ProducerMetadata",
4366 language: language,
4367 processedBy: processedBy,
4368 sdk: sdk
4369 };
4370 return node;
4371}
4372
4373function producerMetadataVersionedName(name, version) {
4374 if (!(typeof name === "string")) {
4375 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
4376 }
4377
4378 if (!(typeof version === "string")) {
4379 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
4380 }
4381
4382 var node = {
4383 type: "ProducerMetadataVersionedName",
4384 name: name,
4385 version: version
4386 };
4387 return node;
4388}
4389
4390function loopInstruction(label, resulttype, instr) {
4391 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
4392 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
4393 }
4394
4395 var node = {
4396 type: "LoopInstruction",
4397 id: "loop",
4398 label: label,
4399 resulttype: resulttype,
4400 instr: instr
4401 };
4402 return node;
4403}
4404
4405function instr(id, object, args, namedArgs) {
4406 if (!(typeof id === "string")) {
4407 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
4408 }
4409
4410 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
4411 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
4412 }
4413
4414 var node = {
4415 type: "Instr",
4416 id: id,
4417 args: args
4418 };
4419
4420 if (typeof object !== "undefined") {
4421 node.object = object;
4422 }
4423
4424 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
4425 node.namedArgs = namedArgs;
4426 }
4427
4428 return node;
4429}
4430
4431function ifInstruction(testLabel, test, result, consequent, alternate) {
4432 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
4433 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
4434 }
4435
4436 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
4437 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
4438 }
4439
4440 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
4441 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
4442 }
4443
4444 var node = {
4445 type: "IfInstruction",
4446 id: "if",
4447 testLabel: testLabel,
4448 test: test,
4449 result: result,
4450 consequent: consequent,
4451 alternate: alternate
4452 };
4453 return node;
4454}
4455
4456function stringLiteral(value) {
4457 if (!(typeof value === "string")) {
4458 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4459 }
4460
4461 var node = {
4462 type: "StringLiteral",
4463 value: value
4464 };
4465 return node;
4466}
4467
4468function numberLiteral(value, raw) {
4469 if (!(typeof value === "number")) {
4470 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
4471 }
4472
4473 if (!(typeof raw === "string")) {
4474 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
4475 }
4476
4477 var node = {
4478 type: "NumberLiteral",
4479 value: value,
4480 raw: raw
4481 };
4482 return node;
4483}
4484
4485function longNumberLiteral(value, raw) {
4486 if (!(typeof raw === "string")) {
4487 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
4488 }
4489
4490 var node = {
4491 type: "LongNumberLiteral",
4492 value: value,
4493 raw: raw
4494 };
4495 return node;
4496}
4497
4498function floatLiteral(value, nan, inf, raw) {
4499 if (!(typeof value === "number")) {
4500 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
4501 }
4502
4503 if (nan !== null && nan !== undefined) {
4504 if (!(typeof nan === "boolean")) {
4505 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
4506 }
4507 }
4508
4509 if (inf !== null && inf !== undefined) {
4510 if (!(typeof inf === "boolean")) {
4511 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
4512 }
4513 }
4514
4515 if (!(typeof raw === "string")) {
4516 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
4517 }
4518
4519 var node = {
4520 type: "FloatLiteral",
4521 value: value,
4522 raw: raw
4523 };
4524
4525 if (nan === true) {
4526 node.nan = true;
4527 }
4528
4529 if (inf === true) {
4530 node.inf = true;
4531 }
4532
4533 return node;
4534}
4535
4536function elem(table, offset, funcs) {
4537 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
4538 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
4539 }
4540
4541 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
4542 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
4543 }
4544
4545 var node = {
4546 type: "Elem",
4547 table: table,
4548 offset: offset,
4549 funcs: funcs
4550 };
4551 return node;
4552}
4553
4554function indexInFuncSection(index) {
4555 var node = {
4556 type: "IndexInFuncSection",
4557 index: index
4558 };
4559 return node;
4560}
4561
4562function valtypeLiteral(name) {
4563 var node = {
4564 type: "ValtypeLiteral",
4565 name: name
4566 };
4567 return node;
4568}
4569
4570function typeInstruction(id, functype) {
4571 var node = {
4572 type: "TypeInstruction",
4573 id: id,
4574 functype: functype
4575 };
4576 return node;
4577}
4578
4579function start(index) {
4580 var node = {
4581 type: "Start",
4582 index: index
4583 };
4584 return node;
4585}
4586
4587function globalType(valtype, mutability) {
4588 var node = {
4589 type: "GlobalType",
4590 valtype: valtype,
4591 mutability: mutability
4592 };
4593 return node;
4594}
4595
4596function leadingComment(value) {
4597 if (!(typeof value === "string")) {
4598 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4599 }
4600
4601 var node = {
4602 type: "LeadingComment",
4603 value: value
4604 };
4605 return node;
4606}
4607
4608function blockComment(value) {
4609 if (!(typeof value === "string")) {
4610 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4611 }
4612
4613 var node = {
4614 type: "BlockComment",
4615 value: value
4616 };
4617 return node;
4618}
4619
4620function data(memoryIndex, offset, init) {
4621 var node = {
4622 type: "Data",
4623 memoryIndex: memoryIndex,
4624 offset: offset,
4625 init: init
4626 };
4627 return node;
4628}
4629
4630function global(globalType, init, name) {
4631 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
4632 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
4633 }
4634
4635 var node = {
4636 type: "Global",
4637 globalType: globalType,
4638 init: init,
4639 name: name
4640 };
4641 return node;
4642}
4643
4644function table(elementType, limits, name, elements) {
4645 if (!(limits.type === "Limit")) {
4646 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
4647 }
4648
4649 if (elements !== null && elements !== undefined) {
4650 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
4651 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
4652 }
4653 }
4654
4655 var node = {
4656 type: "Table",
4657 elementType: elementType,
4658 limits: limits,
4659 name: name
4660 };
4661
4662 if (typeof elements !== "undefined" && elements.length > 0) {
4663 node.elements = elements;
4664 }
4665
4666 return node;
4667}
4668
4669function memory(limits, id) {
4670 var node = {
4671 type: "Memory",
4672 limits: limits,
4673 id: id
4674 };
4675 return node;
4676}
4677
4678function funcImportDescr(id, signature) {
4679 var node = {
4680 type: "FuncImportDescr",
4681 id: id,
4682 signature: signature
4683 };
4684 return node;
4685}
4686
4687function moduleImport(module, name, descr) {
4688 if (!(typeof module === "string")) {
4689 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
4690 }
4691
4692 if (!(typeof name === "string")) {
4693 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
4694 }
4695
4696 var node = {
4697 type: "ModuleImport",
4698 module: module,
4699 name: name,
4700 descr: descr
4701 };
4702 return node;
4703}
4704
4705function moduleExportDescr(exportType, id) {
4706 var node = {
4707 type: "ModuleExportDescr",
4708 exportType: exportType,
4709 id: id
4710 };
4711 return node;
4712}
4713
4714function moduleExport(name, descr) {
4715 if (!(typeof name === "string")) {
4716 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
4717 }
4718
4719 var node = {
4720 type: "ModuleExport",
4721 name: name,
4722 descr: descr
4723 };
4724 return node;
4725}
4726
4727function limit(min, max) {
4728 if (!(typeof min === "number")) {
4729 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
4730 }
4731
4732 if (max !== null && max !== undefined) {
4733 if (!(typeof max === "number")) {
4734 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
4735 }
4736 }
4737
4738 var node = {
4739 type: "Limit",
4740 min: min
4741 };
4742
4743 if (typeof max !== "undefined") {
4744 node.max = max;
4745 }
4746
4747 return node;
4748}
4749
4750function signature(params, results) {
4751 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
4752 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
4753 }
4754
4755 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
4756 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
4757 }
4758
4759 var node = {
4760 type: "Signature",
4761 params: params,
4762 results: results
4763 };
4764 return node;
4765}
4766
4767function program(body) {
4768 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
4769 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
4770 }
4771
4772 var node = {
4773 type: "Program",
4774 body: body
4775 };
4776 return node;
4777}
4778
4779function identifier(value, raw) {
4780 if (!(typeof value === "string")) {
4781 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
4782 }
4783
4784 if (raw !== null && raw !== undefined) {
4785 if (!(typeof raw === "string")) {
4786 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
4787 }
4788 }
4789
4790 var node = {
4791 type: "Identifier",
4792 value: value
4793 };
4794
4795 if (typeof raw !== "undefined") {
4796 node.raw = raw;
4797 }
4798
4799 return node;
4800}
4801
4802function blockInstruction(label, instr, result) {
4803 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
4804 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
4805 }
4806
4807 var node = {
4808 type: "BlockInstruction",
4809 id: "block",
4810 label: label,
4811 instr: instr,
4812 result: result
4813 };
4814 return node;
4815}
4816
4817function callInstruction(index, instrArgs, numeric) {
4818 if (instrArgs !== null && instrArgs !== undefined) {
4819 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
4820 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
4821 }
4822 }
4823
4824 var node = {
4825 type: "CallInstruction",
4826 id: "call",
4827 index: index
4828 };
4829
4830 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
4831 node.instrArgs = instrArgs;
4832 }
4833
4834 if (typeof numeric !== "undefined") {
4835 node.numeric = numeric;
4836 }
4837
4838 return node;
4839}
4840
4841function callIndirectInstruction(signature, intrs) {
4842 if (intrs !== null && intrs !== undefined) {
4843 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
4844 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
4845 }
4846 }
4847
4848 var node = {
4849 type: "CallIndirectInstruction",
4850 id: "call_indirect",
4851 signature: signature
4852 };
4853
4854 if (typeof intrs !== "undefined" && intrs.length > 0) {
4855 node.intrs = intrs;
4856 }
4857
4858 return node;
4859}
4860
4861function byteArray(values) {
4862 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
4863 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
4864 }
4865
4866 var node = {
4867 type: "ByteArray",
4868 values: values
4869 };
4870 return node;
4871}
4872
4873function func(name, signature, body, isExternal, metadata) {
4874 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
4875 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
4876 }
4877
4878 if (isExternal !== null && isExternal !== undefined) {
4879 if (!(typeof isExternal === "boolean")) {
4880 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
4881 }
4882 }
4883
4884 var node = {
4885 type: "Func",
4886 name: name,
4887 signature: signature,
4888 body: body
4889 };
4890
4891 if (isExternal === true) {
4892 node.isExternal = true;
4893 }
4894
4895 if (typeof metadata !== "undefined") {
4896 node.metadata = metadata;
4897 }
4898
4899 return node;
4900}
4901
4902function internalBrUnless(target) {
4903 if (!(typeof target === "number")) {
4904 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
4905 }
4906
4907 var node = {
4908 type: "InternalBrUnless",
4909 target: target
4910 };
4911 return node;
4912}
4913
4914function internalGoto(target) {
4915 if (!(typeof target === "number")) {
4916 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
4917 }
4918
4919 var node = {
4920 type: "InternalGoto",
4921 target: target
4922 };
4923 return node;
4924}
4925
4926function internalCallExtern(target) {
4927 if (!(typeof target === "number")) {
4928 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
4929 }
4930
4931 var node = {
4932 type: "InternalCallExtern",
4933 target: target
4934 };
4935 return node;
4936}
4937
4938function internalEndAndReturn() {
4939 var node = {
4940 type: "InternalEndAndReturn"
4941 };
4942 return node;
4943}
4944
4945var isModule = isTypeOf("Module");
4946exports.isModule = isModule;
4947var isModuleMetadata = isTypeOf("ModuleMetadata");
4948exports.isModuleMetadata = isModuleMetadata;
4949var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
4950exports.isModuleNameMetadata = isModuleNameMetadata;
4951var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
4952exports.isFunctionNameMetadata = isFunctionNameMetadata;
4953var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
4954exports.isLocalNameMetadata = isLocalNameMetadata;
4955var isBinaryModule = isTypeOf("BinaryModule");
4956exports.isBinaryModule = isBinaryModule;
4957var isQuoteModule = isTypeOf("QuoteModule");
4958exports.isQuoteModule = isQuoteModule;
4959var isSectionMetadata = isTypeOf("SectionMetadata");
4960exports.isSectionMetadata = isSectionMetadata;
4961var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
4962exports.isProducersSectionMetadata = isProducersSectionMetadata;
4963var isProducerMetadata = isTypeOf("ProducerMetadata");
4964exports.isProducerMetadata = isProducerMetadata;
4965var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
4966exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
4967var isLoopInstruction = isTypeOf("LoopInstruction");
4968exports.isLoopInstruction = isLoopInstruction;
4969var isInstr = isTypeOf("Instr");
4970exports.isInstr = isInstr;
4971var isIfInstruction = isTypeOf("IfInstruction");
4972exports.isIfInstruction = isIfInstruction;
4973var isStringLiteral = isTypeOf("StringLiteral");
4974exports.isStringLiteral = isStringLiteral;
4975var isNumberLiteral = isTypeOf("NumberLiteral");
4976exports.isNumberLiteral = isNumberLiteral;
4977var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
4978exports.isLongNumberLiteral = isLongNumberLiteral;
4979var isFloatLiteral = isTypeOf("FloatLiteral");
4980exports.isFloatLiteral = isFloatLiteral;
4981var isElem = isTypeOf("Elem");
4982exports.isElem = isElem;
4983var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
4984exports.isIndexInFuncSection = isIndexInFuncSection;
4985var isValtypeLiteral = isTypeOf("ValtypeLiteral");
4986exports.isValtypeLiteral = isValtypeLiteral;
4987var isTypeInstruction = isTypeOf("TypeInstruction");
4988exports.isTypeInstruction = isTypeInstruction;
4989var isStart = isTypeOf("Start");
4990exports.isStart = isStart;
4991var isGlobalType = isTypeOf("GlobalType");
4992exports.isGlobalType = isGlobalType;
4993var isLeadingComment = isTypeOf("LeadingComment");
4994exports.isLeadingComment = isLeadingComment;
4995var isBlockComment = isTypeOf("BlockComment");
4996exports.isBlockComment = isBlockComment;
4997var isData = isTypeOf("Data");
4998exports.isData = isData;
4999var isGlobal = isTypeOf("Global");
5000exports.isGlobal = isGlobal;
5001var isTable = isTypeOf("Table");
5002exports.isTable = isTable;
5003var isMemory = isTypeOf("Memory");
5004exports.isMemory = isMemory;
5005var isFuncImportDescr = isTypeOf("FuncImportDescr");
5006exports.isFuncImportDescr = isFuncImportDescr;
5007var isModuleImport = isTypeOf("ModuleImport");
5008exports.isModuleImport = isModuleImport;
5009var isModuleExportDescr = isTypeOf("ModuleExportDescr");
5010exports.isModuleExportDescr = isModuleExportDescr;
5011var isModuleExport = isTypeOf("ModuleExport");
5012exports.isModuleExport = isModuleExport;
5013var isLimit = isTypeOf("Limit");
5014exports.isLimit = isLimit;
5015var isSignature = isTypeOf("Signature");
5016exports.isSignature = isSignature;
5017var isProgram = isTypeOf("Program");
5018exports.isProgram = isProgram;
5019var isIdentifier = isTypeOf("Identifier");
5020exports.isIdentifier = isIdentifier;
5021var isBlockInstruction = isTypeOf("BlockInstruction");
5022exports.isBlockInstruction = isBlockInstruction;
5023var isCallInstruction = isTypeOf("CallInstruction");
5024exports.isCallInstruction = isCallInstruction;
5025var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
5026exports.isCallIndirectInstruction = isCallIndirectInstruction;
5027var isByteArray = isTypeOf("ByteArray");
5028exports.isByteArray = isByteArray;
5029var isFunc = isTypeOf("Func");
5030exports.isFunc = isFunc;
5031var isInternalBrUnless = isTypeOf("InternalBrUnless");
5032exports.isInternalBrUnless = isInternalBrUnless;
5033var isInternalGoto = isTypeOf("InternalGoto");
5034exports.isInternalGoto = isInternalGoto;
5035var isInternalCallExtern = isTypeOf("InternalCallExtern");
5036exports.isInternalCallExtern = isInternalCallExtern;
5037var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
5038exports.isInternalEndAndReturn = isInternalEndAndReturn;
5039
5040var isNode = function isNode(node) {
5041 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
5042};
5043
5044exports.isNode = isNode;
5045
5046var isBlock = function isBlock(node) {
5047 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
5048};
5049
5050exports.isBlock = isBlock;
5051
5052var isInstruction = function isInstruction(node) {
5053 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
5054};
5055
5056exports.isInstruction = isInstruction;
5057
5058var isExpression = function isExpression(node) {
5059 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
5060};
5061
5062exports.isExpression = isExpression;
5063
5064var isNumericLiteral = function isNumericLiteral(node) {
5065 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
5066};
5067
5068exports.isNumericLiteral = isNumericLiteral;
5069
5070var isImportDescr = function isImportDescr(node) {
5071 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
5072};
5073
5074exports.isImportDescr = isImportDescr;
5075
5076var isIntrinsic = function isIntrinsic(node) {
5077 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
5078};
5079
5080exports.isIntrinsic = isIntrinsic;
5081var assertModule = assertTypeOf("Module");
5082exports.assertModule = assertModule;
5083var assertModuleMetadata = assertTypeOf("ModuleMetadata");
5084exports.assertModuleMetadata = assertModuleMetadata;
5085var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
5086exports.assertModuleNameMetadata = assertModuleNameMetadata;
5087var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
5088exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
5089var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
5090exports.assertLocalNameMetadata = assertLocalNameMetadata;
5091var assertBinaryModule = assertTypeOf("BinaryModule");
5092exports.assertBinaryModule = assertBinaryModule;
5093var assertQuoteModule = assertTypeOf("QuoteModule");
5094exports.assertQuoteModule = assertQuoteModule;
5095var assertSectionMetadata = assertTypeOf("SectionMetadata");
5096exports.assertSectionMetadata = assertSectionMetadata;
5097var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
5098exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
5099var assertProducerMetadata = assertTypeOf("ProducerMetadata");
5100exports.assertProducerMetadata = assertProducerMetadata;
5101var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
5102exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
5103var assertLoopInstruction = assertTypeOf("LoopInstruction");
5104exports.assertLoopInstruction = assertLoopInstruction;
5105var assertInstr = assertTypeOf("Instr");
5106exports.assertInstr = assertInstr;
5107var assertIfInstruction = assertTypeOf("IfInstruction");
5108exports.assertIfInstruction = assertIfInstruction;
5109var assertStringLiteral = assertTypeOf("StringLiteral");
5110exports.assertStringLiteral = assertStringLiteral;
5111var assertNumberLiteral = assertTypeOf("NumberLiteral");
5112exports.assertNumberLiteral = assertNumberLiteral;
5113var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
5114exports.assertLongNumberLiteral = assertLongNumberLiteral;
5115var assertFloatLiteral = assertTypeOf("FloatLiteral");
5116exports.assertFloatLiteral = assertFloatLiteral;
5117var assertElem = assertTypeOf("Elem");
5118exports.assertElem = assertElem;
5119var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
5120exports.assertIndexInFuncSection = assertIndexInFuncSection;
5121var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
5122exports.assertValtypeLiteral = assertValtypeLiteral;
5123var assertTypeInstruction = assertTypeOf("TypeInstruction");
5124exports.assertTypeInstruction = assertTypeInstruction;
5125var assertStart = assertTypeOf("Start");
5126exports.assertStart = assertStart;
5127var assertGlobalType = assertTypeOf("GlobalType");
5128exports.assertGlobalType = assertGlobalType;
5129var assertLeadingComment = assertTypeOf("LeadingComment");
5130exports.assertLeadingComment = assertLeadingComment;
5131var assertBlockComment = assertTypeOf("BlockComment");
5132exports.assertBlockComment = assertBlockComment;
5133var assertData = assertTypeOf("Data");
5134exports.assertData = assertData;
5135var assertGlobal = assertTypeOf("Global");
5136exports.assertGlobal = assertGlobal;
5137var assertTable = assertTypeOf("Table");
5138exports.assertTable = assertTable;
5139var assertMemory = assertTypeOf("Memory");
5140exports.assertMemory = assertMemory;
5141var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
5142exports.assertFuncImportDescr = assertFuncImportDescr;
5143var assertModuleImport = assertTypeOf("ModuleImport");
5144exports.assertModuleImport = assertModuleImport;
5145var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
5146exports.assertModuleExportDescr = assertModuleExportDescr;
5147var assertModuleExport = assertTypeOf("ModuleExport");
5148exports.assertModuleExport = assertModuleExport;
5149var assertLimit = assertTypeOf("Limit");
5150exports.assertLimit = assertLimit;
5151var assertSignature = assertTypeOf("Signature");
5152exports.assertSignature = assertSignature;
5153var assertProgram = assertTypeOf("Program");
5154exports.assertProgram = assertProgram;
5155var assertIdentifier = assertTypeOf("Identifier");
5156exports.assertIdentifier = assertIdentifier;
5157var assertBlockInstruction = assertTypeOf("BlockInstruction");
5158exports.assertBlockInstruction = assertBlockInstruction;
5159var assertCallInstruction = assertTypeOf("CallInstruction");
5160exports.assertCallInstruction = assertCallInstruction;
5161var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
5162exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
5163var assertByteArray = assertTypeOf("ByteArray");
5164exports.assertByteArray = assertByteArray;
5165var assertFunc = assertTypeOf("Func");
5166exports.assertFunc = assertFunc;
5167var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
5168exports.assertInternalBrUnless = assertInternalBrUnless;
5169var assertInternalGoto = assertTypeOf("InternalGoto");
5170exports.assertInternalGoto = assertInternalGoto;
5171var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
5172exports.assertInternalCallExtern = assertInternalCallExtern;
5173var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
5174exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
5175var unionTypesMap = {
5176 Module: ["Node"],
5177 ModuleMetadata: ["Node"],
5178 ModuleNameMetadata: ["Node"],
5179 FunctionNameMetadata: ["Node"],
5180 LocalNameMetadata: ["Node"],
5181 BinaryModule: ["Node"],
5182 QuoteModule: ["Node"],
5183 SectionMetadata: ["Node"],
5184 ProducersSectionMetadata: ["Node"],
5185 ProducerMetadata: ["Node"],
5186 ProducerMetadataVersionedName: ["Node"],
5187 LoopInstruction: ["Node", "Block", "Instruction"],
5188 Instr: ["Node", "Expression", "Instruction"],
5189 IfInstruction: ["Node", "Instruction"],
5190 StringLiteral: ["Node", "Expression"],
5191 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
5192 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
5193 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
5194 Elem: ["Node"],
5195 IndexInFuncSection: ["Node"],
5196 ValtypeLiteral: ["Node", "Expression"],
5197 TypeInstruction: ["Node", "Instruction"],
5198 Start: ["Node"],
5199 GlobalType: ["Node", "ImportDescr"],
5200 LeadingComment: ["Node"],
5201 BlockComment: ["Node"],
5202 Data: ["Node"],
5203 Global: ["Node"],
5204 Table: ["Node", "ImportDescr"],
5205 Memory: ["Node", "ImportDescr"],
5206 FuncImportDescr: ["Node", "ImportDescr"],
5207 ModuleImport: ["Node"],
5208 ModuleExportDescr: ["Node"],
5209 ModuleExport: ["Node"],
5210 Limit: ["Node"],
5211 Signature: ["Node"],
5212 Program: ["Node"],
5213 Identifier: ["Node", "Expression"],
5214 BlockInstruction: ["Node", "Block", "Instruction"],
5215 CallInstruction: ["Node", "Instruction"],
5216 CallIndirectInstruction: ["Node", "Instruction"],
5217 ByteArray: ["Node"],
5218 Func: ["Node", "Block"],
5219 InternalBrUnless: ["Node", "Intrinsic"],
5220 InternalGoto: ["Node", "Intrinsic"],
5221 InternalCallExtern: ["Node", "Intrinsic"],
5222 InternalEndAndReturn: ["Node", "Intrinsic"]
5223};
5224exports.unionTypesMap = unionTypesMap;
5225var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
5226exports.nodeAndUnionTypes = nodeAndUnionTypes;
5227
5228/***/ }),
5229
5230/***/ 37240:
5231/***/ (function(__unused_webpack_module, exports) {
5232
5233"use strict";
5234
5235
5236Object.defineProperty(exports, "__esModule", ({
5237 value: true
5238}));
5239exports.signatures = void 0;
5240
5241function sign(input, output) {
5242 return [input, output];
5243}
5244
5245var u32 = "u32";
5246var i32 = "i32";
5247var i64 = "i64";
5248var f32 = "f32";
5249var f64 = "f64";
5250
5251var vector = function vector(t) {
5252 var vecType = [t]; // $FlowIgnore
5253
5254 vecType.vector = true;
5255 return vecType;
5256};
5257
5258var controlInstructions = {
5259 unreachable: sign([], []),
5260 nop: sign([], []),
5261 // block ?
5262 // loop ?
5263 // if ?
5264 // if else ?
5265 br: sign([u32], []),
5266 br_if: sign([u32], []),
5267 br_table: sign(vector(u32), []),
5268 return: sign([], []),
5269 call: sign([u32], []),
5270 call_indirect: sign([u32], [])
5271};
5272var parametricInstructions = {
5273 drop: sign([], []),
5274 select: sign([], [])
5275};
5276var variableInstructions = {
5277 get_local: sign([u32], []),
5278 set_local: sign([u32], []),
5279 tee_local: sign([u32], []),
5280 get_global: sign([u32], []),
5281 set_global: sign([u32], [])
5282};
5283var memoryInstructions = {
5284 "i32.load": sign([u32, u32], [i32]),
5285 "i64.load": sign([u32, u32], []),
5286 "f32.load": sign([u32, u32], []),
5287 "f64.load": sign([u32, u32], []),
5288 "i32.load8_s": sign([u32, u32], [i32]),
5289 "i32.load8_u": sign([u32, u32], [i32]),
5290 "i32.load16_s": sign([u32, u32], [i32]),
5291 "i32.load16_u": sign([u32, u32], [i32]),
5292 "i64.load8_s": sign([u32, u32], [i64]),
5293 "i64.load8_u": sign([u32, u32], [i64]),
5294 "i64.load16_s": sign([u32, u32], [i64]),
5295 "i64.load16_u": sign([u32, u32], [i64]),
5296 "i64.load32_s": sign([u32, u32], [i64]),
5297 "i64.load32_u": sign([u32, u32], [i64]),
5298 "i32.store": sign([u32, u32], []),
5299 "i64.store": sign([u32, u32], []),
5300 "f32.store": sign([u32, u32], []),
5301 "f64.store": sign([u32, u32], []),
5302 "i32.store8": sign([u32, u32], []),
5303 "i32.store16": sign([u32, u32], []),
5304 "i64.store8": sign([u32, u32], []),
5305 "i64.store16": sign([u32, u32], []),
5306 "i64.store32": sign([u32, u32], []),
5307 current_memory: sign([], []),
5308 grow_memory: sign([], [])
5309};
5310var numericInstructions = {
5311 "i32.const": sign([i32], [i32]),
5312 "i64.const": sign([i64], [i64]),
5313 "f32.const": sign([f32], [f32]),
5314 "f64.const": sign([f64], [f64]),
5315 "i32.eqz": sign([i32], [i32]),
5316 "i32.eq": sign([i32, i32], [i32]),
5317 "i32.ne": sign([i32, i32], [i32]),
5318 "i32.lt_s": sign([i32, i32], [i32]),
5319 "i32.lt_u": sign([i32, i32], [i32]),
5320 "i32.gt_s": sign([i32, i32], [i32]),
5321 "i32.gt_u": sign([i32, i32], [i32]),
5322 "i32.le_s": sign([i32, i32], [i32]),
5323 "i32.le_u": sign([i32, i32], [i32]),
5324 "i32.ge_s": sign([i32, i32], [i32]),
5325 "i32.ge_u": sign([i32, i32], [i32]),
5326 "i64.eqz": sign([i64], [i64]),
5327 "i64.eq": sign([i64, i64], [i32]),
5328 "i64.ne": sign([i64, i64], [i32]),
5329 "i64.lt_s": sign([i64, i64], [i32]),
5330 "i64.lt_u": sign([i64, i64], [i32]),
5331 "i64.gt_s": sign([i64, i64], [i32]),
5332 "i64.gt_u": sign([i64, i64], [i32]),
5333 "i64.le_s": sign([i64, i64], [i32]),
5334 "i64.le_u": sign([i64, i64], [i32]),
5335 "i64.ge_s": sign([i64, i64], [i32]),
5336 "i64.ge_u": sign([i64, i64], [i32]),
5337 "f32.eq": sign([f32, f32], [i32]),
5338 "f32.ne": sign([f32, f32], [i32]),
5339 "f32.lt": sign([f32, f32], [i32]),
5340 "f32.gt": sign([f32, f32], [i32]),
5341 "f32.le": sign([f32, f32], [i32]),
5342 "f32.ge": sign([f32, f32], [i32]),
5343 "f64.eq": sign([f64, f64], [i32]),
5344 "f64.ne": sign([f64, f64], [i32]),
5345 "f64.lt": sign([f64, f64], [i32]),
5346 "f64.gt": sign([f64, f64], [i32]),
5347 "f64.le": sign([f64, f64], [i32]),
5348 "f64.ge": sign([f64, f64], [i32]),
5349 "i32.clz": sign([i32], [i32]),
5350 "i32.ctz": sign([i32], [i32]),
5351 "i32.popcnt": sign([i32], [i32]),
5352 "i32.add": sign([i32, i32], [i32]),
5353 "i32.sub": sign([i32, i32], [i32]),
5354 "i32.mul": sign([i32, i32], [i32]),
5355 "i32.div_s": sign([i32, i32], [i32]),
5356 "i32.div_u": sign([i32, i32], [i32]),
5357 "i32.rem_s": sign([i32, i32], [i32]),
5358 "i32.rem_u": sign([i32, i32], [i32]),
5359 "i32.and": sign([i32, i32], [i32]),
5360 "i32.or": sign([i32, i32], [i32]),
5361 "i32.xor": sign([i32, i32], [i32]),
5362 "i32.shl": sign([i32, i32], [i32]),
5363 "i32.shr_s": sign([i32, i32], [i32]),
5364 "i32.shr_u": sign([i32, i32], [i32]),
5365 "i32.rotl": sign([i32, i32], [i32]),
5366 "i32.rotr": sign([i32, i32], [i32]),
5367 "i64.clz": sign([i64], [i64]),
5368 "i64.ctz": sign([i64], [i64]),
5369 "i64.popcnt": sign([i64], [i64]),
5370 "i64.add": sign([i64, i64], [i64]),
5371 "i64.sub": sign([i64, i64], [i64]),
5372 "i64.mul": sign([i64, i64], [i64]),
5373 "i64.div_s": sign([i64, i64], [i64]),
5374 "i64.div_u": sign([i64, i64], [i64]),
5375 "i64.rem_s": sign([i64, i64], [i64]),
5376 "i64.rem_u": sign([i64, i64], [i64]),
5377 "i64.and": sign([i64, i64], [i64]),
5378 "i64.or": sign([i64, i64], [i64]),
5379 "i64.xor": sign([i64, i64], [i64]),
5380 "i64.shl": sign([i64, i64], [i64]),
5381 "i64.shr_s": sign([i64, i64], [i64]),
5382 "i64.shr_u": sign([i64, i64], [i64]),
5383 "i64.rotl": sign([i64, i64], [i64]),
5384 "i64.rotr": sign([i64, i64], [i64]),
5385 "f32.abs": sign([f32], [f32]),
5386 "f32.neg": sign([f32], [f32]),
5387 "f32.ceil": sign([f32], [f32]),
5388 "f32.floor": sign([f32], [f32]),
5389 "f32.trunc": sign([f32], [f32]),
5390 "f32.nearest": sign([f32], [f32]),
5391 "f32.sqrt": sign([f32], [f32]),
5392 "f32.add": sign([f32, f32], [f32]),
5393 "f32.sub": sign([f32, f32], [f32]),
5394 "f32.mul": sign([f32, f32], [f32]),
5395 "f32.div": sign([f32, f32], [f32]),
5396 "f32.min": sign([f32, f32], [f32]),
5397 "f32.max": sign([f32, f32], [f32]),
5398 "f32.copysign": sign([f32, f32], [f32]),
5399 "f64.abs": sign([f64], [f64]),
5400 "f64.neg": sign([f64], [f64]),
5401 "f64.ceil": sign([f64], [f64]),
5402 "f64.floor": sign([f64], [f64]),
5403 "f64.trunc": sign([f64], [f64]),
5404 "f64.nearest": sign([f64], [f64]),
5405 "f64.sqrt": sign([f64], [f64]),
5406 "f64.add": sign([f64, f64], [f64]),
5407 "f64.sub": sign([f64, f64], [f64]),
5408 "f64.mul": sign([f64, f64], [f64]),
5409 "f64.div": sign([f64, f64], [f64]),
5410 "f64.min": sign([f64, f64], [f64]),
5411 "f64.max": sign([f64, f64], [f64]),
5412 "f64.copysign": sign([f64, f64], [f64]),
5413 "i32.wrap/i64": sign([i64], [i32]),
5414 "i32.trunc_s/f32": sign([f32], [i32]),
5415 "i32.trunc_u/f32": sign([f32], [i32]),
5416 "i32.trunc_s/f64": sign([f32], [i32]),
5417 "i32.trunc_u/f64": sign([f64], [i32]),
5418 "i64.extend_s/i32": sign([i32], [i64]),
5419 "i64.extend_u/i32": sign([i32], [i64]),
5420 "i64.trunc_s/f32": sign([f32], [i64]),
5421 "i64.trunc_u/f32": sign([f32], [i64]),
5422 "i64.trunc_s/f64": sign([f64], [i64]),
5423 "i64.trunc_u/f64": sign([f64], [i64]),
5424 "f32.convert_s/i32": sign([i32], [f32]),
5425 "f32.convert_u/i32": sign([i32], [f32]),
5426 "f32.convert_s/i64": sign([i64], [f32]),
5427 "f32.convert_u/i64": sign([i64], [f32]),
5428 "f32.demote/f64": sign([f64], [f32]),
5429 "f64.convert_s/i32": sign([i32], [f64]),
5430 "f64.convert_u/i32": sign([i32], [f64]),
5431 "f64.convert_s/i64": sign([i64], [f64]),
5432 "f64.convert_u/i64": sign([i64], [f64]),
5433 "f64.promote/f32": sign([f32], [f64]),
5434 "i32.reinterpret/f32": sign([f32], [i32]),
5435 "i64.reinterpret/f64": sign([f64], [i64]),
5436 "f32.reinterpret/i32": sign([i32], [f32]),
5437 "f64.reinterpret/i64": sign([i64], [f64])
5438};
5439var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
5440exports.signatures = signatures;
5441
5442/***/ }),
5443
5444/***/ 42411:
5445/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5446
5447"use strict";
5448
5449
5450Object.defineProperty(exports, "__esModule", ({
5451 value: true
5452}));
5453exports.traverse = traverse;
5454
5455var _nodePath = __webpack_require__(76953);
5456
5457var _nodes = __webpack_require__(36924);
5458
5459// recursively walks the AST starting at the given node. The callback is invoked for
5460// and object that has a 'type' property.
5461function walk(context, callback) {
5462 var stop = false;
5463
5464 function innerWalk(context, callback) {
5465 if (stop) {
5466 return;
5467 }
5468
5469 var node = context.node;
5470
5471 if (node === undefined) {
5472 console.warn("traversing with an empty context");
5473 return;
5474 }
5475
5476 if (node._deleted === true) {
5477 return;
5478 }
5479
5480 var path = (0, _nodePath.createPath)(context);
5481 callback(node.type, path);
5482
5483 if (path.shouldStop) {
5484 stop = true;
5485 return;
5486 }
5487
5488 Object.keys(node).forEach(function (prop) {
5489 var value = node[prop];
5490
5491 if (value === null || value === undefined) {
5492 return;
5493 }
5494
5495 var valueAsArray = Array.isArray(value) ? value : [value];
5496 valueAsArray.forEach(function (childNode) {
5497 if (typeof childNode.type === "string") {
5498 var childContext = {
5499 node: childNode,
5500 parentKey: prop,
5501 parentPath: path,
5502 shouldStop: false,
5503 inList: Array.isArray(value)
5504 };
5505 innerWalk(childContext, callback);
5506 }
5507 });
5508 });
5509 }
5510
5511 innerWalk(context, callback);
5512}
5513
5514var noop = function noop() {};
5515
5516function traverse(node, visitors) {
5517 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
5518 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
5519 Object.keys(visitors).forEach(function (visitor) {
5520 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
5521 throw new Error("Unexpected visitor ".concat(visitor));
5522 }
5523 });
5524 var context = {
5525 node: node,
5526 inList: false,
5527 shouldStop: false,
5528 parentPath: null,
5529 parentKey: null
5530 };
5531 walk(context, function (type, path) {
5532 if (typeof visitors[type] === "function") {
5533 before(type, path);
5534 visitors[type](path);
5535 after(type, path);
5536 }
5537
5538 var unionTypes = _nodes.unionTypesMap[type];
5539
5540 if (!unionTypes) {
5541 throw new Error("Unexpected node type ".concat(type));
5542 }
5543
5544 unionTypes.forEach(function (unionType) {
5545 if (typeof visitors[unionType] === "function") {
5546 before(unionType, path);
5547 visitors[unionType](path);
5548 after(unionType, path);
5549 }
5550 });
5551 });
5552}
5553
5554/***/ }),
5555
5556/***/ 55594:
5557/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5558
5559"use strict";
5560
5561
5562Object.defineProperty(exports, "__esModule", ({
5563 value: true
5564}));
5565exports.isAnonymous = isAnonymous;
5566exports.getSectionMetadata = getSectionMetadata;
5567exports.getSectionMetadatas = getSectionMetadatas;
5568exports.sortSectionMetadata = sortSectionMetadata;
5569exports.orderedInsertNode = orderedInsertNode;
5570exports.assertHasLoc = assertHasLoc;
5571exports.getEndOfSection = getEndOfSection;
5572exports.shiftLoc = shiftLoc;
5573exports.shiftSection = shiftSection;
5574exports.signatureForOpcode = signatureForOpcode;
5575exports.getUniqueNameGenerator = getUniqueNameGenerator;
5576exports.getStartByteOffset = getStartByteOffset;
5577exports.getEndByteOffset = getEndByteOffset;
5578exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
5579exports.getEndBlockByteOffset = getEndBlockByteOffset;
5580exports.getStartBlockByteOffset = getStartBlockByteOffset;
5581
5582var _signatures = __webpack_require__(37240);
5583
5584var _traverse = __webpack_require__(42411);
5585
5586var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(19015));
5587
5588function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
5589
5590function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
5591
5592function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
5593
5594function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5595
5596function isAnonymous(ident) {
5597 return ident.raw === "";
5598}
5599
5600function getSectionMetadata(ast, name) {
5601 var section;
5602 (0, _traverse.traverse)(ast, {
5603 SectionMetadata: function (_SectionMetadata) {
5604 function SectionMetadata(_x) {
5605 return _SectionMetadata.apply(this, arguments);
5606 }
5607
5608 SectionMetadata.toString = function () {
5609 return _SectionMetadata.toString();
5610 };
5611
5612 return SectionMetadata;
5613 }(function (_ref) {
5614 var node = _ref.node;
5615
5616 if (node.section === name) {
5617 section = node;
5618 }
5619 })
5620 });
5621 return section;
5622}
5623
5624function getSectionMetadatas(ast, name) {
5625 var sections = [];
5626 (0, _traverse.traverse)(ast, {
5627 SectionMetadata: function (_SectionMetadata2) {
5628 function SectionMetadata(_x2) {
5629 return _SectionMetadata2.apply(this, arguments);
5630 }
5631
5632 SectionMetadata.toString = function () {
5633 return _SectionMetadata2.toString();
5634 };
5635
5636 return SectionMetadata;
5637 }(function (_ref2) {
5638 var node = _ref2.node;
5639
5640 if (node.section === name) {
5641 sections.push(node);
5642 }
5643 })
5644 });
5645 return sections;
5646}
5647
5648function sortSectionMetadata(m) {
5649 if (m.metadata == null) {
5650 console.warn("sortSectionMetadata: no metadata to sort");
5651 return;
5652 } // $FlowIgnore
5653
5654
5655 m.metadata.sections.sort(function (a, b) {
5656 var aId = _helperWasmBytecode.default.sections[a.section];
5657 var bId = _helperWasmBytecode.default.sections[b.section];
5658
5659 if (typeof aId !== "number" || typeof bId !== "number") {
5660 throw new Error("Section id not found");
5661 }
5662
5663 return aId - bId;
5664 });
5665}
5666
5667function orderedInsertNode(m, n) {
5668 assertHasLoc(n);
5669 var didInsert = false;
5670
5671 if (n.type === "ModuleExport") {
5672 m.fields.push(n);
5673 return;
5674 }
5675
5676 m.fields = m.fields.reduce(function (acc, field) {
5677 var fieldEndCol = Infinity;
5678
5679 if (field.loc != null) {
5680 // $FlowIgnore
5681 fieldEndCol = field.loc.end.column;
5682 } // $FlowIgnore: assertHasLoc ensures that
5683
5684
5685 if (didInsert === false && n.loc.start.column < fieldEndCol) {
5686 didInsert = true;
5687 acc.push(n);
5688 }
5689
5690 acc.push(field);
5691 return acc;
5692 }, []); // Handles empty modules or n is the last element
5693
5694 if (didInsert === false) {
5695 m.fields.push(n);
5696 }
5697}
5698
5699function assertHasLoc(n) {
5700 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
5701 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
5702 }
5703}
5704
5705function getEndOfSection(s) {
5706 assertHasLoc(s.size);
5707 return s.startOffset + s.size.value + ( // $FlowIgnore
5708 s.size.loc.end.column - s.size.loc.start.column);
5709}
5710
5711function shiftLoc(node, delta) {
5712 // $FlowIgnore
5713 node.loc.start.column += delta; // $FlowIgnore
5714
5715 node.loc.end.column += delta;
5716}
5717
5718function shiftSection(ast, node, delta) {
5719 if (node.type !== "SectionMetadata") {
5720 throw new Error("Can not shift node " + JSON.stringify(node.type));
5721 }
5722
5723 node.startOffset += delta;
5724
5725 if (_typeof(node.size.loc) === "object") {
5726 shiftLoc(node.size, delta);
5727 } // Custom sections doesn't have vectorOfSize
5728
5729
5730 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
5731 shiftLoc(node.vectorOfSize, delta);
5732 }
5733
5734 var sectionName = node.section; // shift node locations within that section
5735
5736 (0, _traverse.traverse)(ast, {
5737 Node: function Node(_ref3) {
5738 var node = _ref3.node;
5739 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
5740
5741 if (section === sectionName && _typeof(node.loc) === "object") {
5742 shiftLoc(node, delta);
5743 }
5744 }
5745 });
5746}
5747
5748function signatureForOpcode(object, name) {
5749 var opcodeName = name;
5750
5751 if (object !== undefined && object !== "") {
5752 opcodeName = object + "." + name;
5753 }
5754
5755 var sign = _signatures.signatures[opcodeName];
5756
5757 if (sign == undefined) {
5758 // TODO: Uncomment this when br_table and others has been done
5759 //throw new Error("Invalid opcode: "+opcodeName);
5760 return [object, object];
5761 }
5762
5763 return sign[0];
5764}
5765
5766function getUniqueNameGenerator() {
5767 var inc = {};
5768 return function () {
5769 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
5770
5771 if (!(prefix in inc)) {
5772 inc[prefix] = 0;
5773 } else {
5774 inc[prefix] = inc[prefix] + 1;
5775 }
5776
5777 return prefix + "_" + inc[prefix];
5778 };
5779}
5780
5781function getStartByteOffset(n) {
5782 // $FlowIgnore
5783 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
5784 throw new Error( // $FlowIgnore
5785 "Can not get byte offset without loc informations, node: " + String(n.id));
5786 }
5787
5788 return n.loc.start.column;
5789}
5790
5791function getEndByteOffset(n) {
5792 // $FlowIgnore
5793 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
5794 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
5795 }
5796
5797 return n.loc.end.column;
5798}
5799
5800function getFunctionBeginingByteOffset(n) {
5801 if (!(n.body.length > 0)) {
5802 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
5803 }
5804
5805 var _n$body = _slicedToArray(n.body, 1),
5806 firstInstruction = _n$body[0];
5807
5808 return getStartByteOffset(firstInstruction);
5809}
5810
5811function getEndBlockByteOffset(n) {
5812 // $FlowIgnore
5813 if (!(n.instr.length > 0 || n.body.length > 0)) {
5814 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
5815 }
5816
5817 var lastInstruction;
5818
5819 if (n.instr) {
5820 // $FlowIgnore
5821 lastInstruction = n.instr[n.instr.length - 1];
5822 }
5823
5824 if (n.body) {
5825 // $FlowIgnore
5826 lastInstruction = n.body[n.body.length - 1];
5827 }
5828
5829 if (!(_typeof(lastInstruction) === "object")) {
5830 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
5831 }
5832
5833 // $FlowIgnore
5834 return getStartByteOffset(lastInstruction);
5835}
5836
5837function getStartBlockByteOffset(n) {
5838 // $FlowIgnore
5839 if (!(n.instr.length > 0 || n.body.length > 0)) {
5840 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
5841 }
5842
5843 var fistInstruction;
5844
5845 if (n.instr) {
5846 // $FlowIgnore
5847 var _n$instr = _slicedToArray(n.instr, 1);
5848
5849 fistInstruction = _n$instr[0];
5850 }
5851
5852 if (n.body) {
5853 // $FlowIgnore
5854 var _n$body2 = _slicedToArray(n.body, 1);
5855
5856 fistInstruction = _n$body2[0];
5857 }
5858
5859 if (!(_typeof(fistInstruction) === "object")) {
5860 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
5861 }
5862
5863 // $FlowIgnore
5864 return getStartByteOffset(fistInstruction);
5865}
5866
5867/***/ }),
5868
5869/***/ 50391:
5870/***/ (function(__unused_webpack_module, exports) {
5871
5872"use strict";
5873
5874
5875Object.defineProperty(exports, "__esModule", ({
5876 value: true
5877}));
5878exports.overrideBytesInBuffer = overrideBytesInBuffer;
5879exports.makeBuffer = makeBuffer;
5880exports.fromHexdump = fromHexdump;
5881
5882function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5883
5884function concatUint8Arrays() {
5885 for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
5886 arrays[_key] = arguments[_key];
5887 }
5888
5889 var totalLength = arrays.reduce(function (a, b) {
5890 return a + b.length;
5891 }, 0);
5892 var result = new Uint8Array(totalLength);
5893 var offset = 0;
5894
5895 for (var _i = 0; _i < arrays.length; _i++) {
5896 var arr = arrays[_i];
5897
5898 if (arr instanceof Uint8Array === false) {
5899 throw new Error("arr must be of type Uint8Array");
5900 }
5901
5902 result.set(arr, offset);
5903 offset += arr.length;
5904 }
5905
5906 return result;
5907}
5908
5909function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) {
5910 var beforeBytes = buffer.slice(0, startLoc);
5911 var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it
5912
5913 if (newBytes.length === 0) {
5914 return concatUint8Arrays(beforeBytes, afterBytes);
5915 }
5916
5917 var replacement = Uint8Array.from(newBytes);
5918 return concatUint8Arrays(beforeBytes, replacement, afterBytes);
5919}
5920
5921function makeBuffer() {
5922 for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5923 splitedBytes[_key2] = arguments[_key2];
5924 }
5925
5926 var bytes = [].concat.apply([], splitedBytes);
5927 return new Uint8Array(bytes).buffer;
5928}
5929
5930function fromHexdump(str) {
5931 var lines = str.split("\n"); // remove any leading left whitespace
5932
5933 lines = lines.map(function (line) {
5934 return line.trim();
5935 });
5936 var bytes = lines.reduce(function (acc, line) {
5937 var cols = line.split(" "); // remove the offset, left column
5938
5939 cols.shift();
5940 cols = cols.filter(function (x) {
5941 return x !== "";
5942 });
5943 var bytes = cols.map(function (x) {
5944 return parseInt(x, 16);
5945 });
5946 acc.push.apply(acc, _toConsumableArray(bytes));
5947 return acc;
5948 }, []);
5949 return Buffer.from(bytes);
5950}
5951
5952/***/ }),
5953
5954/***/ 19015:
5955/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5956
5957"use strict";
5958
5959
5960Object.defineProperty(exports, "__esModule", ({
5961 value: true
5962}));
5963Object.defineProperty(exports, "getSectionForNode", ({
5964 enumerable: true,
5965 get: function get() {
5966 return _section.getSectionForNode;
5967 }
5968}));
5969exports.default = void 0;
5970
5971var _section = __webpack_require__(85611);
5972
5973var illegalop = "illegal";
5974var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
5975var moduleVersion = [0x01, 0x00, 0x00, 0x00];
5976
5977function invertMap(obj) {
5978 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
5979 return k;
5980 };
5981 var result = {};
5982 var keys = Object.keys(obj);
5983
5984 for (var i = 0, length = keys.length; i < length; i++) {
5985 result[keyModifierFn(obj[keys[i]])] = keys[i];
5986 }
5987
5988 return result;
5989}
5990
5991function createSymbolObject(name
5992/*: string */
5993, object
5994/*: string */
5995)
5996/*: Symbol*/
5997{
5998 var numberOfArgs
5999 /*: number*/
6000 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
6001 return {
6002 name: name,
6003 object: object,
6004 numberOfArgs: numberOfArgs
6005 };
6006}
6007
6008function createSymbol(name
6009/*: string */
6010)
6011/*: Symbol*/
6012{
6013 var numberOfArgs
6014 /*: number*/
6015 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
6016 return {
6017 name: name,
6018 numberOfArgs: numberOfArgs
6019 };
6020}
6021
6022var types = {
6023 func: 0x60,
6024 result: 0x40
6025};
6026var exportTypes = {
6027 0x00: "Func",
6028 0x01: "Table",
6029 0x02: "Mem",
6030 0x03: "Global"
6031};
6032var exportTypesByName = invertMap(exportTypes);
6033var valtypes = {
6034 0x7f: "i32",
6035 0x7e: "i64",
6036 0x7d: "f32",
6037 0x7c: "f64",
6038 0x7b: "v128"
6039};
6040var valtypesByString = invertMap(valtypes);
6041var tableTypes = {
6042 0x70: "anyfunc"
6043};
6044var blockTypes = Object.assign({}, valtypes, {
6045 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
6046 0x40: null,
6047 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
6048 0x7f: "i32",
6049 0x7e: "i64",
6050 0x7d: "f32",
6051 0x7c: "f64"
6052});
6053var globalTypes = {
6054 0x00: "const",
6055 0x01: "var"
6056};
6057var globalTypesByString = invertMap(globalTypes);
6058var importTypes = {
6059 0x00: "func",
6060 0x01: "table",
6061 0x02: "mem",
6062 0x03: "global"
6063};
6064var sections = {
6065 custom: 0,
6066 type: 1,
6067 import: 2,
6068 func: 3,
6069 table: 4,
6070 memory: 5,
6071 global: 6,
6072 export: 7,
6073 start: 8,
6074 element: 9,
6075 code: 10,
6076 data: 11
6077};
6078var symbolsByByte = {
6079 0x00: createSymbol("unreachable"),
6080 0x01: createSymbol("nop"),
6081 0x02: createSymbol("block"),
6082 0x03: createSymbol("loop"),
6083 0x04: createSymbol("if"),
6084 0x05: createSymbol("else"),
6085 0x06: illegalop,
6086 0x07: illegalop,
6087 0x08: illegalop,
6088 0x09: illegalop,
6089 0x0a: illegalop,
6090 0x0b: createSymbol("end"),
6091 0x0c: createSymbol("br", 1),
6092 0x0d: createSymbol("br_if", 1),
6093 0x0e: createSymbol("br_table"),
6094 0x0f: createSymbol("return"),
6095 0x10: createSymbol("call", 1),
6096 0x11: createSymbol("call_indirect", 2),
6097 0x12: illegalop,
6098 0x13: illegalop,
6099 0x14: illegalop,
6100 0x15: illegalop,
6101 0x16: illegalop,
6102 0x17: illegalop,
6103 0x18: illegalop,
6104 0x19: illegalop,
6105 0x1a: createSymbol("drop"),
6106 0x1b: createSymbol("select"),
6107 0x1c: illegalop,
6108 0x1d: illegalop,
6109 0x1e: illegalop,
6110 0x1f: illegalop,
6111 0x20: createSymbol("get_local", 1),
6112 0x21: createSymbol("set_local", 1),
6113 0x22: createSymbol("tee_local", 1),
6114 0x23: createSymbol("get_global", 1),
6115 0x24: createSymbol("set_global", 1),
6116 0x25: illegalop,
6117 0x26: illegalop,
6118 0x27: illegalop,
6119 0x28: createSymbolObject("load", "u32", 1),
6120 0x29: createSymbolObject("load", "u64", 1),
6121 0x2a: createSymbolObject("load", "f32", 1),
6122 0x2b: createSymbolObject("load", "f64", 1),
6123 0x2c: createSymbolObject("load8_s", "u32", 1),
6124 0x2d: createSymbolObject("load8_u", "u32", 1),
6125 0x2e: createSymbolObject("load16_s", "u32", 1),
6126 0x2f: createSymbolObject("load16_u", "u32", 1),
6127 0x30: createSymbolObject("load8_s", "u64", 1),
6128 0x31: createSymbolObject("load8_u", "u64", 1),
6129 0x32: createSymbolObject("load16_s", "u64", 1),
6130 0x33: createSymbolObject("load16_u", "u64", 1),
6131 0x34: createSymbolObject("load32_s", "u64", 1),
6132 0x35: createSymbolObject("load32_u", "u64", 1),
6133 0x36: createSymbolObject("store", "u32", 1),
6134 0x37: createSymbolObject("store", "u64", 1),
6135 0x38: createSymbolObject("store", "f32", 1),
6136 0x39: createSymbolObject("store", "f64", 1),
6137 0x3a: createSymbolObject("store8", "u32", 1),
6138 0x3b: createSymbolObject("store16", "u32", 1),
6139 0x3c: createSymbolObject("store8", "u64", 1),
6140 0x3d: createSymbolObject("store16", "u64", 1),
6141 0x3e: createSymbolObject("store32", "u64", 1),
6142 0x3f: createSymbolObject("current_memory"),
6143 0x40: createSymbolObject("grow_memory"),
6144 0x41: createSymbolObject("const", "i32", 1),
6145 0x42: createSymbolObject("const", "i64", 1),
6146 0x43: createSymbolObject("const", "f32", 1),
6147 0x44: createSymbolObject("const", "f64", 1),
6148 0x45: createSymbolObject("eqz", "i32"),
6149 0x46: createSymbolObject("eq", "i32"),
6150 0x47: createSymbolObject("ne", "i32"),
6151 0x48: createSymbolObject("lt_s", "i32"),
6152 0x49: createSymbolObject("lt_u", "i32"),
6153 0x4a: createSymbolObject("gt_s", "i32"),
6154 0x4b: createSymbolObject("gt_u", "i32"),
6155 0x4c: createSymbolObject("le_s", "i32"),
6156 0x4d: createSymbolObject("le_u", "i32"),
6157 0x4e: createSymbolObject("ge_s", "i32"),
6158 0x4f: createSymbolObject("ge_u", "i32"),
6159 0x50: createSymbolObject("eqz", "i64"),
6160 0x51: createSymbolObject("eq", "i64"),
6161 0x52: createSymbolObject("ne", "i64"),
6162 0x53: createSymbolObject("lt_s", "i64"),
6163 0x54: createSymbolObject("lt_u", "i64"),
6164 0x55: createSymbolObject("gt_s", "i64"),
6165 0x56: createSymbolObject("gt_u", "i64"),
6166 0x57: createSymbolObject("le_s", "i64"),
6167 0x58: createSymbolObject("le_u", "i64"),
6168 0x59: createSymbolObject("ge_s", "i64"),
6169 0x5a: createSymbolObject("ge_u", "i64"),
6170 0x5b: createSymbolObject("eq", "f32"),
6171 0x5c: createSymbolObject("ne", "f32"),
6172 0x5d: createSymbolObject("lt", "f32"),
6173 0x5e: createSymbolObject("gt", "f32"),
6174 0x5f: createSymbolObject("le", "f32"),
6175 0x60: createSymbolObject("ge", "f32"),
6176 0x61: createSymbolObject("eq", "f64"),
6177 0x62: createSymbolObject("ne", "f64"),
6178 0x63: createSymbolObject("lt", "f64"),
6179 0x64: createSymbolObject("gt", "f64"),
6180 0x65: createSymbolObject("le", "f64"),
6181 0x66: createSymbolObject("ge", "f64"),
6182 0x67: createSymbolObject("clz", "i32"),
6183 0x68: createSymbolObject("ctz", "i32"),
6184 0x69: createSymbolObject("popcnt", "i32"),
6185 0x6a: createSymbolObject("add", "i32"),
6186 0x6b: createSymbolObject("sub", "i32"),
6187 0x6c: createSymbolObject("mul", "i32"),
6188 0x6d: createSymbolObject("div_s", "i32"),
6189 0x6e: createSymbolObject("div_u", "i32"),
6190 0x6f: createSymbolObject("rem_s", "i32"),
6191 0x70: createSymbolObject("rem_u", "i32"),
6192 0x71: createSymbolObject("and", "i32"),
6193 0x72: createSymbolObject("or", "i32"),
6194 0x73: createSymbolObject("xor", "i32"),
6195 0x74: createSymbolObject("shl", "i32"),
6196 0x75: createSymbolObject("shr_s", "i32"),
6197 0x76: createSymbolObject("shr_u", "i32"),
6198 0x77: createSymbolObject("rotl", "i32"),
6199 0x78: createSymbolObject("rotr", "i32"),
6200 0x79: createSymbolObject("clz", "i64"),
6201 0x7a: createSymbolObject("ctz", "i64"),
6202 0x7b: createSymbolObject("popcnt", "i64"),
6203 0x7c: createSymbolObject("add", "i64"),
6204 0x7d: createSymbolObject("sub", "i64"),
6205 0x7e: createSymbolObject("mul", "i64"),
6206 0x7f: createSymbolObject("div_s", "i64"),
6207 0x80: createSymbolObject("div_u", "i64"),
6208 0x81: createSymbolObject("rem_s", "i64"),
6209 0x82: createSymbolObject("rem_u", "i64"),
6210 0x83: createSymbolObject("and", "i64"),
6211 0x84: createSymbolObject("or", "i64"),
6212 0x85: createSymbolObject("xor", "i64"),
6213 0x86: createSymbolObject("shl", "i64"),
6214 0x87: createSymbolObject("shr_s", "i64"),
6215 0x88: createSymbolObject("shr_u", "i64"),
6216 0x89: createSymbolObject("rotl", "i64"),
6217 0x8a: createSymbolObject("rotr", "i64"),
6218 0x8b: createSymbolObject("abs", "f32"),
6219 0x8c: createSymbolObject("neg", "f32"),
6220 0x8d: createSymbolObject("ceil", "f32"),
6221 0x8e: createSymbolObject("floor", "f32"),
6222 0x8f: createSymbolObject("trunc", "f32"),
6223 0x90: createSymbolObject("nearest", "f32"),
6224 0x91: createSymbolObject("sqrt", "f32"),
6225 0x92: createSymbolObject("add", "f32"),
6226 0x93: createSymbolObject("sub", "f32"),
6227 0x94: createSymbolObject("mul", "f32"),
6228 0x95: createSymbolObject("div", "f32"),
6229 0x96: createSymbolObject("min", "f32"),
6230 0x97: createSymbolObject("max", "f32"),
6231 0x98: createSymbolObject("copysign", "f32"),
6232 0x99: createSymbolObject("abs", "f64"),
6233 0x9a: createSymbolObject("neg", "f64"),
6234 0x9b: createSymbolObject("ceil", "f64"),
6235 0x9c: createSymbolObject("floor", "f64"),
6236 0x9d: createSymbolObject("trunc", "f64"),
6237 0x9e: createSymbolObject("nearest", "f64"),
6238 0x9f: createSymbolObject("sqrt", "f64"),
6239 0xa0: createSymbolObject("add", "f64"),
6240 0xa1: createSymbolObject("sub", "f64"),
6241 0xa2: createSymbolObject("mul", "f64"),
6242 0xa3: createSymbolObject("div", "f64"),
6243 0xa4: createSymbolObject("min", "f64"),
6244 0xa5: createSymbolObject("max", "f64"),
6245 0xa6: createSymbolObject("copysign", "f64"),
6246 0xa7: createSymbolObject("wrap/i64", "i32"),
6247 0xa8: createSymbolObject("trunc_s/f32", "i32"),
6248 0xa9: createSymbolObject("trunc_u/f32", "i32"),
6249 0xaa: createSymbolObject("trunc_s/f64", "i32"),
6250 0xab: createSymbolObject("trunc_u/f64", "i32"),
6251 0xac: createSymbolObject("extend_s/i32", "i64"),
6252 0xad: createSymbolObject("extend_u/i32", "i64"),
6253 0xae: createSymbolObject("trunc_s/f32", "i64"),
6254 0xaf: createSymbolObject("trunc_u/f32", "i64"),
6255 0xb0: createSymbolObject("trunc_s/f64", "i64"),
6256 0xb1: createSymbolObject("trunc_u/f64", "i64"),
6257 0xb2: createSymbolObject("convert_s/i32", "f32"),
6258 0xb3: createSymbolObject("convert_u/i32", "f32"),
6259 0xb4: createSymbolObject("convert_s/i64", "f32"),
6260 0xb5: createSymbolObject("convert_u/i64", "f32"),
6261 0xb6: createSymbolObject("demote/f64", "f32"),
6262 0xb7: createSymbolObject("convert_s/i32", "f64"),
6263 0xb8: createSymbolObject("convert_u/i32", "f64"),
6264 0xb9: createSymbolObject("convert_s/i64", "f64"),
6265 0xba: createSymbolObject("convert_u/i64", "f64"),
6266 0xbb: createSymbolObject("promote/f32", "f64"),
6267 0xbc: createSymbolObject("reinterpret/f32", "i32"),
6268 0xbd: createSymbolObject("reinterpret/f64", "i64"),
6269 0xbe: createSymbolObject("reinterpret/i32", "f32"),
6270 0xbf: createSymbolObject("reinterpret/i64", "f64")
6271};
6272var symbolsByName = invertMap(symbolsByByte, function (obj) {
6273 if (typeof obj.object === "string") {
6274 return "".concat(obj.object, ".").concat(obj.name);
6275 }
6276
6277 return obj.name;
6278});
6279var _default = {
6280 symbolsByByte: symbolsByByte,
6281 sections: sections,
6282 magicModuleHeader: magicModuleHeader,
6283 moduleVersion: moduleVersion,
6284 types: types,
6285 valtypes: valtypes,
6286 exportTypes: exportTypes,
6287 blockTypes: blockTypes,
6288 tableTypes: tableTypes,
6289 globalTypes: globalTypes,
6290 importTypes: importTypes,
6291 valtypesByString: valtypesByString,
6292 globalTypesByString: globalTypesByString,
6293 exportTypesByName: exportTypesByName,
6294 symbolsByName: symbolsByName
6295};
6296exports.default = _default;
6297
6298/***/ }),
6299
6300/***/ 85611:
6301/***/ (function(__unused_webpack_module, exports) {
6302
6303"use strict";
6304
6305
6306Object.defineProperty(exports, "__esModule", ({
6307 value: true
6308}));
6309exports.getSectionForNode = getSectionForNode;
6310
6311function getSectionForNode(n) {
6312 switch (n.type) {
6313 case "ModuleImport":
6314 return "import";
6315
6316 case "CallInstruction":
6317 case "CallIndirectInstruction":
6318 case "Func":
6319 case "Instr":
6320 return "code";
6321
6322 case "ModuleExport":
6323 return "export";
6324
6325 case "Start":
6326 return "start";
6327
6328 case "TypeInstruction":
6329 return "type";
6330
6331 case "IndexInFuncSection":
6332 return "func";
6333
6334 case "Global":
6335 return "global";
6336 // No section
6337
6338 default:
6339 return;
6340 }
6341}
6342
6343/***/ }),
6344
6345/***/ 59436:
6346/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6347
6348"use strict";
6349
6350
6351Object.defineProperty(exports, "__esModule", ({
6352 value: true
6353}));
6354exports.encodeF32 = encodeF32;
6355exports.encodeF64 = encodeF64;
6356exports.decodeF32 = decodeF32;
6357exports.decodeF64 = decodeF64;
6358exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0;
6359
6360var _ieee = __webpack_require__(30848);
6361
6362/**
6363 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
6364 * n = 32/8
6365 */
6366var NUMBER_OF_BYTE_F32 = 4;
6367/**
6368 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
6369 * n = 64/8
6370 */
6371
6372exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32;
6373var NUMBER_OF_BYTE_F64 = 8;
6374exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64;
6375var SINGLE_PRECISION_MANTISSA = 23;
6376exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA;
6377var DOUBLE_PRECISION_MANTISSA = 52;
6378exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA;
6379
6380function encodeF32(v) {
6381 var buffer = [];
6382 (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
6383 return buffer;
6384}
6385
6386function encodeF64(v) {
6387 var buffer = [];
6388 (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
6389 return buffer;
6390}
6391
6392function decodeF32(bytes) {
6393 var buffer = Buffer.from(bytes);
6394 return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
6395}
6396
6397function decodeF64(bytes) {
6398 var buffer = Buffer.from(bytes);
6399 return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
6400}
6401
6402/***/ }),
6403
6404/***/ 34279:
6405/***/ (function(__unused_webpack_module, exports) {
6406
6407"use strict";
6408// Copyright 2012 The Obvious Corporation.
6409
6410/*
6411 * bits: Bitwise buffer utilities. The utilities here treat a buffer
6412 * as a little-endian bigint, so the lowest-order bit is bit #0 of
6413 * `buffer[0]`, and the highest-order bit is bit #7 of
6414 * `buffer[buffer.length - 1]`.
6415 */
6416
6417/*
6418 * Modules used
6419 */
6420
6421/*
6422 * Exported bindings
6423 */
6424
6425/**
6426 * Extracts the given number of bits from the buffer at the indicated
6427 * index, returning a simple number as the result. If bits are requested
6428 * that aren't covered by the buffer, the `defaultBit` is used as their
6429 * value.
6430 *
6431 * The `bitLength` must be no more than 32. The `defaultBit` if not
6432 * specified is taken to be `0`.
6433 */
6434
6435Object.defineProperty(exports, "__esModule", ({
6436 value: true
6437}));
6438exports.extract = extract;
6439exports.inject = inject;
6440exports.getSign = getSign;
6441exports.highOrder = highOrder;
6442
6443function extract(buffer, bitIndex, bitLength, defaultBit) {
6444 if (bitLength < 0 || bitLength > 32) {
6445 throw new Error("Bad value for bitLength.");
6446 }
6447
6448 if (defaultBit === undefined) {
6449 defaultBit = 0;
6450 } else if (defaultBit !== 0 && defaultBit !== 1) {
6451 throw new Error("Bad value for defaultBit.");
6452 }
6453
6454 var defaultByte = defaultBit * 0xff;
6455 var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but
6456 // if endBit !== 0, then endByte is inclusive.
6457
6458 var lastBit = bitIndex + bitLength;
6459 var startByte = Math.floor(bitIndex / 8);
6460 var startBit = bitIndex % 8;
6461 var endByte = Math.floor(lastBit / 8);
6462 var endBit = lastBit % 8;
6463
6464 if (endBit !== 0) {
6465 // `(1 << endBit) - 1` is the mask of all bits up to but not including
6466 // the endBit.
6467 result = get(endByte) & (1 << endBit) - 1;
6468 }
6469
6470 while (endByte > startByte) {
6471 endByte--;
6472 result = result << 8 | get(endByte);
6473 }
6474
6475 result >>>= startBit;
6476 return result;
6477
6478 function get(index) {
6479 var result = buffer[index];
6480 return result === undefined ? defaultByte : result;
6481 }
6482}
6483/**
6484 * Injects the given bits into the given buffer at the given index. Any
6485 * bits in the value beyond the length to set are ignored.
6486 */
6487
6488
6489function inject(buffer, bitIndex, bitLength, value) {
6490 if (bitLength < 0 || bitLength > 32) {
6491 throw new Error("Bad value for bitLength.");
6492 }
6493
6494 var lastByte = Math.floor((bitIndex + bitLength - 1) / 8);
6495
6496 if (bitIndex < 0 || lastByte >= buffer.length) {
6497 throw new Error("Index out of range.");
6498 } // Just keeping it simple, until / unless profiling shows that this
6499 // is a problem.
6500
6501
6502 var atByte = Math.floor(bitIndex / 8);
6503 var atBit = bitIndex % 8;
6504
6505 while (bitLength > 0) {
6506 if (value & 1) {
6507 buffer[atByte] |= 1 << atBit;
6508 } else {
6509 buffer[atByte] &= ~(1 << atBit);
6510 }
6511
6512 value >>= 1;
6513 bitLength--;
6514 atBit = (atBit + 1) % 8;
6515
6516 if (atBit === 0) {
6517 atByte++;
6518 }
6519 }
6520}
6521/**
6522 * Gets the sign bit of the given buffer.
6523 */
6524
6525
6526function getSign(buffer) {
6527 return buffer[buffer.length - 1] >>> 7;
6528}
6529/**
6530 * Gets the zero-based bit number of the highest-order bit with the
6531 * given value in the given buffer.
6532 *
6533 * If the buffer consists entirely of the other bit value, then this returns
6534 * `-1`.
6535 */
6536
6537
6538function highOrder(bit, buffer) {
6539 var length = buffer.length;
6540 var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte
6541
6542 while (length > 0 && buffer[length - 1] === fullyWrongByte) {
6543 length--;
6544 }
6545
6546 if (length === 0) {
6547 // Degenerate case. The buffer consists entirely of ~bit.
6548 return -1;
6549 }
6550
6551 var byteToCheck = buffer[length - 1];
6552 var result = length * 8 - 1;
6553
6554 for (var i = 7; i > 0; i--) {
6555 if ((byteToCheck >> i & 1) === bit) {
6556 break;
6557 }
6558
6559 result--;
6560 }
6561
6562 return result;
6563}
6564
6565/***/ }),
6566
6567/***/ 83006:
6568/***/ (function(__unused_webpack_module, exports) {
6569
6570"use strict";
6571
6572
6573Object.defineProperty(exports, "__esModule", ({
6574 value: true
6575}));
6576exports.alloc = alloc;
6577exports.free = free;
6578exports.resize = resize;
6579exports.readInt = readInt;
6580exports.readUInt = readUInt;
6581exports.writeInt64 = writeInt64;
6582exports.writeUInt64 = writeUInt64;
6583// Copyright 2012 The Obvious Corporation.
6584
6585/*
6586 * bufs: Buffer utilities.
6587 */
6588
6589/*
6590 * Module variables
6591 */
6592
6593/** Pool of buffers, where `bufPool[x].length === x`. */
6594var bufPool = [];
6595/** Maximum length of kept temporary buffers. */
6596
6597var TEMP_BUF_MAXIMUM_LENGTH = 20;
6598/** Minimum exactly-representable 64-bit int. */
6599
6600var MIN_EXACT_INT64 = -0x8000000000000000;
6601/** Maximum exactly-representable 64-bit int. */
6602
6603var MAX_EXACT_INT64 = 0x7ffffffffffffc00;
6604/** Maximum exactly-representable 64-bit uint. */
6605
6606var MAX_EXACT_UINT64 = 0xfffffffffffff800;
6607/**
6608 * The int value consisting just of a 1 in bit #32 (that is, one more
6609 * than the maximum 32-bit unsigned value).
6610 */
6611
6612var BIT_32 = 0x100000000;
6613/**
6614 * The int value consisting just of a 1 in bit #64 (that is, one more
6615 * than the maximum 64-bit unsigned value).
6616 */
6617
6618var BIT_64 = 0x10000000000000000;
6619/*
6620 * Helper functions
6621 */
6622
6623/**
6624 * Masks off all but the lowest bit set of the given number.
6625 */
6626
6627function lowestBit(num) {
6628 return num & -num;
6629}
6630/**
6631 * Gets whether trying to add the second number to the first is lossy
6632 * (inexact). The first number is meant to be an accumulated result.
6633 */
6634
6635
6636function isLossyToAdd(accum, num) {
6637 if (num === 0) {
6638 return false;
6639 }
6640
6641 var lowBit = lowestBit(num);
6642 var added = accum + lowBit;
6643
6644 if (added === accum) {
6645 return true;
6646 }
6647
6648 if (added - lowBit !== accum) {
6649 return true;
6650 }
6651
6652 return false;
6653}
6654/*
6655 * Exported functions
6656 */
6657
6658/**
6659 * Allocates a buffer of the given length, which is initialized
6660 * with all zeroes. This returns a buffer from the pool if it is
6661 * available, or a freshly-allocated buffer if not.
6662 */
6663
6664
6665function alloc(length) {
6666 var result = bufPool[length];
6667
6668 if (result) {
6669 bufPool[length] = undefined;
6670 } else {
6671 result = new Buffer(length);
6672 }
6673
6674 result.fill(0);
6675 return result;
6676}
6677/**
6678 * Releases a buffer back to the pool.
6679 */
6680
6681
6682function free(buffer) {
6683 var length = buffer.length;
6684
6685 if (length < TEMP_BUF_MAXIMUM_LENGTH) {
6686 bufPool[length] = buffer;
6687 }
6688}
6689/**
6690 * Resizes a buffer, returning a new buffer. Returns the argument if
6691 * the length wouldn't actually change. This function is only safe to
6692 * use if the given buffer was allocated within this module (since
6693 * otherwise the buffer might possibly be shared externally).
6694 */
6695
6696
6697function resize(buffer, length) {
6698 if (length === buffer.length) {
6699 return buffer;
6700 }
6701
6702 var newBuf = alloc(length);
6703 buffer.copy(newBuf);
6704 free(buffer);
6705 return newBuf;
6706}
6707/**
6708 * Reads an arbitrary signed int from a buffer.
6709 */
6710
6711
6712function readInt(buffer) {
6713 var length = buffer.length;
6714 var positive = buffer[length - 1] < 0x80;
6715 var result = positive ? 0 : -1;
6716 var lossy = false; // Note: We can't use bit manipulation here, since that stops
6717 // working if the result won't fit in a 32-bit int.
6718
6719 if (length < 7) {
6720 // Common case which can't possibly be lossy (because the result has
6721 // no more than 48 bits, and loss only happens with 54 or more).
6722 for (var i = length - 1; i >= 0; i--) {
6723 result = result * 0x100 + buffer[i];
6724 }
6725 } else {
6726 for (var _i = length - 1; _i >= 0; _i--) {
6727 var one = buffer[_i];
6728 result *= 0x100;
6729
6730 if (isLossyToAdd(result, one)) {
6731 lossy = true;
6732 }
6733
6734 result += one;
6735 }
6736 }
6737
6738 return {
6739 value: result,
6740 lossy: lossy
6741 };
6742}
6743/**
6744 * Reads an arbitrary unsigned int from a buffer.
6745 */
6746
6747
6748function readUInt(buffer) {
6749 var length = buffer.length;
6750 var result = 0;
6751 var lossy = false; // Note: See above in re bit manipulation.
6752
6753 if (length < 7) {
6754 // Common case which can't possibly be lossy (see above).
6755 for (var i = length - 1; i >= 0; i--) {
6756 result = result * 0x100 + buffer[i];
6757 }
6758 } else {
6759 for (var _i2 = length - 1; _i2 >= 0; _i2--) {
6760 var one = buffer[_i2];
6761 result *= 0x100;
6762
6763 if (isLossyToAdd(result, one)) {
6764 lossy = true;
6765 }
6766
6767 result += one;
6768 }
6769 }
6770
6771 return {
6772 value: result,
6773 lossy: lossy
6774 };
6775}
6776/**
6777 * Writes a little-endian 64-bit signed int into a buffer.
6778 */
6779
6780
6781function writeInt64(value, buffer) {
6782 if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) {
6783 throw new Error("Value out of range.");
6784 }
6785
6786 if (value < 0) {
6787 value += BIT_64;
6788 }
6789
6790 writeUInt64(value, buffer);
6791}
6792/**
6793 * Writes a little-endian 64-bit unsigned int into a buffer.
6794 */
6795
6796
6797function writeUInt64(value, buffer) {
6798 if (value < 0 || value > MAX_EXACT_UINT64) {
6799 throw new Error("Value out of range.");
6800 }
6801
6802 var lowWord = value % BIT_32;
6803 var highWord = Math.floor(value / BIT_32);
6804 buffer.writeUInt32LE(lowWord, 0);
6805 buffer.writeUInt32LE(highWord, 4);
6806}
6807
6808/***/ }),
6809
6810/***/ 21681:
6811/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6812
6813"use strict";
6814
6815
6816Object.defineProperty(exports, "__esModule", ({
6817 value: true
6818}));
6819exports.decodeInt64 = decodeInt64;
6820exports.decodeUInt64 = decodeUInt64;
6821exports.decodeInt32 = decodeInt32;
6822exports.decodeUInt32 = decodeUInt32;
6823exports.encodeU32 = encodeU32;
6824exports.encodeI32 = encodeI32;
6825exports.encodeI64 = encodeI64;
6826exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0;
6827
6828var _leb = _interopRequireDefault(__webpack_require__(36524));
6829
6830function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6831
6832/**
6833 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
6834 * max = ceil(32/7)
6835 */
6836var MAX_NUMBER_OF_BYTE_U32 = 5;
6837/**
6838 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
6839 * max = ceil(64/7)
6840 */
6841
6842exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32;
6843var MAX_NUMBER_OF_BYTE_U64 = 10;
6844exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64;
6845
6846function decodeInt64(encodedBuffer, index) {
6847 return _leb.default.decodeInt64(encodedBuffer, index);
6848}
6849
6850function decodeUInt64(encodedBuffer, index) {
6851 return _leb.default.decodeUInt64(encodedBuffer, index);
6852}
6853
6854function decodeInt32(encodedBuffer, index) {
6855 return _leb.default.decodeInt32(encodedBuffer, index);
6856}
6857
6858function decodeUInt32(encodedBuffer, index) {
6859 return _leb.default.decodeUInt32(encodedBuffer, index);
6860}
6861
6862function encodeU32(v) {
6863 return _leb.default.encodeUInt32(v);
6864}
6865
6866function encodeI32(v) {
6867 return _leb.default.encodeInt32(v);
6868}
6869
6870function encodeI64(v) {
6871 return _leb.default.encodeInt64(v);
6872}
6873
6874/***/ }),
6875
6876/***/ 36524:
6877/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6878
6879"use strict";
6880// Copyright 2012 The Obvious Corporation.
6881
6882/*
6883 * leb: LEB128 utilities.
6884 */
6885
6886/*
6887 * Modules used
6888 */
6889
6890
6891Object.defineProperty(exports, "__esModule", ({
6892 value: true
6893}));
6894exports.default = void 0;
6895
6896var _long = _interopRequireDefault(__webpack_require__(77960));
6897
6898var bits = _interopRequireWildcard(__webpack_require__(34279));
6899
6900var bufs = _interopRequireWildcard(__webpack_require__(83006));
6901
6902function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
6903
6904function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6905
6906/*
6907 * Module variables
6908 */
6909
6910/** The minimum possible 32-bit signed int. */
6911var MIN_INT32 = -0x80000000;
6912/** The maximum possible 32-bit signed int. */
6913
6914var MAX_INT32 = 0x7fffffff;
6915/** The maximum possible 32-bit unsigned int. */
6916
6917var MAX_UINT32 = 0xffffffff;
6918/** The minimum possible 64-bit signed int. */
6919// const MIN_INT64 = -0x8000000000000000;
6920
6921/**
6922 * The maximum possible 64-bit signed int that is representable as a
6923 * JavaScript number.
6924 */
6925// const MAX_INT64 = 0x7ffffffffffffc00;
6926
6927/**
6928 * The maximum possible 64-bit unsigned int that is representable as a
6929 * JavaScript number.
6930 */
6931// const MAX_UINT64 = 0xfffffffffffff800;
6932
6933/*
6934 * Helper functions
6935 */
6936
6937/**
6938 * Determines the number of bits required to encode the number
6939 * represented in the given buffer as a signed value. The buffer is
6940 * taken to represent a signed number in little-endian form.
6941 *
6942 * The number of bits to encode is the (zero-based) bit number of the
6943 * highest-order non-sign-matching bit, plus two. For example:
6944 *
6945 * 11111011 01110101
6946 * high low
6947 *
6948 * The sign bit here is 1 (that is, it's a negative number). The highest
6949 * bit number that doesn't match the sign is bit #10 (where the lowest-order
6950 * bit is bit #0). So, we have to encode at least 12 bits total.
6951 *
6952 * As a special degenerate case, the numbers 0 and -1 each require just one bit.
6953 */
6954
6955function signedBitCount(buffer) {
6956 return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2;
6957}
6958/**
6959 * Determines the number of bits required to encode the number
6960 * represented in the given buffer as an unsigned value. The buffer is
6961 * taken to represent an unsigned number in little-endian form.
6962 *
6963 * The number of bits to encode is the (zero-based) bit number of the
6964 * highest-order 1 bit, plus one. For example:
6965 *
6966 * 00011000 01010011
6967 * high low
6968 *
6969 * The highest-order 1 bit here is bit #12 (where the lowest-order bit
6970 * is bit #0). So, we have to encode at least 13 bits total.
6971 *
6972 * As a special degenerate case, the number 0 requires 1 bit.
6973 */
6974
6975
6976function unsignedBitCount(buffer) {
6977 var result = bits.highOrder(1, buffer) + 1;
6978 return result ? result : 1;
6979}
6980/**
6981 * Common encoder for both signed and unsigned ints. This takes a
6982 * bigint-ish buffer, returning an LEB128-encoded buffer.
6983 */
6984
6985
6986function encodeBufferCommon(buffer, signed) {
6987 var signBit;
6988 var bitCount;
6989
6990 if (signed) {
6991 signBit = bits.getSign(buffer);
6992 bitCount = signedBitCount(buffer);
6993 } else {
6994 signBit = 0;
6995 bitCount = unsignedBitCount(buffer);
6996 }
6997
6998 var byteCount = Math.ceil(bitCount / 7);
6999 var result = bufs.alloc(byteCount);
7000
7001 for (var i = 0; i < byteCount; i++) {
7002 var payload = bits.extract(buffer, i * 7, 7, signBit);
7003 result[i] = payload | 0x80;
7004 } // Mask off the top bit of the last byte, to indicate the end of the
7005 // encoding.
7006
7007
7008 result[byteCount - 1] &= 0x7f;
7009 return result;
7010}
7011/**
7012 * Gets the byte-length of the value encoded in the given buffer at
7013 * the given index.
7014 */
7015
7016
7017function encodedLength(encodedBuffer, index) {
7018 var result = 0;
7019
7020 while (encodedBuffer[index + result] >= 0x80) {
7021 result++;
7022 }
7023
7024 result++; // to account for the last byte
7025
7026 if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives
7027 // throw new Error("integer representation too long");
7028 }
7029
7030 return result;
7031}
7032/**
7033 * Common decoder for both signed and unsigned ints. This takes an
7034 * LEB128-encoded buffer, returning a bigint-ish buffer.
7035 */
7036
7037
7038function decodeBufferCommon(encodedBuffer, index, signed) {
7039 index = index === undefined ? 0 : index;
7040 var length = encodedLength(encodedBuffer, index);
7041 var bitLength = length * 7;
7042 var byteLength = Math.ceil(bitLength / 8);
7043 var result = bufs.alloc(byteLength);
7044 var outIndex = 0;
7045
7046 while (length > 0) {
7047 bits.inject(result, outIndex, 7, encodedBuffer[index]);
7048 outIndex += 7;
7049 index++;
7050 length--;
7051 }
7052
7053 var signBit;
7054 var signByte;
7055
7056 if (signed) {
7057 // Sign-extend the last byte.
7058 var lastByte = result[byteLength - 1];
7059 var endBit = outIndex % 8;
7060
7061 if (endBit !== 0) {
7062 var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
7063
7064 lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff;
7065 }
7066
7067 signBit = lastByte >> 7;
7068 signByte = signBit * 0xff;
7069 } else {
7070 signBit = 0;
7071 signByte = 0;
7072 } // Slice off any superfluous bytes, that is, ones that add no meaningful
7073 // bits (because the value would be the same if they were removed).
7074
7075
7076 while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) {
7077 byteLength--;
7078 }
7079
7080 result = bufs.resize(result, byteLength);
7081 return {
7082 value: result,
7083 nextIndex: index
7084 };
7085}
7086/*
7087 * Exported bindings
7088 */
7089
7090
7091function encodeIntBuffer(buffer) {
7092 return encodeBufferCommon(buffer, true);
7093}
7094
7095function decodeIntBuffer(encodedBuffer, index) {
7096 return decodeBufferCommon(encodedBuffer, index, true);
7097}
7098
7099function encodeInt32(num) {
7100 var buf = bufs.alloc(4);
7101 buf.writeInt32LE(num, 0);
7102 var result = encodeIntBuffer(buf);
7103 bufs.free(buf);
7104 return result;
7105}
7106
7107function decodeInt32(encodedBuffer, index) {
7108 var result = decodeIntBuffer(encodedBuffer, index);
7109 var parsed = bufs.readInt(result.value);
7110 var value = parsed.value;
7111 bufs.free(result.value);
7112
7113 if (value < MIN_INT32 || value > MAX_INT32) {
7114 throw new Error("integer too large");
7115 }
7116
7117 return {
7118 value: value,
7119 nextIndex: result.nextIndex
7120 };
7121}
7122
7123function encodeInt64(num) {
7124 var buf = bufs.alloc(8);
7125 bufs.writeInt64(num, buf);
7126 var result = encodeIntBuffer(buf);
7127 bufs.free(buf);
7128 return result;
7129}
7130
7131function decodeInt64(encodedBuffer, index) {
7132 var result = decodeIntBuffer(encodedBuffer, index);
7133
7134 var value = _long.default.fromBytesLE(result.value, false);
7135
7136 bufs.free(result.value);
7137 return {
7138 value: value,
7139 nextIndex: result.nextIndex,
7140 lossy: false
7141 };
7142}
7143
7144function encodeUIntBuffer(buffer) {
7145 return encodeBufferCommon(buffer, false);
7146}
7147
7148function decodeUIntBuffer(encodedBuffer, index) {
7149 return decodeBufferCommon(encodedBuffer, index, false);
7150}
7151
7152function encodeUInt32(num) {
7153 var buf = bufs.alloc(4);
7154 buf.writeUInt32LE(num, 0);
7155 var result = encodeUIntBuffer(buf);
7156 bufs.free(buf);
7157 return result;
7158}
7159
7160function decodeUInt32(encodedBuffer, index) {
7161 var result = decodeUIntBuffer(encodedBuffer, index);
7162 var parsed = bufs.readUInt(result.value);
7163 var value = parsed.value;
7164 bufs.free(result.value);
7165
7166 if (value > MAX_UINT32) {
7167 throw new Error("integer too large");
7168 }
7169
7170 return {
7171 value: value,
7172 nextIndex: result.nextIndex
7173 };
7174}
7175
7176function encodeUInt64(num) {
7177 var buf = bufs.alloc(8);
7178 bufs.writeUInt64(num, buf);
7179 var result = encodeUIntBuffer(buf);
7180 bufs.free(buf);
7181 return result;
7182}
7183
7184function decodeUInt64(encodedBuffer, index) {
7185 var result = decodeUIntBuffer(encodedBuffer, index);
7186
7187 var value = _long.default.fromBytesLE(result.value, true);
7188
7189 bufs.free(result.value);
7190 return {
7191 value: value,
7192 nextIndex: result.nextIndex,
7193 lossy: false
7194 };
7195}
7196
7197var _default = {
7198 decodeInt32: decodeInt32,
7199 decodeInt64: decodeInt64,
7200 decodeIntBuffer: decodeIntBuffer,
7201 decodeUInt32: decodeUInt32,
7202 decodeUInt64: decodeUInt64,
7203 decodeUIntBuffer: decodeUIntBuffer,
7204 encodeInt32: encodeInt32,
7205 encodeInt64: encodeInt64,
7206 encodeIntBuffer: encodeIntBuffer,
7207 encodeUInt32: encodeUInt32,
7208 encodeUInt64: encodeUInt64,
7209 encodeUIntBuffer: encodeUIntBuffer
7210};
7211exports.default = _default;
7212
7213/***/ }),
7214
7215/***/ 53731:
7216/***/ (function(__unused_webpack_module, exports) {
7217
7218"use strict";
7219
7220
7221Object.defineProperty(exports, "__esModule", ({
7222 value: true
7223}));
7224exports.decode = decode;
7225
7226function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7227
7228function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
7229
7230function con(b) {
7231 if ((b & 0xc0) === 0x80) {
7232 return b & 0x3f;
7233 } else {
7234 throw new Error("invalid UTF-8 encoding");
7235 }
7236}
7237
7238function code(min, n) {
7239 if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
7240 throw new Error("invalid UTF-8 encoding");
7241 } else {
7242 return n;
7243 }
7244}
7245
7246function decode(bytes) {
7247 return _decode(bytes).map(function (x) {
7248 return String.fromCharCode(x);
7249 }).join("");
7250}
7251
7252function _decode(bytes) {
7253 if (bytes.length === 0) {
7254 return [];
7255 }
7256 /**
7257 * 1 byte
7258 */
7259
7260
7261 {
7262 var _bytes = _toArray(bytes),
7263 b1 = _bytes[0],
7264 bs = _bytes.slice(1);
7265
7266 if (b1 < 0x80) {
7267 return [code(0x0, b1)].concat(_toConsumableArray(_decode(bs)));
7268 }
7269
7270 if (b1 < 0xc0) {
7271 throw new Error("invalid UTF-8 encoding");
7272 }
7273 }
7274 /**
7275 * 2 bytes
7276 */
7277
7278 {
7279 var _bytes2 = _toArray(bytes),
7280 _b = _bytes2[0],
7281 b2 = _bytes2[1],
7282 _bs = _bytes2.slice(2);
7283
7284 if (_b < 0xe0) {
7285 return [code(0x80, ((_b & 0x1f) << 6) + con(b2))].concat(_toConsumableArray(_decode(_bs)));
7286 }
7287 }
7288 /**
7289 * 3 bytes
7290 */
7291
7292 {
7293 var _bytes3 = _toArray(bytes),
7294 _b2 = _bytes3[0],
7295 _b3 = _bytes3[1],
7296 b3 = _bytes3[2],
7297 _bs2 = _bytes3.slice(3);
7298
7299 if (_b2 < 0xf0) {
7300 return [code(0x800, ((_b2 & 0x0f) << 12) + (con(_b3) << 6) + con(b3))].concat(_toConsumableArray(_decode(_bs2)));
7301 }
7302 }
7303 /**
7304 * 4 bytes
7305 */
7306
7307 {
7308 var _bytes4 = _toArray(bytes),
7309 _b4 = _bytes4[0],
7310 _b5 = _bytes4[1],
7311 _b6 = _bytes4[2],
7312 b4 = _bytes4[3],
7313 _bs3 = _bytes4.slice(4);
7314
7315 if (_b4 < 0xf8) {
7316 return [code(0x10000, (((_b4 & 0x07) << 18) + con(_b5) << 12) + (con(_b6) << 6) + con(b4))].concat(_toConsumableArray(_decode(_bs3)));
7317 }
7318 }
7319 throw new Error("invalid UTF-8 encoding");
7320}
7321
7322/***/ }),
7323
7324/***/ 13048:
7325/***/ (function(__unused_webpack_module, exports) {
7326
7327"use strict";
7328
7329
7330Object.defineProperty(exports, "__esModule", ({
7331 value: true
7332}));
7333exports.encode = encode;
7334
7335function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7336
7337function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
7338
7339function con(n) {
7340 return 0x80 | n & 0x3f;
7341}
7342
7343function encode(str) {
7344 var arr = str.split("").map(function (x) {
7345 return x.charCodeAt(0);
7346 });
7347 return _encode(arr);
7348}
7349
7350function _encode(arr) {
7351 if (arr.length === 0) {
7352 return [];
7353 }
7354
7355 var _arr = _toArray(arr),
7356 n = _arr[0],
7357 ns = _arr.slice(1);
7358
7359 if (n < 0) {
7360 throw new Error("utf8");
7361 }
7362
7363 if (n < 0x80) {
7364 return [n].concat(_toConsumableArray(_encode(ns)));
7365 }
7366
7367 if (n < 0x800) {
7368 return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
7369 }
7370
7371 if (n < 0x10000) {
7372 return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
7373 }
7374
7375 if (n < 0x110000) {
7376 return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
7377 }
7378
7379 throw new Error("utf8");
7380}
7381
7382/***/ }),
7383
7384/***/ 86881:
7385/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7386
7387"use strict";
7388
7389
7390Object.defineProperty(exports, "__esModule", ({
7391 value: true
7392}));
7393Object.defineProperty(exports, "decode", ({
7394 enumerable: true,
7395 get: function get() {
7396 return _decoder.decode;
7397 }
7398}));
7399Object.defineProperty(exports, "encode", ({
7400 enumerable: true,
7401 get: function get() {
7402 return _encoder.encode;
7403 }
7404}));
7405
7406var _decoder = __webpack_require__(53731);
7407
7408var _encoder = __webpack_require__(13048);
7409
7410/***/ }),
7411
7412/***/ 34586:
7413/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7414
7415"use strict";
7416
7417
7418Object.defineProperty(exports, "__esModule", ({
7419 value: true
7420}));
7421exports.encodeVersion = encodeVersion;
7422exports.encodeHeader = encodeHeader;
7423exports.encodeU32 = encodeU32;
7424exports.encodeI32 = encodeI32;
7425exports.encodeI64 = encodeI64;
7426exports.encodeVec = encodeVec;
7427exports.encodeValtype = encodeValtype;
7428exports.encodeMutability = encodeMutability;
7429exports.encodeUTF8Vec = encodeUTF8Vec;
7430exports.encodeLimits = encodeLimits;
7431exports.encodeModuleImport = encodeModuleImport;
7432exports.encodeSectionMetadata = encodeSectionMetadata;
7433exports.encodeCallInstruction = encodeCallInstruction;
7434exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction;
7435exports.encodeModuleExport = encodeModuleExport;
7436exports.encodeTypeInstruction = encodeTypeInstruction;
7437exports.encodeInstr = encodeInstr;
7438exports.encodeStringLiteral = encodeStringLiteral;
7439exports.encodeGlobal = encodeGlobal;
7440exports.encodeFuncBody = encodeFuncBody;
7441exports.encodeIndexInFuncSection = encodeIndexInFuncSection;
7442exports.encodeElem = encodeElem;
7443
7444var leb = _interopRequireWildcard(__webpack_require__(21681));
7445
7446var ieee754 = _interopRequireWildcard(__webpack_require__(59436));
7447
7448var utf8 = _interopRequireWildcard(__webpack_require__(86881));
7449
7450var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(19015));
7451
7452var _index = __webpack_require__(71119);
7453
7454function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7455
7456function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
7457
7458function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7459
7460function assertNotIdentifierNode(n) {
7461 if (n.type === "Identifier") {
7462 throw new Error("Unsupported node Identifier");
7463 }
7464}
7465
7466function encodeVersion(v) {
7467 var bytes = _helperWasmBytecode.default.moduleVersion;
7468 bytes[0] = v;
7469 return bytes;
7470}
7471
7472function encodeHeader() {
7473 return _helperWasmBytecode.default.magicModuleHeader;
7474}
7475
7476function encodeU32(v) {
7477 var uint8view = new Uint8Array(leb.encodeU32(v));
7478
7479 var array = _toConsumableArray(uint8view);
7480
7481 return array;
7482}
7483
7484function encodeI32(v) {
7485 var uint8view = new Uint8Array(leb.encodeI32(v));
7486
7487 var array = _toConsumableArray(uint8view);
7488
7489 return array;
7490}
7491
7492function encodeI64(v) {
7493 var uint8view = new Uint8Array(leb.encodeI64(v));
7494
7495 var array = _toConsumableArray(uint8view);
7496
7497 return array;
7498}
7499
7500function encodeVec(elements) {
7501 var size = encodeU32(elements.length);
7502 return _toConsumableArray(size).concat(_toConsumableArray(elements));
7503}
7504
7505function encodeValtype(v) {
7506 var byte = _helperWasmBytecode.default.valtypesByString[v];
7507
7508 if (typeof byte === "undefined") {
7509 throw new Error("Unknown valtype: " + v);
7510 }
7511
7512 return parseInt(byte, 10);
7513}
7514
7515function encodeMutability(v) {
7516 var byte = _helperWasmBytecode.default.globalTypesByString[v];
7517
7518 if (typeof byte === "undefined") {
7519 throw new Error("Unknown mutability: " + v);
7520 }
7521
7522 return parseInt(byte, 10);
7523}
7524
7525function encodeUTF8Vec(str) {
7526 return encodeVec(utf8.encode(str));
7527}
7528
7529function encodeLimits(n) {
7530 var out = [];
7531
7532 if (typeof n.max === "number") {
7533 out.push(0x01);
7534 out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof
7535
7536 out.push.apply(out, _toConsumableArray(encodeU32(n.max)));
7537 } else {
7538 out.push(0x00);
7539 out.push.apply(out, _toConsumableArray(encodeU32(n.min)));
7540 }
7541
7542 return out;
7543}
7544
7545function encodeModuleImport(n) {
7546 var out = [];
7547 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.module)));
7548 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
7549
7550 switch (n.descr.type) {
7551 case "GlobalType":
7552 {
7553 out.push(0x03); // $FlowIgnore: GlobalType ensure that these props exists
7554
7555 out.push(encodeValtype(n.descr.valtype)); // $FlowIgnore: GlobalType ensure that these props exists
7556
7557 out.push(encodeMutability(n.descr.mutability));
7558 break;
7559 }
7560
7561 case "Memory":
7562 {
7563 out.push(0x02); // $FlowIgnore
7564
7565 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
7566 break;
7567 }
7568
7569 case "Table":
7570 {
7571 out.push(0x01);
7572 out.push(0x70); // element type
7573 // $FlowIgnore
7574
7575 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
7576 break;
7577 }
7578
7579 case "FuncImportDescr":
7580 {
7581 out.push(0x00); // $FlowIgnore
7582
7583 assertNotIdentifierNode(n.descr.id); // $FlowIgnore
7584
7585 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
7586 break;
7587 }
7588
7589 default:
7590 throw new Error("Unsupport operation: encode module import of type: " + n.descr.type);
7591 }
7592
7593 return out;
7594}
7595
7596function encodeSectionMetadata(n) {
7597 var out = [];
7598 var sectionId = _helperWasmBytecode.default.sections[n.section];
7599
7600 if (typeof sectionId === "undefined") {
7601 throw new Error("Unknown section: " + n.section);
7602 }
7603
7604 if (n.section === "start") {
7605 /**
7606 * This is not implemented yet because it's a special case which
7607 * doesn't have a vector in its section.
7608 */
7609 throw new Error("Unsupported section encoding of type start");
7610 }
7611
7612 out.push(sectionId);
7613 out.push.apply(out, _toConsumableArray(encodeU32(n.size.value)));
7614 out.push.apply(out, _toConsumableArray(encodeU32(n.vectorOfSize.value)));
7615 return out;
7616}
7617
7618function encodeCallInstruction(n) {
7619 var out = [];
7620 assertNotIdentifierNode(n.index);
7621 out.push(0x10); // $FlowIgnore
7622
7623 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value)));
7624 return out;
7625}
7626
7627function encodeCallIndirectInstruction(n) {
7628 var out = []; // $FlowIgnore
7629
7630 assertNotIdentifierNode(n.index);
7631 out.push(0x11); // $FlowIgnore
7632
7633 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); // add a reserved byte
7634
7635 out.push(0x00);
7636 return out;
7637}
7638
7639function encodeModuleExport(n) {
7640 var out = [];
7641 assertNotIdentifierNode(n.descr.id);
7642 var exportTypeByteString = _helperWasmBytecode.default.exportTypesByName[n.descr.exportType];
7643
7644 if (typeof exportTypeByteString === "undefined") {
7645 throw new Error("Unknown export of type: " + n.descr.exportType);
7646 }
7647
7648 var exportTypeByte = parseInt(exportTypeByteString, 10);
7649 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
7650 out.push(exportTypeByte); // $FlowIgnore
7651
7652 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
7653 return out;
7654}
7655
7656function encodeTypeInstruction(n) {
7657 var out = [0x60];
7658 var params = n.functype.params.map(function (x) {
7659 return x.valtype;
7660 }).map(encodeValtype);
7661 var results = n.functype.results.map(encodeValtype);
7662 out.push.apply(out, _toConsumableArray(encodeVec(params)));
7663 out.push.apply(out, _toConsumableArray(encodeVec(results)));
7664 return out;
7665}
7666
7667function encodeInstr(n) {
7668 var out = [];
7669 var instructionName = n.id;
7670
7671 if (typeof n.object === "string") {
7672 instructionName = "".concat(n.object, ".").concat(String(n.id));
7673 }
7674
7675 var byteString = _helperWasmBytecode.default.symbolsByName[instructionName];
7676
7677 if (typeof byteString === "undefined") {
7678 throw new Error("encodeInstr: unknown instruction " + JSON.stringify(instructionName));
7679 }
7680
7681 var byte = parseInt(byteString, 10);
7682 out.push(byte);
7683
7684 if (n.args) {
7685 n.args.forEach(function (arg) {
7686 var encoder = encodeU32; // find correct encoder
7687
7688 if (n.object === "i32") {
7689 encoder = encodeI32;
7690 }
7691
7692 if (n.object === "i64") {
7693 encoder = encodeI64;
7694 }
7695
7696 if (n.object === "f32") {
7697 encoder = ieee754.encodeF32;
7698 }
7699
7700 if (n.object === "f64") {
7701 encoder = ieee754.encodeF64;
7702 }
7703
7704 if (arg.type === "NumberLiteral" || arg.type === "FloatLiteral" || arg.type === "LongNumberLiteral") {
7705 // $FlowIgnore
7706 out.push.apply(out, _toConsumableArray(encoder(arg.value)));
7707 } else {
7708 throw new Error("Unsupported instruction argument encoding " + JSON.stringify(arg.type));
7709 }
7710 });
7711 }
7712
7713 return out;
7714}
7715
7716function encodeExpr(instrs) {
7717 var out = [];
7718 instrs.forEach(function (instr) {
7719 // $FlowIgnore
7720 var n = (0, _index.encodeNode)(instr);
7721 out.push.apply(out, _toConsumableArray(n));
7722 });
7723 return out;
7724}
7725
7726function encodeStringLiteral(n) {
7727 return encodeUTF8Vec(n.value);
7728}
7729
7730function encodeGlobal(n) {
7731 var out = [];
7732 var _n$globalType = n.globalType,
7733 valtype = _n$globalType.valtype,
7734 mutability = _n$globalType.mutability;
7735 out.push(encodeValtype(valtype));
7736 out.push(encodeMutability(mutability));
7737 out.push.apply(out, _toConsumableArray(encodeExpr(n.init)));
7738 return out;
7739}
7740
7741function encodeFuncBody(n) {
7742 var out = [];
7743 out.push(-1); // temporary function body size
7744 // FIXME(sven): get the func locals?
7745
7746 var localBytes = encodeVec([]);
7747 out.push.apply(out, _toConsumableArray(localBytes));
7748 var funcBodyBytes = encodeExpr(n.body);
7749 out[0] = funcBodyBytes.length + localBytes.length;
7750 out.push.apply(out, _toConsumableArray(funcBodyBytes));
7751 return out;
7752}
7753
7754function encodeIndexInFuncSection(n) {
7755 assertNotIdentifierNode(n.index); // $FlowIgnore
7756
7757 return encodeU32(n.index.value);
7758}
7759
7760function encodeElem(n) {
7761 var out = [];
7762 assertNotIdentifierNode(n.table); // $FlowIgnore
7763
7764 out.push.apply(out, _toConsumableArray(encodeU32(n.table.value)));
7765 out.push.apply(out, _toConsumableArray(encodeExpr(n.offset))); // $FlowIgnore
7766
7767 var funcs = n.funcs.reduce(function (acc, x) {
7768 return _toConsumableArray(acc).concat(_toConsumableArray(encodeU32(x.value)));
7769 }, []);
7770 out.push.apply(out, _toConsumableArray(encodeVec(funcs)));
7771 return out;
7772}
7773
7774/***/ }),
7775
7776/***/ 71119:
7777/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7778
7779"use strict";
7780
7781
7782Object.defineProperty(exports, "__esModule", ({
7783 value: true
7784}));
7785exports.encodeNode = encodeNode;
7786exports.encodeU32 = void 0;
7787
7788var encoder = _interopRequireWildcard(__webpack_require__(34586));
7789
7790function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
7791
7792function encodeNode(n) {
7793 switch (n.type) {
7794 case "ModuleImport":
7795 // $FlowIgnore: ModuleImport ensure that the node is well formated
7796 return encoder.encodeModuleImport(n);
7797
7798 case "SectionMetadata":
7799 // $FlowIgnore: SectionMetadata ensure that the node is well formated
7800 return encoder.encodeSectionMetadata(n);
7801
7802 case "CallInstruction":
7803 // $FlowIgnore: SectionMetadata ensure that the node is well formated
7804 return encoder.encodeCallInstruction(n);
7805
7806 case "CallIndirectInstruction":
7807 // $FlowIgnore: SectionMetadata ensure that the node is well formated
7808 return encoder.encodeCallIndirectInstruction(n);
7809
7810 case "TypeInstruction":
7811 return encoder.encodeTypeInstruction(n);
7812
7813 case "Instr":
7814 // $FlowIgnore
7815 return encoder.encodeInstr(n);
7816
7817 case "ModuleExport":
7818 // $FlowIgnore: SectionMetadata ensure that the node is well formated
7819 return encoder.encodeModuleExport(n);
7820
7821 case "Global":
7822 // $FlowIgnore
7823 return encoder.encodeGlobal(n);
7824
7825 case "Func":
7826 return encoder.encodeFuncBody(n);
7827
7828 case "IndexInFuncSection":
7829 return encoder.encodeIndexInFuncSection(n);
7830
7831 case "StringLiteral":
7832 return encoder.encodeStringLiteral(n);
7833
7834 case "Elem":
7835 return encoder.encodeElem(n);
7836
7837 default:
7838 throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type));
7839 }
7840}
7841
7842var encodeU32 = encoder.encodeU32;
7843exports.encodeU32 = encodeU32;
7844
7845/***/ }),
7846
7847/***/ 56550:
7848/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7849
7850"use strict";
7851
7852
7853Object.defineProperty(exports, "__esModule", ({
7854 value: true
7855}));
7856exports.applyOperations = applyOperations;
7857
7858var _wasmGen = __webpack_require__(41929);
7859
7860var _encoder = __webpack_require__(16026);
7861
7862var _ast = __webpack_require__(19300);
7863
7864var _helperWasmSection = __webpack_require__(37427);
7865
7866var _helperBuffer = __webpack_require__(5401);
7867
7868var _helperWasmBytecode = __webpack_require__(1594);
7869
7870function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
7871
7872function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
7873
7874function shiftLocNodeByDelta(node, delta) {
7875 (0, _ast.assertHasLoc)(node); // $FlowIgnore: assertHasLoc ensures that
7876
7877 node.loc.start.column += delta; // $FlowIgnore: assertHasLoc ensures that
7878
7879 node.loc.end.column += delta;
7880}
7881
7882function applyUpdate(ast, uint8Buffer, _ref) {
7883 var _ref2 = _slicedToArray(_ref, 2),
7884 oldNode = _ref2[0],
7885 newNode = _ref2[1];
7886
7887 var deltaElements = 0;
7888 (0, _ast.assertHasLoc)(oldNode);
7889 var sectionName = (0, _helperWasmBytecode.getSectionForNode)(newNode);
7890 var replacementByteArray = (0, _wasmGen.encodeNode)(newNode);
7891 /**
7892 * Replace new node as bytes
7893 */
7894
7895 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that
7896 oldNode.loc.start.column, // $FlowIgnore: assertHasLoc ensures that
7897 oldNode.loc.end.column, replacementByteArray);
7898 /**
7899 * Update function body size if needed
7900 */
7901
7902 if (sectionName === "code") {
7903 // Find the parent func
7904 (0, _ast.traverse)(ast, {
7905 Func: function Func(_ref3) {
7906 var node = _ref3.node;
7907 var funcHasThisIntr = node.body.find(function (n) {
7908 return n === newNode;
7909 }) !== undefined; // Update func's body size if needed
7910
7911 if (funcHasThisIntr === true) {
7912 // These are the old functions locations informations
7913 (0, _ast.assertHasLoc)(node);
7914 var oldNodeSize = (0, _wasmGen.encodeNode)(oldNode).length;
7915 var bodySizeDeltaBytes = replacementByteArray.length - oldNodeSize;
7916
7917 if (bodySizeDeltaBytes !== 0) {
7918 var newValue = node.metadata.bodySize + bodySizeDeltaBytes;
7919 var newByteArray = (0, _encoder.encodeU32)(newValue); // function body size byte
7920 // FIXME(sven): only handles one byte u32
7921
7922 var start = node.loc.start.column;
7923 var end = start + 1;
7924 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newByteArray);
7925 }
7926 }
7927 }
7928 });
7929 }
7930 /**
7931 * Update section size
7932 */
7933
7934
7935 var deltaBytes = replacementByteArray.length - ( // $FlowIgnore: assertHasLoc ensures that
7936 oldNode.loc.end.column - oldNode.loc.start.column); // Init location informations
7937
7938 newNode.loc = {
7939 start: {
7940 line: -1,
7941 column: -1
7942 },
7943 end: {
7944 line: -1,
7945 column: -1
7946 }
7947 }; // Update new node end position
7948 // $FlowIgnore: assertHasLoc ensures that
7949
7950 newNode.loc.start.column = oldNode.loc.start.column; // $FlowIgnore: assertHasLoc ensures that
7951
7952 newNode.loc.end.column = // $FlowIgnore: assertHasLoc ensures that
7953 oldNode.loc.start.column + replacementByteArray.length;
7954 return {
7955 uint8Buffer: uint8Buffer,
7956 deltaBytes: deltaBytes,
7957 deltaElements: deltaElements
7958 };
7959}
7960
7961function applyDelete(ast, uint8Buffer, node) {
7962 var deltaElements = -1; // since we removed an element
7963
7964 (0, _ast.assertHasLoc)(node);
7965 var sectionName = (0, _helperWasmBytecode.getSectionForNode)(node);
7966
7967 if (sectionName === "start") {
7968 var sectionMetadata = (0, _ast.getSectionMetadata)(ast, "start");
7969 /**
7970 * The start section only contains one element,
7971 * we need to remove the whole section
7972 */
7973
7974 uint8Buffer = (0, _helperWasmSection.removeSections)(ast, uint8Buffer, "start");
7975
7976 var _deltaBytes = -(sectionMetadata.size.value + 1);
7977 /* section id */
7978
7979
7980 return {
7981 uint8Buffer: uint8Buffer,
7982 deltaBytes: _deltaBytes,
7983 deltaElements: deltaElements
7984 };
7985 } // replacement is nothing
7986
7987
7988 var replacement = [];
7989 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, // $FlowIgnore: assertHasLoc ensures that
7990 node.loc.start.column, // $FlowIgnore: assertHasLoc ensures that
7991 node.loc.end.column, replacement);
7992 /**
7993 * Update section
7994 */
7995 // $FlowIgnore: assertHasLoc ensures that
7996
7997 var deltaBytes = -(node.loc.end.column - node.loc.start.column);
7998 return {
7999 uint8Buffer: uint8Buffer,
8000 deltaBytes: deltaBytes,
8001 deltaElements: deltaElements
8002 };
8003}
8004
8005function applyAdd(ast, uint8Buffer, node) {
8006 var deltaElements = +1; // since we added an element
8007
8008 var sectionName = (0, _helperWasmBytecode.getSectionForNode)(node);
8009 var sectionMetadata = (0, _ast.getSectionMetadata)(ast, sectionName); // Section doesn't exists, we create an empty one
8010
8011 if (typeof sectionMetadata === "undefined") {
8012 var res = (0, _helperWasmSection.createEmptySection)(ast, uint8Buffer, sectionName);
8013 uint8Buffer = res.uint8Buffer;
8014 sectionMetadata = res.sectionMetadata;
8015 }
8016 /**
8017 * check that the expressions were ended
8018 */
8019
8020
8021 if ((0, _ast.isFunc)(node)) {
8022 // $FlowIgnore
8023 var body = node.body;
8024
8025 if (body.length === 0 || body[body.length - 1].id !== "end") {
8026 throw new Error("expressions must be ended");
8027 }
8028 }
8029
8030 if ((0, _ast.isGlobal)(node)) {
8031 // $FlowIgnore
8032 var body = node.init;
8033
8034 if (body.length === 0 || body[body.length - 1].id !== "end") {
8035 throw new Error("expressions must be ended");
8036 }
8037 }
8038 /**
8039 * Add nodes
8040 */
8041
8042
8043 var newByteArray = (0, _wasmGen.encodeNode)(node); // The size of the section doesn't include the storage of the size itself
8044 // we need to manually add it here
8045
8046 var start = (0, _ast.getEndOfSection)(sectionMetadata);
8047 var end = start;
8048 /**
8049 * Update section
8050 */
8051
8052 var deltaBytes = newByteArray.length;
8053 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newByteArray);
8054 node.loc = {
8055 start: {
8056 line: -1,
8057 column: start
8058 },
8059 end: {
8060 line: -1,
8061 column: start + deltaBytes
8062 }
8063 }; // for func add the additional metadata in the AST
8064
8065 if (node.type === "Func") {
8066 // the size is the first byte
8067 // FIXME(sven): handle LEB128 correctly here
8068 var bodySize = newByteArray[0];
8069 node.metadata = {
8070 bodySize: bodySize
8071 };
8072 }
8073
8074 if (node.type !== "IndexInFuncSection") {
8075 (0, _ast.orderedInsertNode)(ast.body[0], node);
8076 }
8077
8078 return {
8079 uint8Buffer: uint8Buffer,
8080 deltaBytes: deltaBytes,
8081 deltaElements: deltaElements
8082 };
8083}
8084
8085function applyOperations(ast, uint8Buffer, ops) {
8086 ops.forEach(function (op) {
8087 var state;
8088 var sectionName;
8089
8090 switch (op.kind) {
8091 case "update":
8092 state = applyUpdate(ast, uint8Buffer, [op.oldNode, op.node]);
8093 sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node);
8094 break;
8095
8096 case "delete":
8097 state = applyDelete(ast, uint8Buffer, op.node);
8098 sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node);
8099 break;
8100
8101 case "add":
8102 state = applyAdd(ast, uint8Buffer, op.node);
8103 sectionName = (0, _helperWasmBytecode.getSectionForNode)(op.node);
8104 break;
8105
8106 default:
8107 throw new Error("Unknown operation");
8108 }
8109 /**
8110 * Resize section vec size.
8111 * If the length of the LEB-encoded size changes, this can change
8112 * the byte length of the section and the offset for nodes in the
8113 * section. So we do this first before resizing section byte size
8114 * or shifting following operations' nodes.
8115 */
8116
8117
8118 if (state.deltaElements !== 0 && sectionName !== "start") {
8119 var oldBufferLength = state.uint8Buffer.length;
8120 state.uint8Buffer = (0, _helperWasmSection.resizeSectionVecSize)(ast, state.uint8Buffer, sectionName, state.deltaElements); // Infer bytes added/removed by comparing buffer lengths
8121
8122 state.deltaBytes += state.uint8Buffer.length - oldBufferLength;
8123 }
8124 /**
8125 * Resize section byte size.
8126 * If the length of the LEB-encoded size changes, this can change
8127 * the offset for nodes in the section. So we do this before
8128 * shifting following operations' nodes.
8129 */
8130
8131
8132 if (state.deltaBytes !== 0 && sectionName !== "start") {
8133 var _oldBufferLength = state.uint8Buffer.length;
8134 state.uint8Buffer = (0, _helperWasmSection.resizeSectionByteSize)(ast, state.uint8Buffer, sectionName, state.deltaBytes); // Infer bytes added/removed by comparing buffer lengths
8135
8136 state.deltaBytes += state.uint8Buffer.length - _oldBufferLength;
8137 }
8138 /**
8139 * Shift following operation's nodes
8140 */
8141
8142
8143 if (state.deltaBytes !== 0) {
8144 ops.forEach(function (op) {
8145 // We don't need to handle add ops, they are positioning independent
8146 switch (op.kind) {
8147 case "update":
8148 shiftLocNodeByDelta(op.oldNode, state.deltaBytes);
8149 break;
8150
8151 case "delete":
8152 shiftLocNodeByDelta(op.node, state.deltaBytes);
8153 break;
8154 }
8155 });
8156 }
8157
8158 uint8Buffer = state.uint8Buffer;
8159 });
8160 return uint8Buffer;
8161}
8162
8163/***/ }),
8164
8165/***/ 65584:
8166/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8167
8168"use strict";
8169
8170
8171Object.defineProperty(exports, "__esModule", ({
8172 value: true
8173}));
8174exports.edit = edit;
8175exports.editWithAST = editWithAST;
8176exports.add = add;
8177exports.addWithAST = addWithAST;
8178
8179var _wasmParser = __webpack_require__(17192);
8180
8181var _ast = __webpack_require__(19300);
8182
8183var _clone = __webpack_require__(49345);
8184
8185var _wasmOpt = __webpack_require__(46421);
8186
8187var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(1594));
8188
8189var _apply = __webpack_require__(56550);
8190
8191function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
8192
8193function hashNode(node) {
8194 return JSON.stringify(node);
8195}
8196
8197function preprocess(ab) {
8198 var optBin = (0, _wasmOpt.shrinkPaddedLEB128)(new Uint8Array(ab));
8199 return optBin.buffer;
8200}
8201
8202function sortBySectionOrder(nodes) {
8203 var originalOrder = new Map();
8204 var _iteratorNormalCompletion = true;
8205 var _didIteratorError = false;
8206 var _iteratorError = undefined;
8207
8208 try {
8209 for (var _iterator = nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
8210 var _node = _step.value;
8211 originalOrder.set(_node, originalOrder.size);
8212 }
8213 } catch (err) {
8214 _didIteratorError = true;
8215 _iteratorError = err;
8216 } finally {
8217 try {
8218 if (!_iteratorNormalCompletion && _iterator.return != null) {
8219 _iterator.return();
8220 }
8221 } finally {
8222 if (_didIteratorError) {
8223 throw _iteratorError;
8224 }
8225 }
8226 }
8227
8228 nodes.sort(function (a, b) {
8229 var sectionA = (0, _helperWasmBytecode.getSectionForNode)(a);
8230 var sectionB = (0, _helperWasmBytecode.getSectionForNode)(b);
8231 var aId = _helperWasmBytecode.default.sections[sectionA];
8232 var bId = _helperWasmBytecode.default.sections[sectionB];
8233
8234 if (typeof aId !== "number" || typeof bId !== "number") {
8235 throw new Error("Section id not found");
8236 }
8237
8238 if (aId === bId) {
8239 // $FlowIgnore originalOrder is filled for all nodes
8240 return originalOrder.get(a) - originalOrder.get(b);
8241 }
8242
8243 return aId - bId;
8244 });
8245}
8246
8247function edit(ab, visitors) {
8248 ab = preprocess(ab);
8249 var ast = (0, _wasmParser.decode)(ab);
8250 return editWithAST(ast, ab, visitors);
8251}
8252
8253function editWithAST(ast, ab, visitors) {
8254 var operations = [];
8255 var uint8Buffer = new Uint8Array(ab);
8256 var nodeBefore;
8257
8258 function before(type, path) {
8259 nodeBefore = (0, _clone.cloneNode)(path.node);
8260 }
8261
8262 function after(type, path) {
8263 if (path.node._deleted === true) {
8264 operations.push({
8265 kind: "delete",
8266 node: path.node
8267 }); // $FlowIgnore
8268 } else if (hashNode(nodeBefore) !== hashNode(path.node)) {
8269 operations.push({
8270 kind: "update",
8271 oldNode: nodeBefore,
8272 node: path.node
8273 });
8274 }
8275 }
8276
8277 (0, _ast.traverse)(ast, visitors, before, after);
8278 uint8Buffer = (0, _apply.applyOperations)(ast, uint8Buffer, operations);
8279 return uint8Buffer.buffer;
8280}
8281
8282function add(ab, newNodes) {
8283 ab = preprocess(ab);
8284 var ast = (0, _wasmParser.decode)(ab);
8285 return addWithAST(ast, ab, newNodes);
8286}
8287
8288function addWithAST(ast, ab, newNodes) {
8289 // Sort nodes by insertion order
8290 sortBySectionOrder(newNodes);
8291 var uint8Buffer = new Uint8Array(ab); // Map node into operations
8292
8293 var operations = newNodes.map(function (n) {
8294 return {
8295 kind: "add",
8296 node: n
8297 };
8298 });
8299 uint8Buffer = (0, _apply.applyOperations)(ast, uint8Buffer, operations);
8300 return uint8Buffer.buffer;
8301}
8302
8303/***/ }),
8304
8305/***/ 49345:
8306/***/ (function(__unused_webpack_module, exports) {
8307
8308"use strict";
8309
8310
8311Object.defineProperty(exports, "__esModule", ({
8312 value: true
8313}));
8314exports.cloneNode = cloneNode;
8315
8316function cloneNode(n) {
8317 // $FlowIgnore
8318 var newObj = {};
8319
8320 for (var k in n) {
8321 newObj[k] = n[k];
8322 }
8323
8324 return newObj;
8325}
8326
8327/***/ }),
8328
8329/***/ 19300:
8330/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8331
8332"use strict";
8333
8334
8335Object.defineProperty(exports, "__esModule", ({
8336 value: true
8337}));
8338var _exportNames = {
8339 numberLiteralFromRaw: true,
8340 withLoc: true,
8341 withRaw: true,
8342 funcParam: true,
8343 indexLiteral: true,
8344 memIndexLiteral: true,
8345 instruction: true,
8346 objectInstruction: true,
8347 traverse: true,
8348 signatures: true,
8349 cloneNode: true
8350};
8351Object.defineProperty(exports, "numberLiteralFromRaw", ({
8352 enumerable: true,
8353 get: function get() {
8354 return _nodeHelpers.numberLiteralFromRaw;
8355 }
8356}));
8357Object.defineProperty(exports, "withLoc", ({
8358 enumerable: true,
8359 get: function get() {
8360 return _nodeHelpers.withLoc;
8361 }
8362}));
8363Object.defineProperty(exports, "withRaw", ({
8364 enumerable: true,
8365 get: function get() {
8366 return _nodeHelpers.withRaw;
8367 }
8368}));
8369Object.defineProperty(exports, "funcParam", ({
8370 enumerable: true,
8371 get: function get() {
8372 return _nodeHelpers.funcParam;
8373 }
8374}));
8375Object.defineProperty(exports, "indexLiteral", ({
8376 enumerable: true,
8377 get: function get() {
8378 return _nodeHelpers.indexLiteral;
8379 }
8380}));
8381Object.defineProperty(exports, "memIndexLiteral", ({
8382 enumerable: true,
8383 get: function get() {
8384 return _nodeHelpers.memIndexLiteral;
8385 }
8386}));
8387Object.defineProperty(exports, "instruction", ({
8388 enumerable: true,
8389 get: function get() {
8390 return _nodeHelpers.instruction;
8391 }
8392}));
8393Object.defineProperty(exports, "objectInstruction", ({
8394 enumerable: true,
8395 get: function get() {
8396 return _nodeHelpers.objectInstruction;
8397 }
8398}));
8399Object.defineProperty(exports, "traverse", ({
8400 enumerable: true,
8401 get: function get() {
8402 return _traverse.traverse;
8403 }
8404}));
8405Object.defineProperty(exports, "signatures", ({
8406 enumerable: true,
8407 get: function get() {
8408 return _signatures.signatures;
8409 }
8410}));
8411Object.defineProperty(exports, "cloneNode", ({
8412 enumerable: true,
8413 get: function get() {
8414 return _clone.cloneNode;
8415 }
8416}));
8417
8418var _nodes = __webpack_require__(18402);
8419
8420Object.keys(_nodes).forEach(function (key) {
8421 if (key === "default" || key === "__esModule") return;
8422 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
8423 Object.defineProperty(exports, key, {
8424 enumerable: true,
8425 get: function get() {
8426 return _nodes[key];
8427 }
8428 });
8429});
8430
8431var _nodeHelpers = __webpack_require__(19334);
8432
8433var _traverse = __webpack_require__(6576);
8434
8435var _signatures = __webpack_require__(46529);
8436
8437var _utils = __webpack_require__(44605);
8438
8439Object.keys(_utils).forEach(function (key) {
8440 if (key === "default" || key === "__esModule") return;
8441 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
8442 Object.defineProperty(exports, key, {
8443 enumerable: true,
8444 get: function get() {
8445 return _utils[key];
8446 }
8447 });
8448});
8449
8450var _clone = __webpack_require__(49345);
8451
8452/***/ }),
8453
8454/***/ 19334:
8455/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8456
8457"use strict";
8458
8459
8460Object.defineProperty(exports, "__esModule", ({
8461 value: true
8462}));
8463exports.numberLiteralFromRaw = numberLiteralFromRaw;
8464exports.instruction = instruction;
8465exports.objectInstruction = objectInstruction;
8466exports.withLoc = withLoc;
8467exports.withRaw = withRaw;
8468exports.funcParam = funcParam;
8469exports.indexLiteral = indexLiteral;
8470exports.memIndexLiteral = memIndexLiteral;
8471
8472var _wastParser = __webpack_require__(9016);
8473
8474var _nodes = __webpack_require__(18402);
8475
8476function numberLiteralFromRaw(rawValue) {
8477 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
8478 var original = rawValue; // Remove numeric separators _
8479
8480 if (typeof rawValue === "string") {
8481 rawValue = rawValue.replace(/_/g, "");
8482 }
8483
8484 if (typeof rawValue === "number") {
8485 return (0, _nodes.numberLiteral)(rawValue, String(original));
8486 } else {
8487 switch (instructionType) {
8488 case "i32":
8489 {
8490 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
8491 }
8492
8493 case "u32":
8494 {
8495 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
8496 }
8497
8498 case "i64":
8499 {
8500 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
8501 }
8502
8503 case "f32":
8504 {
8505 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
8506 }
8507 // f64
8508
8509 default:
8510 {
8511 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
8512 }
8513 }
8514 }
8515}
8516
8517function instruction(id) {
8518 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
8519 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8520 return (0, _nodes.instr)(id, undefined, args, namedArgs);
8521}
8522
8523function objectInstruction(id, object) {
8524 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8525 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
8526 return (0, _nodes.instr)(id, object, args, namedArgs);
8527}
8528/**
8529 * Decorators
8530 */
8531
8532
8533function withLoc(n, end, start) {
8534 var loc = {
8535 start: start,
8536 end: end
8537 };
8538 n.loc = loc;
8539 return n;
8540}
8541
8542function withRaw(n, raw) {
8543 n.raw = raw;
8544 return n;
8545}
8546
8547function funcParam(valtype, id) {
8548 return {
8549 id: id,
8550 valtype: valtype
8551 };
8552}
8553
8554function indexLiteral(value) {
8555 // $FlowIgnore
8556 var x = numberLiteralFromRaw(value, "u32");
8557 return x;
8558}
8559
8560function memIndexLiteral(value) {
8561 // $FlowIgnore
8562 var x = numberLiteralFromRaw(value, "u32");
8563 return x;
8564}
8565
8566/***/ }),
8567
8568/***/ 82023:
8569/***/ (function(__unused_webpack_module, exports) {
8570
8571"use strict";
8572
8573
8574Object.defineProperty(exports, "__esModule", ({
8575 value: true
8576}));
8577exports.createPath = createPath;
8578
8579function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
8580
8581function findParent(_ref, cb) {
8582 var parentPath = _ref.parentPath;
8583
8584 if (parentPath == null) {
8585 throw new Error("node is root");
8586 }
8587
8588 var currentPath = parentPath;
8589
8590 while (cb(currentPath) !== false) {
8591 // Hit the root node, stop
8592 // $FlowIgnore
8593 if (currentPath.parentPath == null) {
8594 return null;
8595 } // $FlowIgnore
8596
8597
8598 currentPath = currentPath.parentPath;
8599 }
8600
8601 return currentPath.node;
8602}
8603
8604function insertBefore(context, newNode) {
8605 return insert(context, newNode);
8606}
8607
8608function insertAfter(context, newNode) {
8609 return insert(context, newNode, 1);
8610}
8611
8612function insert(_ref2, newNode) {
8613 var node = _ref2.node,
8614 inList = _ref2.inList,
8615 parentPath = _ref2.parentPath,
8616 parentKey = _ref2.parentKey;
8617 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8618
8619 if (!inList) {
8620 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
8621 }
8622
8623 if (!(parentPath != null)) {
8624 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
8625 }
8626
8627 // $FlowIgnore
8628 var parentList = parentPath.node[parentKey];
8629 var indexInList = parentList.findIndex(function (n) {
8630 return n === node;
8631 });
8632 parentList.splice(indexInList + indexOffset, 0, newNode);
8633}
8634
8635function remove(_ref3) {
8636 var node = _ref3.node,
8637 parentKey = _ref3.parentKey,
8638 parentPath = _ref3.parentPath;
8639
8640 if (!(parentPath != null)) {
8641 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
8642 }
8643
8644 // $FlowIgnore
8645 var parentNode = parentPath.node; // $FlowIgnore
8646
8647 var parentProperty = parentNode[parentKey];
8648
8649 if (Array.isArray(parentProperty)) {
8650 // $FlowIgnore
8651 parentNode[parentKey] = parentProperty.filter(function (n) {
8652 return n !== node;
8653 });
8654 } else {
8655 // $FlowIgnore
8656 delete parentNode[parentKey];
8657 }
8658
8659 node._deleted = true;
8660}
8661
8662function stop(context) {
8663 context.shouldStop = true;
8664}
8665
8666function replaceWith(context, newNode) {
8667 // $FlowIgnore
8668 var parentNode = context.parentPath.node; // $FlowIgnore
8669
8670 var parentProperty = parentNode[context.parentKey];
8671
8672 if (Array.isArray(parentProperty)) {
8673 var indexInList = parentProperty.findIndex(function (n) {
8674 return n === context.node;
8675 });
8676 parentProperty.splice(indexInList, 1, newNode);
8677 } else {
8678 // $FlowIgnore
8679 parentNode[context.parentKey] = newNode;
8680 }
8681
8682 context.node._deleted = true;
8683 context.node = newNode;
8684} // bind the context to the first argument of node operations
8685
8686
8687function bindNodeOperations(operations, context) {
8688 var keys = Object.keys(operations);
8689 var boundOperations = {};
8690 keys.forEach(function (key) {
8691 boundOperations[key] = operations[key].bind(null, context);
8692 });
8693 return boundOperations;
8694}
8695
8696function createPathOperations(context) {
8697 // $FlowIgnore
8698 return bindNodeOperations({
8699 findParent: findParent,
8700 replaceWith: replaceWith,
8701 remove: remove,
8702 insertBefore: insertBefore,
8703 insertAfter: insertAfter,
8704 stop: stop
8705 }, context);
8706}
8707
8708function createPath(context) {
8709 var path = _extends({}, context); // $FlowIgnore
8710
8711
8712 Object.assign(path, createPathOperations(path)); // $FlowIgnore
8713
8714 return path;
8715}
8716
8717/***/ }),
8718
8719/***/ 18402:
8720/***/ (function(__unused_webpack_module, exports) {
8721
8722"use strict";
8723
8724
8725Object.defineProperty(exports, "__esModule", ({
8726 value: true
8727}));
8728exports.module = _module;
8729exports.moduleMetadata = moduleMetadata;
8730exports.moduleNameMetadata = moduleNameMetadata;
8731exports.functionNameMetadata = functionNameMetadata;
8732exports.localNameMetadata = localNameMetadata;
8733exports.binaryModule = binaryModule;
8734exports.quoteModule = quoteModule;
8735exports.sectionMetadata = sectionMetadata;
8736exports.producersSectionMetadata = producersSectionMetadata;
8737exports.producerMetadata = producerMetadata;
8738exports.producerMetadataVersionedName = producerMetadataVersionedName;
8739exports.loopInstruction = loopInstruction;
8740exports.instr = instr;
8741exports.ifInstruction = ifInstruction;
8742exports.stringLiteral = stringLiteral;
8743exports.numberLiteral = numberLiteral;
8744exports.longNumberLiteral = longNumberLiteral;
8745exports.floatLiteral = floatLiteral;
8746exports.elem = elem;
8747exports.indexInFuncSection = indexInFuncSection;
8748exports.valtypeLiteral = valtypeLiteral;
8749exports.typeInstruction = typeInstruction;
8750exports.start = start;
8751exports.globalType = globalType;
8752exports.leadingComment = leadingComment;
8753exports.blockComment = blockComment;
8754exports.data = data;
8755exports.global = global;
8756exports.table = table;
8757exports.memory = memory;
8758exports.funcImportDescr = funcImportDescr;
8759exports.moduleImport = moduleImport;
8760exports.moduleExportDescr = moduleExportDescr;
8761exports.moduleExport = moduleExport;
8762exports.limit = limit;
8763exports.signature = signature;
8764exports.program = program;
8765exports.identifier = identifier;
8766exports.blockInstruction = blockInstruction;
8767exports.callInstruction = callInstruction;
8768exports.callIndirectInstruction = callIndirectInstruction;
8769exports.byteArray = byteArray;
8770exports.func = func;
8771exports.internalBrUnless = internalBrUnless;
8772exports.internalGoto = internalGoto;
8773exports.internalCallExtern = internalCallExtern;
8774exports.internalEndAndReturn = internalEndAndReturn;
8775exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
8776exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
8777
8778function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8779
8780// THIS FILE IS AUTOGENERATED
8781// see scripts/generateNodeUtils.js
8782function isTypeOf(t) {
8783 return function (n) {
8784 return n.type === t;
8785 };
8786}
8787
8788function assertTypeOf(t) {
8789 return function (n) {
8790 return function () {
8791 if (!(n.type === t)) {
8792 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
8793 }
8794 }();
8795 };
8796}
8797
8798function _module(id, fields, metadata) {
8799 if (id !== null && id !== undefined) {
8800 if (!(typeof id === "string")) {
8801 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
8802 }
8803 }
8804
8805 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
8806 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
8807 }
8808
8809 var node = {
8810 type: "Module",
8811 id: id,
8812 fields: fields
8813 };
8814
8815 if (typeof metadata !== "undefined") {
8816 node.metadata = metadata;
8817 }
8818
8819 return node;
8820}
8821
8822function moduleMetadata(sections, functionNames, localNames, producers) {
8823 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
8824 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
8825 }
8826
8827 if (functionNames !== null && functionNames !== undefined) {
8828 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
8829 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
8830 }
8831 }
8832
8833 if (localNames !== null && localNames !== undefined) {
8834 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
8835 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
8836 }
8837 }
8838
8839 if (producers !== null && producers !== undefined) {
8840 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
8841 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
8842 }
8843 }
8844
8845 var node = {
8846 type: "ModuleMetadata",
8847 sections: sections
8848 };
8849
8850 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
8851 node.functionNames = functionNames;
8852 }
8853
8854 if (typeof localNames !== "undefined" && localNames.length > 0) {
8855 node.localNames = localNames;
8856 }
8857
8858 if (typeof producers !== "undefined" && producers.length > 0) {
8859 node.producers = producers;
8860 }
8861
8862 return node;
8863}
8864
8865function moduleNameMetadata(value) {
8866 if (!(typeof value === "string")) {
8867 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
8868 }
8869
8870 var node = {
8871 type: "ModuleNameMetadata",
8872 value: value
8873 };
8874 return node;
8875}
8876
8877function functionNameMetadata(value, index) {
8878 if (!(typeof value === "string")) {
8879 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
8880 }
8881
8882 if (!(typeof index === "number")) {
8883 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
8884 }
8885
8886 var node = {
8887 type: "FunctionNameMetadata",
8888 value: value,
8889 index: index
8890 };
8891 return node;
8892}
8893
8894function localNameMetadata(value, localIndex, functionIndex) {
8895 if (!(typeof value === "string")) {
8896 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
8897 }
8898
8899 if (!(typeof localIndex === "number")) {
8900 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
8901 }
8902
8903 if (!(typeof functionIndex === "number")) {
8904 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
8905 }
8906
8907 var node = {
8908 type: "LocalNameMetadata",
8909 value: value,
8910 localIndex: localIndex,
8911 functionIndex: functionIndex
8912 };
8913 return node;
8914}
8915
8916function binaryModule(id, blob) {
8917 if (id !== null && id !== undefined) {
8918 if (!(typeof id === "string")) {
8919 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
8920 }
8921 }
8922
8923 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
8924 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
8925 }
8926
8927 var node = {
8928 type: "BinaryModule",
8929 id: id,
8930 blob: blob
8931 };
8932 return node;
8933}
8934
8935function quoteModule(id, string) {
8936 if (id !== null && id !== undefined) {
8937 if (!(typeof id === "string")) {
8938 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
8939 }
8940 }
8941
8942 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
8943 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
8944 }
8945
8946 var node = {
8947 type: "QuoteModule",
8948 id: id,
8949 string: string
8950 };
8951 return node;
8952}
8953
8954function sectionMetadata(section, startOffset, size, vectorOfSize) {
8955 if (!(typeof startOffset === "number")) {
8956 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
8957 }
8958
8959 var node = {
8960 type: "SectionMetadata",
8961 section: section,
8962 startOffset: startOffset,
8963 size: size,
8964 vectorOfSize: vectorOfSize
8965 };
8966 return node;
8967}
8968
8969function producersSectionMetadata(producers) {
8970 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
8971 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
8972 }
8973
8974 var node = {
8975 type: "ProducersSectionMetadata",
8976 producers: producers
8977 };
8978 return node;
8979}
8980
8981function producerMetadata(language, processedBy, sdk) {
8982 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
8983 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
8984 }
8985
8986 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
8987 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
8988 }
8989
8990 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
8991 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
8992 }
8993
8994 var node = {
8995 type: "ProducerMetadata",
8996 language: language,
8997 processedBy: processedBy,
8998 sdk: sdk
8999 };
9000 return node;
9001}
9002
9003function producerMetadataVersionedName(name, version) {
9004 if (!(typeof name === "string")) {
9005 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
9006 }
9007
9008 if (!(typeof version === "string")) {
9009 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
9010 }
9011
9012 var node = {
9013 type: "ProducerMetadataVersionedName",
9014 name: name,
9015 version: version
9016 };
9017 return node;
9018}
9019
9020function loopInstruction(label, resulttype, instr) {
9021 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
9022 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
9023 }
9024
9025 var node = {
9026 type: "LoopInstruction",
9027 id: "loop",
9028 label: label,
9029 resulttype: resulttype,
9030 instr: instr
9031 };
9032 return node;
9033}
9034
9035function instr(id, object, args, namedArgs) {
9036 if (!(typeof id === "string")) {
9037 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
9038 }
9039
9040 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
9041 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
9042 }
9043
9044 var node = {
9045 type: "Instr",
9046 id: id,
9047 args: args
9048 };
9049
9050 if (typeof object !== "undefined") {
9051 node.object = object;
9052 }
9053
9054 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
9055 node.namedArgs = namedArgs;
9056 }
9057
9058 return node;
9059}
9060
9061function ifInstruction(testLabel, test, result, consequent, alternate) {
9062 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
9063 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
9064 }
9065
9066 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
9067 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
9068 }
9069
9070 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
9071 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
9072 }
9073
9074 var node = {
9075 type: "IfInstruction",
9076 id: "if",
9077 testLabel: testLabel,
9078 test: test,
9079 result: result,
9080 consequent: consequent,
9081 alternate: alternate
9082 };
9083 return node;
9084}
9085
9086function stringLiteral(value) {
9087 if (!(typeof value === "string")) {
9088 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
9089 }
9090
9091 var node = {
9092 type: "StringLiteral",
9093 value: value
9094 };
9095 return node;
9096}
9097
9098function numberLiteral(value, raw) {
9099 if (!(typeof value === "number")) {
9100 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
9101 }
9102
9103 if (!(typeof raw === "string")) {
9104 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
9105 }
9106
9107 var node = {
9108 type: "NumberLiteral",
9109 value: value,
9110 raw: raw
9111 };
9112 return node;
9113}
9114
9115function longNumberLiteral(value, raw) {
9116 if (!(typeof raw === "string")) {
9117 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
9118 }
9119
9120 var node = {
9121 type: "LongNumberLiteral",
9122 value: value,
9123 raw: raw
9124 };
9125 return node;
9126}
9127
9128function floatLiteral(value, nan, inf, raw) {
9129 if (!(typeof value === "number")) {
9130 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
9131 }
9132
9133 if (nan !== null && nan !== undefined) {
9134 if (!(typeof nan === "boolean")) {
9135 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
9136 }
9137 }
9138
9139 if (inf !== null && inf !== undefined) {
9140 if (!(typeof inf === "boolean")) {
9141 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
9142 }
9143 }
9144
9145 if (!(typeof raw === "string")) {
9146 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
9147 }
9148
9149 var node = {
9150 type: "FloatLiteral",
9151 value: value,
9152 raw: raw
9153 };
9154
9155 if (nan === true) {
9156 node.nan = true;
9157 }
9158
9159 if (inf === true) {
9160 node.inf = true;
9161 }
9162
9163 return node;
9164}
9165
9166function elem(table, offset, funcs) {
9167 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
9168 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
9169 }
9170
9171 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
9172 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
9173 }
9174
9175 var node = {
9176 type: "Elem",
9177 table: table,
9178 offset: offset,
9179 funcs: funcs
9180 };
9181 return node;
9182}
9183
9184function indexInFuncSection(index) {
9185 var node = {
9186 type: "IndexInFuncSection",
9187 index: index
9188 };
9189 return node;
9190}
9191
9192function valtypeLiteral(name) {
9193 var node = {
9194 type: "ValtypeLiteral",
9195 name: name
9196 };
9197 return node;
9198}
9199
9200function typeInstruction(id, functype) {
9201 var node = {
9202 type: "TypeInstruction",
9203 id: id,
9204 functype: functype
9205 };
9206 return node;
9207}
9208
9209function start(index) {
9210 var node = {
9211 type: "Start",
9212 index: index
9213 };
9214 return node;
9215}
9216
9217function globalType(valtype, mutability) {
9218 var node = {
9219 type: "GlobalType",
9220 valtype: valtype,
9221 mutability: mutability
9222 };
9223 return node;
9224}
9225
9226function leadingComment(value) {
9227 if (!(typeof value === "string")) {
9228 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
9229 }
9230
9231 var node = {
9232 type: "LeadingComment",
9233 value: value
9234 };
9235 return node;
9236}
9237
9238function blockComment(value) {
9239 if (!(typeof value === "string")) {
9240 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
9241 }
9242
9243 var node = {
9244 type: "BlockComment",
9245 value: value
9246 };
9247 return node;
9248}
9249
9250function data(memoryIndex, offset, init) {
9251 var node = {
9252 type: "Data",
9253 memoryIndex: memoryIndex,
9254 offset: offset,
9255 init: init
9256 };
9257 return node;
9258}
9259
9260function global(globalType, init, name) {
9261 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
9262 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
9263 }
9264
9265 var node = {
9266 type: "Global",
9267 globalType: globalType,
9268 init: init,
9269 name: name
9270 };
9271 return node;
9272}
9273
9274function table(elementType, limits, name, elements) {
9275 if (!(limits.type === "Limit")) {
9276 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
9277 }
9278
9279 if (elements !== null && elements !== undefined) {
9280 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
9281 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
9282 }
9283 }
9284
9285 var node = {
9286 type: "Table",
9287 elementType: elementType,
9288 limits: limits,
9289 name: name
9290 };
9291
9292 if (typeof elements !== "undefined" && elements.length > 0) {
9293 node.elements = elements;
9294 }
9295
9296 return node;
9297}
9298
9299function memory(limits, id) {
9300 var node = {
9301 type: "Memory",
9302 limits: limits,
9303 id: id
9304 };
9305 return node;
9306}
9307
9308function funcImportDescr(id, signature) {
9309 var node = {
9310 type: "FuncImportDescr",
9311 id: id,
9312 signature: signature
9313 };
9314 return node;
9315}
9316
9317function moduleImport(module, name, descr) {
9318 if (!(typeof module === "string")) {
9319 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
9320 }
9321
9322 if (!(typeof name === "string")) {
9323 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
9324 }
9325
9326 var node = {
9327 type: "ModuleImport",
9328 module: module,
9329 name: name,
9330 descr: descr
9331 };
9332 return node;
9333}
9334
9335function moduleExportDescr(exportType, id) {
9336 var node = {
9337 type: "ModuleExportDescr",
9338 exportType: exportType,
9339 id: id
9340 };
9341 return node;
9342}
9343
9344function moduleExport(name, descr) {
9345 if (!(typeof name === "string")) {
9346 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
9347 }
9348
9349 var node = {
9350 type: "ModuleExport",
9351 name: name,
9352 descr: descr
9353 };
9354 return node;
9355}
9356
9357function limit(min, max) {
9358 if (!(typeof min === "number")) {
9359 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
9360 }
9361
9362 if (max !== null && max !== undefined) {
9363 if (!(typeof max === "number")) {
9364 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
9365 }
9366 }
9367
9368 var node = {
9369 type: "Limit",
9370 min: min
9371 };
9372
9373 if (typeof max !== "undefined") {
9374 node.max = max;
9375 }
9376
9377 return node;
9378}
9379
9380function signature(params, results) {
9381 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
9382 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
9383 }
9384
9385 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
9386 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
9387 }
9388
9389 var node = {
9390 type: "Signature",
9391 params: params,
9392 results: results
9393 };
9394 return node;
9395}
9396
9397function program(body) {
9398 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
9399 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
9400 }
9401
9402 var node = {
9403 type: "Program",
9404 body: body
9405 };
9406 return node;
9407}
9408
9409function identifier(value, raw) {
9410 if (!(typeof value === "string")) {
9411 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
9412 }
9413
9414 if (raw !== null && raw !== undefined) {
9415 if (!(typeof raw === "string")) {
9416 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
9417 }
9418 }
9419
9420 var node = {
9421 type: "Identifier",
9422 value: value
9423 };
9424
9425 if (typeof raw !== "undefined") {
9426 node.raw = raw;
9427 }
9428
9429 return node;
9430}
9431
9432function blockInstruction(label, instr, result) {
9433 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
9434 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
9435 }
9436
9437 var node = {
9438 type: "BlockInstruction",
9439 id: "block",
9440 label: label,
9441 instr: instr,
9442 result: result
9443 };
9444 return node;
9445}
9446
9447function callInstruction(index, instrArgs, numeric) {
9448 if (instrArgs !== null && instrArgs !== undefined) {
9449 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
9450 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
9451 }
9452 }
9453
9454 var node = {
9455 type: "CallInstruction",
9456 id: "call",
9457 index: index
9458 };
9459
9460 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
9461 node.instrArgs = instrArgs;
9462 }
9463
9464 if (typeof numeric !== "undefined") {
9465 node.numeric = numeric;
9466 }
9467
9468 return node;
9469}
9470
9471function callIndirectInstruction(signature, intrs) {
9472 if (intrs !== null && intrs !== undefined) {
9473 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
9474 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
9475 }
9476 }
9477
9478 var node = {
9479 type: "CallIndirectInstruction",
9480 id: "call_indirect",
9481 signature: signature
9482 };
9483
9484 if (typeof intrs !== "undefined" && intrs.length > 0) {
9485 node.intrs = intrs;
9486 }
9487
9488 return node;
9489}
9490
9491function byteArray(values) {
9492 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
9493 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
9494 }
9495
9496 var node = {
9497 type: "ByteArray",
9498 values: values
9499 };
9500 return node;
9501}
9502
9503function func(name, signature, body, isExternal, metadata) {
9504 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
9505 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
9506 }
9507
9508 if (isExternal !== null && isExternal !== undefined) {
9509 if (!(typeof isExternal === "boolean")) {
9510 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
9511 }
9512 }
9513
9514 var node = {
9515 type: "Func",
9516 name: name,
9517 signature: signature,
9518 body: body
9519 };
9520
9521 if (isExternal === true) {
9522 node.isExternal = true;
9523 }
9524
9525 if (typeof metadata !== "undefined") {
9526 node.metadata = metadata;
9527 }
9528
9529 return node;
9530}
9531
9532function internalBrUnless(target) {
9533 if (!(typeof target === "number")) {
9534 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
9535 }
9536
9537 var node = {
9538 type: "InternalBrUnless",
9539 target: target
9540 };
9541 return node;
9542}
9543
9544function internalGoto(target) {
9545 if (!(typeof target === "number")) {
9546 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
9547 }
9548
9549 var node = {
9550 type: "InternalGoto",
9551 target: target
9552 };
9553 return node;
9554}
9555
9556function internalCallExtern(target) {
9557 if (!(typeof target === "number")) {
9558 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
9559 }
9560
9561 var node = {
9562 type: "InternalCallExtern",
9563 target: target
9564 };
9565 return node;
9566}
9567
9568function internalEndAndReturn() {
9569 var node = {
9570 type: "InternalEndAndReturn"
9571 };
9572 return node;
9573}
9574
9575var isModule = isTypeOf("Module");
9576exports.isModule = isModule;
9577var isModuleMetadata = isTypeOf("ModuleMetadata");
9578exports.isModuleMetadata = isModuleMetadata;
9579var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
9580exports.isModuleNameMetadata = isModuleNameMetadata;
9581var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
9582exports.isFunctionNameMetadata = isFunctionNameMetadata;
9583var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
9584exports.isLocalNameMetadata = isLocalNameMetadata;
9585var isBinaryModule = isTypeOf("BinaryModule");
9586exports.isBinaryModule = isBinaryModule;
9587var isQuoteModule = isTypeOf("QuoteModule");
9588exports.isQuoteModule = isQuoteModule;
9589var isSectionMetadata = isTypeOf("SectionMetadata");
9590exports.isSectionMetadata = isSectionMetadata;
9591var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
9592exports.isProducersSectionMetadata = isProducersSectionMetadata;
9593var isProducerMetadata = isTypeOf("ProducerMetadata");
9594exports.isProducerMetadata = isProducerMetadata;
9595var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
9596exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
9597var isLoopInstruction = isTypeOf("LoopInstruction");
9598exports.isLoopInstruction = isLoopInstruction;
9599var isInstr = isTypeOf("Instr");
9600exports.isInstr = isInstr;
9601var isIfInstruction = isTypeOf("IfInstruction");
9602exports.isIfInstruction = isIfInstruction;
9603var isStringLiteral = isTypeOf("StringLiteral");
9604exports.isStringLiteral = isStringLiteral;
9605var isNumberLiteral = isTypeOf("NumberLiteral");
9606exports.isNumberLiteral = isNumberLiteral;
9607var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
9608exports.isLongNumberLiteral = isLongNumberLiteral;
9609var isFloatLiteral = isTypeOf("FloatLiteral");
9610exports.isFloatLiteral = isFloatLiteral;
9611var isElem = isTypeOf("Elem");
9612exports.isElem = isElem;
9613var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
9614exports.isIndexInFuncSection = isIndexInFuncSection;
9615var isValtypeLiteral = isTypeOf("ValtypeLiteral");
9616exports.isValtypeLiteral = isValtypeLiteral;
9617var isTypeInstruction = isTypeOf("TypeInstruction");
9618exports.isTypeInstruction = isTypeInstruction;
9619var isStart = isTypeOf("Start");
9620exports.isStart = isStart;
9621var isGlobalType = isTypeOf("GlobalType");
9622exports.isGlobalType = isGlobalType;
9623var isLeadingComment = isTypeOf("LeadingComment");
9624exports.isLeadingComment = isLeadingComment;
9625var isBlockComment = isTypeOf("BlockComment");
9626exports.isBlockComment = isBlockComment;
9627var isData = isTypeOf("Data");
9628exports.isData = isData;
9629var isGlobal = isTypeOf("Global");
9630exports.isGlobal = isGlobal;
9631var isTable = isTypeOf("Table");
9632exports.isTable = isTable;
9633var isMemory = isTypeOf("Memory");
9634exports.isMemory = isMemory;
9635var isFuncImportDescr = isTypeOf("FuncImportDescr");
9636exports.isFuncImportDescr = isFuncImportDescr;
9637var isModuleImport = isTypeOf("ModuleImport");
9638exports.isModuleImport = isModuleImport;
9639var isModuleExportDescr = isTypeOf("ModuleExportDescr");
9640exports.isModuleExportDescr = isModuleExportDescr;
9641var isModuleExport = isTypeOf("ModuleExport");
9642exports.isModuleExport = isModuleExport;
9643var isLimit = isTypeOf("Limit");
9644exports.isLimit = isLimit;
9645var isSignature = isTypeOf("Signature");
9646exports.isSignature = isSignature;
9647var isProgram = isTypeOf("Program");
9648exports.isProgram = isProgram;
9649var isIdentifier = isTypeOf("Identifier");
9650exports.isIdentifier = isIdentifier;
9651var isBlockInstruction = isTypeOf("BlockInstruction");
9652exports.isBlockInstruction = isBlockInstruction;
9653var isCallInstruction = isTypeOf("CallInstruction");
9654exports.isCallInstruction = isCallInstruction;
9655var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
9656exports.isCallIndirectInstruction = isCallIndirectInstruction;
9657var isByteArray = isTypeOf("ByteArray");
9658exports.isByteArray = isByteArray;
9659var isFunc = isTypeOf("Func");
9660exports.isFunc = isFunc;
9661var isInternalBrUnless = isTypeOf("InternalBrUnless");
9662exports.isInternalBrUnless = isInternalBrUnless;
9663var isInternalGoto = isTypeOf("InternalGoto");
9664exports.isInternalGoto = isInternalGoto;
9665var isInternalCallExtern = isTypeOf("InternalCallExtern");
9666exports.isInternalCallExtern = isInternalCallExtern;
9667var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
9668exports.isInternalEndAndReturn = isInternalEndAndReturn;
9669
9670var isNode = function isNode(node) {
9671 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
9672};
9673
9674exports.isNode = isNode;
9675
9676var isBlock = function isBlock(node) {
9677 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
9678};
9679
9680exports.isBlock = isBlock;
9681
9682var isInstruction = function isInstruction(node) {
9683 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
9684};
9685
9686exports.isInstruction = isInstruction;
9687
9688var isExpression = function isExpression(node) {
9689 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
9690};
9691
9692exports.isExpression = isExpression;
9693
9694var isNumericLiteral = function isNumericLiteral(node) {
9695 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
9696};
9697
9698exports.isNumericLiteral = isNumericLiteral;
9699
9700var isImportDescr = function isImportDescr(node) {
9701 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
9702};
9703
9704exports.isImportDescr = isImportDescr;
9705
9706var isIntrinsic = function isIntrinsic(node) {
9707 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
9708};
9709
9710exports.isIntrinsic = isIntrinsic;
9711var assertModule = assertTypeOf("Module");
9712exports.assertModule = assertModule;
9713var assertModuleMetadata = assertTypeOf("ModuleMetadata");
9714exports.assertModuleMetadata = assertModuleMetadata;
9715var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
9716exports.assertModuleNameMetadata = assertModuleNameMetadata;
9717var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
9718exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
9719var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
9720exports.assertLocalNameMetadata = assertLocalNameMetadata;
9721var assertBinaryModule = assertTypeOf("BinaryModule");
9722exports.assertBinaryModule = assertBinaryModule;
9723var assertQuoteModule = assertTypeOf("QuoteModule");
9724exports.assertQuoteModule = assertQuoteModule;
9725var assertSectionMetadata = assertTypeOf("SectionMetadata");
9726exports.assertSectionMetadata = assertSectionMetadata;
9727var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
9728exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
9729var assertProducerMetadata = assertTypeOf("ProducerMetadata");
9730exports.assertProducerMetadata = assertProducerMetadata;
9731var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
9732exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
9733var assertLoopInstruction = assertTypeOf("LoopInstruction");
9734exports.assertLoopInstruction = assertLoopInstruction;
9735var assertInstr = assertTypeOf("Instr");
9736exports.assertInstr = assertInstr;
9737var assertIfInstruction = assertTypeOf("IfInstruction");
9738exports.assertIfInstruction = assertIfInstruction;
9739var assertStringLiteral = assertTypeOf("StringLiteral");
9740exports.assertStringLiteral = assertStringLiteral;
9741var assertNumberLiteral = assertTypeOf("NumberLiteral");
9742exports.assertNumberLiteral = assertNumberLiteral;
9743var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
9744exports.assertLongNumberLiteral = assertLongNumberLiteral;
9745var assertFloatLiteral = assertTypeOf("FloatLiteral");
9746exports.assertFloatLiteral = assertFloatLiteral;
9747var assertElem = assertTypeOf("Elem");
9748exports.assertElem = assertElem;
9749var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
9750exports.assertIndexInFuncSection = assertIndexInFuncSection;
9751var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
9752exports.assertValtypeLiteral = assertValtypeLiteral;
9753var assertTypeInstruction = assertTypeOf("TypeInstruction");
9754exports.assertTypeInstruction = assertTypeInstruction;
9755var assertStart = assertTypeOf("Start");
9756exports.assertStart = assertStart;
9757var assertGlobalType = assertTypeOf("GlobalType");
9758exports.assertGlobalType = assertGlobalType;
9759var assertLeadingComment = assertTypeOf("LeadingComment");
9760exports.assertLeadingComment = assertLeadingComment;
9761var assertBlockComment = assertTypeOf("BlockComment");
9762exports.assertBlockComment = assertBlockComment;
9763var assertData = assertTypeOf("Data");
9764exports.assertData = assertData;
9765var assertGlobal = assertTypeOf("Global");
9766exports.assertGlobal = assertGlobal;
9767var assertTable = assertTypeOf("Table");
9768exports.assertTable = assertTable;
9769var assertMemory = assertTypeOf("Memory");
9770exports.assertMemory = assertMemory;
9771var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
9772exports.assertFuncImportDescr = assertFuncImportDescr;
9773var assertModuleImport = assertTypeOf("ModuleImport");
9774exports.assertModuleImport = assertModuleImport;
9775var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
9776exports.assertModuleExportDescr = assertModuleExportDescr;
9777var assertModuleExport = assertTypeOf("ModuleExport");
9778exports.assertModuleExport = assertModuleExport;
9779var assertLimit = assertTypeOf("Limit");
9780exports.assertLimit = assertLimit;
9781var assertSignature = assertTypeOf("Signature");
9782exports.assertSignature = assertSignature;
9783var assertProgram = assertTypeOf("Program");
9784exports.assertProgram = assertProgram;
9785var assertIdentifier = assertTypeOf("Identifier");
9786exports.assertIdentifier = assertIdentifier;
9787var assertBlockInstruction = assertTypeOf("BlockInstruction");
9788exports.assertBlockInstruction = assertBlockInstruction;
9789var assertCallInstruction = assertTypeOf("CallInstruction");
9790exports.assertCallInstruction = assertCallInstruction;
9791var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
9792exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
9793var assertByteArray = assertTypeOf("ByteArray");
9794exports.assertByteArray = assertByteArray;
9795var assertFunc = assertTypeOf("Func");
9796exports.assertFunc = assertFunc;
9797var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
9798exports.assertInternalBrUnless = assertInternalBrUnless;
9799var assertInternalGoto = assertTypeOf("InternalGoto");
9800exports.assertInternalGoto = assertInternalGoto;
9801var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
9802exports.assertInternalCallExtern = assertInternalCallExtern;
9803var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
9804exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
9805var unionTypesMap = {
9806 Module: ["Node"],
9807 ModuleMetadata: ["Node"],
9808 ModuleNameMetadata: ["Node"],
9809 FunctionNameMetadata: ["Node"],
9810 LocalNameMetadata: ["Node"],
9811 BinaryModule: ["Node"],
9812 QuoteModule: ["Node"],
9813 SectionMetadata: ["Node"],
9814 ProducersSectionMetadata: ["Node"],
9815 ProducerMetadata: ["Node"],
9816 ProducerMetadataVersionedName: ["Node"],
9817 LoopInstruction: ["Node", "Block", "Instruction"],
9818 Instr: ["Node", "Expression", "Instruction"],
9819 IfInstruction: ["Node", "Instruction"],
9820 StringLiteral: ["Node", "Expression"],
9821 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
9822 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
9823 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
9824 Elem: ["Node"],
9825 IndexInFuncSection: ["Node"],
9826 ValtypeLiteral: ["Node", "Expression"],
9827 TypeInstruction: ["Node", "Instruction"],
9828 Start: ["Node"],
9829 GlobalType: ["Node", "ImportDescr"],
9830 LeadingComment: ["Node"],
9831 BlockComment: ["Node"],
9832 Data: ["Node"],
9833 Global: ["Node"],
9834 Table: ["Node", "ImportDescr"],
9835 Memory: ["Node", "ImportDescr"],
9836 FuncImportDescr: ["Node", "ImportDescr"],
9837 ModuleImport: ["Node"],
9838 ModuleExportDescr: ["Node"],
9839 ModuleExport: ["Node"],
9840 Limit: ["Node"],
9841 Signature: ["Node"],
9842 Program: ["Node"],
9843 Identifier: ["Node", "Expression"],
9844 BlockInstruction: ["Node", "Block", "Instruction"],
9845 CallInstruction: ["Node", "Instruction"],
9846 CallIndirectInstruction: ["Node", "Instruction"],
9847 ByteArray: ["Node"],
9848 Func: ["Node", "Block"],
9849 InternalBrUnless: ["Node", "Intrinsic"],
9850 InternalGoto: ["Node", "Intrinsic"],
9851 InternalCallExtern: ["Node", "Intrinsic"],
9852 InternalEndAndReturn: ["Node", "Intrinsic"]
9853};
9854exports.unionTypesMap = unionTypesMap;
9855var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
9856exports.nodeAndUnionTypes = nodeAndUnionTypes;
9857
9858/***/ }),
9859
9860/***/ 46529:
9861/***/ (function(__unused_webpack_module, exports) {
9862
9863"use strict";
9864
9865
9866Object.defineProperty(exports, "__esModule", ({
9867 value: true
9868}));
9869exports.signatures = void 0;
9870
9871function sign(input, output) {
9872 return [input, output];
9873}
9874
9875var u32 = "u32";
9876var i32 = "i32";
9877var i64 = "i64";
9878var f32 = "f32";
9879var f64 = "f64";
9880
9881var vector = function vector(t) {
9882 var vecType = [t]; // $FlowIgnore
9883
9884 vecType.vector = true;
9885 return vecType;
9886};
9887
9888var controlInstructions = {
9889 unreachable: sign([], []),
9890 nop: sign([], []),
9891 // block ?
9892 // loop ?
9893 // if ?
9894 // if else ?
9895 br: sign([u32], []),
9896 br_if: sign([u32], []),
9897 br_table: sign(vector(u32), []),
9898 return: sign([], []),
9899 call: sign([u32], []),
9900 call_indirect: sign([u32], [])
9901};
9902var parametricInstructions = {
9903 drop: sign([], []),
9904 select: sign([], [])
9905};
9906var variableInstructions = {
9907 get_local: sign([u32], []),
9908 set_local: sign([u32], []),
9909 tee_local: sign([u32], []),
9910 get_global: sign([u32], []),
9911 set_global: sign([u32], [])
9912};
9913var memoryInstructions = {
9914 "i32.load": sign([u32, u32], [i32]),
9915 "i64.load": sign([u32, u32], []),
9916 "f32.load": sign([u32, u32], []),
9917 "f64.load": sign([u32, u32], []),
9918 "i32.load8_s": sign([u32, u32], [i32]),
9919 "i32.load8_u": sign([u32, u32], [i32]),
9920 "i32.load16_s": sign([u32, u32], [i32]),
9921 "i32.load16_u": sign([u32, u32], [i32]),
9922 "i64.load8_s": sign([u32, u32], [i64]),
9923 "i64.load8_u": sign([u32, u32], [i64]),
9924 "i64.load16_s": sign([u32, u32], [i64]),
9925 "i64.load16_u": sign([u32, u32], [i64]),
9926 "i64.load32_s": sign([u32, u32], [i64]),
9927 "i64.load32_u": sign([u32, u32], [i64]),
9928 "i32.store": sign([u32, u32], []),
9929 "i64.store": sign([u32, u32], []),
9930 "f32.store": sign([u32, u32], []),
9931 "f64.store": sign([u32, u32], []),
9932 "i32.store8": sign([u32, u32], []),
9933 "i32.store16": sign([u32, u32], []),
9934 "i64.store8": sign([u32, u32], []),
9935 "i64.store16": sign([u32, u32], []),
9936 "i64.store32": sign([u32, u32], []),
9937 current_memory: sign([], []),
9938 grow_memory: sign([], [])
9939};
9940var numericInstructions = {
9941 "i32.const": sign([i32], [i32]),
9942 "i64.const": sign([i64], [i64]),
9943 "f32.const": sign([f32], [f32]),
9944 "f64.const": sign([f64], [f64]),
9945 "i32.eqz": sign([i32], [i32]),
9946 "i32.eq": sign([i32, i32], [i32]),
9947 "i32.ne": sign([i32, i32], [i32]),
9948 "i32.lt_s": sign([i32, i32], [i32]),
9949 "i32.lt_u": sign([i32, i32], [i32]),
9950 "i32.gt_s": sign([i32, i32], [i32]),
9951 "i32.gt_u": sign([i32, i32], [i32]),
9952 "i32.le_s": sign([i32, i32], [i32]),
9953 "i32.le_u": sign([i32, i32], [i32]),
9954 "i32.ge_s": sign([i32, i32], [i32]),
9955 "i32.ge_u": sign([i32, i32], [i32]),
9956 "i64.eqz": sign([i64], [i64]),
9957 "i64.eq": sign([i64, i64], [i32]),
9958 "i64.ne": sign([i64, i64], [i32]),
9959 "i64.lt_s": sign([i64, i64], [i32]),
9960 "i64.lt_u": sign([i64, i64], [i32]),
9961 "i64.gt_s": sign([i64, i64], [i32]),
9962 "i64.gt_u": sign([i64, i64], [i32]),
9963 "i64.le_s": sign([i64, i64], [i32]),
9964 "i64.le_u": sign([i64, i64], [i32]),
9965 "i64.ge_s": sign([i64, i64], [i32]),
9966 "i64.ge_u": sign([i64, i64], [i32]),
9967 "f32.eq": sign([f32, f32], [i32]),
9968 "f32.ne": sign([f32, f32], [i32]),
9969 "f32.lt": sign([f32, f32], [i32]),
9970 "f32.gt": sign([f32, f32], [i32]),
9971 "f32.le": sign([f32, f32], [i32]),
9972 "f32.ge": sign([f32, f32], [i32]),
9973 "f64.eq": sign([f64, f64], [i32]),
9974 "f64.ne": sign([f64, f64], [i32]),
9975 "f64.lt": sign([f64, f64], [i32]),
9976 "f64.gt": sign([f64, f64], [i32]),
9977 "f64.le": sign([f64, f64], [i32]),
9978 "f64.ge": sign([f64, f64], [i32]),
9979 "i32.clz": sign([i32], [i32]),
9980 "i32.ctz": sign([i32], [i32]),
9981 "i32.popcnt": sign([i32], [i32]),
9982 "i32.add": sign([i32, i32], [i32]),
9983 "i32.sub": sign([i32, i32], [i32]),
9984 "i32.mul": sign([i32, i32], [i32]),
9985 "i32.div_s": sign([i32, i32], [i32]),
9986 "i32.div_u": sign([i32, i32], [i32]),
9987 "i32.rem_s": sign([i32, i32], [i32]),
9988 "i32.rem_u": sign([i32, i32], [i32]),
9989 "i32.and": sign([i32, i32], [i32]),
9990 "i32.or": sign([i32, i32], [i32]),
9991 "i32.xor": sign([i32, i32], [i32]),
9992 "i32.shl": sign([i32, i32], [i32]),
9993 "i32.shr_s": sign([i32, i32], [i32]),
9994 "i32.shr_u": sign([i32, i32], [i32]),
9995 "i32.rotl": sign([i32, i32], [i32]),
9996 "i32.rotr": sign([i32, i32], [i32]),
9997 "i64.clz": sign([i64], [i64]),
9998 "i64.ctz": sign([i64], [i64]),
9999 "i64.popcnt": sign([i64], [i64]),
10000 "i64.add": sign([i64, i64], [i64]),
10001 "i64.sub": sign([i64, i64], [i64]),
10002 "i64.mul": sign([i64, i64], [i64]),
10003 "i64.div_s": sign([i64, i64], [i64]),
10004 "i64.div_u": sign([i64, i64], [i64]),
10005 "i64.rem_s": sign([i64, i64], [i64]),
10006 "i64.rem_u": sign([i64, i64], [i64]),
10007 "i64.and": sign([i64, i64], [i64]),
10008 "i64.or": sign([i64, i64], [i64]),
10009 "i64.xor": sign([i64, i64], [i64]),
10010 "i64.shl": sign([i64, i64], [i64]),
10011 "i64.shr_s": sign([i64, i64], [i64]),
10012 "i64.shr_u": sign([i64, i64], [i64]),
10013 "i64.rotl": sign([i64, i64], [i64]),
10014 "i64.rotr": sign([i64, i64], [i64]),
10015 "f32.abs": sign([f32], [f32]),
10016 "f32.neg": sign([f32], [f32]),
10017 "f32.ceil": sign([f32], [f32]),
10018 "f32.floor": sign([f32], [f32]),
10019 "f32.trunc": sign([f32], [f32]),
10020 "f32.nearest": sign([f32], [f32]),
10021 "f32.sqrt": sign([f32], [f32]),
10022 "f32.add": sign([f32, f32], [f32]),
10023 "f32.sub": sign([f32, f32], [f32]),
10024 "f32.mul": sign([f32, f32], [f32]),
10025 "f32.div": sign([f32, f32], [f32]),
10026 "f32.min": sign([f32, f32], [f32]),
10027 "f32.max": sign([f32, f32], [f32]),
10028 "f32.copysign": sign([f32, f32], [f32]),
10029 "f64.abs": sign([f64], [f64]),
10030 "f64.neg": sign([f64], [f64]),
10031 "f64.ceil": sign([f64], [f64]),
10032 "f64.floor": sign([f64], [f64]),
10033 "f64.trunc": sign([f64], [f64]),
10034 "f64.nearest": sign([f64], [f64]),
10035 "f64.sqrt": sign([f64], [f64]),
10036 "f64.add": sign([f64, f64], [f64]),
10037 "f64.sub": sign([f64, f64], [f64]),
10038 "f64.mul": sign([f64, f64], [f64]),
10039 "f64.div": sign([f64, f64], [f64]),
10040 "f64.min": sign([f64, f64], [f64]),
10041 "f64.max": sign([f64, f64], [f64]),
10042 "f64.copysign": sign([f64, f64], [f64]),
10043 "i32.wrap/i64": sign([i64], [i32]),
10044 "i32.trunc_s/f32": sign([f32], [i32]),
10045 "i32.trunc_u/f32": sign([f32], [i32]),
10046 "i32.trunc_s/f64": sign([f32], [i32]),
10047 "i32.trunc_u/f64": sign([f64], [i32]),
10048 "i64.extend_s/i32": sign([i32], [i64]),
10049 "i64.extend_u/i32": sign([i32], [i64]),
10050 "i64.trunc_s/f32": sign([f32], [i64]),
10051 "i64.trunc_u/f32": sign([f32], [i64]),
10052 "i64.trunc_s/f64": sign([f64], [i64]),
10053 "i64.trunc_u/f64": sign([f64], [i64]),
10054 "f32.convert_s/i32": sign([i32], [f32]),
10055 "f32.convert_u/i32": sign([i32], [f32]),
10056 "f32.convert_s/i64": sign([i64], [f32]),
10057 "f32.convert_u/i64": sign([i64], [f32]),
10058 "f32.demote/f64": sign([f64], [f32]),
10059 "f64.convert_s/i32": sign([i32], [f64]),
10060 "f64.convert_u/i32": sign([i32], [f64]),
10061 "f64.convert_s/i64": sign([i64], [f64]),
10062 "f64.convert_u/i64": sign([i64], [f64]),
10063 "f64.promote/f32": sign([f32], [f64]),
10064 "i32.reinterpret/f32": sign([f32], [i32]),
10065 "i64.reinterpret/f64": sign([f64], [i64]),
10066 "f32.reinterpret/i32": sign([i32], [f32]),
10067 "f64.reinterpret/i64": sign([i64], [f64])
10068};
10069var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
10070exports.signatures = signatures;
10071
10072/***/ }),
10073
10074/***/ 6576:
10075/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10076
10077"use strict";
10078
10079
10080Object.defineProperty(exports, "__esModule", ({
10081 value: true
10082}));
10083exports.traverse = traverse;
10084
10085var _nodePath = __webpack_require__(82023);
10086
10087var _nodes = __webpack_require__(18402);
10088
10089// recursively walks the AST starting at the given node. The callback is invoked for
10090// and object that has a 'type' property.
10091function walk(context, callback) {
10092 var stop = false;
10093
10094 function innerWalk(context, callback) {
10095 if (stop) {
10096 return;
10097 }
10098
10099 var node = context.node;
10100
10101 if (node === undefined) {
10102 console.warn("traversing with an empty context");
10103 return;
10104 }
10105
10106 if (node._deleted === true) {
10107 return;
10108 }
10109
10110 var path = (0, _nodePath.createPath)(context);
10111 callback(node.type, path);
10112
10113 if (path.shouldStop) {
10114 stop = true;
10115 return;
10116 }
10117
10118 Object.keys(node).forEach(function (prop) {
10119 var value = node[prop];
10120
10121 if (value === null || value === undefined) {
10122 return;
10123 }
10124
10125 var valueAsArray = Array.isArray(value) ? value : [value];
10126 valueAsArray.forEach(function (childNode) {
10127 if (typeof childNode.type === "string") {
10128 var childContext = {
10129 node: childNode,
10130 parentKey: prop,
10131 parentPath: path,
10132 shouldStop: false,
10133 inList: Array.isArray(value)
10134 };
10135 innerWalk(childContext, callback);
10136 }
10137 });
10138 });
10139 }
10140
10141 innerWalk(context, callback);
10142}
10143
10144var noop = function noop() {};
10145
10146function traverse(node, visitors) {
10147 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
10148 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
10149 Object.keys(visitors).forEach(function (visitor) {
10150 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
10151 throw new Error("Unexpected visitor ".concat(visitor));
10152 }
10153 });
10154 var context = {
10155 node: node,
10156 inList: false,
10157 shouldStop: false,
10158 parentPath: null,
10159 parentKey: null
10160 };
10161 walk(context, function (type, path) {
10162 if (typeof visitors[type] === "function") {
10163 before(type, path);
10164 visitors[type](path);
10165 after(type, path);
10166 }
10167
10168 var unionTypes = _nodes.unionTypesMap[type];
10169
10170 if (!unionTypes) {
10171 throw new Error("Unexpected node type ".concat(type));
10172 }
10173
10174 unionTypes.forEach(function (unionType) {
10175 if (typeof visitors[unionType] === "function") {
10176 before(unionType, path);
10177 visitors[unionType](path);
10178 after(unionType, path);
10179 }
10180 });
10181 });
10182}
10183
10184/***/ }),
10185
10186/***/ 44605:
10187/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10188
10189"use strict";
10190
10191
10192Object.defineProperty(exports, "__esModule", ({
10193 value: true
10194}));
10195exports.isAnonymous = isAnonymous;
10196exports.getSectionMetadata = getSectionMetadata;
10197exports.getSectionMetadatas = getSectionMetadatas;
10198exports.sortSectionMetadata = sortSectionMetadata;
10199exports.orderedInsertNode = orderedInsertNode;
10200exports.assertHasLoc = assertHasLoc;
10201exports.getEndOfSection = getEndOfSection;
10202exports.shiftLoc = shiftLoc;
10203exports.shiftSection = shiftSection;
10204exports.signatureForOpcode = signatureForOpcode;
10205exports.getUniqueNameGenerator = getUniqueNameGenerator;
10206exports.getStartByteOffset = getStartByteOffset;
10207exports.getEndByteOffset = getEndByteOffset;
10208exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
10209exports.getEndBlockByteOffset = getEndBlockByteOffset;
10210exports.getStartBlockByteOffset = getStartBlockByteOffset;
10211
10212var _signatures = __webpack_require__(46529);
10213
10214var _traverse = __webpack_require__(6576);
10215
10216var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(1594));
10217
10218function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
10219
10220function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10221
10222function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
10223
10224function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10225
10226function isAnonymous(ident) {
10227 return ident.raw === "";
10228}
10229
10230function getSectionMetadata(ast, name) {
10231 var section;
10232 (0, _traverse.traverse)(ast, {
10233 SectionMetadata: function (_SectionMetadata) {
10234 function SectionMetadata(_x) {
10235 return _SectionMetadata.apply(this, arguments);
10236 }
10237
10238 SectionMetadata.toString = function () {
10239 return _SectionMetadata.toString();
10240 };
10241
10242 return SectionMetadata;
10243 }(function (_ref) {
10244 var node = _ref.node;
10245
10246 if (node.section === name) {
10247 section = node;
10248 }
10249 })
10250 });
10251 return section;
10252}
10253
10254function getSectionMetadatas(ast, name) {
10255 var sections = [];
10256 (0, _traverse.traverse)(ast, {
10257 SectionMetadata: function (_SectionMetadata2) {
10258 function SectionMetadata(_x2) {
10259 return _SectionMetadata2.apply(this, arguments);
10260 }
10261
10262 SectionMetadata.toString = function () {
10263 return _SectionMetadata2.toString();
10264 };
10265
10266 return SectionMetadata;
10267 }(function (_ref2) {
10268 var node = _ref2.node;
10269
10270 if (node.section === name) {
10271 sections.push(node);
10272 }
10273 })
10274 });
10275 return sections;
10276}
10277
10278function sortSectionMetadata(m) {
10279 if (m.metadata == null) {
10280 console.warn("sortSectionMetadata: no metadata to sort");
10281 return;
10282 } // $FlowIgnore
10283
10284
10285 m.metadata.sections.sort(function (a, b) {
10286 var aId = _helperWasmBytecode.default.sections[a.section];
10287 var bId = _helperWasmBytecode.default.sections[b.section];
10288
10289 if (typeof aId !== "number" || typeof bId !== "number") {
10290 throw new Error("Section id not found");
10291 }
10292
10293 return aId - bId;
10294 });
10295}
10296
10297function orderedInsertNode(m, n) {
10298 assertHasLoc(n);
10299 var didInsert = false;
10300
10301 if (n.type === "ModuleExport") {
10302 m.fields.push(n);
10303 return;
10304 }
10305
10306 m.fields = m.fields.reduce(function (acc, field) {
10307 var fieldEndCol = Infinity;
10308
10309 if (field.loc != null) {
10310 // $FlowIgnore
10311 fieldEndCol = field.loc.end.column;
10312 } // $FlowIgnore: assertHasLoc ensures that
10313
10314
10315 if (didInsert === false && n.loc.start.column < fieldEndCol) {
10316 didInsert = true;
10317 acc.push(n);
10318 }
10319
10320 acc.push(field);
10321 return acc;
10322 }, []); // Handles empty modules or n is the last element
10323
10324 if (didInsert === false) {
10325 m.fields.push(n);
10326 }
10327}
10328
10329function assertHasLoc(n) {
10330 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
10331 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
10332 }
10333}
10334
10335function getEndOfSection(s) {
10336 assertHasLoc(s.size);
10337 return s.startOffset + s.size.value + ( // $FlowIgnore
10338 s.size.loc.end.column - s.size.loc.start.column);
10339}
10340
10341function shiftLoc(node, delta) {
10342 // $FlowIgnore
10343 node.loc.start.column += delta; // $FlowIgnore
10344
10345 node.loc.end.column += delta;
10346}
10347
10348function shiftSection(ast, node, delta) {
10349 if (node.type !== "SectionMetadata") {
10350 throw new Error("Can not shift node " + JSON.stringify(node.type));
10351 }
10352
10353 node.startOffset += delta;
10354
10355 if (_typeof(node.size.loc) === "object") {
10356 shiftLoc(node.size, delta);
10357 } // Custom sections doesn't have vectorOfSize
10358
10359
10360 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
10361 shiftLoc(node.vectorOfSize, delta);
10362 }
10363
10364 var sectionName = node.section; // shift node locations within that section
10365
10366 (0, _traverse.traverse)(ast, {
10367 Node: function Node(_ref3) {
10368 var node = _ref3.node;
10369 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
10370
10371 if (section === sectionName && _typeof(node.loc) === "object") {
10372 shiftLoc(node, delta);
10373 }
10374 }
10375 });
10376}
10377
10378function signatureForOpcode(object, name) {
10379 var opcodeName = name;
10380
10381 if (object !== undefined && object !== "") {
10382 opcodeName = object + "." + name;
10383 }
10384
10385 var sign = _signatures.signatures[opcodeName];
10386
10387 if (sign == undefined) {
10388 // TODO: Uncomment this when br_table and others has been done
10389 //throw new Error("Invalid opcode: "+opcodeName);
10390 return [object, object];
10391 }
10392
10393 return sign[0];
10394}
10395
10396function getUniqueNameGenerator() {
10397 var inc = {};
10398 return function () {
10399 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
10400
10401 if (!(prefix in inc)) {
10402 inc[prefix] = 0;
10403 } else {
10404 inc[prefix] = inc[prefix] + 1;
10405 }
10406
10407 return prefix + "_" + inc[prefix];
10408 };
10409}
10410
10411function getStartByteOffset(n) {
10412 // $FlowIgnore
10413 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
10414 throw new Error( // $FlowIgnore
10415 "Can not get byte offset without loc informations, node: " + String(n.id));
10416 }
10417
10418 return n.loc.start.column;
10419}
10420
10421function getEndByteOffset(n) {
10422 // $FlowIgnore
10423 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
10424 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
10425 }
10426
10427 return n.loc.end.column;
10428}
10429
10430function getFunctionBeginingByteOffset(n) {
10431 if (!(n.body.length > 0)) {
10432 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
10433 }
10434
10435 var _n$body = _slicedToArray(n.body, 1),
10436 firstInstruction = _n$body[0];
10437
10438 return getStartByteOffset(firstInstruction);
10439}
10440
10441function getEndBlockByteOffset(n) {
10442 // $FlowIgnore
10443 if (!(n.instr.length > 0 || n.body.length > 0)) {
10444 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
10445 }
10446
10447 var lastInstruction;
10448
10449 if (n.instr) {
10450 // $FlowIgnore
10451 lastInstruction = n.instr[n.instr.length - 1];
10452 }
10453
10454 if (n.body) {
10455 // $FlowIgnore
10456 lastInstruction = n.body[n.body.length - 1];
10457 }
10458
10459 if (!(_typeof(lastInstruction) === "object")) {
10460 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
10461 }
10462
10463 // $FlowIgnore
10464 return getStartByteOffset(lastInstruction);
10465}
10466
10467function getStartBlockByteOffset(n) {
10468 // $FlowIgnore
10469 if (!(n.instr.length > 0 || n.body.length > 0)) {
10470 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
10471 }
10472
10473 var fistInstruction;
10474
10475 if (n.instr) {
10476 // $FlowIgnore
10477 var _n$instr = _slicedToArray(n.instr, 1);
10478
10479 fistInstruction = _n$instr[0];
10480 }
10481
10482 if (n.body) {
10483 // $FlowIgnore
10484 var _n$body2 = _slicedToArray(n.body, 1);
10485
10486 fistInstruction = _n$body2[0];
10487 }
10488
10489 if (!(_typeof(fistInstruction) === "object")) {
10490 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
10491 }
10492
10493 // $FlowIgnore
10494 return getStartByteOffset(fistInstruction);
10495}
10496
10497/***/ }),
10498
10499/***/ 53086:
10500/***/ (function(__unused_webpack_module, exports) {
10501
10502"use strict";
10503
10504
10505Object.defineProperty(exports, "__esModule", ({
10506 value: true
10507}));
10508exports.LinkError = exports.CompileError = exports.RuntimeError = void 0;
10509
10510function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10511
10512function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10513
10514function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
10515
10516function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10517
10518var RuntimeError =
10519/*#__PURE__*/
10520function (_Error) {
10521 _inherits(RuntimeError, _Error);
10522
10523 function RuntimeError() {
10524 _classCallCheck(this, RuntimeError);
10525
10526 return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
10527 }
10528
10529 return RuntimeError;
10530}(Error);
10531
10532exports.RuntimeError = RuntimeError;
10533
10534var CompileError =
10535/*#__PURE__*/
10536function (_Error2) {
10537 _inherits(CompileError, _Error2);
10538
10539 function CompileError() {
10540 _classCallCheck(this, CompileError);
10541
10542 return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
10543 }
10544
10545 return CompileError;
10546}(Error);
10547
10548exports.CompileError = CompileError;
10549
10550var LinkError =
10551/*#__PURE__*/
10552function (_Error3) {
10553 _inherits(LinkError, _Error3);
10554
10555 function LinkError() {
10556 _classCallCheck(this, LinkError);
10557
10558 return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
10559 }
10560
10561 return LinkError;
10562}(Error);
10563
10564exports.LinkError = LinkError;
10565
10566/***/ }),
10567
10568/***/ 5401:
10569/***/ (function(__unused_webpack_module, exports) {
10570
10571"use strict";
10572
10573
10574Object.defineProperty(exports, "__esModule", ({
10575 value: true
10576}));
10577exports.overrideBytesInBuffer = overrideBytesInBuffer;
10578exports.makeBuffer = makeBuffer;
10579exports.fromHexdump = fromHexdump;
10580
10581function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10582
10583function concatUint8Arrays() {
10584 for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
10585 arrays[_key] = arguments[_key];
10586 }
10587
10588 var totalLength = arrays.reduce(function (a, b) {
10589 return a + b.length;
10590 }, 0);
10591 var result = new Uint8Array(totalLength);
10592 var offset = 0;
10593
10594 for (var _i = 0; _i < arrays.length; _i++) {
10595 var arr = arrays[_i];
10596
10597 if (arr instanceof Uint8Array === false) {
10598 throw new Error("arr must be of type Uint8Array");
10599 }
10600
10601 result.set(arr, offset);
10602 offset += arr.length;
10603 }
10604
10605 return result;
10606}
10607
10608function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) {
10609 var beforeBytes = buffer.slice(0, startLoc);
10610 var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it
10611
10612 if (newBytes.length === 0) {
10613 return concatUint8Arrays(beforeBytes, afterBytes);
10614 }
10615
10616 var replacement = Uint8Array.from(newBytes);
10617 return concatUint8Arrays(beforeBytes, replacement, afterBytes);
10618}
10619
10620function makeBuffer() {
10621 for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
10622 splitedBytes[_key2] = arguments[_key2];
10623 }
10624
10625 var bytes = [].concat.apply([], splitedBytes);
10626 return new Uint8Array(bytes).buffer;
10627}
10628
10629function fromHexdump(str) {
10630 var lines = str.split("\n"); // remove any leading left whitespace
10631
10632 lines = lines.map(function (line) {
10633 return line.trim();
10634 });
10635 var bytes = lines.reduce(function (acc, line) {
10636 var cols = line.split(" "); // remove the offset, left column
10637
10638 cols.shift();
10639 cols = cols.filter(function (x) {
10640 return x !== "";
10641 });
10642 var bytes = cols.map(function (x) {
10643 return parseInt(x, 16);
10644 });
10645 acc.push.apply(acc, _toConsumableArray(bytes));
10646 return acc;
10647 }, []);
10648 return Buffer.from(bytes);
10649}
10650
10651/***/ }),
10652
10653/***/ 1594:
10654/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10655
10656"use strict";
10657
10658
10659Object.defineProperty(exports, "__esModule", ({
10660 value: true
10661}));
10662Object.defineProperty(exports, "getSectionForNode", ({
10663 enumerable: true,
10664 get: function get() {
10665 return _section.getSectionForNode;
10666 }
10667}));
10668exports.default = void 0;
10669
10670var _section = __webpack_require__(12851);
10671
10672var illegalop = "illegal";
10673var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
10674var moduleVersion = [0x01, 0x00, 0x00, 0x00];
10675
10676function invertMap(obj) {
10677 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
10678 return k;
10679 };
10680 var result = {};
10681 var keys = Object.keys(obj);
10682
10683 for (var i = 0, length = keys.length; i < length; i++) {
10684 result[keyModifierFn(obj[keys[i]])] = keys[i];
10685 }
10686
10687 return result;
10688}
10689
10690function createSymbolObject(name
10691/*: string */
10692, object
10693/*: string */
10694)
10695/*: Symbol*/
10696{
10697 var numberOfArgs
10698 /*: number*/
10699 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
10700 return {
10701 name: name,
10702 object: object,
10703 numberOfArgs: numberOfArgs
10704 };
10705}
10706
10707function createSymbol(name
10708/*: string */
10709)
10710/*: Symbol*/
10711{
10712 var numberOfArgs
10713 /*: number*/
10714 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
10715 return {
10716 name: name,
10717 numberOfArgs: numberOfArgs
10718 };
10719}
10720
10721var types = {
10722 func: 0x60,
10723 result: 0x40
10724};
10725var exportTypes = {
10726 0x00: "Func",
10727 0x01: "Table",
10728 0x02: "Mem",
10729 0x03: "Global"
10730};
10731var exportTypesByName = invertMap(exportTypes);
10732var valtypes = {
10733 0x7f: "i32",
10734 0x7e: "i64",
10735 0x7d: "f32",
10736 0x7c: "f64",
10737 0x7b: "v128"
10738};
10739var valtypesByString = invertMap(valtypes);
10740var tableTypes = {
10741 0x70: "anyfunc"
10742};
10743var blockTypes = Object.assign({}, valtypes, {
10744 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
10745 0x40: null,
10746 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
10747 0x7f: "i32",
10748 0x7e: "i64",
10749 0x7d: "f32",
10750 0x7c: "f64"
10751});
10752var globalTypes = {
10753 0x00: "const",
10754 0x01: "var"
10755};
10756var globalTypesByString = invertMap(globalTypes);
10757var importTypes = {
10758 0x00: "func",
10759 0x01: "table",
10760 0x02: "mem",
10761 0x03: "global"
10762};
10763var sections = {
10764 custom: 0,
10765 type: 1,
10766 import: 2,
10767 func: 3,
10768 table: 4,
10769 memory: 5,
10770 global: 6,
10771 export: 7,
10772 start: 8,
10773 element: 9,
10774 code: 10,
10775 data: 11
10776};
10777var symbolsByByte = {
10778 0x00: createSymbol("unreachable"),
10779 0x01: createSymbol("nop"),
10780 0x02: createSymbol("block"),
10781 0x03: createSymbol("loop"),
10782 0x04: createSymbol("if"),
10783 0x05: createSymbol("else"),
10784 0x06: illegalop,
10785 0x07: illegalop,
10786 0x08: illegalop,
10787 0x09: illegalop,
10788 0x0a: illegalop,
10789 0x0b: createSymbol("end"),
10790 0x0c: createSymbol("br", 1),
10791 0x0d: createSymbol("br_if", 1),
10792 0x0e: createSymbol("br_table"),
10793 0x0f: createSymbol("return"),
10794 0x10: createSymbol("call", 1),
10795 0x11: createSymbol("call_indirect", 2),
10796 0x12: illegalop,
10797 0x13: illegalop,
10798 0x14: illegalop,
10799 0x15: illegalop,
10800 0x16: illegalop,
10801 0x17: illegalop,
10802 0x18: illegalop,
10803 0x19: illegalop,
10804 0x1a: createSymbol("drop"),
10805 0x1b: createSymbol("select"),
10806 0x1c: illegalop,
10807 0x1d: illegalop,
10808 0x1e: illegalop,
10809 0x1f: illegalop,
10810 0x20: createSymbol("get_local", 1),
10811 0x21: createSymbol("set_local", 1),
10812 0x22: createSymbol("tee_local", 1),
10813 0x23: createSymbol("get_global", 1),
10814 0x24: createSymbol("set_global", 1),
10815 0x25: illegalop,
10816 0x26: illegalop,
10817 0x27: illegalop,
10818 0x28: createSymbolObject("load", "u32", 1),
10819 0x29: createSymbolObject("load", "u64", 1),
10820 0x2a: createSymbolObject("load", "f32", 1),
10821 0x2b: createSymbolObject("load", "f64", 1),
10822 0x2c: createSymbolObject("load8_s", "u32", 1),
10823 0x2d: createSymbolObject("load8_u", "u32", 1),
10824 0x2e: createSymbolObject("load16_s", "u32", 1),
10825 0x2f: createSymbolObject("load16_u", "u32", 1),
10826 0x30: createSymbolObject("load8_s", "u64", 1),
10827 0x31: createSymbolObject("load8_u", "u64", 1),
10828 0x32: createSymbolObject("load16_s", "u64", 1),
10829 0x33: createSymbolObject("load16_u", "u64", 1),
10830 0x34: createSymbolObject("load32_s", "u64", 1),
10831 0x35: createSymbolObject("load32_u", "u64", 1),
10832 0x36: createSymbolObject("store", "u32", 1),
10833 0x37: createSymbolObject("store", "u64", 1),
10834 0x38: createSymbolObject("store", "f32", 1),
10835 0x39: createSymbolObject("store", "f64", 1),
10836 0x3a: createSymbolObject("store8", "u32", 1),
10837 0x3b: createSymbolObject("store16", "u32", 1),
10838 0x3c: createSymbolObject("store8", "u64", 1),
10839 0x3d: createSymbolObject("store16", "u64", 1),
10840 0x3e: createSymbolObject("store32", "u64", 1),
10841 0x3f: createSymbolObject("current_memory"),
10842 0x40: createSymbolObject("grow_memory"),
10843 0x41: createSymbolObject("const", "i32", 1),
10844 0x42: createSymbolObject("const", "i64", 1),
10845 0x43: createSymbolObject("const", "f32", 1),
10846 0x44: createSymbolObject("const", "f64", 1),
10847 0x45: createSymbolObject("eqz", "i32"),
10848 0x46: createSymbolObject("eq", "i32"),
10849 0x47: createSymbolObject("ne", "i32"),
10850 0x48: createSymbolObject("lt_s", "i32"),
10851 0x49: createSymbolObject("lt_u", "i32"),
10852 0x4a: createSymbolObject("gt_s", "i32"),
10853 0x4b: createSymbolObject("gt_u", "i32"),
10854 0x4c: createSymbolObject("le_s", "i32"),
10855 0x4d: createSymbolObject("le_u", "i32"),
10856 0x4e: createSymbolObject("ge_s", "i32"),
10857 0x4f: createSymbolObject("ge_u", "i32"),
10858 0x50: createSymbolObject("eqz", "i64"),
10859 0x51: createSymbolObject("eq", "i64"),
10860 0x52: createSymbolObject("ne", "i64"),
10861 0x53: createSymbolObject("lt_s", "i64"),
10862 0x54: createSymbolObject("lt_u", "i64"),
10863 0x55: createSymbolObject("gt_s", "i64"),
10864 0x56: createSymbolObject("gt_u", "i64"),
10865 0x57: createSymbolObject("le_s", "i64"),
10866 0x58: createSymbolObject("le_u", "i64"),
10867 0x59: createSymbolObject("ge_s", "i64"),
10868 0x5a: createSymbolObject("ge_u", "i64"),
10869 0x5b: createSymbolObject("eq", "f32"),
10870 0x5c: createSymbolObject("ne", "f32"),
10871 0x5d: createSymbolObject("lt", "f32"),
10872 0x5e: createSymbolObject("gt", "f32"),
10873 0x5f: createSymbolObject("le", "f32"),
10874 0x60: createSymbolObject("ge", "f32"),
10875 0x61: createSymbolObject("eq", "f64"),
10876 0x62: createSymbolObject("ne", "f64"),
10877 0x63: createSymbolObject("lt", "f64"),
10878 0x64: createSymbolObject("gt", "f64"),
10879 0x65: createSymbolObject("le", "f64"),
10880 0x66: createSymbolObject("ge", "f64"),
10881 0x67: createSymbolObject("clz", "i32"),
10882 0x68: createSymbolObject("ctz", "i32"),
10883 0x69: createSymbolObject("popcnt", "i32"),
10884 0x6a: createSymbolObject("add", "i32"),
10885 0x6b: createSymbolObject("sub", "i32"),
10886 0x6c: createSymbolObject("mul", "i32"),
10887 0x6d: createSymbolObject("div_s", "i32"),
10888 0x6e: createSymbolObject("div_u", "i32"),
10889 0x6f: createSymbolObject("rem_s", "i32"),
10890 0x70: createSymbolObject("rem_u", "i32"),
10891 0x71: createSymbolObject("and", "i32"),
10892 0x72: createSymbolObject("or", "i32"),
10893 0x73: createSymbolObject("xor", "i32"),
10894 0x74: createSymbolObject("shl", "i32"),
10895 0x75: createSymbolObject("shr_s", "i32"),
10896 0x76: createSymbolObject("shr_u", "i32"),
10897 0x77: createSymbolObject("rotl", "i32"),
10898 0x78: createSymbolObject("rotr", "i32"),
10899 0x79: createSymbolObject("clz", "i64"),
10900 0x7a: createSymbolObject("ctz", "i64"),
10901 0x7b: createSymbolObject("popcnt", "i64"),
10902 0x7c: createSymbolObject("add", "i64"),
10903 0x7d: createSymbolObject("sub", "i64"),
10904 0x7e: createSymbolObject("mul", "i64"),
10905 0x7f: createSymbolObject("div_s", "i64"),
10906 0x80: createSymbolObject("div_u", "i64"),
10907 0x81: createSymbolObject("rem_s", "i64"),
10908 0x82: createSymbolObject("rem_u", "i64"),
10909 0x83: createSymbolObject("and", "i64"),
10910 0x84: createSymbolObject("or", "i64"),
10911 0x85: createSymbolObject("xor", "i64"),
10912 0x86: createSymbolObject("shl", "i64"),
10913 0x87: createSymbolObject("shr_s", "i64"),
10914 0x88: createSymbolObject("shr_u", "i64"),
10915 0x89: createSymbolObject("rotl", "i64"),
10916 0x8a: createSymbolObject("rotr", "i64"),
10917 0x8b: createSymbolObject("abs", "f32"),
10918 0x8c: createSymbolObject("neg", "f32"),
10919 0x8d: createSymbolObject("ceil", "f32"),
10920 0x8e: createSymbolObject("floor", "f32"),
10921 0x8f: createSymbolObject("trunc", "f32"),
10922 0x90: createSymbolObject("nearest", "f32"),
10923 0x91: createSymbolObject("sqrt", "f32"),
10924 0x92: createSymbolObject("add", "f32"),
10925 0x93: createSymbolObject("sub", "f32"),
10926 0x94: createSymbolObject("mul", "f32"),
10927 0x95: createSymbolObject("div", "f32"),
10928 0x96: createSymbolObject("min", "f32"),
10929 0x97: createSymbolObject("max", "f32"),
10930 0x98: createSymbolObject("copysign", "f32"),
10931 0x99: createSymbolObject("abs", "f64"),
10932 0x9a: createSymbolObject("neg", "f64"),
10933 0x9b: createSymbolObject("ceil", "f64"),
10934 0x9c: createSymbolObject("floor", "f64"),
10935 0x9d: createSymbolObject("trunc", "f64"),
10936 0x9e: createSymbolObject("nearest", "f64"),
10937 0x9f: createSymbolObject("sqrt", "f64"),
10938 0xa0: createSymbolObject("add", "f64"),
10939 0xa1: createSymbolObject("sub", "f64"),
10940 0xa2: createSymbolObject("mul", "f64"),
10941 0xa3: createSymbolObject("div", "f64"),
10942 0xa4: createSymbolObject("min", "f64"),
10943 0xa5: createSymbolObject("max", "f64"),
10944 0xa6: createSymbolObject("copysign", "f64"),
10945 0xa7: createSymbolObject("wrap/i64", "i32"),
10946 0xa8: createSymbolObject("trunc_s/f32", "i32"),
10947 0xa9: createSymbolObject("trunc_u/f32", "i32"),
10948 0xaa: createSymbolObject("trunc_s/f64", "i32"),
10949 0xab: createSymbolObject("trunc_u/f64", "i32"),
10950 0xac: createSymbolObject("extend_s/i32", "i64"),
10951 0xad: createSymbolObject("extend_u/i32", "i64"),
10952 0xae: createSymbolObject("trunc_s/f32", "i64"),
10953 0xaf: createSymbolObject("trunc_u/f32", "i64"),
10954 0xb0: createSymbolObject("trunc_s/f64", "i64"),
10955 0xb1: createSymbolObject("trunc_u/f64", "i64"),
10956 0xb2: createSymbolObject("convert_s/i32", "f32"),
10957 0xb3: createSymbolObject("convert_u/i32", "f32"),
10958 0xb4: createSymbolObject("convert_s/i64", "f32"),
10959 0xb5: createSymbolObject("convert_u/i64", "f32"),
10960 0xb6: createSymbolObject("demote/f64", "f32"),
10961 0xb7: createSymbolObject("convert_s/i32", "f64"),
10962 0xb8: createSymbolObject("convert_u/i32", "f64"),
10963 0xb9: createSymbolObject("convert_s/i64", "f64"),
10964 0xba: createSymbolObject("convert_u/i64", "f64"),
10965 0xbb: createSymbolObject("promote/f32", "f64"),
10966 0xbc: createSymbolObject("reinterpret/f32", "i32"),
10967 0xbd: createSymbolObject("reinterpret/f64", "i64"),
10968 0xbe: createSymbolObject("reinterpret/i32", "f32"),
10969 0xbf: createSymbolObject("reinterpret/i64", "f64")
10970};
10971var symbolsByName = invertMap(symbolsByByte, function (obj) {
10972 if (typeof obj.object === "string") {
10973 return "".concat(obj.object, ".").concat(obj.name);
10974 }
10975
10976 return obj.name;
10977});
10978var _default = {
10979 symbolsByByte: symbolsByByte,
10980 sections: sections,
10981 magicModuleHeader: magicModuleHeader,
10982 moduleVersion: moduleVersion,
10983 types: types,
10984 valtypes: valtypes,
10985 exportTypes: exportTypes,
10986 blockTypes: blockTypes,
10987 tableTypes: tableTypes,
10988 globalTypes: globalTypes,
10989 importTypes: importTypes,
10990 valtypesByString: valtypesByString,
10991 globalTypesByString: globalTypesByString,
10992 exportTypesByName: exportTypesByName,
10993 symbolsByName: symbolsByName
10994};
10995exports.default = _default;
10996
10997/***/ }),
10998
10999/***/ 12851:
11000/***/ (function(__unused_webpack_module, exports) {
11001
11002"use strict";
11003
11004
11005Object.defineProperty(exports, "__esModule", ({
11006 value: true
11007}));
11008exports.getSectionForNode = getSectionForNode;
11009
11010function getSectionForNode(n) {
11011 switch (n.type) {
11012 case "ModuleImport":
11013 return "import";
11014
11015 case "CallInstruction":
11016 case "CallIndirectInstruction":
11017 case "Func":
11018 case "Instr":
11019 return "code";
11020
11021 case "ModuleExport":
11022 return "export";
11023
11024 case "Start":
11025 return "start";
11026
11027 case "TypeInstruction":
11028 return "type";
11029
11030 case "IndexInFuncSection":
11031 return "func";
11032
11033 case "Global":
11034 return "global";
11035 // No section
11036
11037 default:
11038 return;
11039 }
11040}
11041
11042/***/ }),
11043
11044/***/ 41211:
11045/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
11046
11047"use strict";
11048
11049
11050Object.defineProperty(exports, "__esModule", ({
11051 value: true
11052}));
11053exports.encodeF32 = encodeF32;
11054exports.encodeF64 = encodeF64;
11055exports.decodeF32 = decodeF32;
11056exports.decodeF64 = decodeF64;
11057exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0;
11058
11059var _ieee = __webpack_require__(30848);
11060
11061/**
11062 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
11063 * n = 32/8
11064 */
11065var NUMBER_OF_BYTE_F32 = 4;
11066/**
11067 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
11068 * n = 64/8
11069 */
11070
11071exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32;
11072var NUMBER_OF_BYTE_F64 = 8;
11073exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64;
11074var SINGLE_PRECISION_MANTISSA = 23;
11075exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA;
11076var DOUBLE_PRECISION_MANTISSA = 52;
11077exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA;
11078
11079function encodeF32(v) {
11080 var buffer = [];
11081 (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
11082 return buffer;
11083}
11084
11085function encodeF64(v) {
11086 var buffer = [];
11087 (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
11088 return buffer;
11089}
11090
11091function decodeF32(bytes) {
11092 var buffer = Buffer.from(bytes);
11093 return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
11094}
11095
11096function decodeF64(bytes) {
11097 var buffer = Buffer.from(bytes);
11098 return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
11099}
11100
11101/***/ }),
11102
11103/***/ 54280:
11104/***/ (function(__unused_webpack_module, exports) {
11105
11106"use strict";
11107// Copyright 2012 The Obvious Corporation.
11108
11109/*
11110 * bits: Bitwise buffer utilities. The utilities here treat a buffer
11111 * as a little-endian bigint, so the lowest-order bit is bit #0 of
11112 * `buffer[0]`, and the highest-order bit is bit #7 of
11113 * `buffer[buffer.length - 1]`.
11114 */
11115
11116/*
11117 * Modules used
11118 */
11119
11120/*
11121 * Exported bindings
11122 */
11123
11124/**
11125 * Extracts the given number of bits from the buffer at the indicated
11126 * index, returning a simple number as the result. If bits are requested
11127 * that aren't covered by the buffer, the `defaultBit` is used as their
11128 * value.
11129 *
11130 * The `bitLength` must be no more than 32. The `defaultBit` if not
11131 * specified is taken to be `0`.
11132 */
11133
11134Object.defineProperty(exports, "__esModule", ({
11135 value: true
11136}));
11137exports.extract = extract;
11138exports.inject = inject;
11139exports.getSign = getSign;
11140exports.highOrder = highOrder;
11141
11142function extract(buffer, bitIndex, bitLength, defaultBit) {
11143 if (bitLength < 0 || bitLength > 32) {
11144 throw new Error("Bad value for bitLength.");
11145 }
11146
11147 if (defaultBit === undefined) {
11148 defaultBit = 0;
11149 } else if (defaultBit !== 0 && defaultBit !== 1) {
11150 throw new Error("Bad value for defaultBit.");
11151 }
11152
11153 var defaultByte = defaultBit * 0xff;
11154 var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but
11155 // if endBit !== 0, then endByte is inclusive.
11156
11157 var lastBit = bitIndex + bitLength;
11158 var startByte = Math.floor(bitIndex / 8);
11159 var startBit = bitIndex % 8;
11160 var endByte = Math.floor(lastBit / 8);
11161 var endBit = lastBit % 8;
11162
11163 if (endBit !== 0) {
11164 // `(1 << endBit) - 1` is the mask of all bits up to but not including
11165 // the endBit.
11166 result = get(endByte) & (1 << endBit) - 1;
11167 }
11168
11169 while (endByte > startByte) {
11170 endByte--;
11171 result = result << 8 | get(endByte);
11172 }
11173
11174 result >>>= startBit;
11175 return result;
11176
11177 function get(index) {
11178 var result = buffer[index];
11179 return result === undefined ? defaultByte : result;
11180 }
11181}
11182/**
11183 * Injects the given bits into the given buffer at the given index. Any
11184 * bits in the value beyond the length to set are ignored.
11185 */
11186
11187
11188function inject(buffer, bitIndex, bitLength, value) {
11189 if (bitLength < 0 || bitLength > 32) {
11190 throw new Error("Bad value for bitLength.");
11191 }
11192
11193 var lastByte = Math.floor((bitIndex + bitLength - 1) / 8);
11194
11195 if (bitIndex < 0 || lastByte >= buffer.length) {
11196 throw new Error("Index out of range.");
11197 } // Just keeping it simple, until / unless profiling shows that this
11198 // is a problem.
11199
11200
11201 var atByte = Math.floor(bitIndex / 8);
11202 var atBit = bitIndex % 8;
11203
11204 while (bitLength > 0) {
11205 if (value & 1) {
11206 buffer[atByte] |= 1 << atBit;
11207 } else {
11208 buffer[atByte] &= ~(1 << atBit);
11209 }
11210
11211 value >>= 1;
11212 bitLength--;
11213 atBit = (atBit + 1) % 8;
11214
11215 if (atBit === 0) {
11216 atByte++;
11217 }
11218 }
11219}
11220/**
11221 * Gets the sign bit of the given buffer.
11222 */
11223
11224
11225function getSign(buffer) {
11226 return buffer[buffer.length - 1] >>> 7;
11227}
11228/**
11229 * Gets the zero-based bit number of the highest-order bit with the
11230 * given value in the given buffer.
11231 *
11232 * If the buffer consists entirely of the other bit value, then this returns
11233 * `-1`.
11234 */
11235
11236
11237function highOrder(bit, buffer) {
11238 var length = buffer.length;
11239 var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte
11240
11241 while (length > 0 && buffer[length - 1] === fullyWrongByte) {
11242 length--;
11243 }
11244
11245 if (length === 0) {
11246 // Degenerate case. The buffer consists entirely of ~bit.
11247 return -1;
11248 }
11249
11250 var byteToCheck = buffer[length - 1];
11251 var result = length * 8 - 1;
11252
11253 for (var i = 7; i > 0; i--) {
11254 if ((byteToCheck >> i & 1) === bit) {
11255 break;
11256 }
11257
11258 result--;
11259 }
11260
11261 return result;
11262}
11263
11264/***/ }),
11265
11266/***/ 14009:
11267/***/ (function(__unused_webpack_module, exports) {
11268
11269"use strict";
11270
11271
11272Object.defineProperty(exports, "__esModule", ({
11273 value: true
11274}));
11275exports.alloc = alloc;
11276exports.free = free;
11277exports.resize = resize;
11278exports.readInt = readInt;
11279exports.readUInt = readUInt;
11280exports.writeInt64 = writeInt64;
11281exports.writeUInt64 = writeUInt64;
11282// Copyright 2012 The Obvious Corporation.
11283
11284/*
11285 * bufs: Buffer utilities.
11286 */
11287
11288/*
11289 * Module variables
11290 */
11291
11292/** Pool of buffers, where `bufPool[x].length === x`. */
11293var bufPool = [];
11294/** Maximum length of kept temporary buffers. */
11295
11296var TEMP_BUF_MAXIMUM_LENGTH = 20;
11297/** Minimum exactly-representable 64-bit int. */
11298
11299var MIN_EXACT_INT64 = -0x8000000000000000;
11300/** Maximum exactly-representable 64-bit int. */
11301
11302var MAX_EXACT_INT64 = 0x7ffffffffffffc00;
11303/** Maximum exactly-representable 64-bit uint. */
11304
11305var MAX_EXACT_UINT64 = 0xfffffffffffff800;
11306/**
11307 * The int value consisting just of a 1 in bit #32 (that is, one more
11308 * than the maximum 32-bit unsigned value).
11309 */
11310
11311var BIT_32 = 0x100000000;
11312/**
11313 * The int value consisting just of a 1 in bit #64 (that is, one more
11314 * than the maximum 64-bit unsigned value).
11315 */
11316
11317var BIT_64 = 0x10000000000000000;
11318/*
11319 * Helper functions
11320 */
11321
11322/**
11323 * Masks off all but the lowest bit set of the given number.
11324 */
11325
11326function lowestBit(num) {
11327 return num & -num;
11328}
11329/**
11330 * Gets whether trying to add the second number to the first is lossy
11331 * (inexact). The first number is meant to be an accumulated result.
11332 */
11333
11334
11335function isLossyToAdd(accum, num) {
11336 if (num === 0) {
11337 return false;
11338 }
11339
11340 var lowBit = lowestBit(num);
11341 var added = accum + lowBit;
11342
11343 if (added === accum) {
11344 return true;
11345 }
11346
11347 if (added - lowBit !== accum) {
11348 return true;
11349 }
11350
11351 return false;
11352}
11353/*
11354 * Exported functions
11355 */
11356
11357/**
11358 * Allocates a buffer of the given length, which is initialized
11359 * with all zeroes. This returns a buffer from the pool if it is
11360 * available, or a freshly-allocated buffer if not.
11361 */
11362
11363
11364function alloc(length) {
11365 var result = bufPool[length];
11366
11367 if (result) {
11368 bufPool[length] = undefined;
11369 } else {
11370 result = new Buffer(length);
11371 }
11372
11373 result.fill(0);
11374 return result;
11375}
11376/**
11377 * Releases a buffer back to the pool.
11378 */
11379
11380
11381function free(buffer) {
11382 var length = buffer.length;
11383
11384 if (length < TEMP_BUF_MAXIMUM_LENGTH) {
11385 bufPool[length] = buffer;
11386 }
11387}
11388/**
11389 * Resizes a buffer, returning a new buffer. Returns the argument if
11390 * the length wouldn't actually change. This function is only safe to
11391 * use if the given buffer was allocated within this module (since
11392 * otherwise the buffer might possibly be shared externally).
11393 */
11394
11395
11396function resize(buffer, length) {
11397 if (length === buffer.length) {
11398 return buffer;
11399 }
11400
11401 var newBuf = alloc(length);
11402 buffer.copy(newBuf);
11403 free(buffer);
11404 return newBuf;
11405}
11406/**
11407 * Reads an arbitrary signed int from a buffer.
11408 */
11409
11410
11411function readInt(buffer) {
11412 var length = buffer.length;
11413 var positive = buffer[length - 1] < 0x80;
11414 var result = positive ? 0 : -1;
11415 var lossy = false; // Note: We can't use bit manipulation here, since that stops
11416 // working if the result won't fit in a 32-bit int.
11417
11418 if (length < 7) {
11419 // Common case which can't possibly be lossy (because the result has
11420 // no more than 48 bits, and loss only happens with 54 or more).
11421 for (var i = length - 1; i >= 0; i--) {
11422 result = result * 0x100 + buffer[i];
11423 }
11424 } else {
11425 for (var _i = length - 1; _i >= 0; _i--) {
11426 var one = buffer[_i];
11427 result *= 0x100;
11428
11429 if (isLossyToAdd(result, one)) {
11430 lossy = true;
11431 }
11432
11433 result += one;
11434 }
11435 }
11436
11437 return {
11438 value: result,
11439 lossy: lossy
11440 };
11441}
11442/**
11443 * Reads an arbitrary unsigned int from a buffer.
11444 */
11445
11446
11447function readUInt(buffer) {
11448 var length = buffer.length;
11449 var result = 0;
11450 var lossy = false; // Note: See above in re bit manipulation.
11451
11452 if (length < 7) {
11453 // Common case which can't possibly be lossy (see above).
11454 for (var i = length - 1; i >= 0; i--) {
11455 result = result * 0x100 + buffer[i];
11456 }
11457 } else {
11458 for (var _i2 = length - 1; _i2 >= 0; _i2--) {
11459 var one = buffer[_i2];
11460 result *= 0x100;
11461
11462 if (isLossyToAdd(result, one)) {
11463 lossy = true;
11464 }
11465
11466 result += one;
11467 }
11468 }
11469
11470 return {
11471 value: result,
11472 lossy: lossy
11473 };
11474}
11475/**
11476 * Writes a little-endian 64-bit signed int into a buffer.
11477 */
11478
11479
11480function writeInt64(value, buffer) {
11481 if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) {
11482 throw new Error("Value out of range.");
11483 }
11484
11485 if (value < 0) {
11486 value += BIT_64;
11487 }
11488
11489 writeUInt64(value, buffer);
11490}
11491/**
11492 * Writes a little-endian 64-bit unsigned int into a buffer.
11493 */
11494
11495
11496function writeUInt64(value, buffer) {
11497 if (value < 0 || value > MAX_EXACT_UINT64) {
11498 throw new Error("Value out of range.");
11499 }
11500
11501 var lowWord = value % BIT_32;
11502 var highWord = Math.floor(value / BIT_32);
11503 buffer.writeUInt32LE(lowWord, 0);
11504 buffer.writeUInt32LE(highWord, 4);
11505}
11506
11507/***/ }),
11508
11509/***/ 89443:
11510/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
11511
11512"use strict";
11513
11514
11515Object.defineProperty(exports, "__esModule", ({
11516 value: true
11517}));
11518exports.decodeInt64 = decodeInt64;
11519exports.decodeUInt64 = decodeUInt64;
11520exports.decodeInt32 = decodeInt32;
11521exports.decodeUInt32 = decodeUInt32;
11522exports.encodeU32 = encodeU32;
11523exports.encodeI32 = encodeI32;
11524exports.encodeI64 = encodeI64;
11525exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0;
11526
11527var _leb = _interopRequireDefault(__webpack_require__(74753));
11528
11529function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11530
11531/**
11532 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
11533 * max = ceil(32/7)
11534 */
11535var MAX_NUMBER_OF_BYTE_U32 = 5;
11536/**
11537 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
11538 * max = ceil(64/7)
11539 */
11540
11541exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32;
11542var MAX_NUMBER_OF_BYTE_U64 = 10;
11543exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64;
11544
11545function decodeInt64(encodedBuffer, index) {
11546 return _leb.default.decodeInt64(encodedBuffer, index);
11547}
11548
11549function decodeUInt64(encodedBuffer, index) {
11550 return _leb.default.decodeUInt64(encodedBuffer, index);
11551}
11552
11553function decodeInt32(encodedBuffer, index) {
11554 return _leb.default.decodeInt32(encodedBuffer, index);
11555}
11556
11557function decodeUInt32(encodedBuffer, index) {
11558 return _leb.default.decodeUInt32(encodedBuffer, index);
11559}
11560
11561function encodeU32(v) {
11562 return _leb.default.encodeUInt32(v);
11563}
11564
11565function encodeI32(v) {
11566 return _leb.default.encodeInt32(v);
11567}
11568
11569function encodeI64(v) {
11570 return _leb.default.encodeInt64(v);
11571}
11572
11573/***/ }),
11574
11575/***/ 74753:
11576/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
11577
11578"use strict";
11579// Copyright 2012 The Obvious Corporation.
11580
11581/*
11582 * leb: LEB128 utilities.
11583 */
11584
11585/*
11586 * Modules used
11587 */
11588
11589
11590Object.defineProperty(exports, "__esModule", ({
11591 value: true
11592}));
11593exports.default = void 0;
11594
11595var _long = _interopRequireDefault(__webpack_require__(77960));
11596
11597var bits = _interopRequireWildcard(__webpack_require__(54280));
11598
11599var bufs = _interopRequireWildcard(__webpack_require__(14009));
11600
11601function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
11602
11603function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11604
11605/*
11606 * Module variables
11607 */
11608
11609/** The minimum possible 32-bit signed int. */
11610var MIN_INT32 = -0x80000000;
11611/** The maximum possible 32-bit signed int. */
11612
11613var MAX_INT32 = 0x7fffffff;
11614/** The maximum possible 32-bit unsigned int. */
11615
11616var MAX_UINT32 = 0xffffffff;
11617/** The minimum possible 64-bit signed int. */
11618// const MIN_INT64 = -0x8000000000000000;
11619
11620/**
11621 * The maximum possible 64-bit signed int that is representable as a
11622 * JavaScript number.
11623 */
11624// const MAX_INT64 = 0x7ffffffffffffc00;
11625
11626/**
11627 * The maximum possible 64-bit unsigned int that is representable as a
11628 * JavaScript number.
11629 */
11630// const MAX_UINT64 = 0xfffffffffffff800;
11631
11632/*
11633 * Helper functions
11634 */
11635
11636/**
11637 * Determines the number of bits required to encode the number
11638 * represented in the given buffer as a signed value. The buffer is
11639 * taken to represent a signed number in little-endian form.
11640 *
11641 * The number of bits to encode is the (zero-based) bit number of the
11642 * highest-order non-sign-matching bit, plus two. For example:
11643 *
11644 * 11111011 01110101
11645 * high low
11646 *
11647 * The sign bit here is 1 (that is, it's a negative number). The highest
11648 * bit number that doesn't match the sign is bit #10 (where the lowest-order
11649 * bit is bit #0). So, we have to encode at least 12 bits total.
11650 *
11651 * As a special degenerate case, the numbers 0 and -1 each require just one bit.
11652 */
11653
11654function signedBitCount(buffer) {
11655 return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2;
11656}
11657/**
11658 * Determines the number of bits required to encode the number
11659 * represented in the given buffer as an unsigned value. The buffer is
11660 * taken to represent an unsigned number in little-endian form.
11661 *
11662 * The number of bits to encode is the (zero-based) bit number of the
11663 * highest-order 1 bit, plus one. For example:
11664 *
11665 * 00011000 01010011
11666 * high low
11667 *
11668 * The highest-order 1 bit here is bit #12 (where the lowest-order bit
11669 * is bit #0). So, we have to encode at least 13 bits total.
11670 *
11671 * As a special degenerate case, the number 0 requires 1 bit.
11672 */
11673
11674
11675function unsignedBitCount(buffer) {
11676 var result = bits.highOrder(1, buffer) + 1;
11677 return result ? result : 1;
11678}
11679/**
11680 * Common encoder for both signed and unsigned ints. This takes a
11681 * bigint-ish buffer, returning an LEB128-encoded buffer.
11682 */
11683
11684
11685function encodeBufferCommon(buffer, signed) {
11686 var signBit;
11687 var bitCount;
11688
11689 if (signed) {
11690 signBit = bits.getSign(buffer);
11691 bitCount = signedBitCount(buffer);
11692 } else {
11693 signBit = 0;
11694 bitCount = unsignedBitCount(buffer);
11695 }
11696
11697 var byteCount = Math.ceil(bitCount / 7);
11698 var result = bufs.alloc(byteCount);
11699
11700 for (var i = 0; i < byteCount; i++) {
11701 var payload = bits.extract(buffer, i * 7, 7, signBit);
11702 result[i] = payload | 0x80;
11703 } // Mask off the top bit of the last byte, to indicate the end of the
11704 // encoding.
11705
11706
11707 result[byteCount - 1] &= 0x7f;
11708 return result;
11709}
11710/**
11711 * Gets the byte-length of the value encoded in the given buffer at
11712 * the given index.
11713 */
11714
11715
11716function encodedLength(encodedBuffer, index) {
11717 var result = 0;
11718
11719 while (encodedBuffer[index + result] >= 0x80) {
11720 result++;
11721 }
11722
11723 result++; // to account for the last byte
11724
11725 if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives
11726 // throw new Error("integer representation too long");
11727 }
11728
11729 return result;
11730}
11731/**
11732 * Common decoder for both signed and unsigned ints. This takes an
11733 * LEB128-encoded buffer, returning a bigint-ish buffer.
11734 */
11735
11736
11737function decodeBufferCommon(encodedBuffer, index, signed) {
11738 index = index === undefined ? 0 : index;
11739 var length = encodedLength(encodedBuffer, index);
11740 var bitLength = length * 7;
11741 var byteLength = Math.ceil(bitLength / 8);
11742 var result = bufs.alloc(byteLength);
11743 var outIndex = 0;
11744
11745 while (length > 0) {
11746 bits.inject(result, outIndex, 7, encodedBuffer[index]);
11747 outIndex += 7;
11748 index++;
11749 length--;
11750 }
11751
11752 var signBit;
11753 var signByte;
11754
11755 if (signed) {
11756 // Sign-extend the last byte.
11757 var lastByte = result[byteLength - 1];
11758 var endBit = outIndex % 8;
11759
11760 if (endBit !== 0) {
11761 var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
11762
11763 lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff;
11764 }
11765
11766 signBit = lastByte >> 7;
11767 signByte = signBit * 0xff;
11768 } else {
11769 signBit = 0;
11770 signByte = 0;
11771 } // Slice off any superfluous bytes, that is, ones that add no meaningful
11772 // bits (because the value would be the same if they were removed).
11773
11774
11775 while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) {
11776 byteLength--;
11777 }
11778
11779 result = bufs.resize(result, byteLength);
11780 return {
11781 value: result,
11782 nextIndex: index
11783 };
11784}
11785/*
11786 * Exported bindings
11787 */
11788
11789
11790function encodeIntBuffer(buffer) {
11791 return encodeBufferCommon(buffer, true);
11792}
11793
11794function decodeIntBuffer(encodedBuffer, index) {
11795 return decodeBufferCommon(encodedBuffer, index, true);
11796}
11797
11798function encodeInt32(num) {
11799 var buf = bufs.alloc(4);
11800 buf.writeInt32LE(num, 0);
11801 var result = encodeIntBuffer(buf);
11802 bufs.free(buf);
11803 return result;
11804}
11805
11806function decodeInt32(encodedBuffer, index) {
11807 var result = decodeIntBuffer(encodedBuffer, index);
11808 var parsed = bufs.readInt(result.value);
11809 var value = parsed.value;
11810 bufs.free(result.value);
11811
11812 if (value < MIN_INT32 || value > MAX_INT32) {
11813 throw new Error("integer too large");
11814 }
11815
11816 return {
11817 value: value,
11818 nextIndex: result.nextIndex
11819 };
11820}
11821
11822function encodeInt64(num) {
11823 var buf = bufs.alloc(8);
11824 bufs.writeInt64(num, buf);
11825 var result = encodeIntBuffer(buf);
11826 bufs.free(buf);
11827 return result;
11828}
11829
11830function decodeInt64(encodedBuffer, index) {
11831 var result = decodeIntBuffer(encodedBuffer, index);
11832
11833 var value = _long.default.fromBytesLE(result.value, false);
11834
11835 bufs.free(result.value);
11836 return {
11837 value: value,
11838 nextIndex: result.nextIndex,
11839 lossy: false
11840 };
11841}
11842
11843function encodeUIntBuffer(buffer) {
11844 return encodeBufferCommon(buffer, false);
11845}
11846
11847function decodeUIntBuffer(encodedBuffer, index) {
11848 return decodeBufferCommon(encodedBuffer, index, false);
11849}
11850
11851function encodeUInt32(num) {
11852 var buf = bufs.alloc(4);
11853 buf.writeUInt32LE(num, 0);
11854 var result = encodeUIntBuffer(buf);
11855 bufs.free(buf);
11856 return result;
11857}
11858
11859function decodeUInt32(encodedBuffer, index) {
11860 var result = decodeUIntBuffer(encodedBuffer, index);
11861 var parsed = bufs.readUInt(result.value);
11862 var value = parsed.value;
11863 bufs.free(result.value);
11864
11865 if (value > MAX_UINT32) {
11866 throw new Error("integer too large");
11867 }
11868
11869 return {
11870 value: value,
11871 nextIndex: result.nextIndex
11872 };
11873}
11874
11875function encodeUInt64(num) {
11876 var buf = bufs.alloc(8);
11877 bufs.writeUInt64(num, buf);
11878 var result = encodeUIntBuffer(buf);
11879 bufs.free(buf);
11880 return result;
11881}
11882
11883function decodeUInt64(encodedBuffer, index) {
11884 var result = decodeUIntBuffer(encodedBuffer, index);
11885
11886 var value = _long.default.fromBytesLE(result.value, true);
11887
11888 bufs.free(result.value);
11889 return {
11890 value: value,
11891 nextIndex: result.nextIndex,
11892 lossy: false
11893 };
11894}
11895
11896var _default = {
11897 decodeInt32: decodeInt32,
11898 decodeInt64: decodeInt64,
11899 decodeIntBuffer: decodeIntBuffer,
11900 decodeUInt32: decodeUInt32,
11901 decodeUInt64: decodeUInt64,
11902 decodeUIntBuffer: decodeUIntBuffer,
11903 encodeInt32: encodeInt32,
11904 encodeInt64: encodeInt64,
11905 encodeIntBuffer: encodeIntBuffer,
11906 encodeUInt32: encodeUInt32,
11907 encodeUInt64: encodeUInt64,
11908 encodeUIntBuffer: encodeUIntBuffer
11909};
11910exports.default = _default;
11911
11912/***/ }),
11913
11914/***/ 54202:
11915/***/ (function(__unused_webpack_module, exports) {
11916
11917"use strict";
11918
11919
11920Object.defineProperty(exports, "__esModule", ({
11921 value: true
11922}));
11923exports.decode = decode;
11924
11925function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
11926
11927function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
11928
11929function con(b) {
11930 if ((b & 0xc0) === 0x80) {
11931 return b & 0x3f;
11932 } else {
11933 throw new Error("invalid UTF-8 encoding");
11934 }
11935}
11936
11937function code(min, n) {
11938 if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
11939 throw new Error("invalid UTF-8 encoding");
11940 } else {
11941 return n;
11942 }
11943}
11944
11945function decode(bytes) {
11946 return _decode(bytes).map(function (x) {
11947 return String.fromCharCode(x);
11948 }).join("");
11949}
11950
11951function _decode(bytes) {
11952 if (bytes.length === 0) {
11953 return [];
11954 }
11955 /**
11956 * 1 byte
11957 */
11958
11959
11960 {
11961 var _bytes = _toArray(bytes),
11962 b1 = _bytes[0],
11963 bs = _bytes.slice(1);
11964
11965 if (b1 < 0x80) {
11966 return [code(0x0, b1)].concat(_toConsumableArray(_decode(bs)));
11967 }
11968
11969 if (b1 < 0xc0) {
11970 throw new Error("invalid UTF-8 encoding");
11971 }
11972 }
11973 /**
11974 * 2 bytes
11975 */
11976
11977 {
11978 var _bytes2 = _toArray(bytes),
11979 _b = _bytes2[0],
11980 b2 = _bytes2[1],
11981 _bs = _bytes2.slice(2);
11982
11983 if (_b < 0xe0) {
11984 return [code(0x80, ((_b & 0x1f) << 6) + con(b2))].concat(_toConsumableArray(_decode(_bs)));
11985 }
11986 }
11987 /**
11988 * 3 bytes
11989 */
11990
11991 {
11992 var _bytes3 = _toArray(bytes),
11993 _b2 = _bytes3[0],
11994 _b3 = _bytes3[1],
11995 b3 = _bytes3[2],
11996 _bs2 = _bytes3.slice(3);
11997
11998 if (_b2 < 0xf0) {
11999 return [code(0x800, ((_b2 & 0x0f) << 12) + (con(_b3) << 6) + con(b3))].concat(_toConsumableArray(_decode(_bs2)));
12000 }
12001 }
12002 /**
12003 * 4 bytes
12004 */
12005
12006 {
12007 var _bytes4 = _toArray(bytes),
12008 _b4 = _bytes4[0],
12009 _b5 = _bytes4[1],
12010 _b6 = _bytes4[2],
12011 b4 = _bytes4[3],
12012 _bs3 = _bytes4.slice(4);
12013
12014 if (_b4 < 0xf8) {
12015 return [code(0x10000, (((_b4 & 0x07) << 18) + con(_b5) << 12) + (con(_b6) << 6) + con(b4))].concat(_toConsumableArray(_decode(_bs3)));
12016 }
12017 }
12018 throw new Error("invalid UTF-8 encoding");
12019}
12020
12021/***/ }),
12022
12023/***/ 44819:
12024/***/ (function(__unused_webpack_module, exports) {
12025
12026"use strict";
12027
12028
12029Object.defineProperty(exports, "__esModule", ({
12030 value: true
12031}));
12032exports.encode = encode;
12033
12034function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
12035
12036function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
12037
12038function con(n) {
12039 return 0x80 | n & 0x3f;
12040}
12041
12042function encode(str) {
12043 var arr = str.split("").map(function (x) {
12044 return x.charCodeAt(0);
12045 });
12046 return _encode(arr);
12047}
12048
12049function _encode(arr) {
12050 if (arr.length === 0) {
12051 return [];
12052 }
12053
12054 var _arr = _toArray(arr),
12055 n = _arr[0],
12056 ns = _arr.slice(1);
12057
12058 if (n < 0) {
12059 throw new Error("utf8");
12060 }
12061
12062 if (n < 0x80) {
12063 return [n].concat(_toConsumableArray(_encode(ns)));
12064 }
12065
12066 if (n < 0x800) {
12067 return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
12068 }
12069
12070 if (n < 0x10000) {
12071 return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
12072 }
12073
12074 if (n < 0x110000) {
12075 return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
12076 }
12077
12078 throw new Error("utf8");
12079}
12080
12081/***/ }),
12082
12083/***/ 34423:
12084/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12085
12086"use strict";
12087
12088
12089Object.defineProperty(exports, "__esModule", ({
12090 value: true
12091}));
12092Object.defineProperty(exports, "decode", ({
12093 enumerable: true,
12094 get: function get() {
12095 return _decoder.decode;
12096 }
12097}));
12098Object.defineProperty(exports, "encode", ({
12099 enumerable: true,
12100 get: function get() {
12101 return _encoder.encode;
12102 }
12103}));
12104
12105var _decoder = __webpack_require__(54202);
12106
12107var _encoder = __webpack_require__(44819);
12108
12109/***/ }),
12110
12111/***/ 16026:
12112/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12113
12114"use strict";
12115
12116
12117Object.defineProperty(exports, "__esModule", ({
12118 value: true
12119}));
12120exports.encodeVersion = encodeVersion;
12121exports.encodeHeader = encodeHeader;
12122exports.encodeU32 = encodeU32;
12123exports.encodeI32 = encodeI32;
12124exports.encodeI64 = encodeI64;
12125exports.encodeVec = encodeVec;
12126exports.encodeValtype = encodeValtype;
12127exports.encodeMutability = encodeMutability;
12128exports.encodeUTF8Vec = encodeUTF8Vec;
12129exports.encodeLimits = encodeLimits;
12130exports.encodeModuleImport = encodeModuleImport;
12131exports.encodeSectionMetadata = encodeSectionMetadata;
12132exports.encodeCallInstruction = encodeCallInstruction;
12133exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction;
12134exports.encodeModuleExport = encodeModuleExport;
12135exports.encodeTypeInstruction = encodeTypeInstruction;
12136exports.encodeInstr = encodeInstr;
12137exports.encodeStringLiteral = encodeStringLiteral;
12138exports.encodeGlobal = encodeGlobal;
12139exports.encodeFuncBody = encodeFuncBody;
12140exports.encodeIndexInFuncSection = encodeIndexInFuncSection;
12141exports.encodeElem = encodeElem;
12142
12143var leb = _interopRequireWildcard(__webpack_require__(89443));
12144
12145var ieee754 = _interopRequireWildcard(__webpack_require__(41211));
12146
12147var utf8 = _interopRequireWildcard(__webpack_require__(34423));
12148
12149var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(1594));
12150
12151var _index = __webpack_require__(41929);
12152
12153function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12154
12155function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
12156
12157function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
12158
12159function assertNotIdentifierNode(n) {
12160 if (n.type === "Identifier") {
12161 throw new Error("Unsupported node Identifier");
12162 }
12163}
12164
12165function encodeVersion(v) {
12166 var bytes = _helperWasmBytecode.default.moduleVersion;
12167 bytes[0] = v;
12168 return bytes;
12169}
12170
12171function encodeHeader() {
12172 return _helperWasmBytecode.default.magicModuleHeader;
12173}
12174
12175function encodeU32(v) {
12176 var uint8view = new Uint8Array(leb.encodeU32(v));
12177
12178 var array = _toConsumableArray(uint8view);
12179
12180 return array;
12181}
12182
12183function encodeI32(v) {
12184 var uint8view = new Uint8Array(leb.encodeI32(v));
12185
12186 var array = _toConsumableArray(uint8view);
12187
12188 return array;
12189}
12190
12191function encodeI64(v) {
12192 var uint8view = new Uint8Array(leb.encodeI64(v));
12193
12194 var array = _toConsumableArray(uint8view);
12195
12196 return array;
12197}
12198
12199function encodeVec(elements) {
12200 var size = encodeU32(elements.length);
12201 return _toConsumableArray(size).concat(_toConsumableArray(elements));
12202}
12203
12204function encodeValtype(v) {
12205 var byte = _helperWasmBytecode.default.valtypesByString[v];
12206
12207 if (typeof byte === "undefined") {
12208 throw new Error("Unknown valtype: " + v);
12209 }
12210
12211 return parseInt(byte, 10);
12212}
12213
12214function encodeMutability(v) {
12215 var byte = _helperWasmBytecode.default.globalTypesByString[v];
12216
12217 if (typeof byte === "undefined") {
12218 throw new Error("Unknown mutability: " + v);
12219 }
12220
12221 return parseInt(byte, 10);
12222}
12223
12224function encodeUTF8Vec(str) {
12225 return encodeVec(utf8.encode(str));
12226}
12227
12228function encodeLimits(n) {
12229 var out = [];
12230
12231 if (typeof n.max === "number") {
12232 out.push(0x01);
12233 out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof
12234
12235 out.push.apply(out, _toConsumableArray(encodeU32(n.max)));
12236 } else {
12237 out.push(0x00);
12238 out.push.apply(out, _toConsumableArray(encodeU32(n.min)));
12239 }
12240
12241 return out;
12242}
12243
12244function encodeModuleImport(n) {
12245 var out = [];
12246 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.module)));
12247 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
12248
12249 switch (n.descr.type) {
12250 case "GlobalType":
12251 {
12252 out.push(0x03); // $FlowIgnore: GlobalType ensure that these props exists
12253
12254 out.push(encodeValtype(n.descr.valtype)); // $FlowIgnore: GlobalType ensure that these props exists
12255
12256 out.push(encodeMutability(n.descr.mutability));
12257 break;
12258 }
12259
12260 case "Memory":
12261 {
12262 out.push(0x02); // $FlowIgnore
12263
12264 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
12265 break;
12266 }
12267
12268 case "Table":
12269 {
12270 out.push(0x01);
12271 out.push(0x70); // element type
12272 // $FlowIgnore
12273
12274 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
12275 break;
12276 }
12277
12278 case "FuncImportDescr":
12279 {
12280 out.push(0x00); // $FlowIgnore
12281
12282 assertNotIdentifierNode(n.descr.id); // $FlowIgnore
12283
12284 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
12285 break;
12286 }
12287
12288 default:
12289 throw new Error("Unsupport operation: encode module import of type: " + n.descr.type);
12290 }
12291
12292 return out;
12293}
12294
12295function encodeSectionMetadata(n) {
12296 var out = [];
12297 var sectionId = _helperWasmBytecode.default.sections[n.section];
12298
12299 if (typeof sectionId === "undefined") {
12300 throw new Error("Unknown section: " + n.section);
12301 }
12302
12303 if (n.section === "start") {
12304 /**
12305 * This is not implemented yet because it's a special case which
12306 * doesn't have a vector in its section.
12307 */
12308 throw new Error("Unsupported section encoding of type start");
12309 }
12310
12311 out.push(sectionId);
12312 out.push.apply(out, _toConsumableArray(encodeU32(n.size.value)));
12313 out.push.apply(out, _toConsumableArray(encodeU32(n.vectorOfSize.value)));
12314 return out;
12315}
12316
12317function encodeCallInstruction(n) {
12318 var out = [];
12319 assertNotIdentifierNode(n.index);
12320 out.push(0x10); // $FlowIgnore
12321
12322 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value)));
12323 return out;
12324}
12325
12326function encodeCallIndirectInstruction(n) {
12327 var out = []; // $FlowIgnore
12328
12329 assertNotIdentifierNode(n.index);
12330 out.push(0x11); // $FlowIgnore
12331
12332 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); // add a reserved byte
12333
12334 out.push(0x00);
12335 return out;
12336}
12337
12338function encodeModuleExport(n) {
12339 var out = [];
12340 assertNotIdentifierNode(n.descr.id);
12341 var exportTypeByteString = _helperWasmBytecode.default.exportTypesByName[n.descr.exportType];
12342
12343 if (typeof exportTypeByteString === "undefined") {
12344 throw new Error("Unknown export of type: " + n.descr.exportType);
12345 }
12346
12347 var exportTypeByte = parseInt(exportTypeByteString, 10);
12348 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
12349 out.push(exportTypeByte); // $FlowIgnore
12350
12351 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
12352 return out;
12353}
12354
12355function encodeTypeInstruction(n) {
12356 var out = [0x60];
12357 var params = n.functype.params.map(function (x) {
12358 return x.valtype;
12359 }).map(encodeValtype);
12360 var results = n.functype.results.map(encodeValtype);
12361 out.push.apply(out, _toConsumableArray(encodeVec(params)));
12362 out.push.apply(out, _toConsumableArray(encodeVec(results)));
12363 return out;
12364}
12365
12366function encodeInstr(n) {
12367 var out = [];
12368 var instructionName = n.id;
12369
12370 if (typeof n.object === "string") {
12371 instructionName = "".concat(n.object, ".").concat(String(n.id));
12372 }
12373
12374 var byteString = _helperWasmBytecode.default.symbolsByName[instructionName];
12375
12376 if (typeof byteString === "undefined") {
12377 throw new Error("encodeInstr: unknown instruction " + JSON.stringify(instructionName));
12378 }
12379
12380 var byte = parseInt(byteString, 10);
12381 out.push(byte);
12382
12383 if (n.args) {
12384 n.args.forEach(function (arg) {
12385 var encoder = encodeU32; // find correct encoder
12386
12387 if (n.object === "i32") {
12388 encoder = encodeI32;
12389 }
12390
12391 if (n.object === "i64") {
12392 encoder = encodeI64;
12393 }
12394
12395 if (n.object === "f32") {
12396 encoder = ieee754.encodeF32;
12397 }
12398
12399 if (n.object === "f64") {
12400 encoder = ieee754.encodeF64;
12401 }
12402
12403 if (arg.type === "NumberLiteral" || arg.type === "FloatLiteral" || arg.type === "LongNumberLiteral") {
12404 // $FlowIgnore
12405 out.push.apply(out, _toConsumableArray(encoder(arg.value)));
12406 } else {
12407 throw new Error("Unsupported instruction argument encoding " + JSON.stringify(arg.type));
12408 }
12409 });
12410 }
12411
12412 return out;
12413}
12414
12415function encodeExpr(instrs) {
12416 var out = [];
12417 instrs.forEach(function (instr) {
12418 // $FlowIgnore
12419 var n = (0, _index.encodeNode)(instr);
12420 out.push.apply(out, _toConsumableArray(n));
12421 });
12422 return out;
12423}
12424
12425function encodeStringLiteral(n) {
12426 return encodeUTF8Vec(n.value);
12427}
12428
12429function encodeGlobal(n) {
12430 var out = [];
12431 var _n$globalType = n.globalType,
12432 valtype = _n$globalType.valtype,
12433 mutability = _n$globalType.mutability;
12434 out.push(encodeValtype(valtype));
12435 out.push(encodeMutability(mutability));
12436 out.push.apply(out, _toConsumableArray(encodeExpr(n.init)));
12437 return out;
12438}
12439
12440function encodeFuncBody(n) {
12441 var out = [];
12442 out.push(-1); // temporary function body size
12443 // FIXME(sven): get the func locals?
12444
12445 var localBytes = encodeVec([]);
12446 out.push.apply(out, _toConsumableArray(localBytes));
12447 var funcBodyBytes = encodeExpr(n.body);
12448 out[0] = funcBodyBytes.length + localBytes.length;
12449 out.push.apply(out, _toConsumableArray(funcBodyBytes));
12450 return out;
12451}
12452
12453function encodeIndexInFuncSection(n) {
12454 assertNotIdentifierNode(n.index); // $FlowIgnore
12455
12456 return encodeU32(n.index.value);
12457}
12458
12459function encodeElem(n) {
12460 var out = [];
12461 assertNotIdentifierNode(n.table); // $FlowIgnore
12462
12463 out.push.apply(out, _toConsumableArray(encodeU32(n.table.value)));
12464 out.push.apply(out, _toConsumableArray(encodeExpr(n.offset))); // $FlowIgnore
12465
12466 var funcs = n.funcs.reduce(function (acc, x) {
12467 return _toConsumableArray(acc).concat(_toConsumableArray(encodeU32(x.value)));
12468 }, []);
12469 out.push.apply(out, _toConsumableArray(encodeVec(funcs)));
12470 return out;
12471}
12472
12473/***/ }),
12474
12475/***/ 41929:
12476/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12477
12478"use strict";
12479
12480
12481Object.defineProperty(exports, "__esModule", ({
12482 value: true
12483}));
12484exports.encodeNode = encodeNode;
12485exports.encodeU32 = void 0;
12486
12487var encoder = _interopRequireWildcard(__webpack_require__(16026));
12488
12489function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
12490
12491function encodeNode(n) {
12492 switch (n.type) {
12493 case "ModuleImport":
12494 // $FlowIgnore: ModuleImport ensure that the node is well formated
12495 return encoder.encodeModuleImport(n);
12496
12497 case "SectionMetadata":
12498 // $FlowIgnore: SectionMetadata ensure that the node is well formated
12499 return encoder.encodeSectionMetadata(n);
12500
12501 case "CallInstruction":
12502 // $FlowIgnore: SectionMetadata ensure that the node is well formated
12503 return encoder.encodeCallInstruction(n);
12504
12505 case "CallIndirectInstruction":
12506 // $FlowIgnore: SectionMetadata ensure that the node is well formated
12507 return encoder.encodeCallIndirectInstruction(n);
12508
12509 case "TypeInstruction":
12510 return encoder.encodeTypeInstruction(n);
12511
12512 case "Instr":
12513 // $FlowIgnore
12514 return encoder.encodeInstr(n);
12515
12516 case "ModuleExport":
12517 // $FlowIgnore: SectionMetadata ensure that the node is well formated
12518 return encoder.encodeModuleExport(n);
12519
12520 case "Global":
12521 // $FlowIgnore
12522 return encoder.encodeGlobal(n);
12523
12524 case "Func":
12525 return encoder.encodeFuncBody(n);
12526
12527 case "IndexInFuncSection":
12528 return encoder.encodeIndexInFuncSection(n);
12529
12530 case "StringLiteral":
12531 return encoder.encodeStringLiteral(n);
12532
12533 case "Elem":
12534 return encoder.encodeElem(n);
12535
12536 default:
12537 throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type));
12538 }
12539}
12540
12541var encodeU32 = encoder.encodeU32;
12542exports.encodeU32 = encodeU32;
12543
12544/***/ }),
12545
12546/***/ 15312:
12547/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12548
12549"use strict";
12550
12551
12552Object.defineProperty(exports, "__esModule", ({
12553 value: true
12554}));
12555exports.decode = decode;
12556
12557var _helperApiError = __webpack_require__(53086);
12558
12559var ieee754 = _interopRequireWildcard(__webpack_require__(41211));
12560
12561var utf8 = _interopRequireWildcard(__webpack_require__(34423));
12562
12563var t = _interopRequireWildcard(__webpack_require__(19300));
12564
12565var _leb = __webpack_require__(89443);
12566
12567var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(1594));
12568
12569function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12570
12571function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
12572
12573function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
12574
12575function toHex(n) {
12576 return "0x" + Number(n).toString(16);
12577}
12578
12579function byteArrayEq(l, r) {
12580 if (l.length !== r.length) {
12581 return false;
12582 }
12583
12584 for (var i = 0; i < l.length; i++) {
12585 if (l[i] !== r[i]) {
12586 return false;
12587 }
12588 }
12589
12590 return true;
12591}
12592
12593function decode(ab, opts) {
12594 var buf = new Uint8Array(ab);
12595 var getUniqueName = t.getUniqueNameGenerator();
12596 var offset = 0;
12597
12598 function getPosition() {
12599 return {
12600 line: -1,
12601 column: offset
12602 };
12603 }
12604
12605 function dump(b, msg) {
12606 if (opts.dump === false) return;
12607 var pad = "\t\t\t\t\t\t\t\t\t\t";
12608 var str = "";
12609
12610 if (b.length < 5) {
12611 str = b.map(toHex).join(" ");
12612 } else {
12613 str = "...";
12614 }
12615
12616 console.log(toHex(offset) + ":\t", str, pad, ";", msg);
12617 }
12618
12619 function dumpSep(msg) {
12620 if (opts.dump === false) return;
12621 console.log(";", msg);
12622 }
12623 /**
12624 * TODO(sven): we can atually use a same structure
12625 * we are adding incrementally new features
12626 */
12627
12628
12629 var state = {
12630 elementsInFuncSection: [],
12631 elementsInExportSection: [],
12632 elementsInCodeSection: [],
12633
12634 /**
12635 * Decode memory from:
12636 * - Memory section
12637 */
12638 memoriesInModule: [],
12639
12640 /**
12641 * Decoded types from:
12642 * - Type section
12643 */
12644 typesInModule: [],
12645
12646 /**
12647 * Decoded functions from:
12648 * - Function section
12649 * - Import section
12650 */
12651 functionsInModule: [],
12652
12653 /**
12654 * Decoded tables from:
12655 * - Table section
12656 */
12657 tablesInModule: [],
12658
12659 /**
12660 * Decoded globals from:
12661 * - Global section
12662 */
12663 globalsInModule: []
12664 };
12665
12666 function isEOF() {
12667 return offset >= buf.length;
12668 }
12669
12670 function eatBytes(n) {
12671 offset = offset + n;
12672 }
12673
12674 function readBytesAtOffset(_offset, numberOfBytes) {
12675 var arr = [];
12676
12677 for (var i = 0; i < numberOfBytes; i++) {
12678 arr.push(buf[_offset + i]);
12679 }
12680
12681 return arr;
12682 }
12683
12684 function readBytes(numberOfBytes) {
12685 return readBytesAtOffset(offset, numberOfBytes);
12686 }
12687
12688 function readF64() {
12689 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F64);
12690 var value = ieee754.decodeF64(bytes);
12691
12692 if (Math.sign(value) * value === Infinity) {
12693 return {
12694 value: Math.sign(value),
12695 inf: true,
12696 nextIndex: ieee754.NUMBER_OF_BYTE_F64
12697 };
12698 }
12699
12700 if (isNaN(value)) {
12701 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
12702 var mantissa = 0;
12703
12704 for (var i = 0; i < bytes.length - 2; ++i) {
12705 mantissa += bytes[i] * Math.pow(256, i);
12706 }
12707
12708 mantissa += bytes[bytes.length - 2] % 16 * Math.pow(256, bytes.length - 2);
12709 return {
12710 value: sign * mantissa,
12711 nan: true,
12712 nextIndex: ieee754.NUMBER_OF_BYTE_F64
12713 };
12714 }
12715
12716 return {
12717 value: value,
12718 nextIndex: ieee754.NUMBER_OF_BYTE_F64
12719 };
12720 }
12721
12722 function readF32() {
12723 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F32);
12724 var value = ieee754.decodeF32(bytes);
12725
12726 if (Math.sign(value) * value === Infinity) {
12727 return {
12728 value: Math.sign(value),
12729 inf: true,
12730 nextIndex: ieee754.NUMBER_OF_BYTE_F32
12731 };
12732 }
12733
12734 if (isNaN(value)) {
12735 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
12736 var mantissa = 0;
12737
12738 for (var i = 0; i < bytes.length - 2; ++i) {
12739 mantissa += bytes[i] * Math.pow(256, i);
12740 }
12741
12742 mantissa += bytes[bytes.length - 2] % 128 * Math.pow(256, bytes.length - 2);
12743 return {
12744 value: sign * mantissa,
12745 nan: true,
12746 nextIndex: ieee754.NUMBER_OF_BYTE_F32
12747 };
12748 }
12749
12750 return {
12751 value: value,
12752 nextIndex: ieee754.NUMBER_OF_BYTE_F32
12753 };
12754 }
12755
12756 function readUTF8String() {
12757 var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
12758 // readBytesAtOffset below. This keeps readUTF8String neutral with respect
12759 // to the current offset, just like the other readX functions.
12760
12761 var strlen = lenu32.value;
12762 dump([strlen], "string length");
12763 var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
12764 var value = utf8.decode(bytes);
12765 return {
12766 value: value,
12767 nextIndex: strlen + lenu32.nextIndex
12768 };
12769 }
12770 /**
12771 * Decode an unsigned 32bits integer
12772 *
12773 * The length will be handled by the leb librairy, we pass the max number of
12774 * byte.
12775 */
12776
12777
12778 function readU32() {
12779 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
12780 var buffer = Buffer.from(bytes);
12781 return (0, _leb.decodeUInt32)(buffer);
12782 }
12783
12784 function readVaruint32() {
12785 // where 32 bits = max 4 bytes
12786 var bytes = readBytes(4);
12787 var buffer = Buffer.from(bytes);
12788 return (0, _leb.decodeUInt32)(buffer);
12789 }
12790
12791 function readVaruint7() {
12792 // where 7 bits = max 1 bytes
12793 var bytes = readBytes(1);
12794 var buffer = Buffer.from(bytes);
12795 return (0, _leb.decodeUInt32)(buffer);
12796 }
12797 /**
12798 * Decode a signed 32bits interger
12799 */
12800
12801
12802 function read32() {
12803 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
12804 var buffer = Buffer.from(bytes);
12805 return (0, _leb.decodeInt32)(buffer);
12806 }
12807 /**
12808 * Decode a signed 64bits integer
12809 */
12810
12811
12812 function read64() {
12813 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
12814 var buffer = Buffer.from(bytes);
12815 return (0, _leb.decodeInt64)(buffer);
12816 }
12817
12818 function readU64() {
12819 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
12820 var buffer = Buffer.from(bytes);
12821 return (0, _leb.decodeUInt64)(buffer);
12822 }
12823
12824 function readByte() {
12825 return readBytes(1)[0];
12826 }
12827
12828 function parseModuleHeader() {
12829 if (isEOF() === true || offset + 4 > buf.length) {
12830 throw new Error("unexpected end");
12831 }
12832
12833 var header = readBytes(4);
12834
12835 if (byteArrayEq(_helperWasmBytecode.default.magicModuleHeader, header) === false) {
12836 throw new _helperApiError.CompileError("magic header not detected");
12837 }
12838
12839 dump(header, "wasm magic header");
12840 eatBytes(4);
12841 }
12842
12843 function parseVersion() {
12844 if (isEOF() === true || offset + 4 > buf.length) {
12845 throw new Error("unexpected end");
12846 }
12847
12848 var version = readBytes(4);
12849
12850 if (byteArrayEq(_helperWasmBytecode.default.moduleVersion, version) === false) {
12851 throw new _helperApiError.CompileError("unknown binary version");
12852 }
12853
12854 dump(version, "wasm version");
12855 eatBytes(4);
12856 }
12857
12858 function parseVec(cast) {
12859 var u32 = readU32();
12860 var length = u32.value;
12861 eatBytes(u32.nextIndex);
12862 dump([length], "number");
12863
12864 if (length === 0) {
12865 return [];
12866 }
12867
12868 var elements = [];
12869
12870 for (var i = 0; i < length; i++) {
12871 var byte = readByte();
12872 eatBytes(1);
12873 var value = cast(byte);
12874 dump([byte], value);
12875
12876 if (typeof value === "undefined") {
12877 throw new _helperApiError.CompileError("Internal failure: parseVec could not cast the value");
12878 }
12879
12880 elements.push(value);
12881 }
12882
12883 return elements;
12884 } // Type section
12885 // https://webassembly.github.io/spec/binary/modules.html#binary-typesec
12886
12887
12888 function parseTypeSection(numberOfTypes) {
12889 var typeInstructionNodes = [];
12890 dump([numberOfTypes], "num types");
12891
12892 for (var i = 0; i < numberOfTypes; i++) {
12893 var _startLoc = getPosition();
12894
12895 dumpSep("type " + i);
12896 var type = readByte();
12897 eatBytes(1);
12898
12899 if (type == _helperWasmBytecode.default.types.func) {
12900 dump([type], "func");
12901 var paramValtypes = parseVec(function (b) {
12902 return _helperWasmBytecode.default.valtypes[b];
12903 });
12904 var params = paramValtypes.map(function (v) {
12905 return t.funcParam(
12906 /*valtype*/
12907 v);
12908 });
12909 var result = parseVec(function (b) {
12910 return _helperWasmBytecode.default.valtypes[b];
12911 });
12912 typeInstructionNodes.push(function () {
12913 var endLoc = getPosition();
12914 return t.withLoc(t.typeInstruction(undefined, t.signature(params, result)), endLoc, _startLoc);
12915 }());
12916 state.typesInModule.push({
12917 params: params,
12918 result: result
12919 });
12920 } else {
12921 throw new Error("Unsupported type: " + toHex(type));
12922 }
12923 }
12924
12925 return typeInstructionNodes;
12926 } // Import section
12927 // https://webassembly.github.io/spec/binary/modules.html#binary-importsec
12928
12929
12930 function parseImportSection(numberOfImports) {
12931 var imports = [];
12932
12933 for (var i = 0; i < numberOfImports; i++) {
12934 dumpSep("import header " + i);
12935
12936 var _startLoc2 = getPosition();
12937 /**
12938 * Module name
12939 */
12940
12941
12942 var moduleName = readUTF8String();
12943 eatBytes(moduleName.nextIndex);
12944 dump([], "module name (".concat(moduleName.value, ")"));
12945 /**
12946 * Name
12947 */
12948
12949 var name = readUTF8String();
12950 eatBytes(name.nextIndex);
12951 dump([], "name (".concat(name.value, ")"));
12952 /**
12953 * Import descr
12954 */
12955
12956 var descrTypeByte = readByte();
12957 eatBytes(1);
12958 var descrType = _helperWasmBytecode.default.importTypes[descrTypeByte];
12959 dump([descrTypeByte], "import kind");
12960
12961 if (typeof descrType === "undefined") {
12962 throw new _helperApiError.CompileError("Unknown import description type: " + toHex(descrTypeByte));
12963 }
12964
12965 var importDescr = void 0;
12966
12967 if (descrType === "func") {
12968 var indexU32 = readU32();
12969 var typeindex = indexU32.value;
12970 eatBytes(indexU32.nextIndex);
12971 dump([typeindex], "type index");
12972 var signature = state.typesInModule[typeindex];
12973
12974 if (typeof signature === "undefined") {
12975 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
12976 }
12977
12978 var id = getUniqueName("func");
12979 importDescr = t.funcImportDescr(id, t.signature(signature.params, signature.result));
12980 state.functionsInModule.push({
12981 id: t.identifier(name.value),
12982 signature: signature,
12983 isExternal: true
12984 });
12985 } else if (descrType === "global") {
12986 importDescr = parseGlobalType();
12987 var globalNode = t.global(importDescr, []);
12988 state.globalsInModule.push(globalNode);
12989 } else if (descrType === "table") {
12990 importDescr = parseTableType(i);
12991 } else if (descrType === "mem") {
12992 var memoryNode = parseMemoryType(0);
12993 state.memoriesInModule.push(memoryNode);
12994 importDescr = memoryNode;
12995 } else {
12996 throw new _helperApiError.CompileError("Unsupported import of type: " + descrType);
12997 }
12998
12999 imports.push(function () {
13000 var endLoc = getPosition();
13001 return t.withLoc(t.moduleImport(moduleName.value, name.value, importDescr), endLoc, _startLoc2);
13002 }());
13003 }
13004
13005 return imports;
13006 } // Function section
13007 // https://webassembly.github.io/spec/binary/modules.html#function-section
13008
13009
13010 function parseFuncSection(numberOfFunctions) {
13011 dump([numberOfFunctions], "num funcs");
13012
13013 for (var i = 0; i < numberOfFunctions; i++) {
13014 var indexU32 = readU32();
13015 var typeindex = indexU32.value;
13016 eatBytes(indexU32.nextIndex);
13017 dump([typeindex], "type index");
13018 var signature = state.typesInModule[typeindex];
13019
13020 if (typeof signature === "undefined") {
13021 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
13022 } // preserve anonymous, a name might be resolved later
13023
13024
13025 var id = t.withRaw(t.identifier(getUniqueName("func")), "");
13026 state.functionsInModule.push({
13027 id: id,
13028 signature: signature,
13029 isExternal: false
13030 });
13031 }
13032 } // Export section
13033 // https://webassembly.github.io/spec/binary/modules.html#export-section
13034
13035
13036 function parseExportSection(numberOfExport) {
13037 dump([numberOfExport], "num exports"); // Parse vector of exports
13038
13039 for (var i = 0; i < numberOfExport; i++) {
13040 var _startLoc3 = getPosition();
13041 /**
13042 * Name
13043 */
13044
13045
13046 var name = readUTF8String();
13047 eatBytes(name.nextIndex);
13048 dump([], "export name (".concat(name.value, ")"));
13049 /**
13050 * exportdescr
13051 */
13052
13053 var typeIndex = readByte();
13054 eatBytes(1);
13055 dump([typeIndex], "export kind");
13056 var indexu32 = readU32();
13057 var index = indexu32.value;
13058 eatBytes(indexu32.nextIndex);
13059 dump([index], "export index");
13060 var id = void 0,
13061 signature = void 0;
13062
13063 if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Func") {
13064 var func = state.functionsInModule[index];
13065
13066 if (typeof func === "undefined") {
13067 throw new _helperApiError.CompileError("unknown function (".concat(index, ")"));
13068 }
13069
13070 id = t.numberLiteralFromRaw(index, String(index));
13071 signature = func.signature;
13072 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Table") {
13073 var table = state.tablesInModule[index];
13074
13075 if (typeof table === "undefined") {
13076 throw new _helperApiError.CompileError("unknown table ".concat(index));
13077 }
13078
13079 id = t.numberLiteralFromRaw(index, String(index));
13080 signature = null;
13081 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Mem") {
13082 var memNode = state.memoriesInModule[index];
13083
13084 if (typeof memNode === "undefined") {
13085 throw new _helperApiError.CompileError("unknown memory ".concat(index));
13086 }
13087
13088 id = t.numberLiteralFromRaw(index, String(index));
13089 signature = null;
13090 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Global") {
13091 var global = state.globalsInModule[index];
13092
13093 if (typeof global === "undefined") {
13094 throw new _helperApiError.CompileError("unknown global ".concat(index));
13095 }
13096
13097 id = t.numberLiteralFromRaw(index, String(index));
13098 signature = null;
13099 } else {
13100 console.warn("Unsupported export type: " + toHex(typeIndex));
13101 return;
13102 }
13103
13104 var endLoc = getPosition();
13105 state.elementsInExportSection.push({
13106 name: name.value,
13107 type: _helperWasmBytecode.default.exportTypes[typeIndex],
13108 signature: signature,
13109 id: id,
13110 index: index,
13111 endLoc: endLoc,
13112 startLoc: _startLoc3
13113 });
13114 }
13115 } // Code section
13116 // https://webassembly.github.io/spec/binary/modules.html#code-section
13117
13118
13119 function parseCodeSection(numberOfFuncs) {
13120 dump([numberOfFuncs], "number functions"); // Parse vector of function
13121
13122 for (var i = 0; i < numberOfFuncs; i++) {
13123 var _startLoc4 = getPosition();
13124
13125 dumpSep("function body " + i); // the u32 size of the function code in bytes
13126 // Ignore it for now
13127
13128 var bodySizeU32 = readU32();
13129 eatBytes(bodySizeU32.nextIndex);
13130 dump([bodySizeU32.value], "function body size");
13131 var code = [];
13132 /**
13133 * Parse locals
13134 */
13135
13136 var funcLocalNumU32 = readU32();
13137 var funcLocalNum = funcLocalNumU32.value;
13138 eatBytes(funcLocalNumU32.nextIndex);
13139 dump([funcLocalNum], "num locals");
13140 var locals = [];
13141
13142 for (var _i = 0; _i < funcLocalNum; _i++) {
13143 var _startLoc5 = getPosition();
13144
13145 var localCountU32 = readU32();
13146 var localCount = localCountU32.value;
13147 eatBytes(localCountU32.nextIndex);
13148 dump([localCount], "num local");
13149 var valtypeByte = readByte();
13150 eatBytes(1);
13151 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
13152 var args = [];
13153
13154 for (var _i2 = 0; _i2 < localCount; _i2++) {
13155 args.push(t.valtypeLiteral(type));
13156 }
13157
13158 var localNode = function () {
13159 var endLoc = getPosition();
13160 return t.withLoc(t.instruction("local", args), endLoc, _startLoc5);
13161 }();
13162
13163 locals.push(localNode);
13164 dump([valtypeByte], type);
13165
13166 if (typeof type === "undefined") {
13167 throw new _helperApiError.CompileError("Unexpected valtype: " + toHex(valtypeByte));
13168 }
13169 }
13170
13171 code.push.apply(code, locals); // Decode instructions until the end
13172
13173 parseInstructionBlock(code);
13174 var endLoc = getPosition();
13175 state.elementsInCodeSection.push({
13176 code: code,
13177 locals: locals,
13178 endLoc: endLoc,
13179 startLoc: _startLoc4,
13180 bodySize: bodySizeU32.value
13181 });
13182 }
13183 }
13184
13185 function parseInstructionBlock(code) {
13186 while (true) {
13187 var _startLoc6 = getPosition();
13188
13189 var instructionAlreadyCreated = false;
13190 var instructionByte = readByte();
13191 eatBytes(1);
13192
13193 if (instructionByte === 0xfe) {
13194 throw new _helperApiError.CompileError("Atomic instructions are not implemented");
13195 }
13196
13197 var instruction = _helperWasmBytecode.default.symbolsByByte[instructionByte];
13198
13199 if (typeof instruction === "undefined") {
13200 throw new _helperApiError.CompileError("Unexpected instruction: " + toHex(instructionByte));
13201 }
13202
13203 if (typeof instruction.object === "string") {
13204 dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name));
13205 } else {
13206 dump([instructionByte], instruction.name);
13207 }
13208 /**
13209 * End of the function
13210 */
13211
13212
13213 if (instruction.name === "end") {
13214 var node = function () {
13215 var endLoc = getPosition();
13216 return t.withLoc(t.instruction(instruction.name), endLoc, _startLoc6);
13217 }();
13218
13219 code.push(node);
13220 break;
13221 }
13222
13223 var args = [];
13224
13225 if (instruction.name === "loop") {
13226 var _startLoc7 = getPosition();
13227
13228 var blocktypeByte = readByte();
13229 eatBytes(1);
13230 var blocktype = _helperWasmBytecode.default.blockTypes[blocktypeByte];
13231 dump([blocktypeByte], "blocktype");
13232
13233 if (typeof blocktype === "undefined") {
13234 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(blocktypeByte));
13235 }
13236
13237 var instr = [];
13238 parseInstructionBlock(instr); // preserve anonymous
13239
13240 var label = t.withRaw(t.identifier(getUniqueName("loop")), "");
13241
13242 var loopNode = function () {
13243 var endLoc = getPosition();
13244 return t.withLoc(t.loopInstruction(label, blocktype, instr), endLoc, _startLoc7);
13245 }();
13246
13247 code.push(loopNode);
13248 instructionAlreadyCreated = true;
13249 } else if (instruction.name === "if") {
13250 var _startLoc8 = getPosition();
13251
13252 var _blocktypeByte = readByte();
13253
13254 eatBytes(1);
13255 var _blocktype = _helperWasmBytecode.default.blockTypes[_blocktypeByte];
13256 dump([_blocktypeByte], "blocktype");
13257
13258 if (typeof _blocktype === "undefined") {
13259 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte));
13260 }
13261
13262 var testIndex = t.withRaw(t.identifier(getUniqueName("if")), "");
13263 var ifBody = [];
13264 parseInstructionBlock(ifBody); // Defaults to no alternate
13265
13266 var elseIndex = 0;
13267
13268 for (elseIndex = 0; elseIndex < ifBody.length; ++elseIndex) {
13269 var _instr = ifBody[elseIndex];
13270
13271 if (_instr.type === "Instr" && _instr.id === "else") {
13272 break;
13273 }
13274 }
13275
13276 var consequentInstr = ifBody.slice(0, elseIndex);
13277 var alternate = ifBody.slice(elseIndex + 1); // wast sugar
13278
13279 var testInstrs = [];
13280
13281 var ifNode = function () {
13282 var endLoc = getPosition();
13283 return t.withLoc(t.ifInstruction(testIndex, testInstrs, _blocktype, consequentInstr, alternate), endLoc, _startLoc8);
13284 }();
13285
13286 code.push(ifNode);
13287 instructionAlreadyCreated = true;
13288 } else if (instruction.name === "block") {
13289 var _startLoc9 = getPosition();
13290
13291 var _blocktypeByte2 = readByte();
13292
13293 eatBytes(1);
13294 var _blocktype2 = _helperWasmBytecode.default.blockTypes[_blocktypeByte2];
13295 dump([_blocktypeByte2], "blocktype");
13296
13297 if (typeof _blocktype2 === "undefined") {
13298 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte2));
13299 }
13300
13301 var _instr2 = [];
13302 parseInstructionBlock(_instr2); // preserve anonymous
13303
13304 var _label = t.withRaw(t.identifier(getUniqueName("block")), "");
13305
13306 var blockNode = function () {
13307 var endLoc = getPosition();
13308 return t.withLoc(t.blockInstruction(_label, _instr2, _blocktype2), endLoc, _startLoc9);
13309 }();
13310
13311 code.push(blockNode);
13312 instructionAlreadyCreated = true;
13313 } else if (instruction.name === "call") {
13314 var indexu32 = readU32();
13315 var index = indexu32.value;
13316 eatBytes(indexu32.nextIndex);
13317 dump([index], "index");
13318
13319 var callNode = function () {
13320 var endLoc = getPosition();
13321 return t.withLoc(t.callInstruction(t.indexLiteral(index)), endLoc, _startLoc6);
13322 }();
13323
13324 code.push(callNode);
13325 instructionAlreadyCreated = true;
13326 } else if (instruction.name === "call_indirect") {
13327 var _startLoc10 = getPosition();
13328
13329 var indexU32 = readU32();
13330 var typeindex = indexU32.value;
13331 eatBytes(indexU32.nextIndex);
13332 dump([typeindex], "type index");
13333 var signature = state.typesInModule[typeindex];
13334
13335 if (typeof signature === "undefined") {
13336 throw new _helperApiError.CompileError("call_indirect signature not found (".concat(typeindex, ")"));
13337 }
13338
13339 var _callNode = t.callIndirectInstruction(t.signature(signature.params, signature.result), []);
13340
13341 var flagU32 = readU32();
13342 var flag = flagU32.value; // 0x00 - reserved byte
13343
13344 eatBytes(flagU32.nextIndex);
13345
13346 if (flag !== 0) {
13347 throw new _helperApiError.CompileError("zero flag expected");
13348 }
13349
13350 code.push(function () {
13351 var endLoc = getPosition();
13352 return t.withLoc(_callNode, endLoc, _startLoc10);
13353 }());
13354 instructionAlreadyCreated = true;
13355 } else if (instruction.name === "br_table") {
13356 var indicesu32 = readU32();
13357 var indices = indicesu32.value;
13358 eatBytes(indicesu32.nextIndex);
13359 dump([indices], "num indices");
13360
13361 for (var i = 0; i <= indices; i++) {
13362 var _indexu = readU32();
13363
13364 var _index = _indexu.value;
13365 eatBytes(_indexu.nextIndex);
13366 dump([_index], "index");
13367 args.push(t.numberLiteralFromRaw(_indexu.value.toString(), "u32"));
13368 }
13369 } else if (instructionByte >= 0x28 && instructionByte <= 0x40) {
13370 /**
13371 * Memory instructions
13372 */
13373 if (instruction.name === "grow_memory" || instruction.name === "current_memory") {
13374 var _indexU = readU32();
13375
13376 var _index2 = _indexU.value;
13377 eatBytes(_indexU.nextIndex);
13378
13379 if (_index2 !== 0) {
13380 throw new Error("zero flag expected");
13381 }
13382
13383 dump([_index2], "index");
13384 } else {
13385 var aligun32 = readU32();
13386 var align = aligun32.value;
13387 eatBytes(aligun32.nextIndex);
13388 dump([align], "align");
13389 var offsetu32 = readU32();
13390 var _offset2 = offsetu32.value;
13391 eatBytes(offsetu32.nextIndex);
13392 dump([_offset2], "offset");
13393 }
13394 } else if (instructionByte >= 0x41 && instructionByte <= 0x44) {
13395 /**
13396 * Numeric instructions
13397 */
13398 if (instruction.object === "i32") {
13399 var value32 = read32();
13400 var value = value32.value;
13401 eatBytes(value32.nextIndex);
13402 dump([value], "i32 value");
13403 args.push(t.numberLiteralFromRaw(value));
13404 }
13405
13406 if (instruction.object === "u32") {
13407 var valueu32 = readU32();
13408 var _value = valueu32.value;
13409 eatBytes(valueu32.nextIndex);
13410 dump([_value], "u32 value");
13411 args.push(t.numberLiteralFromRaw(_value));
13412 }
13413
13414 if (instruction.object === "i64") {
13415 var value64 = read64();
13416 var _value2 = value64.value;
13417 eatBytes(value64.nextIndex);
13418 dump([Number(_value2.toString())], "i64 value");
13419 var high = _value2.high,
13420 low = _value2.low;
13421 var _node = {
13422 type: "LongNumberLiteral",
13423 value: {
13424 high: high,
13425 low: low
13426 }
13427 };
13428 args.push(_node);
13429 }
13430
13431 if (instruction.object === "u64") {
13432 var valueu64 = readU64();
13433 var _value3 = valueu64.value;
13434 eatBytes(valueu64.nextIndex);
13435 dump([Number(_value3.toString())], "u64 value");
13436 var _high = _value3.high,
13437 _low = _value3.low;
13438 var _node2 = {
13439 type: "LongNumberLiteral",
13440 value: {
13441 high: _high,
13442 low: _low
13443 }
13444 };
13445 args.push(_node2);
13446 }
13447
13448 if (instruction.object === "f32") {
13449 var valuef32 = readF32();
13450 var _value4 = valuef32.value;
13451 eatBytes(valuef32.nextIndex);
13452 dump([_value4], "f32 value");
13453 args.push( // $FlowIgnore
13454 t.floatLiteral(_value4, valuef32.nan, valuef32.inf, String(_value4)));
13455 }
13456
13457 if (instruction.object === "f64") {
13458 var valuef64 = readF64();
13459 var _value5 = valuef64.value;
13460 eatBytes(valuef64.nextIndex);
13461 dump([_value5], "f64 value");
13462 args.push( // $FlowIgnore
13463 t.floatLiteral(_value5, valuef64.nan, valuef64.inf, String(_value5)));
13464 }
13465 } else {
13466 for (var _i3 = 0; _i3 < instruction.numberOfArgs; _i3++) {
13467 var u32 = readU32();
13468 eatBytes(u32.nextIndex);
13469 dump([u32.value], "argument " + _i3);
13470 args.push(t.numberLiteralFromRaw(u32.value));
13471 }
13472 }
13473
13474 if (instructionAlreadyCreated === false) {
13475 if (typeof instruction.object === "string") {
13476 var _node3 = function () {
13477 var endLoc = getPosition();
13478 return t.withLoc(t.objectInstruction(instruction.name, instruction.object, args), endLoc, _startLoc6);
13479 }();
13480
13481 code.push(_node3);
13482 } else {
13483 var _node4 = function () {
13484 var endLoc = getPosition();
13485 return t.withLoc(t.instruction(instruction.name, args), endLoc, _startLoc6);
13486 }();
13487
13488 code.push(_node4);
13489 }
13490 }
13491 }
13492 } // https://webassembly.github.io/spec/core/binary/types.html#limits
13493
13494
13495 function parseLimits() {
13496 var limitType = readByte();
13497 eatBytes(1);
13498 dump([limitType], "limit type");
13499 var min, max;
13500
13501 if (limitType === 0x01 || limitType === 0x03 // shared limits
13502 ) {
13503 var u32min = readU32();
13504 min = parseInt(u32min.value);
13505 eatBytes(u32min.nextIndex);
13506 dump([min], "min");
13507 var u32max = readU32();
13508 max = parseInt(u32max.value);
13509 eatBytes(u32max.nextIndex);
13510 dump([max], "max");
13511 }
13512
13513 if (limitType === 0x00) {
13514 var _u32min = readU32();
13515
13516 min = parseInt(_u32min.value);
13517 eatBytes(_u32min.nextIndex);
13518 dump([min], "min");
13519 }
13520
13521 return t.limit(min, max);
13522 } // https://webassembly.github.io/spec/core/binary/types.html#binary-tabletype
13523
13524
13525 function parseTableType(index) {
13526 var name = t.withRaw(t.identifier(getUniqueName("table")), String(index));
13527 var elementTypeByte = readByte();
13528 eatBytes(1);
13529 dump([elementTypeByte], "element type");
13530 var elementType = _helperWasmBytecode.default.tableTypes[elementTypeByte];
13531
13532 if (typeof elementType === "undefined") {
13533 throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementType));
13534 }
13535
13536 var limits = parseLimits();
13537 return t.table(elementType, limits, name);
13538 } // https://webassembly.github.io/spec/binary/types.html#global-types
13539
13540
13541 function parseGlobalType() {
13542 var valtypeByte = readByte();
13543 eatBytes(1);
13544 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
13545 dump([valtypeByte], type);
13546
13547 if (typeof type === "undefined") {
13548 throw new _helperApiError.CompileError("Unknown valtype: " + toHex(valtypeByte));
13549 }
13550
13551 var globalTypeByte = readByte();
13552 eatBytes(1);
13553 var globalType = _helperWasmBytecode.default.globalTypes[globalTypeByte];
13554 dump([globalTypeByte], "global type (".concat(globalType, ")"));
13555
13556 if (typeof globalType === "undefined") {
13557 throw new _helperApiError.CompileError("Invalid mutability: " + toHex(globalTypeByte));
13558 }
13559
13560 return t.globalType(type, globalType);
13561 } // function parseNameModule() {
13562 // const lenu32 = readVaruint32();
13563 // eatBytes(lenu32.nextIndex);
13564 // console.log("len", lenu32);
13565 // const strlen = lenu32.value;
13566 // dump([strlen], "string length");
13567 // const bytes = readBytes(strlen);
13568 // eatBytes(strlen);
13569 // const value = utf8.decode(bytes);
13570 // return [t.moduleNameMetadata(value)];
13571 // }
13572 // this section contains an array of function names and indices
13573
13574
13575 function parseNameSectionFunctions() {
13576 var functionNames = [];
13577 var numberOfFunctionsu32 = readU32();
13578 var numbeOfFunctions = numberOfFunctionsu32.value;
13579 eatBytes(numberOfFunctionsu32.nextIndex);
13580
13581 for (var i = 0; i < numbeOfFunctions; i++) {
13582 var indexu32 = readU32();
13583 var index = indexu32.value;
13584 eatBytes(indexu32.nextIndex);
13585 var name = readUTF8String();
13586 eatBytes(name.nextIndex);
13587 functionNames.push(t.functionNameMetadata(name.value, index));
13588 }
13589
13590 return functionNames;
13591 }
13592
13593 function parseNameSectionLocals() {
13594 var localNames = [];
13595 var numbeOfFunctionsu32 = readU32();
13596 var numbeOfFunctions = numbeOfFunctionsu32.value;
13597 eatBytes(numbeOfFunctionsu32.nextIndex);
13598
13599 for (var i = 0; i < numbeOfFunctions; i++) {
13600 var functionIndexu32 = readU32();
13601 var functionIndex = functionIndexu32.value;
13602 eatBytes(functionIndexu32.nextIndex);
13603 var numLocalsu32 = readU32();
13604 var numLocals = numLocalsu32.value;
13605 eatBytes(numLocalsu32.nextIndex);
13606
13607 for (var _i4 = 0; _i4 < numLocals; _i4++) {
13608 var localIndexu32 = readU32();
13609 var localIndex = localIndexu32.value;
13610 eatBytes(localIndexu32.nextIndex);
13611 var name = readUTF8String();
13612 eatBytes(name.nextIndex);
13613 localNames.push(t.localNameMetadata(name.value, localIndex, functionIndex));
13614 }
13615 }
13616
13617 return localNames;
13618 } // this is a custom section used for name resolution
13619 // https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
13620
13621
13622 function parseNameSection(remainingBytes) {
13623 var nameMetadata = [];
13624 var initialOffset = offset;
13625
13626 while (offset - initialOffset < remainingBytes) {
13627 // name_type
13628 var sectionTypeByte = readVaruint7();
13629 eatBytes(sectionTypeByte.nextIndex); // name_payload_len
13630
13631 var subSectionSizeInBytesu32 = readVaruint32();
13632 eatBytes(subSectionSizeInBytesu32.nextIndex);
13633
13634 switch (sectionTypeByte.value) {
13635 // case 0: {
13636 // TODO(sven): re-enable that
13637 // Current status: it seems that when we decode the module's name
13638 // no name_payload_len is used.
13639 //
13640 // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
13641 //
13642 // nameMetadata.push(...parseNameModule());
13643 // break;
13644 // }
13645 case 1:
13646 {
13647 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions()));
13648 break;
13649 }
13650
13651 case 2:
13652 {
13653 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals()));
13654 break;
13655 }
13656
13657 default:
13658 {
13659 // skip unknown subsection
13660 eatBytes(subSectionSizeInBytesu32.value);
13661 }
13662 }
13663 }
13664
13665 return nameMetadata;
13666 } // this is a custom section used for information about the producers
13667 // https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md
13668
13669
13670 function parseProducersSection() {
13671 var metadata = t.producersSectionMetadata([]); // field_count
13672
13673 var sectionTypeByte = readVaruint32();
13674 eatBytes(sectionTypeByte.nextIndex);
13675 dump([sectionTypeByte.value], "num of producers");
13676 var fields = {
13677 language: [],
13678 "processed-by": [],
13679 sdk: []
13680 }; // fields
13681
13682 for (var fieldI = 0; fieldI < sectionTypeByte.value; fieldI++) {
13683 // field_name
13684 var fieldName = readUTF8String();
13685 eatBytes(fieldName.nextIndex); // field_value_count
13686
13687 var valueCount = readVaruint32();
13688 eatBytes(valueCount.nextIndex); // field_values
13689
13690 for (var producerI = 0; producerI < valueCount.value; producerI++) {
13691 var producerName = readUTF8String();
13692 eatBytes(producerName.nextIndex);
13693 var producerVersion = readUTF8String();
13694 eatBytes(producerVersion.nextIndex);
13695 fields[fieldName.value].push(t.producerMetadataVersionedName(producerName.value, producerVersion.value));
13696 }
13697
13698 metadata.producers.push(fields[fieldName.value]);
13699 }
13700
13701 return metadata;
13702 }
13703
13704 function parseGlobalSection(numberOfGlobals) {
13705 var globals = [];
13706 dump([numberOfGlobals], "num globals");
13707
13708 for (var i = 0; i < numberOfGlobals; i++) {
13709 var _startLoc11 = getPosition();
13710
13711 var globalType = parseGlobalType();
13712 /**
13713 * Global expressions
13714 */
13715
13716 var init = [];
13717 parseInstructionBlock(init);
13718
13719 var node = function () {
13720 var endLoc = getPosition();
13721 return t.withLoc(t.global(globalType, init), endLoc, _startLoc11);
13722 }();
13723
13724 globals.push(node);
13725 state.globalsInModule.push(node);
13726 }
13727
13728 return globals;
13729 }
13730
13731 function parseElemSection(numberOfElements) {
13732 var elems = [];
13733 dump([numberOfElements], "num elements");
13734
13735 for (var i = 0; i < numberOfElements; i++) {
13736 var _startLoc12 = getPosition();
13737
13738 var tableindexu32 = readU32();
13739 var tableindex = tableindexu32.value;
13740 eatBytes(tableindexu32.nextIndex);
13741 dump([tableindex], "table index");
13742 /**
13743 * Parse instructions
13744 */
13745
13746 var instr = [];
13747 parseInstructionBlock(instr);
13748 /**
13749 * Parse ( vector function index ) *
13750 */
13751
13752 var indicesu32 = readU32();
13753 var indices = indicesu32.value;
13754 eatBytes(indicesu32.nextIndex);
13755 dump([indices], "num indices");
13756 var indexValues = [];
13757
13758 for (var _i5 = 0; _i5 < indices; _i5++) {
13759 var indexu32 = readU32();
13760 var index = indexu32.value;
13761 eatBytes(indexu32.nextIndex);
13762 dump([index], "index");
13763 indexValues.push(t.indexLiteral(index));
13764 }
13765
13766 var elemNode = function () {
13767 var endLoc = getPosition();
13768 return t.withLoc(t.elem(t.indexLiteral(tableindex), instr, indexValues), endLoc, _startLoc12);
13769 }();
13770
13771 elems.push(elemNode);
13772 }
13773
13774 return elems;
13775 } // https://webassembly.github.io/spec/core/binary/types.html#memory-types
13776
13777
13778 function parseMemoryType(i) {
13779 var limits = parseLimits();
13780 return t.memory(limits, t.indexLiteral(i));
13781 } // https://webassembly.github.io/spec/binary/modules.html#table-section
13782
13783
13784 function parseTableSection(numberOfElements) {
13785 var tables = [];
13786 dump([numberOfElements], "num elements");
13787
13788 for (var i = 0; i < numberOfElements; i++) {
13789 var tablesNode = parseTableType(i);
13790 state.tablesInModule.push(tablesNode);
13791 tables.push(tablesNode);
13792 }
13793
13794 return tables;
13795 } // https://webassembly.github.io/spec/binary/modules.html#memory-section
13796
13797
13798 function parseMemorySection(numberOfElements) {
13799 var memories = [];
13800 dump([numberOfElements], "num elements");
13801
13802 for (var i = 0; i < numberOfElements; i++) {
13803 var memoryNode = parseMemoryType(i);
13804 state.memoriesInModule.push(memoryNode);
13805 memories.push(memoryNode);
13806 }
13807
13808 return memories;
13809 } // https://webassembly.github.io/spec/binary/modules.html#binary-startsec
13810
13811
13812 function parseStartSection() {
13813 var startLoc = getPosition();
13814 var u32 = readU32();
13815 var startFuncIndex = u32.value;
13816 eatBytes(u32.nextIndex);
13817 dump([startFuncIndex], "index");
13818 return function () {
13819 var endLoc = getPosition();
13820 return t.withLoc(t.start(t.indexLiteral(startFuncIndex)), endLoc, startLoc);
13821 }();
13822 } // https://webassembly.github.io/spec/binary/modules.html#data-section
13823
13824
13825 function parseDataSection(numberOfElements) {
13826 var dataEntries = [];
13827 dump([numberOfElements], "num elements");
13828
13829 for (var i = 0; i < numberOfElements; i++) {
13830 var memoryIndexu32 = readU32();
13831 var memoryIndex = memoryIndexu32.value;
13832 eatBytes(memoryIndexu32.nextIndex);
13833 dump([memoryIndex], "memory index");
13834 var instrs = [];
13835 parseInstructionBlock(instrs);
13836 var hasExtraInstrs = instrs.filter(function (i) {
13837 return i.id !== "end";
13838 }).length !== 1;
13839
13840 if (hasExtraInstrs) {
13841 throw new _helperApiError.CompileError("data section offset must be a single instruction");
13842 }
13843
13844 var bytes = parseVec(function (b) {
13845 return b;
13846 });
13847 dump([], "init");
13848 dataEntries.push(t.data(t.memIndexLiteral(memoryIndex), instrs[0], t.byteArray(bytes)));
13849 }
13850
13851 return dataEntries;
13852 } // https://webassembly.github.io/spec/binary/modules.html#binary-section
13853
13854
13855 function parseSection(sectionIndex) {
13856 var sectionId = readByte();
13857 eatBytes(1);
13858
13859 if (sectionId >= sectionIndex || sectionIndex === _helperWasmBytecode.default.sections.custom) {
13860 sectionIndex = sectionId + 1;
13861 } else {
13862 if (sectionId !== _helperWasmBytecode.default.sections.custom) throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
13863 }
13864
13865 var nextSectionIndex = sectionIndex;
13866 var startOffset = offset;
13867 var startLoc = getPosition();
13868 var u32 = readU32();
13869 var sectionSizeInBytes = u32.value;
13870 eatBytes(u32.nextIndex);
13871
13872 var sectionSizeInBytesNode = function () {
13873 var endLoc = getPosition();
13874 return t.withLoc(t.numberLiteralFromRaw(sectionSizeInBytes), endLoc, startLoc);
13875 }();
13876
13877 switch (sectionId) {
13878 case _helperWasmBytecode.default.sections.type:
13879 {
13880 dumpSep("section Type");
13881 dump([sectionId], "section code");
13882 dump([sectionSizeInBytes], "section size");
13883
13884 var _startLoc13 = getPosition();
13885
13886 var _u = readU32();
13887
13888 var numberOfTypes = _u.value;
13889 eatBytes(_u.nextIndex);
13890
13891 var _metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () {
13892 var endLoc = getPosition();
13893 return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13);
13894 }());
13895
13896 var _nodes = parseTypeSection(numberOfTypes);
13897
13898 return {
13899 nodes: _nodes,
13900 metadata: _metadata,
13901 nextSectionIndex: nextSectionIndex
13902 };
13903 }
13904
13905 case _helperWasmBytecode.default.sections.table:
13906 {
13907 dumpSep("section Table");
13908 dump([sectionId], "section code");
13909 dump([sectionSizeInBytes], "section size");
13910
13911 var _startLoc14 = getPosition();
13912
13913 var _u2 = readU32();
13914
13915 var numberOfTable = _u2.value;
13916 eatBytes(_u2.nextIndex);
13917 dump([numberOfTable], "num tables");
13918
13919 var _metadata2 = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, function () {
13920 var endLoc = getPosition();
13921 return t.withLoc(t.numberLiteralFromRaw(numberOfTable), endLoc, _startLoc14);
13922 }());
13923
13924 var _nodes2 = parseTableSection(numberOfTable);
13925
13926 return {
13927 nodes: _nodes2,
13928 metadata: _metadata2,
13929 nextSectionIndex: nextSectionIndex
13930 };
13931 }
13932
13933 case _helperWasmBytecode.default.sections.import:
13934 {
13935 dumpSep("section Import");
13936 dump([sectionId], "section code");
13937 dump([sectionSizeInBytes], "section size");
13938
13939 var _startLoc15 = getPosition();
13940
13941 var numberOfImportsu32 = readU32();
13942 var numberOfImports = numberOfImportsu32.value;
13943 eatBytes(numberOfImportsu32.nextIndex);
13944 dump([numberOfImports], "number of imports");
13945
13946 var _metadata3 = t.sectionMetadata("import", startOffset, sectionSizeInBytesNode, function () {
13947 var endLoc = getPosition();
13948 return t.withLoc(t.numberLiteralFromRaw(numberOfImports), endLoc, _startLoc15);
13949 }());
13950
13951 var _nodes3 = parseImportSection(numberOfImports);
13952
13953 return {
13954 nodes: _nodes3,
13955 metadata: _metadata3,
13956 nextSectionIndex: nextSectionIndex
13957 };
13958 }
13959
13960 case _helperWasmBytecode.default.sections.func:
13961 {
13962 dumpSep("section Function");
13963 dump([sectionId], "section code");
13964 dump([sectionSizeInBytes], "section size");
13965
13966 var _startLoc16 = getPosition();
13967
13968 var numberOfFunctionsu32 = readU32();
13969 var numberOfFunctions = numberOfFunctionsu32.value;
13970 eatBytes(numberOfFunctionsu32.nextIndex);
13971
13972 var _metadata4 = t.sectionMetadata("func", startOffset, sectionSizeInBytesNode, function () {
13973 var endLoc = getPosition();
13974 return t.withLoc(t.numberLiteralFromRaw(numberOfFunctions), endLoc, _startLoc16);
13975 }());
13976
13977 parseFuncSection(numberOfFunctions);
13978 var _nodes4 = [];
13979 return {
13980 nodes: _nodes4,
13981 metadata: _metadata4,
13982 nextSectionIndex: nextSectionIndex
13983 };
13984 }
13985
13986 case _helperWasmBytecode.default.sections.export:
13987 {
13988 dumpSep("section Export");
13989 dump([sectionId], "section code");
13990 dump([sectionSizeInBytes], "section size");
13991
13992 var _startLoc17 = getPosition();
13993
13994 var _u3 = readU32();
13995
13996 var numberOfExport = _u3.value;
13997 eatBytes(_u3.nextIndex);
13998
13999 var _metadata5 = t.sectionMetadata("export", startOffset, sectionSizeInBytesNode, function () {
14000 var endLoc = getPosition();
14001 return t.withLoc(t.numberLiteralFromRaw(numberOfExport), endLoc, _startLoc17);
14002 }());
14003
14004 parseExportSection(numberOfExport);
14005 var _nodes5 = [];
14006 return {
14007 nodes: _nodes5,
14008 metadata: _metadata5,
14009 nextSectionIndex: nextSectionIndex
14010 };
14011 }
14012
14013 case _helperWasmBytecode.default.sections.code:
14014 {
14015 dumpSep("section Code");
14016 dump([sectionId], "section code");
14017 dump([sectionSizeInBytes], "section size");
14018
14019 var _startLoc18 = getPosition();
14020
14021 var _u4 = readU32();
14022
14023 var numberOfFuncs = _u4.value;
14024 eatBytes(_u4.nextIndex);
14025
14026 var _metadata6 = t.sectionMetadata("code", startOffset, sectionSizeInBytesNode, function () {
14027 var endLoc = getPosition();
14028 return t.withLoc(t.numberLiteralFromRaw(numberOfFuncs), endLoc, _startLoc18);
14029 }());
14030
14031 if (opts.ignoreCodeSection === true) {
14032 var remainingBytes = sectionSizeInBytes - _u4.nextIndex;
14033 eatBytes(remainingBytes); // eat the entire section
14034 } else {
14035 parseCodeSection(numberOfFuncs);
14036 }
14037
14038 var _nodes6 = [];
14039 return {
14040 nodes: _nodes6,
14041 metadata: _metadata6,
14042 nextSectionIndex: nextSectionIndex
14043 };
14044 }
14045
14046 case _helperWasmBytecode.default.sections.start:
14047 {
14048 dumpSep("section Start");
14049 dump([sectionId], "section code");
14050 dump([sectionSizeInBytes], "section size");
14051
14052 var _metadata7 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode);
14053
14054 var _nodes7 = [parseStartSection()];
14055 return {
14056 nodes: _nodes7,
14057 metadata: _metadata7,
14058 nextSectionIndex: nextSectionIndex
14059 };
14060 }
14061
14062 case _helperWasmBytecode.default.sections.element:
14063 {
14064 dumpSep("section Element");
14065 dump([sectionId], "section code");
14066 dump([sectionSizeInBytes], "section size");
14067
14068 var _startLoc19 = getPosition();
14069
14070 var numberOfElementsu32 = readU32();
14071 var numberOfElements = numberOfElementsu32.value;
14072 eatBytes(numberOfElementsu32.nextIndex);
14073
14074 var _metadata8 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () {
14075 var endLoc = getPosition();
14076 return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19);
14077 }());
14078
14079 var _nodes8 = parseElemSection(numberOfElements);
14080
14081 return {
14082 nodes: _nodes8,
14083 metadata: _metadata8,
14084 nextSectionIndex: nextSectionIndex
14085 };
14086 }
14087
14088 case _helperWasmBytecode.default.sections.global:
14089 {
14090 dumpSep("section Global");
14091 dump([sectionId], "section code");
14092 dump([sectionSizeInBytes], "section size");
14093
14094 var _startLoc20 = getPosition();
14095
14096 var numberOfGlobalsu32 = readU32();
14097 var numberOfGlobals = numberOfGlobalsu32.value;
14098 eatBytes(numberOfGlobalsu32.nextIndex);
14099
14100 var _metadata9 = t.sectionMetadata("global", startOffset, sectionSizeInBytesNode, function () {
14101 var endLoc = getPosition();
14102 return t.withLoc(t.numberLiteralFromRaw(numberOfGlobals), endLoc, _startLoc20);
14103 }());
14104
14105 var _nodes9 = parseGlobalSection(numberOfGlobals);
14106
14107 return {
14108 nodes: _nodes9,
14109 metadata: _metadata9,
14110 nextSectionIndex: nextSectionIndex
14111 };
14112 }
14113
14114 case _helperWasmBytecode.default.sections.memory:
14115 {
14116 dumpSep("section Memory");
14117 dump([sectionId], "section code");
14118 dump([sectionSizeInBytes], "section size");
14119
14120 var _startLoc21 = getPosition();
14121
14122 var _numberOfElementsu = readU32();
14123
14124 var _numberOfElements = _numberOfElementsu.value;
14125 eatBytes(_numberOfElementsu.nextIndex);
14126
14127 var _metadata10 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () {
14128 var endLoc = getPosition();
14129 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21);
14130 }());
14131
14132 var _nodes10 = parseMemorySection(_numberOfElements);
14133
14134 return {
14135 nodes: _nodes10,
14136 metadata: _metadata10,
14137 nextSectionIndex: nextSectionIndex
14138 };
14139 }
14140
14141 case _helperWasmBytecode.default.sections.data:
14142 {
14143 dumpSep("section Data");
14144 dump([sectionId], "section code");
14145 dump([sectionSizeInBytes], "section size");
14146
14147 var _metadata11 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode);
14148
14149 var _startLoc22 = getPosition();
14150
14151 var _numberOfElementsu2 = readU32();
14152
14153 var _numberOfElements2 = _numberOfElementsu2.value;
14154 eatBytes(_numberOfElementsu2.nextIndex);
14155
14156 _metadata11.vectorOfSize = function () {
14157 var endLoc = getPosition();
14158 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), endLoc, _startLoc22);
14159 }();
14160
14161 if (opts.ignoreDataSection === true) {
14162 var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex;
14163
14164 eatBytes(_remainingBytes); // eat the entire section
14165
14166 dumpSep("ignore data (" + sectionSizeInBytes + " bytes)");
14167 return {
14168 nodes: [],
14169 metadata: _metadata11,
14170 nextSectionIndex: nextSectionIndex
14171 };
14172 } else {
14173 var _nodes11 = parseDataSection(_numberOfElements2);
14174
14175 return {
14176 nodes: _nodes11,
14177 metadata: _metadata11,
14178 nextSectionIndex: nextSectionIndex
14179 };
14180 }
14181 }
14182
14183 case _helperWasmBytecode.default.sections.custom:
14184 {
14185 dumpSep("section Custom");
14186 dump([sectionId], "section code");
14187 dump([sectionSizeInBytes], "section size");
14188 var _metadata12 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)];
14189 var sectionName = readUTF8String();
14190 eatBytes(sectionName.nextIndex);
14191 dump([], "section name (".concat(sectionName.value, ")"));
14192
14193 var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex;
14194
14195 if (sectionName.value === "name") {
14196 var initialOffset = offset;
14197
14198 try {
14199 _metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
14200 } catch (e) {
14201 console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
14202 eatBytes(offset - (initialOffset + _remainingBytes2));
14203 }
14204 } else if (sectionName.value === "producers") {
14205 var _initialOffset = offset;
14206
14207 try {
14208 _metadata12.push(parseProducersSection());
14209 } catch (e) {
14210 console.warn("Failed to decode custom \"producers\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
14211 eatBytes(offset - (_initialOffset + _remainingBytes2));
14212 }
14213 } else {
14214 // We don't parse the custom section
14215 eatBytes(_remainingBytes2);
14216 dumpSep("ignore custom " + JSON.stringify(sectionName.value) + " section (" + _remainingBytes2 + " bytes)");
14217 }
14218
14219 return {
14220 nodes: [],
14221 metadata: _metadata12,
14222 nextSectionIndex: nextSectionIndex
14223 };
14224 }
14225 }
14226
14227 throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
14228 }
14229
14230 parseModuleHeader();
14231 parseVersion();
14232 var moduleFields = [];
14233 var sectionIndex = 0;
14234 var moduleMetadata = {
14235 sections: [],
14236 functionNames: [],
14237 localNames: [],
14238 producers: []
14239 };
14240 /**
14241 * All the generate declaration are going to be stored in our state
14242 */
14243
14244 while (offset < buf.length) {
14245 var _parseSection = parseSection(sectionIndex),
14246 _nodes12 = _parseSection.nodes,
14247 _metadata13 = _parseSection.metadata,
14248 nextSectionIndex = _parseSection.nextSectionIndex;
14249
14250 moduleFields.push.apply(moduleFields, _toConsumableArray(_nodes12));
14251 var metadataArray = Array.isArray(_metadata13) ? _metadata13 : [_metadata13];
14252 metadataArray.forEach(function (metadataItem) {
14253 if (metadataItem.type === "FunctionNameMetadata") {
14254 moduleMetadata.functionNames.push(metadataItem);
14255 } else if (metadataItem.type === "LocalNameMetadata") {
14256 moduleMetadata.localNames.push(metadataItem);
14257 } else if (metadataItem.type === "ProducersSectionMetadata") {
14258 moduleMetadata.producers.push(metadataItem);
14259 } else {
14260 moduleMetadata.sections.push(metadataItem);
14261 }
14262 }); // Ignore custom section
14263
14264 if (nextSectionIndex) {
14265 sectionIndex = nextSectionIndex;
14266 }
14267 }
14268 /**
14269 * Transform the state into AST nodes
14270 */
14271
14272
14273 var funcIndex = 0;
14274 state.functionsInModule.forEach(function (func) {
14275 var params = func.signature.params;
14276 var result = func.signature.result;
14277 var body = []; // External functions doesn't provide any code, can skip it here
14278
14279 if (func.isExternal === true) {
14280 return;
14281 }
14282
14283 var decodedElementInCodeSection = state.elementsInCodeSection[funcIndex];
14284
14285 if (opts.ignoreCodeSection === false) {
14286 if (typeof decodedElementInCodeSection === "undefined") {
14287 throw new _helperApiError.CompileError("func " + toHex(funcIndex) + " code not found");
14288 }
14289
14290 body = decodedElementInCodeSection.code;
14291 }
14292
14293 funcIndex++;
14294 var funcNode = t.func(func.id, t.signature(params, result), body);
14295
14296 if (func.isExternal === true) {
14297 funcNode.isExternal = func.isExternal;
14298 } // Add function position in the binary if possible
14299
14300
14301 if (opts.ignoreCodeSection === false) {
14302 var _startLoc23 = decodedElementInCodeSection.startLoc,
14303 endLoc = decodedElementInCodeSection.endLoc,
14304 bodySize = decodedElementInCodeSection.bodySize;
14305 funcNode = t.withLoc(funcNode, endLoc, _startLoc23);
14306 funcNode.metadata = {
14307 bodySize: bodySize
14308 };
14309 }
14310
14311 moduleFields.push(funcNode);
14312 });
14313 state.elementsInExportSection.forEach(function (moduleExport) {
14314 /**
14315 * If the export has no id, we won't be able to call it from the outside
14316 * so we can omit it
14317 */
14318 if (moduleExport.id != null) {
14319 moduleFields.push(t.withLoc(t.moduleExport(moduleExport.name, t.moduleExportDescr(moduleExport.type, moduleExport.id)), moduleExport.endLoc, moduleExport.startLoc));
14320 }
14321 });
14322 dumpSep("end of program");
14323 var module = t.module(null, moduleFields, t.moduleMetadata(moduleMetadata.sections, moduleMetadata.functionNames, moduleMetadata.localNames, moduleMetadata.producers));
14324 return t.program([module]);
14325}
14326
14327/***/ }),
14328
14329/***/ 17192:
14330/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
14331
14332"use strict";
14333
14334
14335Object.defineProperty(exports, "__esModule", ({
14336 value: true
14337}));
14338exports.decode = decode;
14339
14340var decoder = _interopRequireWildcard(__webpack_require__(15312));
14341
14342var t = _interopRequireWildcard(__webpack_require__(19300));
14343
14344function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
14345
14346/**
14347 * TODO(sven): I added initial props, but we should rather fix
14348 * https://github.com/xtuc/webassemblyjs/issues/405
14349 */
14350var defaultDecoderOpts = {
14351 dump: false,
14352 ignoreCodeSection: false,
14353 ignoreDataSection: false,
14354 ignoreCustomNameSection: false
14355}; // traverses the AST, locating function name metadata, which is then
14356// used to update index-based identifiers with function names
14357
14358function restoreFunctionNames(ast) {
14359 var functionNames = [];
14360 t.traverse(ast, {
14361 FunctionNameMetadata: function FunctionNameMetadata(_ref) {
14362 var node = _ref.node;
14363 functionNames.push({
14364 name: node.value,
14365 index: node.index
14366 });
14367 }
14368 });
14369
14370 if (functionNames.length === 0) {
14371 return;
14372 }
14373
14374 t.traverse(ast, {
14375 Func: function (_Func) {
14376 function Func(_x) {
14377 return _Func.apply(this, arguments);
14378 }
14379
14380 Func.toString = function () {
14381 return _Func.toString();
14382 };
14383
14384 return Func;
14385 }(function (_ref2) {
14386 var node = _ref2.node;
14387 // $FlowIgnore
14388 var nodeName = node.name;
14389 var indexBasedFunctionName = nodeName.value;
14390 var index = Number(indexBasedFunctionName.replace("func_", ""));
14391 var functionName = functionNames.find(function (f) {
14392 return f.index === index;
14393 });
14394
14395 if (functionName) {
14396 var oldValue = nodeName.value;
14397 nodeName.value = functionName.name;
14398 nodeName.numeric = oldValue; // $FlowIgnore
14399
14400 delete nodeName.raw;
14401 }
14402 }),
14403 // Also update the reference in the export
14404 ModuleExport: function (_ModuleExport) {
14405 function ModuleExport(_x2) {
14406 return _ModuleExport.apply(this, arguments);
14407 }
14408
14409 ModuleExport.toString = function () {
14410 return _ModuleExport.toString();
14411 };
14412
14413 return ModuleExport;
14414 }(function (_ref3) {
14415 var node = _ref3.node;
14416
14417 if (node.descr.exportType === "Func") {
14418 // $FlowIgnore
14419 var nodeName = node.descr.id;
14420 var index = nodeName.value;
14421 var functionName = functionNames.find(function (f) {
14422 return f.index === index;
14423 });
14424
14425 if (functionName) {
14426 node.descr.id = t.identifier(functionName.name);
14427 }
14428 }
14429 }),
14430 ModuleImport: function (_ModuleImport) {
14431 function ModuleImport(_x3) {
14432 return _ModuleImport.apply(this, arguments);
14433 }
14434
14435 ModuleImport.toString = function () {
14436 return _ModuleImport.toString();
14437 };
14438
14439 return ModuleImport;
14440 }(function (_ref4) {
14441 var node = _ref4.node;
14442
14443 if (node.descr.type === "FuncImportDescr") {
14444 // $FlowIgnore
14445 var indexBasedFunctionName = node.descr.id;
14446 var index = Number(indexBasedFunctionName.replace("func_", ""));
14447 var functionName = functionNames.find(function (f) {
14448 return f.index === index;
14449 });
14450
14451 if (functionName) {
14452 // $FlowIgnore
14453 node.descr.id = t.identifier(functionName.name);
14454 }
14455 }
14456 }),
14457 CallInstruction: function (_CallInstruction) {
14458 function CallInstruction(_x4) {
14459 return _CallInstruction.apply(this, arguments);
14460 }
14461
14462 CallInstruction.toString = function () {
14463 return _CallInstruction.toString();
14464 };
14465
14466 return CallInstruction;
14467 }(function (nodePath) {
14468 var node = nodePath.node;
14469 var index = node.index.value;
14470 var functionName = functionNames.find(function (f) {
14471 return f.index === index;
14472 });
14473
14474 if (functionName) {
14475 var oldValue = node.index;
14476 node.index = t.identifier(functionName.name);
14477 node.numeric = oldValue; // $FlowIgnore
14478
14479 delete node.raw;
14480 }
14481 })
14482 });
14483}
14484
14485function restoreLocalNames(ast) {
14486 var localNames = [];
14487 t.traverse(ast, {
14488 LocalNameMetadata: function LocalNameMetadata(_ref5) {
14489 var node = _ref5.node;
14490 localNames.push({
14491 name: node.value,
14492 localIndex: node.localIndex,
14493 functionIndex: node.functionIndex
14494 });
14495 }
14496 });
14497
14498 if (localNames.length === 0) {
14499 return;
14500 }
14501
14502 t.traverse(ast, {
14503 Func: function (_Func2) {
14504 function Func(_x5) {
14505 return _Func2.apply(this, arguments);
14506 }
14507
14508 Func.toString = function () {
14509 return _Func2.toString();
14510 };
14511
14512 return Func;
14513 }(function (_ref6) {
14514 var node = _ref6.node;
14515 var signature = node.signature;
14516
14517 if (signature.type !== "Signature") {
14518 return;
14519 } // $FlowIgnore
14520
14521
14522 var nodeName = node.name;
14523 var indexBasedFunctionName = nodeName.value;
14524 var functionIndex = Number(indexBasedFunctionName.replace("func_", ""));
14525 signature.params.forEach(function (param, paramIndex) {
14526 var paramName = localNames.find(function (f) {
14527 return f.localIndex === paramIndex && f.functionIndex === functionIndex;
14528 });
14529
14530 if (paramName && paramName.name !== "") {
14531 param.id = paramName.name;
14532 }
14533 });
14534 })
14535 });
14536}
14537
14538function restoreModuleName(ast) {
14539 t.traverse(ast, {
14540 ModuleNameMetadata: function (_ModuleNameMetadata) {
14541 function ModuleNameMetadata(_x6) {
14542 return _ModuleNameMetadata.apply(this, arguments);
14543 }
14544
14545 ModuleNameMetadata.toString = function () {
14546 return _ModuleNameMetadata.toString();
14547 };
14548
14549 return ModuleNameMetadata;
14550 }(function (moduleNameMetadataPath) {
14551 // update module
14552 t.traverse(ast, {
14553 Module: function (_Module) {
14554 function Module(_x7) {
14555 return _Module.apply(this, arguments);
14556 }
14557
14558 Module.toString = function () {
14559 return _Module.toString();
14560 };
14561
14562 return Module;
14563 }(function (_ref7) {
14564 var node = _ref7.node;
14565 var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
14566
14567 if (name === "") {
14568 name = null;
14569 }
14570
14571 node.id = name;
14572 })
14573 });
14574 })
14575 });
14576}
14577
14578function decode(buf, customOpts) {
14579 var opts = Object.assign({}, defaultDecoderOpts, customOpts);
14580 var ast = decoder.decode(buf, opts);
14581
14582 if (opts.ignoreCustomNameSection === false) {
14583 restoreFunctionNames(ast);
14584 restoreLocalNames(ast);
14585 restoreModuleName(ast);
14586 }
14587
14588 return ast;
14589}
14590
14591/***/ }),
14592
14593/***/ 46421:
14594/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
14595
14596"use strict";
14597
14598
14599Object.defineProperty(exports, "__esModule", ({
14600 value: true
14601}));
14602exports.shrinkPaddedLEB128 = shrinkPaddedLEB128;
14603
14604var _wasmParser = __webpack_require__(38070);
14605
14606var _leb = __webpack_require__(15829);
14607
14608function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
14609
14610function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14611
14612function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14613
14614function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
14615
14616var OptimizerError =
14617/*#__PURE__*/
14618function (_Error) {
14619 _inherits(OptimizerError, _Error);
14620
14621 function OptimizerError(name, initalError) {
14622 var _this;
14623
14624 _classCallCheck(this, OptimizerError);
14625
14626 _this = _possibleConstructorReturn(this, (OptimizerError.__proto__ || Object.getPrototypeOf(OptimizerError)).call(this, "Error while optimizing: " + name + ": " + initalError.message));
14627 _this.stack = initalError.stack;
14628 return _this;
14629 }
14630
14631 return OptimizerError;
14632}(Error);
14633
14634var decoderOpts = {
14635 ignoreCodeSection: true,
14636 ignoreDataSection: true
14637};
14638
14639function shrinkPaddedLEB128(uint8Buffer) {
14640 try {
14641 var ast = (0, _wasmParser.decode)(uint8Buffer.buffer, decoderOpts);
14642 return (0, _leb.shrinkPaddedLEB128)(ast, uint8Buffer);
14643 } catch (e) {
14644 throw new OptimizerError("shrinkPaddedLEB128", e);
14645 }
14646}
14647
14648/***/ }),
14649
14650/***/ 15829:
14651/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
14652
14653"use strict";
14654
14655
14656Object.defineProperty(exports, "__esModule", ({
14657 value: true
14658}));
14659exports.shrinkPaddedLEB128 = shrinkPaddedLEB128;
14660
14661var _ast = __webpack_require__(25323);
14662
14663var _encoder = __webpack_require__(3516);
14664
14665var _helperBuffer = __webpack_require__(63159);
14666
14667function shiftFollowingSections(ast, _ref, deltaInSizeEncoding) {
14668 var section = _ref.section;
14669 // Once we hit our section every that is after needs to be shifted by the delta
14670 var encounteredSection = false;
14671 (0, _ast.traverse)(ast, {
14672 SectionMetadata: function SectionMetadata(path) {
14673 if (path.node.section === section) {
14674 encounteredSection = true;
14675 return;
14676 }
14677
14678 if (encounteredSection === true) {
14679 (0, _ast.shiftSection)(ast, path.node, deltaInSizeEncoding);
14680 }
14681 }
14682 });
14683}
14684
14685function shrinkPaddedLEB128(ast, uint8Buffer) {
14686 (0, _ast.traverse)(ast, {
14687 SectionMetadata: function SectionMetadata(_ref2) {
14688 var node = _ref2.node;
14689
14690 /**
14691 * Section size
14692 */
14693 {
14694 var newu32Encoded = (0, _encoder.encodeU32)(node.size.value);
14695 var newu32EncodedLen = newu32Encoded.length;
14696 var start = node.size.loc.start.column;
14697 var end = node.size.loc.end.column;
14698 var oldu32EncodedLen = end - start;
14699
14700 if (newu32EncodedLen !== oldu32EncodedLen) {
14701 var deltaInSizeEncoding = oldu32EncodedLen - newu32EncodedLen;
14702 uint8Buffer = (0, _helperBuffer.overrideBytesInBuffer)(uint8Buffer, start, end, newu32Encoded);
14703 shiftFollowingSections(ast, node, -deltaInSizeEncoding);
14704 }
14705 }
14706 }
14707 });
14708 return uint8Buffer;
14709}
14710
14711/***/ }),
14712
14713/***/ 41059:
14714/***/ (function(__unused_webpack_module, exports) {
14715
14716"use strict";
14717
14718
14719Object.defineProperty(exports, "__esModule", ({
14720 value: true
14721}));
14722exports.cloneNode = cloneNode;
14723
14724function cloneNode(n) {
14725 // $FlowIgnore
14726 var newObj = {};
14727
14728 for (var k in n) {
14729 newObj[k] = n[k];
14730 }
14731
14732 return newObj;
14733}
14734
14735/***/ }),
14736
14737/***/ 25323:
14738/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
14739
14740"use strict";
14741
14742
14743Object.defineProperty(exports, "__esModule", ({
14744 value: true
14745}));
14746var _exportNames = {
14747 numberLiteralFromRaw: true,
14748 withLoc: true,
14749 withRaw: true,
14750 funcParam: true,
14751 indexLiteral: true,
14752 memIndexLiteral: true,
14753 instruction: true,
14754 objectInstruction: true,
14755 traverse: true,
14756 signatures: true,
14757 cloneNode: true
14758};
14759Object.defineProperty(exports, "numberLiteralFromRaw", ({
14760 enumerable: true,
14761 get: function get() {
14762 return _nodeHelpers.numberLiteralFromRaw;
14763 }
14764}));
14765Object.defineProperty(exports, "withLoc", ({
14766 enumerable: true,
14767 get: function get() {
14768 return _nodeHelpers.withLoc;
14769 }
14770}));
14771Object.defineProperty(exports, "withRaw", ({
14772 enumerable: true,
14773 get: function get() {
14774 return _nodeHelpers.withRaw;
14775 }
14776}));
14777Object.defineProperty(exports, "funcParam", ({
14778 enumerable: true,
14779 get: function get() {
14780 return _nodeHelpers.funcParam;
14781 }
14782}));
14783Object.defineProperty(exports, "indexLiteral", ({
14784 enumerable: true,
14785 get: function get() {
14786 return _nodeHelpers.indexLiteral;
14787 }
14788}));
14789Object.defineProperty(exports, "memIndexLiteral", ({
14790 enumerable: true,
14791 get: function get() {
14792 return _nodeHelpers.memIndexLiteral;
14793 }
14794}));
14795Object.defineProperty(exports, "instruction", ({
14796 enumerable: true,
14797 get: function get() {
14798 return _nodeHelpers.instruction;
14799 }
14800}));
14801Object.defineProperty(exports, "objectInstruction", ({
14802 enumerable: true,
14803 get: function get() {
14804 return _nodeHelpers.objectInstruction;
14805 }
14806}));
14807Object.defineProperty(exports, "traverse", ({
14808 enumerable: true,
14809 get: function get() {
14810 return _traverse.traverse;
14811 }
14812}));
14813Object.defineProperty(exports, "signatures", ({
14814 enumerable: true,
14815 get: function get() {
14816 return _signatures.signatures;
14817 }
14818}));
14819Object.defineProperty(exports, "cloneNode", ({
14820 enumerable: true,
14821 get: function get() {
14822 return _clone.cloneNode;
14823 }
14824}));
14825
14826var _nodes = __webpack_require__(54389);
14827
14828Object.keys(_nodes).forEach(function (key) {
14829 if (key === "default" || key === "__esModule") return;
14830 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
14831 Object.defineProperty(exports, key, {
14832 enumerable: true,
14833 get: function get() {
14834 return _nodes[key];
14835 }
14836 });
14837});
14838
14839var _nodeHelpers = __webpack_require__(83495);
14840
14841var _traverse = __webpack_require__(80485);
14842
14843var _signatures = __webpack_require__(92417);
14844
14845var _utils = __webpack_require__(53732);
14846
14847Object.keys(_utils).forEach(function (key) {
14848 if (key === "default" || key === "__esModule") return;
14849 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
14850 Object.defineProperty(exports, key, {
14851 enumerable: true,
14852 get: function get() {
14853 return _utils[key];
14854 }
14855 });
14856});
14857
14858var _clone = __webpack_require__(41059);
14859
14860/***/ }),
14861
14862/***/ 83495:
14863/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
14864
14865"use strict";
14866
14867
14868Object.defineProperty(exports, "__esModule", ({
14869 value: true
14870}));
14871exports.numberLiteralFromRaw = numberLiteralFromRaw;
14872exports.instruction = instruction;
14873exports.objectInstruction = objectInstruction;
14874exports.withLoc = withLoc;
14875exports.withRaw = withRaw;
14876exports.funcParam = funcParam;
14877exports.indexLiteral = indexLiteral;
14878exports.memIndexLiteral = memIndexLiteral;
14879
14880var _wastParser = __webpack_require__(9016);
14881
14882var _nodes = __webpack_require__(54389);
14883
14884function numberLiteralFromRaw(rawValue) {
14885 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
14886 var original = rawValue; // Remove numeric separators _
14887
14888 if (typeof rawValue === "string") {
14889 rawValue = rawValue.replace(/_/g, "");
14890 }
14891
14892 if (typeof rawValue === "number") {
14893 return (0, _nodes.numberLiteral)(rawValue, String(original));
14894 } else {
14895 switch (instructionType) {
14896 case "i32":
14897 {
14898 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
14899 }
14900
14901 case "u32":
14902 {
14903 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
14904 }
14905
14906 case "i64":
14907 {
14908 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
14909 }
14910
14911 case "f32":
14912 {
14913 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
14914 }
14915 // f64
14916
14917 default:
14918 {
14919 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
14920 }
14921 }
14922 }
14923}
14924
14925function instruction(id) {
14926 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14927 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
14928 return (0, _nodes.instr)(id, undefined, args, namedArgs);
14929}
14930
14931function objectInstruction(id, object) {
14932 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
14933 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
14934 return (0, _nodes.instr)(id, object, args, namedArgs);
14935}
14936/**
14937 * Decorators
14938 */
14939
14940
14941function withLoc(n, end, start) {
14942 var loc = {
14943 start: start,
14944 end: end
14945 };
14946 n.loc = loc;
14947 return n;
14948}
14949
14950function withRaw(n, raw) {
14951 n.raw = raw;
14952 return n;
14953}
14954
14955function funcParam(valtype, id) {
14956 return {
14957 id: id,
14958 valtype: valtype
14959 };
14960}
14961
14962function indexLiteral(value) {
14963 // $FlowIgnore
14964 var x = numberLiteralFromRaw(value, "u32");
14965 return x;
14966}
14967
14968function memIndexLiteral(value) {
14969 // $FlowIgnore
14970 var x = numberLiteralFromRaw(value, "u32");
14971 return x;
14972}
14973
14974/***/ }),
14975
14976/***/ 8195:
14977/***/ (function(__unused_webpack_module, exports) {
14978
14979"use strict";
14980
14981
14982Object.defineProperty(exports, "__esModule", ({
14983 value: true
14984}));
14985exports.createPath = createPath;
14986
14987function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14988
14989function findParent(_ref, cb) {
14990 var parentPath = _ref.parentPath;
14991
14992 if (parentPath == null) {
14993 throw new Error("node is root");
14994 }
14995
14996 var currentPath = parentPath;
14997
14998 while (cb(currentPath) !== false) {
14999 // Hit the root node, stop
15000 // $FlowIgnore
15001 if (currentPath.parentPath == null) {
15002 return null;
15003 } // $FlowIgnore
15004
15005
15006 currentPath = currentPath.parentPath;
15007 }
15008
15009 return currentPath.node;
15010}
15011
15012function insertBefore(context, newNode) {
15013 return insert(context, newNode);
15014}
15015
15016function insertAfter(context, newNode) {
15017 return insert(context, newNode, 1);
15018}
15019
15020function insert(_ref2, newNode) {
15021 var node = _ref2.node,
15022 inList = _ref2.inList,
15023 parentPath = _ref2.parentPath,
15024 parentKey = _ref2.parentKey;
15025 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
15026
15027 if (!inList) {
15028 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
15029 }
15030
15031 if (!(parentPath != null)) {
15032 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
15033 }
15034
15035 // $FlowIgnore
15036 var parentList = parentPath.node[parentKey];
15037 var indexInList = parentList.findIndex(function (n) {
15038 return n === node;
15039 });
15040 parentList.splice(indexInList + indexOffset, 0, newNode);
15041}
15042
15043function remove(_ref3) {
15044 var node = _ref3.node,
15045 parentKey = _ref3.parentKey,
15046 parentPath = _ref3.parentPath;
15047
15048 if (!(parentPath != null)) {
15049 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
15050 }
15051
15052 // $FlowIgnore
15053 var parentNode = parentPath.node; // $FlowIgnore
15054
15055 var parentProperty = parentNode[parentKey];
15056
15057 if (Array.isArray(parentProperty)) {
15058 // $FlowIgnore
15059 parentNode[parentKey] = parentProperty.filter(function (n) {
15060 return n !== node;
15061 });
15062 } else {
15063 // $FlowIgnore
15064 delete parentNode[parentKey];
15065 }
15066
15067 node._deleted = true;
15068}
15069
15070function stop(context) {
15071 context.shouldStop = true;
15072}
15073
15074function replaceWith(context, newNode) {
15075 // $FlowIgnore
15076 var parentNode = context.parentPath.node; // $FlowIgnore
15077
15078 var parentProperty = parentNode[context.parentKey];
15079
15080 if (Array.isArray(parentProperty)) {
15081 var indexInList = parentProperty.findIndex(function (n) {
15082 return n === context.node;
15083 });
15084 parentProperty.splice(indexInList, 1, newNode);
15085 } else {
15086 // $FlowIgnore
15087 parentNode[context.parentKey] = newNode;
15088 }
15089
15090 context.node._deleted = true;
15091 context.node = newNode;
15092} // bind the context to the first argument of node operations
15093
15094
15095function bindNodeOperations(operations, context) {
15096 var keys = Object.keys(operations);
15097 var boundOperations = {};
15098 keys.forEach(function (key) {
15099 boundOperations[key] = operations[key].bind(null, context);
15100 });
15101 return boundOperations;
15102}
15103
15104function createPathOperations(context) {
15105 // $FlowIgnore
15106 return bindNodeOperations({
15107 findParent: findParent,
15108 replaceWith: replaceWith,
15109 remove: remove,
15110 insertBefore: insertBefore,
15111 insertAfter: insertAfter,
15112 stop: stop
15113 }, context);
15114}
15115
15116function createPath(context) {
15117 var path = _extends({}, context); // $FlowIgnore
15118
15119
15120 Object.assign(path, createPathOperations(path)); // $FlowIgnore
15121
15122 return path;
15123}
15124
15125/***/ }),
15126
15127/***/ 54389:
15128/***/ (function(__unused_webpack_module, exports) {
15129
15130"use strict";
15131
15132
15133Object.defineProperty(exports, "__esModule", ({
15134 value: true
15135}));
15136exports.module = _module;
15137exports.moduleMetadata = moduleMetadata;
15138exports.moduleNameMetadata = moduleNameMetadata;
15139exports.functionNameMetadata = functionNameMetadata;
15140exports.localNameMetadata = localNameMetadata;
15141exports.binaryModule = binaryModule;
15142exports.quoteModule = quoteModule;
15143exports.sectionMetadata = sectionMetadata;
15144exports.producersSectionMetadata = producersSectionMetadata;
15145exports.producerMetadata = producerMetadata;
15146exports.producerMetadataVersionedName = producerMetadataVersionedName;
15147exports.loopInstruction = loopInstruction;
15148exports.instr = instr;
15149exports.ifInstruction = ifInstruction;
15150exports.stringLiteral = stringLiteral;
15151exports.numberLiteral = numberLiteral;
15152exports.longNumberLiteral = longNumberLiteral;
15153exports.floatLiteral = floatLiteral;
15154exports.elem = elem;
15155exports.indexInFuncSection = indexInFuncSection;
15156exports.valtypeLiteral = valtypeLiteral;
15157exports.typeInstruction = typeInstruction;
15158exports.start = start;
15159exports.globalType = globalType;
15160exports.leadingComment = leadingComment;
15161exports.blockComment = blockComment;
15162exports.data = data;
15163exports.global = global;
15164exports.table = table;
15165exports.memory = memory;
15166exports.funcImportDescr = funcImportDescr;
15167exports.moduleImport = moduleImport;
15168exports.moduleExportDescr = moduleExportDescr;
15169exports.moduleExport = moduleExport;
15170exports.limit = limit;
15171exports.signature = signature;
15172exports.program = program;
15173exports.identifier = identifier;
15174exports.blockInstruction = blockInstruction;
15175exports.callInstruction = callInstruction;
15176exports.callIndirectInstruction = callIndirectInstruction;
15177exports.byteArray = byteArray;
15178exports.func = func;
15179exports.internalBrUnless = internalBrUnless;
15180exports.internalGoto = internalGoto;
15181exports.internalCallExtern = internalCallExtern;
15182exports.internalEndAndReturn = internalEndAndReturn;
15183exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
15184exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
15185
15186function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15187
15188// THIS FILE IS AUTOGENERATED
15189// see scripts/generateNodeUtils.js
15190function isTypeOf(t) {
15191 return function (n) {
15192 return n.type === t;
15193 };
15194}
15195
15196function assertTypeOf(t) {
15197 return function (n) {
15198 return function () {
15199 if (!(n.type === t)) {
15200 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
15201 }
15202 }();
15203 };
15204}
15205
15206function _module(id, fields, metadata) {
15207 if (id !== null && id !== undefined) {
15208 if (!(typeof id === "string")) {
15209 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
15210 }
15211 }
15212
15213 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
15214 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
15215 }
15216
15217 var node = {
15218 type: "Module",
15219 id: id,
15220 fields: fields
15221 };
15222
15223 if (typeof metadata !== "undefined") {
15224 node.metadata = metadata;
15225 }
15226
15227 return node;
15228}
15229
15230function moduleMetadata(sections, functionNames, localNames, producers) {
15231 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
15232 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
15233 }
15234
15235 if (functionNames !== null && functionNames !== undefined) {
15236 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
15237 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
15238 }
15239 }
15240
15241 if (localNames !== null && localNames !== undefined) {
15242 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
15243 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
15244 }
15245 }
15246
15247 if (producers !== null && producers !== undefined) {
15248 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
15249 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
15250 }
15251 }
15252
15253 var node = {
15254 type: "ModuleMetadata",
15255 sections: sections
15256 };
15257
15258 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
15259 node.functionNames = functionNames;
15260 }
15261
15262 if (typeof localNames !== "undefined" && localNames.length > 0) {
15263 node.localNames = localNames;
15264 }
15265
15266 if (typeof producers !== "undefined" && producers.length > 0) {
15267 node.producers = producers;
15268 }
15269
15270 return node;
15271}
15272
15273function moduleNameMetadata(value) {
15274 if (!(typeof value === "string")) {
15275 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15276 }
15277
15278 var node = {
15279 type: "ModuleNameMetadata",
15280 value: value
15281 };
15282 return node;
15283}
15284
15285function functionNameMetadata(value, index) {
15286 if (!(typeof value === "string")) {
15287 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15288 }
15289
15290 if (!(typeof index === "number")) {
15291 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
15292 }
15293
15294 var node = {
15295 type: "FunctionNameMetadata",
15296 value: value,
15297 index: index
15298 };
15299 return node;
15300}
15301
15302function localNameMetadata(value, localIndex, functionIndex) {
15303 if (!(typeof value === "string")) {
15304 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15305 }
15306
15307 if (!(typeof localIndex === "number")) {
15308 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
15309 }
15310
15311 if (!(typeof functionIndex === "number")) {
15312 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
15313 }
15314
15315 var node = {
15316 type: "LocalNameMetadata",
15317 value: value,
15318 localIndex: localIndex,
15319 functionIndex: functionIndex
15320 };
15321 return node;
15322}
15323
15324function binaryModule(id, blob) {
15325 if (id !== null && id !== undefined) {
15326 if (!(typeof id === "string")) {
15327 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
15328 }
15329 }
15330
15331 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
15332 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
15333 }
15334
15335 var node = {
15336 type: "BinaryModule",
15337 id: id,
15338 blob: blob
15339 };
15340 return node;
15341}
15342
15343function quoteModule(id, string) {
15344 if (id !== null && id !== undefined) {
15345 if (!(typeof id === "string")) {
15346 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
15347 }
15348 }
15349
15350 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
15351 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
15352 }
15353
15354 var node = {
15355 type: "QuoteModule",
15356 id: id,
15357 string: string
15358 };
15359 return node;
15360}
15361
15362function sectionMetadata(section, startOffset, size, vectorOfSize) {
15363 if (!(typeof startOffset === "number")) {
15364 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
15365 }
15366
15367 var node = {
15368 type: "SectionMetadata",
15369 section: section,
15370 startOffset: startOffset,
15371 size: size,
15372 vectorOfSize: vectorOfSize
15373 };
15374 return node;
15375}
15376
15377function producersSectionMetadata(producers) {
15378 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
15379 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
15380 }
15381
15382 var node = {
15383 type: "ProducersSectionMetadata",
15384 producers: producers
15385 };
15386 return node;
15387}
15388
15389function producerMetadata(language, processedBy, sdk) {
15390 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
15391 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
15392 }
15393
15394 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
15395 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
15396 }
15397
15398 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
15399 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
15400 }
15401
15402 var node = {
15403 type: "ProducerMetadata",
15404 language: language,
15405 processedBy: processedBy,
15406 sdk: sdk
15407 };
15408 return node;
15409}
15410
15411function producerMetadataVersionedName(name, version) {
15412 if (!(typeof name === "string")) {
15413 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
15414 }
15415
15416 if (!(typeof version === "string")) {
15417 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
15418 }
15419
15420 var node = {
15421 type: "ProducerMetadataVersionedName",
15422 name: name,
15423 version: version
15424 };
15425 return node;
15426}
15427
15428function loopInstruction(label, resulttype, instr) {
15429 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
15430 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
15431 }
15432
15433 var node = {
15434 type: "LoopInstruction",
15435 id: "loop",
15436 label: label,
15437 resulttype: resulttype,
15438 instr: instr
15439 };
15440 return node;
15441}
15442
15443function instr(id, object, args, namedArgs) {
15444 if (!(typeof id === "string")) {
15445 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
15446 }
15447
15448 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
15449 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
15450 }
15451
15452 var node = {
15453 type: "Instr",
15454 id: id,
15455 args: args
15456 };
15457
15458 if (typeof object !== "undefined") {
15459 node.object = object;
15460 }
15461
15462 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
15463 node.namedArgs = namedArgs;
15464 }
15465
15466 return node;
15467}
15468
15469function ifInstruction(testLabel, test, result, consequent, alternate) {
15470 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
15471 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
15472 }
15473
15474 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
15475 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
15476 }
15477
15478 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
15479 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
15480 }
15481
15482 var node = {
15483 type: "IfInstruction",
15484 id: "if",
15485 testLabel: testLabel,
15486 test: test,
15487 result: result,
15488 consequent: consequent,
15489 alternate: alternate
15490 };
15491 return node;
15492}
15493
15494function stringLiteral(value) {
15495 if (!(typeof value === "string")) {
15496 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15497 }
15498
15499 var node = {
15500 type: "StringLiteral",
15501 value: value
15502 };
15503 return node;
15504}
15505
15506function numberLiteral(value, raw) {
15507 if (!(typeof value === "number")) {
15508 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
15509 }
15510
15511 if (!(typeof raw === "string")) {
15512 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
15513 }
15514
15515 var node = {
15516 type: "NumberLiteral",
15517 value: value,
15518 raw: raw
15519 };
15520 return node;
15521}
15522
15523function longNumberLiteral(value, raw) {
15524 if (!(typeof raw === "string")) {
15525 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
15526 }
15527
15528 var node = {
15529 type: "LongNumberLiteral",
15530 value: value,
15531 raw: raw
15532 };
15533 return node;
15534}
15535
15536function floatLiteral(value, nan, inf, raw) {
15537 if (!(typeof value === "number")) {
15538 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
15539 }
15540
15541 if (nan !== null && nan !== undefined) {
15542 if (!(typeof nan === "boolean")) {
15543 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
15544 }
15545 }
15546
15547 if (inf !== null && inf !== undefined) {
15548 if (!(typeof inf === "boolean")) {
15549 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
15550 }
15551 }
15552
15553 if (!(typeof raw === "string")) {
15554 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
15555 }
15556
15557 var node = {
15558 type: "FloatLiteral",
15559 value: value,
15560 raw: raw
15561 };
15562
15563 if (nan === true) {
15564 node.nan = true;
15565 }
15566
15567 if (inf === true) {
15568 node.inf = true;
15569 }
15570
15571 return node;
15572}
15573
15574function elem(table, offset, funcs) {
15575 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
15576 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
15577 }
15578
15579 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
15580 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
15581 }
15582
15583 var node = {
15584 type: "Elem",
15585 table: table,
15586 offset: offset,
15587 funcs: funcs
15588 };
15589 return node;
15590}
15591
15592function indexInFuncSection(index) {
15593 var node = {
15594 type: "IndexInFuncSection",
15595 index: index
15596 };
15597 return node;
15598}
15599
15600function valtypeLiteral(name) {
15601 var node = {
15602 type: "ValtypeLiteral",
15603 name: name
15604 };
15605 return node;
15606}
15607
15608function typeInstruction(id, functype) {
15609 var node = {
15610 type: "TypeInstruction",
15611 id: id,
15612 functype: functype
15613 };
15614 return node;
15615}
15616
15617function start(index) {
15618 var node = {
15619 type: "Start",
15620 index: index
15621 };
15622 return node;
15623}
15624
15625function globalType(valtype, mutability) {
15626 var node = {
15627 type: "GlobalType",
15628 valtype: valtype,
15629 mutability: mutability
15630 };
15631 return node;
15632}
15633
15634function leadingComment(value) {
15635 if (!(typeof value === "string")) {
15636 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15637 }
15638
15639 var node = {
15640 type: "LeadingComment",
15641 value: value
15642 };
15643 return node;
15644}
15645
15646function blockComment(value) {
15647 if (!(typeof value === "string")) {
15648 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15649 }
15650
15651 var node = {
15652 type: "BlockComment",
15653 value: value
15654 };
15655 return node;
15656}
15657
15658function data(memoryIndex, offset, init) {
15659 var node = {
15660 type: "Data",
15661 memoryIndex: memoryIndex,
15662 offset: offset,
15663 init: init
15664 };
15665 return node;
15666}
15667
15668function global(globalType, init, name) {
15669 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
15670 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
15671 }
15672
15673 var node = {
15674 type: "Global",
15675 globalType: globalType,
15676 init: init,
15677 name: name
15678 };
15679 return node;
15680}
15681
15682function table(elementType, limits, name, elements) {
15683 if (!(limits.type === "Limit")) {
15684 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
15685 }
15686
15687 if (elements !== null && elements !== undefined) {
15688 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
15689 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
15690 }
15691 }
15692
15693 var node = {
15694 type: "Table",
15695 elementType: elementType,
15696 limits: limits,
15697 name: name
15698 };
15699
15700 if (typeof elements !== "undefined" && elements.length > 0) {
15701 node.elements = elements;
15702 }
15703
15704 return node;
15705}
15706
15707function memory(limits, id) {
15708 var node = {
15709 type: "Memory",
15710 limits: limits,
15711 id: id
15712 };
15713 return node;
15714}
15715
15716function funcImportDescr(id, signature) {
15717 var node = {
15718 type: "FuncImportDescr",
15719 id: id,
15720 signature: signature
15721 };
15722 return node;
15723}
15724
15725function moduleImport(module, name, descr) {
15726 if (!(typeof module === "string")) {
15727 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
15728 }
15729
15730 if (!(typeof name === "string")) {
15731 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
15732 }
15733
15734 var node = {
15735 type: "ModuleImport",
15736 module: module,
15737 name: name,
15738 descr: descr
15739 };
15740 return node;
15741}
15742
15743function moduleExportDescr(exportType, id) {
15744 var node = {
15745 type: "ModuleExportDescr",
15746 exportType: exportType,
15747 id: id
15748 };
15749 return node;
15750}
15751
15752function moduleExport(name, descr) {
15753 if (!(typeof name === "string")) {
15754 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
15755 }
15756
15757 var node = {
15758 type: "ModuleExport",
15759 name: name,
15760 descr: descr
15761 };
15762 return node;
15763}
15764
15765function limit(min, max) {
15766 if (!(typeof min === "number")) {
15767 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
15768 }
15769
15770 if (max !== null && max !== undefined) {
15771 if (!(typeof max === "number")) {
15772 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
15773 }
15774 }
15775
15776 var node = {
15777 type: "Limit",
15778 min: min
15779 };
15780
15781 if (typeof max !== "undefined") {
15782 node.max = max;
15783 }
15784
15785 return node;
15786}
15787
15788function signature(params, results) {
15789 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
15790 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
15791 }
15792
15793 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
15794 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
15795 }
15796
15797 var node = {
15798 type: "Signature",
15799 params: params,
15800 results: results
15801 };
15802 return node;
15803}
15804
15805function program(body) {
15806 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
15807 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
15808 }
15809
15810 var node = {
15811 type: "Program",
15812 body: body
15813 };
15814 return node;
15815}
15816
15817function identifier(value, raw) {
15818 if (!(typeof value === "string")) {
15819 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
15820 }
15821
15822 if (raw !== null && raw !== undefined) {
15823 if (!(typeof raw === "string")) {
15824 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
15825 }
15826 }
15827
15828 var node = {
15829 type: "Identifier",
15830 value: value
15831 };
15832
15833 if (typeof raw !== "undefined") {
15834 node.raw = raw;
15835 }
15836
15837 return node;
15838}
15839
15840function blockInstruction(label, instr, result) {
15841 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
15842 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
15843 }
15844
15845 var node = {
15846 type: "BlockInstruction",
15847 id: "block",
15848 label: label,
15849 instr: instr,
15850 result: result
15851 };
15852 return node;
15853}
15854
15855function callInstruction(index, instrArgs, numeric) {
15856 if (instrArgs !== null && instrArgs !== undefined) {
15857 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
15858 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
15859 }
15860 }
15861
15862 var node = {
15863 type: "CallInstruction",
15864 id: "call",
15865 index: index
15866 };
15867
15868 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
15869 node.instrArgs = instrArgs;
15870 }
15871
15872 if (typeof numeric !== "undefined") {
15873 node.numeric = numeric;
15874 }
15875
15876 return node;
15877}
15878
15879function callIndirectInstruction(signature, intrs) {
15880 if (intrs !== null && intrs !== undefined) {
15881 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
15882 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
15883 }
15884 }
15885
15886 var node = {
15887 type: "CallIndirectInstruction",
15888 id: "call_indirect",
15889 signature: signature
15890 };
15891
15892 if (typeof intrs !== "undefined" && intrs.length > 0) {
15893 node.intrs = intrs;
15894 }
15895
15896 return node;
15897}
15898
15899function byteArray(values) {
15900 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
15901 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
15902 }
15903
15904 var node = {
15905 type: "ByteArray",
15906 values: values
15907 };
15908 return node;
15909}
15910
15911function func(name, signature, body, isExternal, metadata) {
15912 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
15913 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
15914 }
15915
15916 if (isExternal !== null && isExternal !== undefined) {
15917 if (!(typeof isExternal === "boolean")) {
15918 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
15919 }
15920 }
15921
15922 var node = {
15923 type: "Func",
15924 name: name,
15925 signature: signature,
15926 body: body
15927 };
15928
15929 if (isExternal === true) {
15930 node.isExternal = true;
15931 }
15932
15933 if (typeof metadata !== "undefined") {
15934 node.metadata = metadata;
15935 }
15936
15937 return node;
15938}
15939
15940function internalBrUnless(target) {
15941 if (!(typeof target === "number")) {
15942 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
15943 }
15944
15945 var node = {
15946 type: "InternalBrUnless",
15947 target: target
15948 };
15949 return node;
15950}
15951
15952function internalGoto(target) {
15953 if (!(typeof target === "number")) {
15954 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
15955 }
15956
15957 var node = {
15958 type: "InternalGoto",
15959 target: target
15960 };
15961 return node;
15962}
15963
15964function internalCallExtern(target) {
15965 if (!(typeof target === "number")) {
15966 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
15967 }
15968
15969 var node = {
15970 type: "InternalCallExtern",
15971 target: target
15972 };
15973 return node;
15974}
15975
15976function internalEndAndReturn() {
15977 var node = {
15978 type: "InternalEndAndReturn"
15979 };
15980 return node;
15981}
15982
15983var isModule = isTypeOf("Module");
15984exports.isModule = isModule;
15985var isModuleMetadata = isTypeOf("ModuleMetadata");
15986exports.isModuleMetadata = isModuleMetadata;
15987var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
15988exports.isModuleNameMetadata = isModuleNameMetadata;
15989var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
15990exports.isFunctionNameMetadata = isFunctionNameMetadata;
15991var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
15992exports.isLocalNameMetadata = isLocalNameMetadata;
15993var isBinaryModule = isTypeOf("BinaryModule");
15994exports.isBinaryModule = isBinaryModule;
15995var isQuoteModule = isTypeOf("QuoteModule");
15996exports.isQuoteModule = isQuoteModule;
15997var isSectionMetadata = isTypeOf("SectionMetadata");
15998exports.isSectionMetadata = isSectionMetadata;
15999var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
16000exports.isProducersSectionMetadata = isProducersSectionMetadata;
16001var isProducerMetadata = isTypeOf("ProducerMetadata");
16002exports.isProducerMetadata = isProducerMetadata;
16003var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
16004exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
16005var isLoopInstruction = isTypeOf("LoopInstruction");
16006exports.isLoopInstruction = isLoopInstruction;
16007var isInstr = isTypeOf("Instr");
16008exports.isInstr = isInstr;
16009var isIfInstruction = isTypeOf("IfInstruction");
16010exports.isIfInstruction = isIfInstruction;
16011var isStringLiteral = isTypeOf("StringLiteral");
16012exports.isStringLiteral = isStringLiteral;
16013var isNumberLiteral = isTypeOf("NumberLiteral");
16014exports.isNumberLiteral = isNumberLiteral;
16015var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
16016exports.isLongNumberLiteral = isLongNumberLiteral;
16017var isFloatLiteral = isTypeOf("FloatLiteral");
16018exports.isFloatLiteral = isFloatLiteral;
16019var isElem = isTypeOf("Elem");
16020exports.isElem = isElem;
16021var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
16022exports.isIndexInFuncSection = isIndexInFuncSection;
16023var isValtypeLiteral = isTypeOf("ValtypeLiteral");
16024exports.isValtypeLiteral = isValtypeLiteral;
16025var isTypeInstruction = isTypeOf("TypeInstruction");
16026exports.isTypeInstruction = isTypeInstruction;
16027var isStart = isTypeOf("Start");
16028exports.isStart = isStart;
16029var isGlobalType = isTypeOf("GlobalType");
16030exports.isGlobalType = isGlobalType;
16031var isLeadingComment = isTypeOf("LeadingComment");
16032exports.isLeadingComment = isLeadingComment;
16033var isBlockComment = isTypeOf("BlockComment");
16034exports.isBlockComment = isBlockComment;
16035var isData = isTypeOf("Data");
16036exports.isData = isData;
16037var isGlobal = isTypeOf("Global");
16038exports.isGlobal = isGlobal;
16039var isTable = isTypeOf("Table");
16040exports.isTable = isTable;
16041var isMemory = isTypeOf("Memory");
16042exports.isMemory = isMemory;
16043var isFuncImportDescr = isTypeOf("FuncImportDescr");
16044exports.isFuncImportDescr = isFuncImportDescr;
16045var isModuleImport = isTypeOf("ModuleImport");
16046exports.isModuleImport = isModuleImport;
16047var isModuleExportDescr = isTypeOf("ModuleExportDescr");
16048exports.isModuleExportDescr = isModuleExportDescr;
16049var isModuleExport = isTypeOf("ModuleExport");
16050exports.isModuleExport = isModuleExport;
16051var isLimit = isTypeOf("Limit");
16052exports.isLimit = isLimit;
16053var isSignature = isTypeOf("Signature");
16054exports.isSignature = isSignature;
16055var isProgram = isTypeOf("Program");
16056exports.isProgram = isProgram;
16057var isIdentifier = isTypeOf("Identifier");
16058exports.isIdentifier = isIdentifier;
16059var isBlockInstruction = isTypeOf("BlockInstruction");
16060exports.isBlockInstruction = isBlockInstruction;
16061var isCallInstruction = isTypeOf("CallInstruction");
16062exports.isCallInstruction = isCallInstruction;
16063var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
16064exports.isCallIndirectInstruction = isCallIndirectInstruction;
16065var isByteArray = isTypeOf("ByteArray");
16066exports.isByteArray = isByteArray;
16067var isFunc = isTypeOf("Func");
16068exports.isFunc = isFunc;
16069var isInternalBrUnless = isTypeOf("InternalBrUnless");
16070exports.isInternalBrUnless = isInternalBrUnless;
16071var isInternalGoto = isTypeOf("InternalGoto");
16072exports.isInternalGoto = isInternalGoto;
16073var isInternalCallExtern = isTypeOf("InternalCallExtern");
16074exports.isInternalCallExtern = isInternalCallExtern;
16075var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
16076exports.isInternalEndAndReturn = isInternalEndAndReturn;
16077
16078var isNode = function isNode(node) {
16079 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
16080};
16081
16082exports.isNode = isNode;
16083
16084var isBlock = function isBlock(node) {
16085 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
16086};
16087
16088exports.isBlock = isBlock;
16089
16090var isInstruction = function isInstruction(node) {
16091 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
16092};
16093
16094exports.isInstruction = isInstruction;
16095
16096var isExpression = function isExpression(node) {
16097 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
16098};
16099
16100exports.isExpression = isExpression;
16101
16102var isNumericLiteral = function isNumericLiteral(node) {
16103 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
16104};
16105
16106exports.isNumericLiteral = isNumericLiteral;
16107
16108var isImportDescr = function isImportDescr(node) {
16109 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
16110};
16111
16112exports.isImportDescr = isImportDescr;
16113
16114var isIntrinsic = function isIntrinsic(node) {
16115 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
16116};
16117
16118exports.isIntrinsic = isIntrinsic;
16119var assertModule = assertTypeOf("Module");
16120exports.assertModule = assertModule;
16121var assertModuleMetadata = assertTypeOf("ModuleMetadata");
16122exports.assertModuleMetadata = assertModuleMetadata;
16123var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
16124exports.assertModuleNameMetadata = assertModuleNameMetadata;
16125var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
16126exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
16127var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
16128exports.assertLocalNameMetadata = assertLocalNameMetadata;
16129var assertBinaryModule = assertTypeOf("BinaryModule");
16130exports.assertBinaryModule = assertBinaryModule;
16131var assertQuoteModule = assertTypeOf("QuoteModule");
16132exports.assertQuoteModule = assertQuoteModule;
16133var assertSectionMetadata = assertTypeOf("SectionMetadata");
16134exports.assertSectionMetadata = assertSectionMetadata;
16135var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
16136exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
16137var assertProducerMetadata = assertTypeOf("ProducerMetadata");
16138exports.assertProducerMetadata = assertProducerMetadata;
16139var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
16140exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
16141var assertLoopInstruction = assertTypeOf("LoopInstruction");
16142exports.assertLoopInstruction = assertLoopInstruction;
16143var assertInstr = assertTypeOf("Instr");
16144exports.assertInstr = assertInstr;
16145var assertIfInstruction = assertTypeOf("IfInstruction");
16146exports.assertIfInstruction = assertIfInstruction;
16147var assertStringLiteral = assertTypeOf("StringLiteral");
16148exports.assertStringLiteral = assertStringLiteral;
16149var assertNumberLiteral = assertTypeOf("NumberLiteral");
16150exports.assertNumberLiteral = assertNumberLiteral;
16151var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
16152exports.assertLongNumberLiteral = assertLongNumberLiteral;
16153var assertFloatLiteral = assertTypeOf("FloatLiteral");
16154exports.assertFloatLiteral = assertFloatLiteral;
16155var assertElem = assertTypeOf("Elem");
16156exports.assertElem = assertElem;
16157var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
16158exports.assertIndexInFuncSection = assertIndexInFuncSection;
16159var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
16160exports.assertValtypeLiteral = assertValtypeLiteral;
16161var assertTypeInstruction = assertTypeOf("TypeInstruction");
16162exports.assertTypeInstruction = assertTypeInstruction;
16163var assertStart = assertTypeOf("Start");
16164exports.assertStart = assertStart;
16165var assertGlobalType = assertTypeOf("GlobalType");
16166exports.assertGlobalType = assertGlobalType;
16167var assertLeadingComment = assertTypeOf("LeadingComment");
16168exports.assertLeadingComment = assertLeadingComment;
16169var assertBlockComment = assertTypeOf("BlockComment");
16170exports.assertBlockComment = assertBlockComment;
16171var assertData = assertTypeOf("Data");
16172exports.assertData = assertData;
16173var assertGlobal = assertTypeOf("Global");
16174exports.assertGlobal = assertGlobal;
16175var assertTable = assertTypeOf("Table");
16176exports.assertTable = assertTable;
16177var assertMemory = assertTypeOf("Memory");
16178exports.assertMemory = assertMemory;
16179var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
16180exports.assertFuncImportDescr = assertFuncImportDescr;
16181var assertModuleImport = assertTypeOf("ModuleImport");
16182exports.assertModuleImport = assertModuleImport;
16183var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
16184exports.assertModuleExportDescr = assertModuleExportDescr;
16185var assertModuleExport = assertTypeOf("ModuleExport");
16186exports.assertModuleExport = assertModuleExport;
16187var assertLimit = assertTypeOf("Limit");
16188exports.assertLimit = assertLimit;
16189var assertSignature = assertTypeOf("Signature");
16190exports.assertSignature = assertSignature;
16191var assertProgram = assertTypeOf("Program");
16192exports.assertProgram = assertProgram;
16193var assertIdentifier = assertTypeOf("Identifier");
16194exports.assertIdentifier = assertIdentifier;
16195var assertBlockInstruction = assertTypeOf("BlockInstruction");
16196exports.assertBlockInstruction = assertBlockInstruction;
16197var assertCallInstruction = assertTypeOf("CallInstruction");
16198exports.assertCallInstruction = assertCallInstruction;
16199var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
16200exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
16201var assertByteArray = assertTypeOf("ByteArray");
16202exports.assertByteArray = assertByteArray;
16203var assertFunc = assertTypeOf("Func");
16204exports.assertFunc = assertFunc;
16205var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
16206exports.assertInternalBrUnless = assertInternalBrUnless;
16207var assertInternalGoto = assertTypeOf("InternalGoto");
16208exports.assertInternalGoto = assertInternalGoto;
16209var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
16210exports.assertInternalCallExtern = assertInternalCallExtern;
16211var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
16212exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
16213var unionTypesMap = {
16214 Module: ["Node"],
16215 ModuleMetadata: ["Node"],
16216 ModuleNameMetadata: ["Node"],
16217 FunctionNameMetadata: ["Node"],
16218 LocalNameMetadata: ["Node"],
16219 BinaryModule: ["Node"],
16220 QuoteModule: ["Node"],
16221 SectionMetadata: ["Node"],
16222 ProducersSectionMetadata: ["Node"],
16223 ProducerMetadata: ["Node"],
16224 ProducerMetadataVersionedName: ["Node"],
16225 LoopInstruction: ["Node", "Block", "Instruction"],
16226 Instr: ["Node", "Expression", "Instruction"],
16227 IfInstruction: ["Node", "Instruction"],
16228 StringLiteral: ["Node", "Expression"],
16229 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
16230 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
16231 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
16232 Elem: ["Node"],
16233 IndexInFuncSection: ["Node"],
16234 ValtypeLiteral: ["Node", "Expression"],
16235 TypeInstruction: ["Node", "Instruction"],
16236 Start: ["Node"],
16237 GlobalType: ["Node", "ImportDescr"],
16238 LeadingComment: ["Node"],
16239 BlockComment: ["Node"],
16240 Data: ["Node"],
16241 Global: ["Node"],
16242 Table: ["Node", "ImportDescr"],
16243 Memory: ["Node", "ImportDescr"],
16244 FuncImportDescr: ["Node", "ImportDescr"],
16245 ModuleImport: ["Node"],
16246 ModuleExportDescr: ["Node"],
16247 ModuleExport: ["Node"],
16248 Limit: ["Node"],
16249 Signature: ["Node"],
16250 Program: ["Node"],
16251 Identifier: ["Node", "Expression"],
16252 BlockInstruction: ["Node", "Block", "Instruction"],
16253 CallInstruction: ["Node", "Instruction"],
16254 CallIndirectInstruction: ["Node", "Instruction"],
16255 ByteArray: ["Node"],
16256 Func: ["Node", "Block"],
16257 InternalBrUnless: ["Node", "Intrinsic"],
16258 InternalGoto: ["Node", "Intrinsic"],
16259 InternalCallExtern: ["Node", "Intrinsic"],
16260 InternalEndAndReturn: ["Node", "Intrinsic"]
16261};
16262exports.unionTypesMap = unionTypesMap;
16263var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
16264exports.nodeAndUnionTypes = nodeAndUnionTypes;
16265
16266/***/ }),
16267
16268/***/ 92417:
16269/***/ (function(__unused_webpack_module, exports) {
16270
16271"use strict";
16272
16273
16274Object.defineProperty(exports, "__esModule", ({
16275 value: true
16276}));
16277exports.signatures = void 0;
16278
16279function sign(input, output) {
16280 return [input, output];
16281}
16282
16283var u32 = "u32";
16284var i32 = "i32";
16285var i64 = "i64";
16286var f32 = "f32";
16287var f64 = "f64";
16288
16289var vector = function vector(t) {
16290 var vecType = [t]; // $FlowIgnore
16291
16292 vecType.vector = true;
16293 return vecType;
16294};
16295
16296var controlInstructions = {
16297 unreachable: sign([], []),
16298 nop: sign([], []),
16299 // block ?
16300 // loop ?
16301 // if ?
16302 // if else ?
16303 br: sign([u32], []),
16304 br_if: sign([u32], []),
16305 br_table: sign(vector(u32), []),
16306 return: sign([], []),
16307 call: sign([u32], []),
16308 call_indirect: sign([u32], [])
16309};
16310var parametricInstructions = {
16311 drop: sign([], []),
16312 select: sign([], [])
16313};
16314var variableInstructions = {
16315 get_local: sign([u32], []),
16316 set_local: sign([u32], []),
16317 tee_local: sign([u32], []),
16318 get_global: sign([u32], []),
16319 set_global: sign([u32], [])
16320};
16321var memoryInstructions = {
16322 "i32.load": sign([u32, u32], [i32]),
16323 "i64.load": sign([u32, u32], []),
16324 "f32.load": sign([u32, u32], []),
16325 "f64.load": sign([u32, u32], []),
16326 "i32.load8_s": sign([u32, u32], [i32]),
16327 "i32.load8_u": sign([u32, u32], [i32]),
16328 "i32.load16_s": sign([u32, u32], [i32]),
16329 "i32.load16_u": sign([u32, u32], [i32]),
16330 "i64.load8_s": sign([u32, u32], [i64]),
16331 "i64.load8_u": sign([u32, u32], [i64]),
16332 "i64.load16_s": sign([u32, u32], [i64]),
16333 "i64.load16_u": sign([u32, u32], [i64]),
16334 "i64.load32_s": sign([u32, u32], [i64]),
16335 "i64.load32_u": sign([u32, u32], [i64]),
16336 "i32.store": sign([u32, u32], []),
16337 "i64.store": sign([u32, u32], []),
16338 "f32.store": sign([u32, u32], []),
16339 "f64.store": sign([u32, u32], []),
16340 "i32.store8": sign([u32, u32], []),
16341 "i32.store16": sign([u32, u32], []),
16342 "i64.store8": sign([u32, u32], []),
16343 "i64.store16": sign([u32, u32], []),
16344 "i64.store32": sign([u32, u32], []),
16345 current_memory: sign([], []),
16346 grow_memory: sign([], [])
16347};
16348var numericInstructions = {
16349 "i32.const": sign([i32], [i32]),
16350 "i64.const": sign([i64], [i64]),
16351 "f32.const": sign([f32], [f32]),
16352 "f64.const": sign([f64], [f64]),
16353 "i32.eqz": sign([i32], [i32]),
16354 "i32.eq": sign([i32, i32], [i32]),
16355 "i32.ne": sign([i32, i32], [i32]),
16356 "i32.lt_s": sign([i32, i32], [i32]),
16357 "i32.lt_u": sign([i32, i32], [i32]),
16358 "i32.gt_s": sign([i32, i32], [i32]),
16359 "i32.gt_u": sign([i32, i32], [i32]),
16360 "i32.le_s": sign([i32, i32], [i32]),
16361 "i32.le_u": sign([i32, i32], [i32]),
16362 "i32.ge_s": sign([i32, i32], [i32]),
16363 "i32.ge_u": sign([i32, i32], [i32]),
16364 "i64.eqz": sign([i64], [i64]),
16365 "i64.eq": sign([i64, i64], [i32]),
16366 "i64.ne": sign([i64, i64], [i32]),
16367 "i64.lt_s": sign([i64, i64], [i32]),
16368 "i64.lt_u": sign([i64, i64], [i32]),
16369 "i64.gt_s": sign([i64, i64], [i32]),
16370 "i64.gt_u": sign([i64, i64], [i32]),
16371 "i64.le_s": sign([i64, i64], [i32]),
16372 "i64.le_u": sign([i64, i64], [i32]),
16373 "i64.ge_s": sign([i64, i64], [i32]),
16374 "i64.ge_u": sign([i64, i64], [i32]),
16375 "f32.eq": sign([f32, f32], [i32]),
16376 "f32.ne": sign([f32, f32], [i32]),
16377 "f32.lt": sign([f32, f32], [i32]),
16378 "f32.gt": sign([f32, f32], [i32]),
16379 "f32.le": sign([f32, f32], [i32]),
16380 "f32.ge": sign([f32, f32], [i32]),
16381 "f64.eq": sign([f64, f64], [i32]),
16382 "f64.ne": sign([f64, f64], [i32]),
16383 "f64.lt": sign([f64, f64], [i32]),
16384 "f64.gt": sign([f64, f64], [i32]),
16385 "f64.le": sign([f64, f64], [i32]),
16386 "f64.ge": sign([f64, f64], [i32]),
16387 "i32.clz": sign([i32], [i32]),
16388 "i32.ctz": sign([i32], [i32]),
16389 "i32.popcnt": sign([i32], [i32]),
16390 "i32.add": sign([i32, i32], [i32]),
16391 "i32.sub": sign([i32, i32], [i32]),
16392 "i32.mul": sign([i32, i32], [i32]),
16393 "i32.div_s": sign([i32, i32], [i32]),
16394 "i32.div_u": sign([i32, i32], [i32]),
16395 "i32.rem_s": sign([i32, i32], [i32]),
16396 "i32.rem_u": sign([i32, i32], [i32]),
16397 "i32.and": sign([i32, i32], [i32]),
16398 "i32.or": sign([i32, i32], [i32]),
16399 "i32.xor": sign([i32, i32], [i32]),
16400 "i32.shl": sign([i32, i32], [i32]),
16401 "i32.shr_s": sign([i32, i32], [i32]),
16402 "i32.shr_u": sign([i32, i32], [i32]),
16403 "i32.rotl": sign([i32, i32], [i32]),
16404 "i32.rotr": sign([i32, i32], [i32]),
16405 "i64.clz": sign([i64], [i64]),
16406 "i64.ctz": sign([i64], [i64]),
16407 "i64.popcnt": sign([i64], [i64]),
16408 "i64.add": sign([i64, i64], [i64]),
16409 "i64.sub": sign([i64, i64], [i64]),
16410 "i64.mul": sign([i64, i64], [i64]),
16411 "i64.div_s": sign([i64, i64], [i64]),
16412 "i64.div_u": sign([i64, i64], [i64]),
16413 "i64.rem_s": sign([i64, i64], [i64]),
16414 "i64.rem_u": sign([i64, i64], [i64]),
16415 "i64.and": sign([i64, i64], [i64]),
16416 "i64.or": sign([i64, i64], [i64]),
16417 "i64.xor": sign([i64, i64], [i64]),
16418 "i64.shl": sign([i64, i64], [i64]),
16419 "i64.shr_s": sign([i64, i64], [i64]),
16420 "i64.shr_u": sign([i64, i64], [i64]),
16421 "i64.rotl": sign([i64, i64], [i64]),
16422 "i64.rotr": sign([i64, i64], [i64]),
16423 "f32.abs": sign([f32], [f32]),
16424 "f32.neg": sign([f32], [f32]),
16425 "f32.ceil": sign([f32], [f32]),
16426 "f32.floor": sign([f32], [f32]),
16427 "f32.trunc": sign([f32], [f32]),
16428 "f32.nearest": sign([f32], [f32]),
16429 "f32.sqrt": sign([f32], [f32]),
16430 "f32.add": sign([f32, f32], [f32]),
16431 "f32.sub": sign([f32, f32], [f32]),
16432 "f32.mul": sign([f32, f32], [f32]),
16433 "f32.div": sign([f32, f32], [f32]),
16434 "f32.min": sign([f32, f32], [f32]),
16435 "f32.max": sign([f32, f32], [f32]),
16436 "f32.copysign": sign([f32, f32], [f32]),
16437 "f64.abs": sign([f64], [f64]),
16438 "f64.neg": sign([f64], [f64]),
16439 "f64.ceil": sign([f64], [f64]),
16440 "f64.floor": sign([f64], [f64]),
16441 "f64.trunc": sign([f64], [f64]),
16442 "f64.nearest": sign([f64], [f64]),
16443 "f64.sqrt": sign([f64], [f64]),
16444 "f64.add": sign([f64, f64], [f64]),
16445 "f64.sub": sign([f64, f64], [f64]),
16446 "f64.mul": sign([f64, f64], [f64]),
16447 "f64.div": sign([f64, f64], [f64]),
16448 "f64.min": sign([f64, f64], [f64]),
16449 "f64.max": sign([f64, f64], [f64]),
16450 "f64.copysign": sign([f64, f64], [f64]),
16451 "i32.wrap/i64": sign([i64], [i32]),
16452 "i32.trunc_s/f32": sign([f32], [i32]),
16453 "i32.trunc_u/f32": sign([f32], [i32]),
16454 "i32.trunc_s/f64": sign([f32], [i32]),
16455 "i32.trunc_u/f64": sign([f64], [i32]),
16456 "i64.extend_s/i32": sign([i32], [i64]),
16457 "i64.extend_u/i32": sign([i32], [i64]),
16458 "i64.trunc_s/f32": sign([f32], [i64]),
16459 "i64.trunc_u/f32": sign([f32], [i64]),
16460 "i64.trunc_s/f64": sign([f64], [i64]),
16461 "i64.trunc_u/f64": sign([f64], [i64]),
16462 "f32.convert_s/i32": sign([i32], [f32]),
16463 "f32.convert_u/i32": sign([i32], [f32]),
16464 "f32.convert_s/i64": sign([i64], [f32]),
16465 "f32.convert_u/i64": sign([i64], [f32]),
16466 "f32.demote/f64": sign([f64], [f32]),
16467 "f64.convert_s/i32": sign([i32], [f64]),
16468 "f64.convert_u/i32": sign([i32], [f64]),
16469 "f64.convert_s/i64": sign([i64], [f64]),
16470 "f64.convert_u/i64": sign([i64], [f64]),
16471 "f64.promote/f32": sign([f32], [f64]),
16472 "i32.reinterpret/f32": sign([f32], [i32]),
16473 "i64.reinterpret/f64": sign([f64], [i64]),
16474 "f32.reinterpret/i32": sign([i32], [f32]),
16475 "f64.reinterpret/i64": sign([i64], [f64])
16476};
16477var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
16478exports.signatures = signatures;
16479
16480/***/ }),
16481
16482/***/ 80485:
16483/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
16484
16485"use strict";
16486
16487
16488Object.defineProperty(exports, "__esModule", ({
16489 value: true
16490}));
16491exports.traverse = traverse;
16492
16493var _nodePath = __webpack_require__(8195);
16494
16495var _nodes = __webpack_require__(54389);
16496
16497// recursively walks the AST starting at the given node. The callback is invoked for
16498// and object that has a 'type' property.
16499function walk(context, callback) {
16500 var stop = false;
16501
16502 function innerWalk(context, callback) {
16503 if (stop) {
16504 return;
16505 }
16506
16507 var node = context.node;
16508
16509 if (node === undefined) {
16510 console.warn("traversing with an empty context");
16511 return;
16512 }
16513
16514 if (node._deleted === true) {
16515 return;
16516 }
16517
16518 var path = (0, _nodePath.createPath)(context);
16519 callback(node.type, path);
16520
16521 if (path.shouldStop) {
16522 stop = true;
16523 return;
16524 }
16525
16526 Object.keys(node).forEach(function (prop) {
16527 var value = node[prop];
16528
16529 if (value === null || value === undefined) {
16530 return;
16531 }
16532
16533 var valueAsArray = Array.isArray(value) ? value : [value];
16534 valueAsArray.forEach(function (childNode) {
16535 if (typeof childNode.type === "string") {
16536 var childContext = {
16537 node: childNode,
16538 parentKey: prop,
16539 parentPath: path,
16540 shouldStop: false,
16541 inList: Array.isArray(value)
16542 };
16543 innerWalk(childContext, callback);
16544 }
16545 });
16546 });
16547 }
16548
16549 innerWalk(context, callback);
16550}
16551
16552var noop = function noop() {};
16553
16554function traverse(node, visitors) {
16555 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
16556 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
16557 Object.keys(visitors).forEach(function (visitor) {
16558 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
16559 throw new Error("Unexpected visitor ".concat(visitor));
16560 }
16561 });
16562 var context = {
16563 node: node,
16564 inList: false,
16565 shouldStop: false,
16566 parentPath: null,
16567 parentKey: null
16568 };
16569 walk(context, function (type, path) {
16570 if (typeof visitors[type] === "function") {
16571 before(type, path);
16572 visitors[type](path);
16573 after(type, path);
16574 }
16575
16576 var unionTypes = _nodes.unionTypesMap[type];
16577
16578 if (!unionTypes) {
16579 throw new Error("Unexpected node type ".concat(type));
16580 }
16581
16582 unionTypes.forEach(function (unionType) {
16583 if (typeof visitors[unionType] === "function") {
16584 before(unionType, path);
16585 visitors[unionType](path);
16586 after(unionType, path);
16587 }
16588 });
16589 });
16590}
16591
16592/***/ }),
16593
16594/***/ 53732:
16595/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
16596
16597"use strict";
16598
16599
16600Object.defineProperty(exports, "__esModule", ({
16601 value: true
16602}));
16603exports.isAnonymous = isAnonymous;
16604exports.getSectionMetadata = getSectionMetadata;
16605exports.getSectionMetadatas = getSectionMetadatas;
16606exports.sortSectionMetadata = sortSectionMetadata;
16607exports.orderedInsertNode = orderedInsertNode;
16608exports.assertHasLoc = assertHasLoc;
16609exports.getEndOfSection = getEndOfSection;
16610exports.shiftLoc = shiftLoc;
16611exports.shiftSection = shiftSection;
16612exports.signatureForOpcode = signatureForOpcode;
16613exports.getUniqueNameGenerator = getUniqueNameGenerator;
16614exports.getStartByteOffset = getStartByteOffset;
16615exports.getEndByteOffset = getEndByteOffset;
16616exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
16617exports.getEndBlockByteOffset = getEndBlockByteOffset;
16618exports.getStartBlockByteOffset = getStartBlockByteOffset;
16619
16620var _signatures = __webpack_require__(92417);
16621
16622var _traverse = __webpack_require__(80485);
16623
16624var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(90065));
16625
16626function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
16627
16628function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
16629
16630function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
16631
16632function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
16633
16634function isAnonymous(ident) {
16635 return ident.raw === "";
16636}
16637
16638function getSectionMetadata(ast, name) {
16639 var section;
16640 (0, _traverse.traverse)(ast, {
16641 SectionMetadata: function (_SectionMetadata) {
16642 function SectionMetadata(_x) {
16643 return _SectionMetadata.apply(this, arguments);
16644 }
16645
16646 SectionMetadata.toString = function () {
16647 return _SectionMetadata.toString();
16648 };
16649
16650 return SectionMetadata;
16651 }(function (_ref) {
16652 var node = _ref.node;
16653
16654 if (node.section === name) {
16655 section = node;
16656 }
16657 })
16658 });
16659 return section;
16660}
16661
16662function getSectionMetadatas(ast, name) {
16663 var sections = [];
16664 (0, _traverse.traverse)(ast, {
16665 SectionMetadata: function (_SectionMetadata2) {
16666 function SectionMetadata(_x2) {
16667 return _SectionMetadata2.apply(this, arguments);
16668 }
16669
16670 SectionMetadata.toString = function () {
16671 return _SectionMetadata2.toString();
16672 };
16673
16674 return SectionMetadata;
16675 }(function (_ref2) {
16676 var node = _ref2.node;
16677
16678 if (node.section === name) {
16679 sections.push(node);
16680 }
16681 })
16682 });
16683 return sections;
16684}
16685
16686function sortSectionMetadata(m) {
16687 if (m.metadata == null) {
16688 console.warn("sortSectionMetadata: no metadata to sort");
16689 return;
16690 } // $FlowIgnore
16691
16692
16693 m.metadata.sections.sort(function (a, b) {
16694 var aId = _helperWasmBytecode.default.sections[a.section];
16695 var bId = _helperWasmBytecode.default.sections[b.section];
16696
16697 if (typeof aId !== "number" || typeof bId !== "number") {
16698 throw new Error("Section id not found");
16699 }
16700
16701 return aId - bId;
16702 });
16703}
16704
16705function orderedInsertNode(m, n) {
16706 assertHasLoc(n);
16707 var didInsert = false;
16708
16709 if (n.type === "ModuleExport") {
16710 m.fields.push(n);
16711 return;
16712 }
16713
16714 m.fields = m.fields.reduce(function (acc, field) {
16715 var fieldEndCol = Infinity;
16716
16717 if (field.loc != null) {
16718 // $FlowIgnore
16719 fieldEndCol = field.loc.end.column;
16720 } // $FlowIgnore: assertHasLoc ensures that
16721
16722
16723 if (didInsert === false && n.loc.start.column < fieldEndCol) {
16724 didInsert = true;
16725 acc.push(n);
16726 }
16727
16728 acc.push(field);
16729 return acc;
16730 }, []); // Handles empty modules or n is the last element
16731
16732 if (didInsert === false) {
16733 m.fields.push(n);
16734 }
16735}
16736
16737function assertHasLoc(n) {
16738 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
16739 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
16740 }
16741}
16742
16743function getEndOfSection(s) {
16744 assertHasLoc(s.size);
16745 return s.startOffset + s.size.value + ( // $FlowIgnore
16746 s.size.loc.end.column - s.size.loc.start.column);
16747}
16748
16749function shiftLoc(node, delta) {
16750 // $FlowIgnore
16751 node.loc.start.column += delta; // $FlowIgnore
16752
16753 node.loc.end.column += delta;
16754}
16755
16756function shiftSection(ast, node, delta) {
16757 if (node.type !== "SectionMetadata") {
16758 throw new Error("Can not shift node " + JSON.stringify(node.type));
16759 }
16760
16761 node.startOffset += delta;
16762
16763 if (_typeof(node.size.loc) === "object") {
16764 shiftLoc(node.size, delta);
16765 } // Custom sections doesn't have vectorOfSize
16766
16767
16768 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
16769 shiftLoc(node.vectorOfSize, delta);
16770 }
16771
16772 var sectionName = node.section; // shift node locations within that section
16773
16774 (0, _traverse.traverse)(ast, {
16775 Node: function Node(_ref3) {
16776 var node = _ref3.node;
16777 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
16778
16779 if (section === sectionName && _typeof(node.loc) === "object") {
16780 shiftLoc(node, delta);
16781 }
16782 }
16783 });
16784}
16785
16786function signatureForOpcode(object, name) {
16787 var opcodeName = name;
16788
16789 if (object !== undefined && object !== "") {
16790 opcodeName = object + "." + name;
16791 }
16792
16793 var sign = _signatures.signatures[opcodeName];
16794
16795 if (sign == undefined) {
16796 // TODO: Uncomment this when br_table and others has been done
16797 //throw new Error("Invalid opcode: "+opcodeName);
16798 return [object, object];
16799 }
16800
16801 return sign[0];
16802}
16803
16804function getUniqueNameGenerator() {
16805 var inc = {};
16806 return function () {
16807 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
16808
16809 if (!(prefix in inc)) {
16810 inc[prefix] = 0;
16811 } else {
16812 inc[prefix] = inc[prefix] + 1;
16813 }
16814
16815 return prefix + "_" + inc[prefix];
16816 };
16817}
16818
16819function getStartByteOffset(n) {
16820 // $FlowIgnore
16821 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
16822 throw new Error( // $FlowIgnore
16823 "Can not get byte offset without loc informations, node: " + String(n.id));
16824 }
16825
16826 return n.loc.start.column;
16827}
16828
16829function getEndByteOffset(n) {
16830 // $FlowIgnore
16831 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
16832 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
16833 }
16834
16835 return n.loc.end.column;
16836}
16837
16838function getFunctionBeginingByteOffset(n) {
16839 if (!(n.body.length > 0)) {
16840 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
16841 }
16842
16843 var _n$body = _slicedToArray(n.body, 1),
16844 firstInstruction = _n$body[0];
16845
16846 return getStartByteOffset(firstInstruction);
16847}
16848
16849function getEndBlockByteOffset(n) {
16850 // $FlowIgnore
16851 if (!(n.instr.length > 0 || n.body.length > 0)) {
16852 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
16853 }
16854
16855 var lastInstruction;
16856
16857 if (n.instr) {
16858 // $FlowIgnore
16859 lastInstruction = n.instr[n.instr.length - 1];
16860 }
16861
16862 if (n.body) {
16863 // $FlowIgnore
16864 lastInstruction = n.body[n.body.length - 1];
16865 }
16866
16867 if (!(_typeof(lastInstruction) === "object")) {
16868 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
16869 }
16870
16871 // $FlowIgnore
16872 return getStartByteOffset(lastInstruction);
16873}
16874
16875function getStartBlockByteOffset(n) {
16876 // $FlowIgnore
16877 if (!(n.instr.length > 0 || n.body.length > 0)) {
16878 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
16879 }
16880
16881 var fistInstruction;
16882
16883 if (n.instr) {
16884 // $FlowIgnore
16885 var _n$instr = _slicedToArray(n.instr, 1);
16886
16887 fistInstruction = _n$instr[0];
16888 }
16889
16890 if (n.body) {
16891 // $FlowIgnore
16892 var _n$body2 = _slicedToArray(n.body, 1);
16893
16894 fistInstruction = _n$body2[0];
16895 }
16896
16897 if (!(_typeof(fistInstruction) === "object")) {
16898 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
16899 }
16900
16901 // $FlowIgnore
16902 return getStartByteOffset(fistInstruction);
16903}
16904
16905/***/ }),
16906
16907/***/ 1806:
16908/***/ (function(__unused_webpack_module, exports) {
16909
16910"use strict";
16911
16912
16913Object.defineProperty(exports, "__esModule", ({
16914 value: true
16915}));
16916exports.LinkError = exports.CompileError = exports.RuntimeError = void 0;
16917
16918function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
16919
16920function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16921
16922function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
16923
16924function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
16925
16926var RuntimeError =
16927/*#__PURE__*/
16928function (_Error) {
16929 _inherits(RuntimeError, _Error);
16930
16931 function RuntimeError() {
16932 _classCallCheck(this, RuntimeError);
16933
16934 return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
16935 }
16936
16937 return RuntimeError;
16938}(Error);
16939
16940exports.RuntimeError = RuntimeError;
16941
16942var CompileError =
16943/*#__PURE__*/
16944function (_Error2) {
16945 _inherits(CompileError, _Error2);
16946
16947 function CompileError() {
16948 _classCallCheck(this, CompileError);
16949
16950 return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
16951 }
16952
16953 return CompileError;
16954}(Error);
16955
16956exports.CompileError = CompileError;
16957
16958var LinkError =
16959/*#__PURE__*/
16960function (_Error3) {
16961 _inherits(LinkError, _Error3);
16962
16963 function LinkError() {
16964 _classCallCheck(this, LinkError);
16965
16966 return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
16967 }
16968
16969 return LinkError;
16970}(Error);
16971
16972exports.LinkError = LinkError;
16973
16974/***/ }),
16975
16976/***/ 63159:
16977/***/ (function(__unused_webpack_module, exports) {
16978
16979"use strict";
16980
16981
16982Object.defineProperty(exports, "__esModule", ({
16983 value: true
16984}));
16985exports.overrideBytesInBuffer = overrideBytesInBuffer;
16986exports.makeBuffer = makeBuffer;
16987exports.fromHexdump = fromHexdump;
16988
16989function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
16990
16991function concatUint8Arrays() {
16992 for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
16993 arrays[_key] = arguments[_key];
16994 }
16995
16996 var totalLength = arrays.reduce(function (a, b) {
16997 return a + b.length;
16998 }, 0);
16999 var result = new Uint8Array(totalLength);
17000 var offset = 0;
17001
17002 for (var _i = 0; _i < arrays.length; _i++) {
17003 var arr = arrays[_i];
17004
17005 if (arr instanceof Uint8Array === false) {
17006 throw new Error("arr must be of type Uint8Array");
17007 }
17008
17009 result.set(arr, offset);
17010 offset += arr.length;
17011 }
17012
17013 return result;
17014}
17015
17016function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) {
17017 var beforeBytes = buffer.slice(0, startLoc);
17018 var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it
17019
17020 if (newBytes.length === 0) {
17021 return concatUint8Arrays(beforeBytes, afterBytes);
17022 }
17023
17024 var replacement = Uint8Array.from(newBytes);
17025 return concatUint8Arrays(beforeBytes, replacement, afterBytes);
17026}
17027
17028function makeBuffer() {
17029 for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
17030 splitedBytes[_key2] = arguments[_key2];
17031 }
17032
17033 var bytes = [].concat.apply([], splitedBytes);
17034 return new Uint8Array(bytes).buffer;
17035}
17036
17037function fromHexdump(str) {
17038 var lines = str.split("\n"); // remove any leading left whitespace
17039
17040 lines = lines.map(function (line) {
17041 return line.trim();
17042 });
17043 var bytes = lines.reduce(function (acc, line) {
17044 var cols = line.split(" "); // remove the offset, left column
17045
17046 cols.shift();
17047 cols = cols.filter(function (x) {
17048 return x !== "";
17049 });
17050 var bytes = cols.map(function (x) {
17051 return parseInt(x, 16);
17052 });
17053 acc.push.apply(acc, _toConsumableArray(bytes));
17054 return acc;
17055 }, []);
17056 return Buffer.from(bytes);
17057}
17058
17059/***/ }),
17060
17061/***/ 90065:
17062/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17063
17064"use strict";
17065
17066
17067Object.defineProperty(exports, "__esModule", ({
17068 value: true
17069}));
17070Object.defineProperty(exports, "getSectionForNode", ({
17071 enumerable: true,
17072 get: function get() {
17073 return _section.getSectionForNode;
17074 }
17075}));
17076exports.default = void 0;
17077
17078var _section = __webpack_require__(55831);
17079
17080var illegalop = "illegal";
17081var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
17082var moduleVersion = [0x01, 0x00, 0x00, 0x00];
17083
17084function invertMap(obj) {
17085 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
17086 return k;
17087 };
17088 var result = {};
17089 var keys = Object.keys(obj);
17090
17091 for (var i = 0, length = keys.length; i < length; i++) {
17092 result[keyModifierFn(obj[keys[i]])] = keys[i];
17093 }
17094
17095 return result;
17096}
17097
17098function createSymbolObject(name
17099/*: string */
17100, object
17101/*: string */
17102)
17103/*: Symbol*/
17104{
17105 var numberOfArgs
17106 /*: number*/
17107 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
17108 return {
17109 name: name,
17110 object: object,
17111 numberOfArgs: numberOfArgs
17112 };
17113}
17114
17115function createSymbol(name
17116/*: string */
17117)
17118/*: Symbol*/
17119{
17120 var numberOfArgs
17121 /*: number*/
17122 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
17123 return {
17124 name: name,
17125 numberOfArgs: numberOfArgs
17126 };
17127}
17128
17129var types = {
17130 func: 0x60,
17131 result: 0x40
17132};
17133var exportTypes = {
17134 0x00: "Func",
17135 0x01: "Table",
17136 0x02: "Mem",
17137 0x03: "Global"
17138};
17139var exportTypesByName = invertMap(exportTypes);
17140var valtypes = {
17141 0x7f: "i32",
17142 0x7e: "i64",
17143 0x7d: "f32",
17144 0x7c: "f64",
17145 0x7b: "v128"
17146};
17147var valtypesByString = invertMap(valtypes);
17148var tableTypes = {
17149 0x70: "anyfunc"
17150};
17151var blockTypes = Object.assign({}, valtypes, {
17152 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
17153 0x40: null,
17154 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
17155 0x7f: "i32",
17156 0x7e: "i64",
17157 0x7d: "f32",
17158 0x7c: "f64"
17159});
17160var globalTypes = {
17161 0x00: "const",
17162 0x01: "var"
17163};
17164var globalTypesByString = invertMap(globalTypes);
17165var importTypes = {
17166 0x00: "func",
17167 0x01: "table",
17168 0x02: "mem",
17169 0x03: "global"
17170};
17171var sections = {
17172 custom: 0,
17173 type: 1,
17174 import: 2,
17175 func: 3,
17176 table: 4,
17177 memory: 5,
17178 global: 6,
17179 export: 7,
17180 start: 8,
17181 element: 9,
17182 code: 10,
17183 data: 11
17184};
17185var symbolsByByte = {
17186 0x00: createSymbol("unreachable"),
17187 0x01: createSymbol("nop"),
17188 0x02: createSymbol("block"),
17189 0x03: createSymbol("loop"),
17190 0x04: createSymbol("if"),
17191 0x05: createSymbol("else"),
17192 0x06: illegalop,
17193 0x07: illegalop,
17194 0x08: illegalop,
17195 0x09: illegalop,
17196 0x0a: illegalop,
17197 0x0b: createSymbol("end"),
17198 0x0c: createSymbol("br", 1),
17199 0x0d: createSymbol("br_if", 1),
17200 0x0e: createSymbol("br_table"),
17201 0x0f: createSymbol("return"),
17202 0x10: createSymbol("call", 1),
17203 0x11: createSymbol("call_indirect", 2),
17204 0x12: illegalop,
17205 0x13: illegalop,
17206 0x14: illegalop,
17207 0x15: illegalop,
17208 0x16: illegalop,
17209 0x17: illegalop,
17210 0x18: illegalop,
17211 0x19: illegalop,
17212 0x1a: createSymbol("drop"),
17213 0x1b: createSymbol("select"),
17214 0x1c: illegalop,
17215 0x1d: illegalop,
17216 0x1e: illegalop,
17217 0x1f: illegalop,
17218 0x20: createSymbol("get_local", 1),
17219 0x21: createSymbol("set_local", 1),
17220 0x22: createSymbol("tee_local", 1),
17221 0x23: createSymbol("get_global", 1),
17222 0x24: createSymbol("set_global", 1),
17223 0x25: illegalop,
17224 0x26: illegalop,
17225 0x27: illegalop,
17226 0x28: createSymbolObject("load", "u32", 1),
17227 0x29: createSymbolObject("load", "u64", 1),
17228 0x2a: createSymbolObject("load", "f32", 1),
17229 0x2b: createSymbolObject("load", "f64", 1),
17230 0x2c: createSymbolObject("load8_s", "u32", 1),
17231 0x2d: createSymbolObject("load8_u", "u32", 1),
17232 0x2e: createSymbolObject("load16_s", "u32", 1),
17233 0x2f: createSymbolObject("load16_u", "u32", 1),
17234 0x30: createSymbolObject("load8_s", "u64", 1),
17235 0x31: createSymbolObject("load8_u", "u64", 1),
17236 0x32: createSymbolObject("load16_s", "u64", 1),
17237 0x33: createSymbolObject("load16_u", "u64", 1),
17238 0x34: createSymbolObject("load32_s", "u64", 1),
17239 0x35: createSymbolObject("load32_u", "u64", 1),
17240 0x36: createSymbolObject("store", "u32", 1),
17241 0x37: createSymbolObject("store", "u64", 1),
17242 0x38: createSymbolObject("store", "f32", 1),
17243 0x39: createSymbolObject("store", "f64", 1),
17244 0x3a: createSymbolObject("store8", "u32", 1),
17245 0x3b: createSymbolObject("store16", "u32", 1),
17246 0x3c: createSymbolObject("store8", "u64", 1),
17247 0x3d: createSymbolObject("store16", "u64", 1),
17248 0x3e: createSymbolObject("store32", "u64", 1),
17249 0x3f: createSymbolObject("current_memory"),
17250 0x40: createSymbolObject("grow_memory"),
17251 0x41: createSymbolObject("const", "i32", 1),
17252 0x42: createSymbolObject("const", "i64", 1),
17253 0x43: createSymbolObject("const", "f32", 1),
17254 0x44: createSymbolObject("const", "f64", 1),
17255 0x45: createSymbolObject("eqz", "i32"),
17256 0x46: createSymbolObject("eq", "i32"),
17257 0x47: createSymbolObject("ne", "i32"),
17258 0x48: createSymbolObject("lt_s", "i32"),
17259 0x49: createSymbolObject("lt_u", "i32"),
17260 0x4a: createSymbolObject("gt_s", "i32"),
17261 0x4b: createSymbolObject("gt_u", "i32"),
17262 0x4c: createSymbolObject("le_s", "i32"),
17263 0x4d: createSymbolObject("le_u", "i32"),
17264 0x4e: createSymbolObject("ge_s", "i32"),
17265 0x4f: createSymbolObject("ge_u", "i32"),
17266 0x50: createSymbolObject("eqz", "i64"),
17267 0x51: createSymbolObject("eq", "i64"),
17268 0x52: createSymbolObject("ne", "i64"),
17269 0x53: createSymbolObject("lt_s", "i64"),
17270 0x54: createSymbolObject("lt_u", "i64"),
17271 0x55: createSymbolObject("gt_s", "i64"),
17272 0x56: createSymbolObject("gt_u", "i64"),
17273 0x57: createSymbolObject("le_s", "i64"),
17274 0x58: createSymbolObject("le_u", "i64"),
17275 0x59: createSymbolObject("ge_s", "i64"),
17276 0x5a: createSymbolObject("ge_u", "i64"),
17277 0x5b: createSymbolObject("eq", "f32"),
17278 0x5c: createSymbolObject("ne", "f32"),
17279 0x5d: createSymbolObject("lt", "f32"),
17280 0x5e: createSymbolObject("gt", "f32"),
17281 0x5f: createSymbolObject("le", "f32"),
17282 0x60: createSymbolObject("ge", "f32"),
17283 0x61: createSymbolObject("eq", "f64"),
17284 0x62: createSymbolObject("ne", "f64"),
17285 0x63: createSymbolObject("lt", "f64"),
17286 0x64: createSymbolObject("gt", "f64"),
17287 0x65: createSymbolObject("le", "f64"),
17288 0x66: createSymbolObject("ge", "f64"),
17289 0x67: createSymbolObject("clz", "i32"),
17290 0x68: createSymbolObject("ctz", "i32"),
17291 0x69: createSymbolObject("popcnt", "i32"),
17292 0x6a: createSymbolObject("add", "i32"),
17293 0x6b: createSymbolObject("sub", "i32"),
17294 0x6c: createSymbolObject("mul", "i32"),
17295 0x6d: createSymbolObject("div_s", "i32"),
17296 0x6e: createSymbolObject("div_u", "i32"),
17297 0x6f: createSymbolObject("rem_s", "i32"),
17298 0x70: createSymbolObject("rem_u", "i32"),
17299 0x71: createSymbolObject("and", "i32"),
17300 0x72: createSymbolObject("or", "i32"),
17301 0x73: createSymbolObject("xor", "i32"),
17302 0x74: createSymbolObject("shl", "i32"),
17303 0x75: createSymbolObject("shr_s", "i32"),
17304 0x76: createSymbolObject("shr_u", "i32"),
17305 0x77: createSymbolObject("rotl", "i32"),
17306 0x78: createSymbolObject("rotr", "i32"),
17307 0x79: createSymbolObject("clz", "i64"),
17308 0x7a: createSymbolObject("ctz", "i64"),
17309 0x7b: createSymbolObject("popcnt", "i64"),
17310 0x7c: createSymbolObject("add", "i64"),
17311 0x7d: createSymbolObject("sub", "i64"),
17312 0x7e: createSymbolObject("mul", "i64"),
17313 0x7f: createSymbolObject("div_s", "i64"),
17314 0x80: createSymbolObject("div_u", "i64"),
17315 0x81: createSymbolObject("rem_s", "i64"),
17316 0x82: createSymbolObject("rem_u", "i64"),
17317 0x83: createSymbolObject("and", "i64"),
17318 0x84: createSymbolObject("or", "i64"),
17319 0x85: createSymbolObject("xor", "i64"),
17320 0x86: createSymbolObject("shl", "i64"),
17321 0x87: createSymbolObject("shr_s", "i64"),
17322 0x88: createSymbolObject("shr_u", "i64"),
17323 0x89: createSymbolObject("rotl", "i64"),
17324 0x8a: createSymbolObject("rotr", "i64"),
17325 0x8b: createSymbolObject("abs", "f32"),
17326 0x8c: createSymbolObject("neg", "f32"),
17327 0x8d: createSymbolObject("ceil", "f32"),
17328 0x8e: createSymbolObject("floor", "f32"),
17329 0x8f: createSymbolObject("trunc", "f32"),
17330 0x90: createSymbolObject("nearest", "f32"),
17331 0x91: createSymbolObject("sqrt", "f32"),
17332 0x92: createSymbolObject("add", "f32"),
17333 0x93: createSymbolObject("sub", "f32"),
17334 0x94: createSymbolObject("mul", "f32"),
17335 0x95: createSymbolObject("div", "f32"),
17336 0x96: createSymbolObject("min", "f32"),
17337 0x97: createSymbolObject("max", "f32"),
17338 0x98: createSymbolObject("copysign", "f32"),
17339 0x99: createSymbolObject("abs", "f64"),
17340 0x9a: createSymbolObject("neg", "f64"),
17341 0x9b: createSymbolObject("ceil", "f64"),
17342 0x9c: createSymbolObject("floor", "f64"),
17343 0x9d: createSymbolObject("trunc", "f64"),
17344 0x9e: createSymbolObject("nearest", "f64"),
17345 0x9f: createSymbolObject("sqrt", "f64"),
17346 0xa0: createSymbolObject("add", "f64"),
17347 0xa1: createSymbolObject("sub", "f64"),
17348 0xa2: createSymbolObject("mul", "f64"),
17349 0xa3: createSymbolObject("div", "f64"),
17350 0xa4: createSymbolObject("min", "f64"),
17351 0xa5: createSymbolObject("max", "f64"),
17352 0xa6: createSymbolObject("copysign", "f64"),
17353 0xa7: createSymbolObject("wrap/i64", "i32"),
17354 0xa8: createSymbolObject("trunc_s/f32", "i32"),
17355 0xa9: createSymbolObject("trunc_u/f32", "i32"),
17356 0xaa: createSymbolObject("trunc_s/f64", "i32"),
17357 0xab: createSymbolObject("trunc_u/f64", "i32"),
17358 0xac: createSymbolObject("extend_s/i32", "i64"),
17359 0xad: createSymbolObject("extend_u/i32", "i64"),
17360 0xae: createSymbolObject("trunc_s/f32", "i64"),
17361 0xaf: createSymbolObject("trunc_u/f32", "i64"),
17362 0xb0: createSymbolObject("trunc_s/f64", "i64"),
17363 0xb1: createSymbolObject("trunc_u/f64", "i64"),
17364 0xb2: createSymbolObject("convert_s/i32", "f32"),
17365 0xb3: createSymbolObject("convert_u/i32", "f32"),
17366 0xb4: createSymbolObject("convert_s/i64", "f32"),
17367 0xb5: createSymbolObject("convert_u/i64", "f32"),
17368 0xb6: createSymbolObject("demote/f64", "f32"),
17369 0xb7: createSymbolObject("convert_s/i32", "f64"),
17370 0xb8: createSymbolObject("convert_u/i32", "f64"),
17371 0xb9: createSymbolObject("convert_s/i64", "f64"),
17372 0xba: createSymbolObject("convert_u/i64", "f64"),
17373 0xbb: createSymbolObject("promote/f32", "f64"),
17374 0xbc: createSymbolObject("reinterpret/f32", "i32"),
17375 0xbd: createSymbolObject("reinterpret/f64", "i64"),
17376 0xbe: createSymbolObject("reinterpret/i32", "f32"),
17377 0xbf: createSymbolObject("reinterpret/i64", "f64")
17378};
17379var symbolsByName = invertMap(symbolsByByte, function (obj) {
17380 if (typeof obj.object === "string") {
17381 return "".concat(obj.object, ".").concat(obj.name);
17382 }
17383
17384 return obj.name;
17385});
17386var _default = {
17387 symbolsByByte: symbolsByByte,
17388 sections: sections,
17389 magicModuleHeader: magicModuleHeader,
17390 moduleVersion: moduleVersion,
17391 types: types,
17392 valtypes: valtypes,
17393 exportTypes: exportTypes,
17394 blockTypes: blockTypes,
17395 tableTypes: tableTypes,
17396 globalTypes: globalTypes,
17397 importTypes: importTypes,
17398 valtypesByString: valtypesByString,
17399 globalTypesByString: globalTypesByString,
17400 exportTypesByName: exportTypesByName,
17401 symbolsByName: symbolsByName
17402};
17403exports.default = _default;
17404
17405/***/ }),
17406
17407/***/ 55831:
17408/***/ (function(__unused_webpack_module, exports) {
17409
17410"use strict";
17411
17412
17413Object.defineProperty(exports, "__esModule", ({
17414 value: true
17415}));
17416exports.getSectionForNode = getSectionForNode;
17417
17418function getSectionForNode(n) {
17419 switch (n.type) {
17420 case "ModuleImport":
17421 return "import";
17422
17423 case "CallInstruction":
17424 case "CallIndirectInstruction":
17425 case "Func":
17426 case "Instr":
17427 return "code";
17428
17429 case "ModuleExport":
17430 return "export";
17431
17432 case "Start":
17433 return "start";
17434
17435 case "TypeInstruction":
17436 return "type";
17437
17438 case "IndexInFuncSection":
17439 return "func";
17440
17441 case "Global":
17442 return "global";
17443 // No section
17444
17445 default:
17446 return;
17447 }
17448}
17449
17450/***/ }),
17451
17452/***/ 48921:
17453/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17454
17455"use strict";
17456
17457
17458Object.defineProperty(exports, "__esModule", ({
17459 value: true
17460}));
17461exports.encodeF32 = encodeF32;
17462exports.encodeF64 = encodeF64;
17463exports.decodeF32 = decodeF32;
17464exports.decodeF64 = decodeF64;
17465exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0;
17466
17467var _ieee = __webpack_require__(30848);
17468
17469/**
17470 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
17471 * n = 32/8
17472 */
17473var NUMBER_OF_BYTE_F32 = 4;
17474/**
17475 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
17476 * n = 64/8
17477 */
17478
17479exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32;
17480var NUMBER_OF_BYTE_F64 = 8;
17481exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64;
17482var SINGLE_PRECISION_MANTISSA = 23;
17483exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA;
17484var DOUBLE_PRECISION_MANTISSA = 52;
17485exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA;
17486
17487function encodeF32(v) {
17488 var buffer = [];
17489 (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
17490 return buffer;
17491}
17492
17493function encodeF64(v) {
17494 var buffer = [];
17495 (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
17496 return buffer;
17497}
17498
17499function decodeF32(bytes) {
17500 var buffer = Buffer.from(bytes);
17501 return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
17502}
17503
17504function decodeF64(bytes) {
17505 var buffer = Buffer.from(bytes);
17506 return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
17507}
17508
17509/***/ }),
17510
17511/***/ 6894:
17512/***/ (function(__unused_webpack_module, exports) {
17513
17514"use strict";
17515// Copyright 2012 The Obvious Corporation.
17516
17517/*
17518 * bits: Bitwise buffer utilities. The utilities here treat a buffer
17519 * as a little-endian bigint, so the lowest-order bit is bit #0 of
17520 * `buffer[0]`, and the highest-order bit is bit #7 of
17521 * `buffer[buffer.length - 1]`.
17522 */
17523
17524/*
17525 * Modules used
17526 */
17527
17528/*
17529 * Exported bindings
17530 */
17531
17532/**
17533 * Extracts the given number of bits from the buffer at the indicated
17534 * index, returning a simple number as the result. If bits are requested
17535 * that aren't covered by the buffer, the `defaultBit` is used as their
17536 * value.
17537 *
17538 * The `bitLength` must be no more than 32. The `defaultBit` if not
17539 * specified is taken to be `0`.
17540 */
17541
17542Object.defineProperty(exports, "__esModule", ({
17543 value: true
17544}));
17545exports.extract = extract;
17546exports.inject = inject;
17547exports.getSign = getSign;
17548exports.highOrder = highOrder;
17549
17550function extract(buffer, bitIndex, bitLength, defaultBit) {
17551 if (bitLength < 0 || bitLength > 32) {
17552 throw new Error("Bad value for bitLength.");
17553 }
17554
17555 if (defaultBit === undefined) {
17556 defaultBit = 0;
17557 } else if (defaultBit !== 0 && defaultBit !== 1) {
17558 throw new Error("Bad value for defaultBit.");
17559 }
17560
17561 var defaultByte = defaultBit * 0xff;
17562 var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but
17563 // if endBit !== 0, then endByte is inclusive.
17564
17565 var lastBit = bitIndex + bitLength;
17566 var startByte = Math.floor(bitIndex / 8);
17567 var startBit = bitIndex % 8;
17568 var endByte = Math.floor(lastBit / 8);
17569 var endBit = lastBit % 8;
17570
17571 if (endBit !== 0) {
17572 // `(1 << endBit) - 1` is the mask of all bits up to but not including
17573 // the endBit.
17574 result = get(endByte) & (1 << endBit) - 1;
17575 }
17576
17577 while (endByte > startByte) {
17578 endByte--;
17579 result = result << 8 | get(endByte);
17580 }
17581
17582 result >>>= startBit;
17583 return result;
17584
17585 function get(index) {
17586 var result = buffer[index];
17587 return result === undefined ? defaultByte : result;
17588 }
17589}
17590/**
17591 * Injects the given bits into the given buffer at the given index. Any
17592 * bits in the value beyond the length to set are ignored.
17593 */
17594
17595
17596function inject(buffer, bitIndex, bitLength, value) {
17597 if (bitLength < 0 || bitLength > 32) {
17598 throw new Error("Bad value for bitLength.");
17599 }
17600
17601 var lastByte = Math.floor((bitIndex + bitLength - 1) / 8);
17602
17603 if (bitIndex < 0 || lastByte >= buffer.length) {
17604 throw new Error("Index out of range.");
17605 } // Just keeping it simple, until / unless profiling shows that this
17606 // is a problem.
17607
17608
17609 var atByte = Math.floor(bitIndex / 8);
17610 var atBit = bitIndex % 8;
17611
17612 while (bitLength > 0) {
17613 if (value & 1) {
17614 buffer[atByte] |= 1 << atBit;
17615 } else {
17616 buffer[atByte] &= ~(1 << atBit);
17617 }
17618
17619 value >>= 1;
17620 bitLength--;
17621 atBit = (atBit + 1) % 8;
17622
17623 if (atBit === 0) {
17624 atByte++;
17625 }
17626 }
17627}
17628/**
17629 * Gets the sign bit of the given buffer.
17630 */
17631
17632
17633function getSign(buffer) {
17634 return buffer[buffer.length - 1] >>> 7;
17635}
17636/**
17637 * Gets the zero-based bit number of the highest-order bit with the
17638 * given value in the given buffer.
17639 *
17640 * If the buffer consists entirely of the other bit value, then this returns
17641 * `-1`.
17642 */
17643
17644
17645function highOrder(bit, buffer) {
17646 var length = buffer.length;
17647 var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte
17648
17649 while (length > 0 && buffer[length - 1] === fullyWrongByte) {
17650 length--;
17651 }
17652
17653 if (length === 0) {
17654 // Degenerate case. The buffer consists entirely of ~bit.
17655 return -1;
17656 }
17657
17658 var byteToCheck = buffer[length - 1];
17659 var result = length * 8 - 1;
17660
17661 for (var i = 7; i > 0; i--) {
17662 if ((byteToCheck >> i & 1) === bit) {
17663 break;
17664 }
17665
17666 result--;
17667 }
17668
17669 return result;
17670}
17671
17672/***/ }),
17673
17674/***/ 3198:
17675/***/ (function(__unused_webpack_module, exports) {
17676
17677"use strict";
17678
17679
17680Object.defineProperty(exports, "__esModule", ({
17681 value: true
17682}));
17683exports.alloc = alloc;
17684exports.free = free;
17685exports.resize = resize;
17686exports.readInt = readInt;
17687exports.readUInt = readUInt;
17688exports.writeInt64 = writeInt64;
17689exports.writeUInt64 = writeUInt64;
17690// Copyright 2012 The Obvious Corporation.
17691
17692/*
17693 * bufs: Buffer utilities.
17694 */
17695
17696/*
17697 * Module variables
17698 */
17699
17700/** Pool of buffers, where `bufPool[x].length === x`. */
17701var bufPool = [];
17702/** Maximum length of kept temporary buffers. */
17703
17704var TEMP_BUF_MAXIMUM_LENGTH = 20;
17705/** Minimum exactly-representable 64-bit int. */
17706
17707var MIN_EXACT_INT64 = -0x8000000000000000;
17708/** Maximum exactly-representable 64-bit int. */
17709
17710var MAX_EXACT_INT64 = 0x7ffffffffffffc00;
17711/** Maximum exactly-representable 64-bit uint. */
17712
17713var MAX_EXACT_UINT64 = 0xfffffffffffff800;
17714/**
17715 * The int value consisting just of a 1 in bit #32 (that is, one more
17716 * than the maximum 32-bit unsigned value).
17717 */
17718
17719var BIT_32 = 0x100000000;
17720/**
17721 * The int value consisting just of a 1 in bit #64 (that is, one more
17722 * than the maximum 64-bit unsigned value).
17723 */
17724
17725var BIT_64 = 0x10000000000000000;
17726/*
17727 * Helper functions
17728 */
17729
17730/**
17731 * Masks off all but the lowest bit set of the given number.
17732 */
17733
17734function lowestBit(num) {
17735 return num & -num;
17736}
17737/**
17738 * Gets whether trying to add the second number to the first is lossy
17739 * (inexact). The first number is meant to be an accumulated result.
17740 */
17741
17742
17743function isLossyToAdd(accum, num) {
17744 if (num === 0) {
17745 return false;
17746 }
17747
17748 var lowBit = lowestBit(num);
17749 var added = accum + lowBit;
17750
17751 if (added === accum) {
17752 return true;
17753 }
17754
17755 if (added - lowBit !== accum) {
17756 return true;
17757 }
17758
17759 return false;
17760}
17761/*
17762 * Exported functions
17763 */
17764
17765/**
17766 * Allocates a buffer of the given length, which is initialized
17767 * with all zeroes. This returns a buffer from the pool if it is
17768 * available, or a freshly-allocated buffer if not.
17769 */
17770
17771
17772function alloc(length) {
17773 var result = bufPool[length];
17774
17775 if (result) {
17776 bufPool[length] = undefined;
17777 } else {
17778 result = new Buffer(length);
17779 }
17780
17781 result.fill(0);
17782 return result;
17783}
17784/**
17785 * Releases a buffer back to the pool.
17786 */
17787
17788
17789function free(buffer) {
17790 var length = buffer.length;
17791
17792 if (length < TEMP_BUF_MAXIMUM_LENGTH) {
17793 bufPool[length] = buffer;
17794 }
17795}
17796/**
17797 * Resizes a buffer, returning a new buffer. Returns the argument if
17798 * the length wouldn't actually change. This function is only safe to
17799 * use if the given buffer was allocated within this module (since
17800 * otherwise the buffer might possibly be shared externally).
17801 */
17802
17803
17804function resize(buffer, length) {
17805 if (length === buffer.length) {
17806 return buffer;
17807 }
17808
17809 var newBuf = alloc(length);
17810 buffer.copy(newBuf);
17811 free(buffer);
17812 return newBuf;
17813}
17814/**
17815 * Reads an arbitrary signed int from a buffer.
17816 */
17817
17818
17819function readInt(buffer) {
17820 var length = buffer.length;
17821 var positive = buffer[length - 1] < 0x80;
17822 var result = positive ? 0 : -1;
17823 var lossy = false; // Note: We can't use bit manipulation here, since that stops
17824 // working if the result won't fit in a 32-bit int.
17825
17826 if (length < 7) {
17827 // Common case which can't possibly be lossy (because the result has
17828 // no more than 48 bits, and loss only happens with 54 or more).
17829 for (var i = length - 1; i >= 0; i--) {
17830 result = result * 0x100 + buffer[i];
17831 }
17832 } else {
17833 for (var _i = length - 1; _i >= 0; _i--) {
17834 var one = buffer[_i];
17835 result *= 0x100;
17836
17837 if (isLossyToAdd(result, one)) {
17838 lossy = true;
17839 }
17840
17841 result += one;
17842 }
17843 }
17844
17845 return {
17846 value: result,
17847 lossy: lossy
17848 };
17849}
17850/**
17851 * Reads an arbitrary unsigned int from a buffer.
17852 */
17853
17854
17855function readUInt(buffer) {
17856 var length = buffer.length;
17857 var result = 0;
17858 var lossy = false; // Note: See above in re bit manipulation.
17859
17860 if (length < 7) {
17861 // Common case which can't possibly be lossy (see above).
17862 for (var i = length - 1; i >= 0; i--) {
17863 result = result * 0x100 + buffer[i];
17864 }
17865 } else {
17866 for (var _i2 = length - 1; _i2 >= 0; _i2--) {
17867 var one = buffer[_i2];
17868 result *= 0x100;
17869
17870 if (isLossyToAdd(result, one)) {
17871 lossy = true;
17872 }
17873
17874 result += one;
17875 }
17876 }
17877
17878 return {
17879 value: result,
17880 lossy: lossy
17881 };
17882}
17883/**
17884 * Writes a little-endian 64-bit signed int into a buffer.
17885 */
17886
17887
17888function writeInt64(value, buffer) {
17889 if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) {
17890 throw new Error("Value out of range.");
17891 }
17892
17893 if (value < 0) {
17894 value += BIT_64;
17895 }
17896
17897 writeUInt64(value, buffer);
17898}
17899/**
17900 * Writes a little-endian 64-bit unsigned int into a buffer.
17901 */
17902
17903
17904function writeUInt64(value, buffer) {
17905 if (value < 0 || value > MAX_EXACT_UINT64) {
17906 throw new Error("Value out of range.");
17907 }
17908
17909 var lowWord = value % BIT_32;
17910 var highWord = Math.floor(value / BIT_32);
17911 buffer.writeUInt32LE(lowWord, 0);
17912 buffer.writeUInt32LE(highWord, 4);
17913}
17914
17915/***/ }),
17916
17917/***/ 76082:
17918/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17919
17920"use strict";
17921
17922
17923Object.defineProperty(exports, "__esModule", ({
17924 value: true
17925}));
17926exports.decodeInt64 = decodeInt64;
17927exports.decodeUInt64 = decodeUInt64;
17928exports.decodeInt32 = decodeInt32;
17929exports.decodeUInt32 = decodeUInt32;
17930exports.encodeU32 = encodeU32;
17931exports.encodeI32 = encodeI32;
17932exports.encodeI64 = encodeI64;
17933exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0;
17934
17935var _leb = _interopRequireDefault(__webpack_require__(22021));
17936
17937function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17938
17939/**
17940 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
17941 * max = ceil(32/7)
17942 */
17943var MAX_NUMBER_OF_BYTE_U32 = 5;
17944/**
17945 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
17946 * max = ceil(64/7)
17947 */
17948
17949exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32;
17950var MAX_NUMBER_OF_BYTE_U64 = 10;
17951exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64;
17952
17953function decodeInt64(encodedBuffer, index) {
17954 return _leb.default.decodeInt64(encodedBuffer, index);
17955}
17956
17957function decodeUInt64(encodedBuffer, index) {
17958 return _leb.default.decodeUInt64(encodedBuffer, index);
17959}
17960
17961function decodeInt32(encodedBuffer, index) {
17962 return _leb.default.decodeInt32(encodedBuffer, index);
17963}
17964
17965function decodeUInt32(encodedBuffer, index) {
17966 return _leb.default.decodeUInt32(encodedBuffer, index);
17967}
17968
17969function encodeU32(v) {
17970 return _leb.default.encodeUInt32(v);
17971}
17972
17973function encodeI32(v) {
17974 return _leb.default.encodeInt32(v);
17975}
17976
17977function encodeI64(v) {
17978 return _leb.default.encodeInt64(v);
17979}
17980
17981/***/ }),
17982
17983/***/ 22021:
17984/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
17985
17986"use strict";
17987// Copyright 2012 The Obvious Corporation.
17988
17989/*
17990 * leb: LEB128 utilities.
17991 */
17992
17993/*
17994 * Modules used
17995 */
17996
17997
17998Object.defineProperty(exports, "__esModule", ({
17999 value: true
18000}));
18001exports.default = void 0;
18002
18003var _long = _interopRequireDefault(__webpack_require__(77960));
18004
18005var bits = _interopRequireWildcard(__webpack_require__(6894));
18006
18007var bufs = _interopRequireWildcard(__webpack_require__(3198));
18008
18009function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18010
18011function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18012
18013/*
18014 * Module variables
18015 */
18016
18017/** The minimum possible 32-bit signed int. */
18018var MIN_INT32 = -0x80000000;
18019/** The maximum possible 32-bit signed int. */
18020
18021var MAX_INT32 = 0x7fffffff;
18022/** The maximum possible 32-bit unsigned int. */
18023
18024var MAX_UINT32 = 0xffffffff;
18025/** The minimum possible 64-bit signed int. */
18026// const MIN_INT64 = -0x8000000000000000;
18027
18028/**
18029 * The maximum possible 64-bit signed int that is representable as a
18030 * JavaScript number.
18031 */
18032// const MAX_INT64 = 0x7ffffffffffffc00;
18033
18034/**
18035 * The maximum possible 64-bit unsigned int that is representable as a
18036 * JavaScript number.
18037 */
18038// const MAX_UINT64 = 0xfffffffffffff800;
18039
18040/*
18041 * Helper functions
18042 */
18043
18044/**
18045 * Determines the number of bits required to encode the number
18046 * represented in the given buffer as a signed value. The buffer is
18047 * taken to represent a signed number in little-endian form.
18048 *
18049 * The number of bits to encode is the (zero-based) bit number of the
18050 * highest-order non-sign-matching bit, plus two. For example:
18051 *
18052 * 11111011 01110101
18053 * high low
18054 *
18055 * The sign bit here is 1 (that is, it's a negative number). The highest
18056 * bit number that doesn't match the sign is bit #10 (where the lowest-order
18057 * bit is bit #0). So, we have to encode at least 12 bits total.
18058 *
18059 * As a special degenerate case, the numbers 0 and -1 each require just one bit.
18060 */
18061
18062function signedBitCount(buffer) {
18063 return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2;
18064}
18065/**
18066 * Determines the number of bits required to encode the number
18067 * represented in the given buffer as an unsigned value. The buffer is
18068 * taken to represent an unsigned number in little-endian form.
18069 *
18070 * The number of bits to encode is the (zero-based) bit number of the
18071 * highest-order 1 bit, plus one. For example:
18072 *
18073 * 00011000 01010011
18074 * high low
18075 *
18076 * The highest-order 1 bit here is bit #12 (where the lowest-order bit
18077 * is bit #0). So, we have to encode at least 13 bits total.
18078 *
18079 * As a special degenerate case, the number 0 requires 1 bit.
18080 */
18081
18082
18083function unsignedBitCount(buffer) {
18084 var result = bits.highOrder(1, buffer) + 1;
18085 return result ? result : 1;
18086}
18087/**
18088 * Common encoder for both signed and unsigned ints. This takes a
18089 * bigint-ish buffer, returning an LEB128-encoded buffer.
18090 */
18091
18092
18093function encodeBufferCommon(buffer, signed) {
18094 var signBit;
18095 var bitCount;
18096
18097 if (signed) {
18098 signBit = bits.getSign(buffer);
18099 bitCount = signedBitCount(buffer);
18100 } else {
18101 signBit = 0;
18102 bitCount = unsignedBitCount(buffer);
18103 }
18104
18105 var byteCount = Math.ceil(bitCount / 7);
18106 var result = bufs.alloc(byteCount);
18107
18108 for (var i = 0; i < byteCount; i++) {
18109 var payload = bits.extract(buffer, i * 7, 7, signBit);
18110 result[i] = payload | 0x80;
18111 } // Mask off the top bit of the last byte, to indicate the end of the
18112 // encoding.
18113
18114
18115 result[byteCount - 1] &= 0x7f;
18116 return result;
18117}
18118/**
18119 * Gets the byte-length of the value encoded in the given buffer at
18120 * the given index.
18121 */
18122
18123
18124function encodedLength(encodedBuffer, index) {
18125 var result = 0;
18126
18127 while (encodedBuffer[index + result] >= 0x80) {
18128 result++;
18129 }
18130
18131 result++; // to account for the last byte
18132
18133 if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives
18134 // throw new Error("integer representation too long");
18135 }
18136
18137 return result;
18138}
18139/**
18140 * Common decoder for both signed and unsigned ints. This takes an
18141 * LEB128-encoded buffer, returning a bigint-ish buffer.
18142 */
18143
18144
18145function decodeBufferCommon(encodedBuffer, index, signed) {
18146 index = index === undefined ? 0 : index;
18147 var length = encodedLength(encodedBuffer, index);
18148 var bitLength = length * 7;
18149 var byteLength = Math.ceil(bitLength / 8);
18150 var result = bufs.alloc(byteLength);
18151 var outIndex = 0;
18152
18153 while (length > 0) {
18154 bits.inject(result, outIndex, 7, encodedBuffer[index]);
18155 outIndex += 7;
18156 index++;
18157 length--;
18158 }
18159
18160 var signBit;
18161 var signByte;
18162
18163 if (signed) {
18164 // Sign-extend the last byte.
18165 var lastByte = result[byteLength - 1];
18166 var endBit = outIndex % 8;
18167
18168 if (endBit !== 0) {
18169 var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
18170
18171 lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff;
18172 }
18173
18174 signBit = lastByte >> 7;
18175 signByte = signBit * 0xff;
18176 } else {
18177 signBit = 0;
18178 signByte = 0;
18179 } // Slice off any superfluous bytes, that is, ones that add no meaningful
18180 // bits (because the value would be the same if they were removed).
18181
18182
18183 while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) {
18184 byteLength--;
18185 }
18186
18187 result = bufs.resize(result, byteLength);
18188 return {
18189 value: result,
18190 nextIndex: index
18191 };
18192}
18193/*
18194 * Exported bindings
18195 */
18196
18197
18198function encodeIntBuffer(buffer) {
18199 return encodeBufferCommon(buffer, true);
18200}
18201
18202function decodeIntBuffer(encodedBuffer, index) {
18203 return decodeBufferCommon(encodedBuffer, index, true);
18204}
18205
18206function encodeInt32(num) {
18207 var buf = bufs.alloc(4);
18208 buf.writeInt32LE(num, 0);
18209 var result = encodeIntBuffer(buf);
18210 bufs.free(buf);
18211 return result;
18212}
18213
18214function decodeInt32(encodedBuffer, index) {
18215 var result = decodeIntBuffer(encodedBuffer, index);
18216 var parsed = bufs.readInt(result.value);
18217 var value = parsed.value;
18218 bufs.free(result.value);
18219
18220 if (value < MIN_INT32 || value > MAX_INT32) {
18221 throw new Error("integer too large");
18222 }
18223
18224 return {
18225 value: value,
18226 nextIndex: result.nextIndex
18227 };
18228}
18229
18230function encodeInt64(num) {
18231 var buf = bufs.alloc(8);
18232 bufs.writeInt64(num, buf);
18233 var result = encodeIntBuffer(buf);
18234 bufs.free(buf);
18235 return result;
18236}
18237
18238function decodeInt64(encodedBuffer, index) {
18239 var result = decodeIntBuffer(encodedBuffer, index);
18240
18241 var value = _long.default.fromBytesLE(result.value, false);
18242
18243 bufs.free(result.value);
18244 return {
18245 value: value,
18246 nextIndex: result.nextIndex,
18247 lossy: false
18248 };
18249}
18250
18251function encodeUIntBuffer(buffer) {
18252 return encodeBufferCommon(buffer, false);
18253}
18254
18255function decodeUIntBuffer(encodedBuffer, index) {
18256 return decodeBufferCommon(encodedBuffer, index, false);
18257}
18258
18259function encodeUInt32(num) {
18260 var buf = bufs.alloc(4);
18261 buf.writeUInt32LE(num, 0);
18262 var result = encodeUIntBuffer(buf);
18263 bufs.free(buf);
18264 return result;
18265}
18266
18267function decodeUInt32(encodedBuffer, index) {
18268 var result = decodeUIntBuffer(encodedBuffer, index);
18269 var parsed = bufs.readUInt(result.value);
18270 var value = parsed.value;
18271 bufs.free(result.value);
18272
18273 if (value > MAX_UINT32) {
18274 throw new Error("integer too large");
18275 }
18276
18277 return {
18278 value: value,
18279 nextIndex: result.nextIndex
18280 };
18281}
18282
18283function encodeUInt64(num) {
18284 var buf = bufs.alloc(8);
18285 bufs.writeUInt64(num, buf);
18286 var result = encodeUIntBuffer(buf);
18287 bufs.free(buf);
18288 return result;
18289}
18290
18291function decodeUInt64(encodedBuffer, index) {
18292 var result = decodeUIntBuffer(encodedBuffer, index);
18293
18294 var value = _long.default.fromBytesLE(result.value, true);
18295
18296 bufs.free(result.value);
18297 return {
18298 value: value,
18299 nextIndex: result.nextIndex,
18300 lossy: false
18301 };
18302}
18303
18304var _default = {
18305 decodeInt32: decodeInt32,
18306 decodeInt64: decodeInt64,
18307 decodeIntBuffer: decodeIntBuffer,
18308 decodeUInt32: decodeUInt32,
18309 decodeUInt64: decodeUInt64,
18310 decodeUIntBuffer: decodeUIntBuffer,
18311 encodeInt32: encodeInt32,
18312 encodeInt64: encodeInt64,
18313 encodeIntBuffer: encodeIntBuffer,
18314 encodeUInt32: encodeUInt32,
18315 encodeUInt64: encodeUInt64,
18316 encodeUIntBuffer: encodeUIntBuffer
18317};
18318exports.default = _default;
18319
18320/***/ }),
18321
18322/***/ 29217:
18323/***/ (function(__unused_webpack_module, exports) {
18324
18325"use strict";
18326
18327
18328Object.defineProperty(exports, "__esModule", ({
18329 value: true
18330}));
18331exports.decode = decode;
18332
18333function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
18334
18335function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
18336
18337function con(b) {
18338 if ((b & 0xc0) === 0x80) {
18339 return b & 0x3f;
18340 } else {
18341 throw new Error("invalid UTF-8 encoding");
18342 }
18343}
18344
18345function code(min, n) {
18346 if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
18347 throw new Error("invalid UTF-8 encoding");
18348 } else {
18349 return n;
18350 }
18351}
18352
18353function decode(bytes) {
18354 return _decode(bytes).map(function (x) {
18355 return String.fromCharCode(x);
18356 }).join("");
18357}
18358
18359function _decode(bytes) {
18360 if (bytes.length === 0) {
18361 return [];
18362 }
18363 /**
18364 * 1 byte
18365 */
18366
18367
18368 {
18369 var _bytes = _toArray(bytes),
18370 b1 = _bytes[0],
18371 bs = _bytes.slice(1);
18372
18373 if (b1 < 0x80) {
18374 return [code(0x0, b1)].concat(_toConsumableArray(_decode(bs)));
18375 }
18376
18377 if (b1 < 0xc0) {
18378 throw new Error("invalid UTF-8 encoding");
18379 }
18380 }
18381 /**
18382 * 2 bytes
18383 */
18384
18385 {
18386 var _bytes2 = _toArray(bytes),
18387 _b = _bytes2[0],
18388 b2 = _bytes2[1],
18389 _bs = _bytes2.slice(2);
18390
18391 if (_b < 0xe0) {
18392 return [code(0x80, ((_b & 0x1f) << 6) + con(b2))].concat(_toConsumableArray(_decode(_bs)));
18393 }
18394 }
18395 /**
18396 * 3 bytes
18397 */
18398
18399 {
18400 var _bytes3 = _toArray(bytes),
18401 _b2 = _bytes3[0],
18402 _b3 = _bytes3[1],
18403 b3 = _bytes3[2],
18404 _bs2 = _bytes3.slice(3);
18405
18406 if (_b2 < 0xf0) {
18407 return [code(0x800, ((_b2 & 0x0f) << 12) + (con(_b3) << 6) + con(b3))].concat(_toConsumableArray(_decode(_bs2)));
18408 }
18409 }
18410 /**
18411 * 4 bytes
18412 */
18413
18414 {
18415 var _bytes4 = _toArray(bytes),
18416 _b4 = _bytes4[0],
18417 _b5 = _bytes4[1],
18418 _b6 = _bytes4[2],
18419 b4 = _bytes4[3],
18420 _bs3 = _bytes4.slice(4);
18421
18422 if (_b4 < 0xf8) {
18423 return [code(0x10000, (((_b4 & 0x07) << 18) + con(_b5) << 12) + (con(_b6) << 6) + con(b4))].concat(_toConsumableArray(_decode(_bs3)));
18424 }
18425 }
18426 throw new Error("invalid UTF-8 encoding");
18427}
18428
18429/***/ }),
18430
18431/***/ 40116:
18432/***/ (function(__unused_webpack_module, exports) {
18433
18434"use strict";
18435
18436
18437Object.defineProperty(exports, "__esModule", ({
18438 value: true
18439}));
18440exports.encode = encode;
18441
18442function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
18443
18444function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
18445
18446function con(n) {
18447 return 0x80 | n & 0x3f;
18448}
18449
18450function encode(str) {
18451 var arr = str.split("").map(function (x) {
18452 return x.charCodeAt(0);
18453 });
18454 return _encode(arr);
18455}
18456
18457function _encode(arr) {
18458 if (arr.length === 0) {
18459 return [];
18460 }
18461
18462 var _arr = _toArray(arr),
18463 n = _arr[0],
18464 ns = _arr.slice(1);
18465
18466 if (n < 0) {
18467 throw new Error("utf8");
18468 }
18469
18470 if (n < 0x80) {
18471 return [n].concat(_toConsumableArray(_encode(ns)));
18472 }
18473
18474 if (n < 0x800) {
18475 return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
18476 }
18477
18478 if (n < 0x10000) {
18479 return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
18480 }
18481
18482 if (n < 0x110000) {
18483 return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
18484 }
18485
18486 throw new Error("utf8");
18487}
18488
18489/***/ }),
18490
18491/***/ 37459:
18492/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18493
18494"use strict";
18495
18496
18497Object.defineProperty(exports, "__esModule", ({
18498 value: true
18499}));
18500Object.defineProperty(exports, "decode", ({
18501 enumerable: true,
18502 get: function get() {
18503 return _decoder.decode;
18504 }
18505}));
18506Object.defineProperty(exports, "encode", ({
18507 enumerable: true,
18508 get: function get() {
18509 return _encoder.encode;
18510 }
18511}));
18512
18513var _decoder = __webpack_require__(29217);
18514
18515var _encoder = __webpack_require__(40116);
18516
18517/***/ }),
18518
18519/***/ 3516:
18520/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18521
18522"use strict";
18523
18524
18525Object.defineProperty(exports, "__esModule", ({
18526 value: true
18527}));
18528exports.encodeVersion = encodeVersion;
18529exports.encodeHeader = encodeHeader;
18530exports.encodeU32 = encodeU32;
18531exports.encodeI32 = encodeI32;
18532exports.encodeI64 = encodeI64;
18533exports.encodeVec = encodeVec;
18534exports.encodeValtype = encodeValtype;
18535exports.encodeMutability = encodeMutability;
18536exports.encodeUTF8Vec = encodeUTF8Vec;
18537exports.encodeLimits = encodeLimits;
18538exports.encodeModuleImport = encodeModuleImport;
18539exports.encodeSectionMetadata = encodeSectionMetadata;
18540exports.encodeCallInstruction = encodeCallInstruction;
18541exports.encodeCallIndirectInstruction = encodeCallIndirectInstruction;
18542exports.encodeModuleExport = encodeModuleExport;
18543exports.encodeTypeInstruction = encodeTypeInstruction;
18544exports.encodeInstr = encodeInstr;
18545exports.encodeStringLiteral = encodeStringLiteral;
18546exports.encodeGlobal = encodeGlobal;
18547exports.encodeFuncBody = encodeFuncBody;
18548exports.encodeIndexInFuncSection = encodeIndexInFuncSection;
18549exports.encodeElem = encodeElem;
18550
18551var leb = _interopRequireWildcard(__webpack_require__(76082));
18552
18553var ieee754 = _interopRequireWildcard(__webpack_require__(48921));
18554
18555var utf8 = _interopRequireWildcard(__webpack_require__(37459));
18556
18557var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(90065));
18558
18559var _index = __webpack_require__(21116);
18560
18561function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18562
18563function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18564
18565function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
18566
18567function assertNotIdentifierNode(n) {
18568 if (n.type === "Identifier") {
18569 throw new Error("Unsupported node Identifier");
18570 }
18571}
18572
18573function encodeVersion(v) {
18574 var bytes = _helperWasmBytecode.default.moduleVersion;
18575 bytes[0] = v;
18576 return bytes;
18577}
18578
18579function encodeHeader() {
18580 return _helperWasmBytecode.default.magicModuleHeader;
18581}
18582
18583function encodeU32(v) {
18584 var uint8view = new Uint8Array(leb.encodeU32(v));
18585
18586 var array = _toConsumableArray(uint8view);
18587
18588 return array;
18589}
18590
18591function encodeI32(v) {
18592 var uint8view = new Uint8Array(leb.encodeI32(v));
18593
18594 var array = _toConsumableArray(uint8view);
18595
18596 return array;
18597}
18598
18599function encodeI64(v) {
18600 var uint8view = new Uint8Array(leb.encodeI64(v));
18601
18602 var array = _toConsumableArray(uint8view);
18603
18604 return array;
18605}
18606
18607function encodeVec(elements) {
18608 var size = encodeU32(elements.length);
18609 return _toConsumableArray(size).concat(_toConsumableArray(elements));
18610}
18611
18612function encodeValtype(v) {
18613 var byte = _helperWasmBytecode.default.valtypesByString[v];
18614
18615 if (typeof byte === "undefined") {
18616 throw new Error("Unknown valtype: " + v);
18617 }
18618
18619 return parseInt(byte, 10);
18620}
18621
18622function encodeMutability(v) {
18623 var byte = _helperWasmBytecode.default.globalTypesByString[v];
18624
18625 if (typeof byte === "undefined") {
18626 throw new Error("Unknown mutability: " + v);
18627 }
18628
18629 return parseInt(byte, 10);
18630}
18631
18632function encodeUTF8Vec(str) {
18633 return encodeVec(utf8.encode(str));
18634}
18635
18636function encodeLimits(n) {
18637 var out = [];
18638
18639 if (typeof n.max === "number") {
18640 out.push(0x01);
18641 out.push.apply(out, _toConsumableArray(encodeU32(n.min))); // $FlowIgnore: ensured by the typeof
18642
18643 out.push.apply(out, _toConsumableArray(encodeU32(n.max)));
18644 } else {
18645 out.push(0x00);
18646 out.push.apply(out, _toConsumableArray(encodeU32(n.min)));
18647 }
18648
18649 return out;
18650}
18651
18652function encodeModuleImport(n) {
18653 var out = [];
18654 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.module)));
18655 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
18656
18657 switch (n.descr.type) {
18658 case "GlobalType":
18659 {
18660 out.push(0x03); // $FlowIgnore: GlobalType ensure that these props exists
18661
18662 out.push(encodeValtype(n.descr.valtype)); // $FlowIgnore: GlobalType ensure that these props exists
18663
18664 out.push(encodeMutability(n.descr.mutability));
18665 break;
18666 }
18667
18668 case "Memory":
18669 {
18670 out.push(0x02); // $FlowIgnore
18671
18672 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
18673 break;
18674 }
18675
18676 case "Table":
18677 {
18678 out.push(0x01);
18679 out.push(0x70); // element type
18680 // $FlowIgnore
18681
18682 out.push.apply(out, _toConsumableArray(encodeLimits(n.descr.limits)));
18683 break;
18684 }
18685
18686 case "FuncImportDescr":
18687 {
18688 out.push(0x00); // $FlowIgnore
18689
18690 assertNotIdentifierNode(n.descr.id); // $FlowIgnore
18691
18692 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
18693 break;
18694 }
18695
18696 default:
18697 throw new Error("Unsupport operation: encode module import of type: " + n.descr.type);
18698 }
18699
18700 return out;
18701}
18702
18703function encodeSectionMetadata(n) {
18704 var out = [];
18705 var sectionId = _helperWasmBytecode.default.sections[n.section];
18706
18707 if (typeof sectionId === "undefined") {
18708 throw new Error("Unknown section: " + n.section);
18709 }
18710
18711 if (n.section === "start") {
18712 /**
18713 * This is not implemented yet because it's a special case which
18714 * doesn't have a vector in its section.
18715 */
18716 throw new Error("Unsupported section encoding of type start");
18717 }
18718
18719 out.push(sectionId);
18720 out.push.apply(out, _toConsumableArray(encodeU32(n.size.value)));
18721 out.push.apply(out, _toConsumableArray(encodeU32(n.vectorOfSize.value)));
18722 return out;
18723}
18724
18725function encodeCallInstruction(n) {
18726 var out = [];
18727 assertNotIdentifierNode(n.index);
18728 out.push(0x10); // $FlowIgnore
18729
18730 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value)));
18731 return out;
18732}
18733
18734function encodeCallIndirectInstruction(n) {
18735 var out = []; // $FlowIgnore
18736
18737 assertNotIdentifierNode(n.index);
18738 out.push(0x11); // $FlowIgnore
18739
18740 out.push.apply(out, _toConsumableArray(encodeU32(n.index.value))); // add a reserved byte
18741
18742 out.push(0x00);
18743 return out;
18744}
18745
18746function encodeModuleExport(n) {
18747 var out = [];
18748 assertNotIdentifierNode(n.descr.id);
18749 var exportTypeByteString = _helperWasmBytecode.default.exportTypesByName[n.descr.exportType];
18750
18751 if (typeof exportTypeByteString === "undefined") {
18752 throw new Error("Unknown export of type: " + n.descr.exportType);
18753 }
18754
18755 var exportTypeByte = parseInt(exportTypeByteString, 10);
18756 out.push.apply(out, _toConsumableArray(encodeUTF8Vec(n.name)));
18757 out.push(exportTypeByte); // $FlowIgnore
18758
18759 out.push.apply(out, _toConsumableArray(encodeU32(n.descr.id.value)));
18760 return out;
18761}
18762
18763function encodeTypeInstruction(n) {
18764 var out = [0x60];
18765 var params = n.functype.params.map(function (x) {
18766 return x.valtype;
18767 }).map(encodeValtype);
18768 var results = n.functype.results.map(encodeValtype);
18769 out.push.apply(out, _toConsumableArray(encodeVec(params)));
18770 out.push.apply(out, _toConsumableArray(encodeVec(results)));
18771 return out;
18772}
18773
18774function encodeInstr(n) {
18775 var out = [];
18776 var instructionName = n.id;
18777
18778 if (typeof n.object === "string") {
18779 instructionName = "".concat(n.object, ".").concat(String(n.id));
18780 }
18781
18782 var byteString = _helperWasmBytecode.default.symbolsByName[instructionName];
18783
18784 if (typeof byteString === "undefined") {
18785 throw new Error("encodeInstr: unknown instruction " + JSON.stringify(instructionName));
18786 }
18787
18788 var byte = parseInt(byteString, 10);
18789 out.push(byte);
18790
18791 if (n.args) {
18792 n.args.forEach(function (arg) {
18793 var encoder = encodeU32; // find correct encoder
18794
18795 if (n.object === "i32") {
18796 encoder = encodeI32;
18797 }
18798
18799 if (n.object === "i64") {
18800 encoder = encodeI64;
18801 }
18802
18803 if (n.object === "f32") {
18804 encoder = ieee754.encodeF32;
18805 }
18806
18807 if (n.object === "f64") {
18808 encoder = ieee754.encodeF64;
18809 }
18810
18811 if (arg.type === "NumberLiteral" || arg.type === "FloatLiteral" || arg.type === "LongNumberLiteral") {
18812 // $FlowIgnore
18813 out.push.apply(out, _toConsumableArray(encoder(arg.value)));
18814 } else {
18815 throw new Error("Unsupported instruction argument encoding " + JSON.stringify(arg.type));
18816 }
18817 });
18818 }
18819
18820 return out;
18821}
18822
18823function encodeExpr(instrs) {
18824 var out = [];
18825 instrs.forEach(function (instr) {
18826 // $FlowIgnore
18827 var n = (0, _index.encodeNode)(instr);
18828 out.push.apply(out, _toConsumableArray(n));
18829 });
18830 return out;
18831}
18832
18833function encodeStringLiteral(n) {
18834 return encodeUTF8Vec(n.value);
18835}
18836
18837function encodeGlobal(n) {
18838 var out = [];
18839 var _n$globalType = n.globalType,
18840 valtype = _n$globalType.valtype,
18841 mutability = _n$globalType.mutability;
18842 out.push(encodeValtype(valtype));
18843 out.push(encodeMutability(mutability));
18844 out.push.apply(out, _toConsumableArray(encodeExpr(n.init)));
18845 return out;
18846}
18847
18848function encodeFuncBody(n) {
18849 var out = [];
18850 out.push(-1); // temporary function body size
18851 // FIXME(sven): get the func locals?
18852
18853 var localBytes = encodeVec([]);
18854 out.push.apply(out, _toConsumableArray(localBytes));
18855 var funcBodyBytes = encodeExpr(n.body);
18856 out[0] = funcBodyBytes.length + localBytes.length;
18857 out.push.apply(out, _toConsumableArray(funcBodyBytes));
18858 return out;
18859}
18860
18861function encodeIndexInFuncSection(n) {
18862 assertNotIdentifierNode(n.index); // $FlowIgnore
18863
18864 return encodeU32(n.index.value);
18865}
18866
18867function encodeElem(n) {
18868 var out = [];
18869 assertNotIdentifierNode(n.table); // $FlowIgnore
18870
18871 out.push.apply(out, _toConsumableArray(encodeU32(n.table.value)));
18872 out.push.apply(out, _toConsumableArray(encodeExpr(n.offset))); // $FlowIgnore
18873
18874 var funcs = n.funcs.reduce(function (acc, x) {
18875 return _toConsumableArray(acc).concat(_toConsumableArray(encodeU32(x.value)));
18876 }, []);
18877 out.push.apply(out, _toConsumableArray(encodeVec(funcs)));
18878 return out;
18879}
18880
18881/***/ }),
18882
18883/***/ 21116:
18884/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18885
18886"use strict";
18887
18888
18889Object.defineProperty(exports, "__esModule", ({
18890 value: true
18891}));
18892exports.encodeNode = encodeNode;
18893exports.encodeU32 = void 0;
18894
18895var encoder = _interopRequireWildcard(__webpack_require__(3516));
18896
18897function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18898
18899function encodeNode(n) {
18900 switch (n.type) {
18901 case "ModuleImport":
18902 // $FlowIgnore: ModuleImport ensure that the node is well formated
18903 return encoder.encodeModuleImport(n);
18904
18905 case "SectionMetadata":
18906 // $FlowIgnore: SectionMetadata ensure that the node is well formated
18907 return encoder.encodeSectionMetadata(n);
18908
18909 case "CallInstruction":
18910 // $FlowIgnore: SectionMetadata ensure that the node is well formated
18911 return encoder.encodeCallInstruction(n);
18912
18913 case "CallIndirectInstruction":
18914 // $FlowIgnore: SectionMetadata ensure that the node is well formated
18915 return encoder.encodeCallIndirectInstruction(n);
18916
18917 case "TypeInstruction":
18918 return encoder.encodeTypeInstruction(n);
18919
18920 case "Instr":
18921 // $FlowIgnore
18922 return encoder.encodeInstr(n);
18923
18924 case "ModuleExport":
18925 // $FlowIgnore: SectionMetadata ensure that the node is well formated
18926 return encoder.encodeModuleExport(n);
18927
18928 case "Global":
18929 // $FlowIgnore
18930 return encoder.encodeGlobal(n);
18931
18932 case "Func":
18933 return encoder.encodeFuncBody(n);
18934
18935 case "IndexInFuncSection":
18936 return encoder.encodeIndexInFuncSection(n);
18937
18938 case "StringLiteral":
18939 return encoder.encodeStringLiteral(n);
18940
18941 case "Elem":
18942 return encoder.encodeElem(n);
18943
18944 default:
18945 throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type));
18946 }
18947}
18948
18949var encodeU32 = encoder.encodeU32;
18950exports.encodeU32 = encodeU32;
18951
18952/***/ }),
18953
18954/***/ 10514:
18955/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18956
18957"use strict";
18958
18959
18960Object.defineProperty(exports, "__esModule", ({
18961 value: true
18962}));
18963exports.decode = decode;
18964
18965var _helperApiError = __webpack_require__(1806);
18966
18967var ieee754 = _interopRequireWildcard(__webpack_require__(48921));
18968
18969var utf8 = _interopRequireWildcard(__webpack_require__(37459));
18970
18971var t = _interopRequireWildcard(__webpack_require__(25323));
18972
18973var _leb = __webpack_require__(76082);
18974
18975var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(90065));
18976
18977function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18978
18979function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18980
18981function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
18982
18983function toHex(n) {
18984 return "0x" + Number(n).toString(16);
18985}
18986
18987function byteArrayEq(l, r) {
18988 if (l.length !== r.length) {
18989 return false;
18990 }
18991
18992 for (var i = 0; i < l.length; i++) {
18993 if (l[i] !== r[i]) {
18994 return false;
18995 }
18996 }
18997
18998 return true;
18999}
19000
19001function decode(ab, opts) {
19002 var buf = new Uint8Array(ab);
19003 var getUniqueName = t.getUniqueNameGenerator();
19004 var offset = 0;
19005
19006 function getPosition() {
19007 return {
19008 line: -1,
19009 column: offset
19010 };
19011 }
19012
19013 function dump(b, msg) {
19014 if (opts.dump === false) return;
19015 var pad = "\t\t\t\t\t\t\t\t\t\t";
19016 var str = "";
19017
19018 if (b.length < 5) {
19019 str = b.map(toHex).join(" ");
19020 } else {
19021 str = "...";
19022 }
19023
19024 console.log(toHex(offset) + ":\t", str, pad, ";", msg);
19025 }
19026
19027 function dumpSep(msg) {
19028 if (opts.dump === false) return;
19029 console.log(";", msg);
19030 }
19031 /**
19032 * TODO(sven): we can atually use a same structure
19033 * we are adding incrementally new features
19034 */
19035
19036
19037 var state = {
19038 elementsInFuncSection: [],
19039 elementsInExportSection: [],
19040 elementsInCodeSection: [],
19041
19042 /**
19043 * Decode memory from:
19044 * - Memory section
19045 */
19046 memoriesInModule: [],
19047
19048 /**
19049 * Decoded types from:
19050 * - Type section
19051 */
19052 typesInModule: [],
19053
19054 /**
19055 * Decoded functions from:
19056 * - Function section
19057 * - Import section
19058 */
19059 functionsInModule: [],
19060
19061 /**
19062 * Decoded tables from:
19063 * - Table section
19064 */
19065 tablesInModule: [],
19066
19067 /**
19068 * Decoded globals from:
19069 * - Global section
19070 */
19071 globalsInModule: []
19072 };
19073
19074 function isEOF() {
19075 return offset >= buf.length;
19076 }
19077
19078 function eatBytes(n) {
19079 offset = offset + n;
19080 }
19081
19082 function readBytesAtOffset(_offset, numberOfBytes) {
19083 var arr = [];
19084
19085 for (var i = 0; i < numberOfBytes; i++) {
19086 arr.push(buf[_offset + i]);
19087 }
19088
19089 return arr;
19090 }
19091
19092 function readBytes(numberOfBytes) {
19093 return readBytesAtOffset(offset, numberOfBytes);
19094 }
19095
19096 function readF64() {
19097 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F64);
19098 var value = ieee754.decodeF64(bytes);
19099
19100 if (Math.sign(value) * value === Infinity) {
19101 return {
19102 value: Math.sign(value),
19103 inf: true,
19104 nextIndex: ieee754.NUMBER_OF_BYTE_F64
19105 };
19106 }
19107
19108 if (isNaN(value)) {
19109 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
19110 var mantissa = 0;
19111
19112 for (var i = 0; i < bytes.length - 2; ++i) {
19113 mantissa += bytes[i] * Math.pow(256, i);
19114 }
19115
19116 mantissa += bytes[bytes.length - 2] % 16 * Math.pow(256, bytes.length - 2);
19117 return {
19118 value: sign * mantissa,
19119 nan: true,
19120 nextIndex: ieee754.NUMBER_OF_BYTE_F64
19121 };
19122 }
19123
19124 return {
19125 value: value,
19126 nextIndex: ieee754.NUMBER_OF_BYTE_F64
19127 };
19128 }
19129
19130 function readF32() {
19131 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F32);
19132 var value = ieee754.decodeF32(bytes);
19133
19134 if (Math.sign(value) * value === Infinity) {
19135 return {
19136 value: Math.sign(value),
19137 inf: true,
19138 nextIndex: ieee754.NUMBER_OF_BYTE_F32
19139 };
19140 }
19141
19142 if (isNaN(value)) {
19143 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
19144 var mantissa = 0;
19145
19146 for (var i = 0; i < bytes.length - 2; ++i) {
19147 mantissa += bytes[i] * Math.pow(256, i);
19148 }
19149
19150 mantissa += bytes[bytes.length - 2] % 128 * Math.pow(256, bytes.length - 2);
19151 return {
19152 value: sign * mantissa,
19153 nan: true,
19154 nextIndex: ieee754.NUMBER_OF_BYTE_F32
19155 };
19156 }
19157
19158 return {
19159 value: value,
19160 nextIndex: ieee754.NUMBER_OF_BYTE_F32
19161 };
19162 }
19163
19164 function readUTF8String() {
19165 var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
19166 // readBytesAtOffset below. This keeps readUTF8String neutral with respect
19167 // to the current offset, just like the other readX functions.
19168
19169 var strlen = lenu32.value;
19170 dump([strlen], "string length");
19171 var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
19172 var value = utf8.decode(bytes);
19173 return {
19174 value: value,
19175 nextIndex: strlen + lenu32.nextIndex
19176 };
19177 }
19178 /**
19179 * Decode an unsigned 32bits integer
19180 *
19181 * The length will be handled by the leb librairy, we pass the max number of
19182 * byte.
19183 */
19184
19185
19186 function readU32() {
19187 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
19188 var buffer = Buffer.from(bytes);
19189 return (0, _leb.decodeUInt32)(buffer);
19190 }
19191
19192 function readVaruint32() {
19193 // where 32 bits = max 4 bytes
19194 var bytes = readBytes(4);
19195 var buffer = Buffer.from(bytes);
19196 return (0, _leb.decodeUInt32)(buffer);
19197 }
19198
19199 function readVaruint7() {
19200 // where 7 bits = max 1 bytes
19201 var bytes = readBytes(1);
19202 var buffer = Buffer.from(bytes);
19203 return (0, _leb.decodeUInt32)(buffer);
19204 }
19205 /**
19206 * Decode a signed 32bits interger
19207 */
19208
19209
19210 function read32() {
19211 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
19212 var buffer = Buffer.from(bytes);
19213 return (0, _leb.decodeInt32)(buffer);
19214 }
19215 /**
19216 * Decode a signed 64bits integer
19217 */
19218
19219
19220 function read64() {
19221 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
19222 var buffer = Buffer.from(bytes);
19223 return (0, _leb.decodeInt64)(buffer);
19224 }
19225
19226 function readU64() {
19227 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
19228 var buffer = Buffer.from(bytes);
19229 return (0, _leb.decodeUInt64)(buffer);
19230 }
19231
19232 function readByte() {
19233 return readBytes(1)[0];
19234 }
19235
19236 function parseModuleHeader() {
19237 if (isEOF() === true || offset + 4 > buf.length) {
19238 throw new Error("unexpected end");
19239 }
19240
19241 var header = readBytes(4);
19242
19243 if (byteArrayEq(_helperWasmBytecode.default.magicModuleHeader, header) === false) {
19244 throw new _helperApiError.CompileError("magic header not detected");
19245 }
19246
19247 dump(header, "wasm magic header");
19248 eatBytes(4);
19249 }
19250
19251 function parseVersion() {
19252 if (isEOF() === true || offset + 4 > buf.length) {
19253 throw new Error("unexpected end");
19254 }
19255
19256 var version = readBytes(4);
19257
19258 if (byteArrayEq(_helperWasmBytecode.default.moduleVersion, version) === false) {
19259 throw new _helperApiError.CompileError("unknown binary version");
19260 }
19261
19262 dump(version, "wasm version");
19263 eatBytes(4);
19264 }
19265
19266 function parseVec(cast) {
19267 var u32 = readU32();
19268 var length = u32.value;
19269 eatBytes(u32.nextIndex);
19270 dump([length], "number");
19271
19272 if (length === 0) {
19273 return [];
19274 }
19275
19276 var elements = [];
19277
19278 for (var i = 0; i < length; i++) {
19279 var byte = readByte();
19280 eatBytes(1);
19281 var value = cast(byte);
19282 dump([byte], value);
19283
19284 if (typeof value === "undefined") {
19285 throw new _helperApiError.CompileError("Internal failure: parseVec could not cast the value");
19286 }
19287
19288 elements.push(value);
19289 }
19290
19291 return elements;
19292 } // Type section
19293 // https://webassembly.github.io/spec/binary/modules.html#binary-typesec
19294
19295
19296 function parseTypeSection(numberOfTypes) {
19297 var typeInstructionNodes = [];
19298 dump([numberOfTypes], "num types");
19299
19300 for (var i = 0; i < numberOfTypes; i++) {
19301 var _startLoc = getPosition();
19302
19303 dumpSep("type " + i);
19304 var type = readByte();
19305 eatBytes(1);
19306
19307 if (type == _helperWasmBytecode.default.types.func) {
19308 dump([type], "func");
19309 var paramValtypes = parseVec(function (b) {
19310 return _helperWasmBytecode.default.valtypes[b];
19311 });
19312 var params = paramValtypes.map(function (v) {
19313 return t.funcParam(
19314 /*valtype*/
19315 v);
19316 });
19317 var result = parseVec(function (b) {
19318 return _helperWasmBytecode.default.valtypes[b];
19319 });
19320 typeInstructionNodes.push(function () {
19321 var endLoc = getPosition();
19322 return t.withLoc(t.typeInstruction(undefined, t.signature(params, result)), endLoc, _startLoc);
19323 }());
19324 state.typesInModule.push({
19325 params: params,
19326 result: result
19327 });
19328 } else {
19329 throw new Error("Unsupported type: " + toHex(type));
19330 }
19331 }
19332
19333 return typeInstructionNodes;
19334 } // Import section
19335 // https://webassembly.github.io/spec/binary/modules.html#binary-importsec
19336
19337
19338 function parseImportSection(numberOfImports) {
19339 var imports = [];
19340
19341 for (var i = 0; i < numberOfImports; i++) {
19342 dumpSep("import header " + i);
19343
19344 var _startLoc2 = getPosition();
19345 /**
19346 * Module name
19347 */
19348
19349
19350 var moduleName = readUTF8String();
19351 eatBytes(moduleName.nextIndex);
19352 dump([], "module name (".concat(moduleName.value, ")"));
19353 /**
19354 * Name
19355 */
19356
19357 var name = readUTF8String();
19358 eatBytes(name.nextIndex);
19359 dump([], "name (".concat(name.value, ")"));
19360 /**
19361 * Import descr
19362 */
19363
19364 var descrTypeByte = readByte();
19365 eatBytes(1);
19366 var descrType = _helperWasmBytecode.default.importTypes[descrTypeByte];
19367 dump([descrTypeByte], "import kind");
19368
19369 if (typeof descrType === "undefined") {
19370 throw new _helperApiError.CompileError("Unknown import description type: " + toHex(descrTypeByte));
19371 }
19372
19373 var importDescr = void 0;
19374
19375 if (descrType === "func") {
19376 var indexU32 = readU32();
19377 var typeindex = indexU32.value;
19378 eatBytes(indexU32.nextIndex);
19379 dump([typeindex], "type index");
19380 var signature = state.typesInModule[typeindex];
19381
19382 if (typeof signature === "undefined") {
19383 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
19384 }
19385
19386 var id = getUniqueName("func");
19387 importDescr = t.funcImportDescr(id, t.signature(signature.params, signature.result));
19388 state.functionsInModule.push({
19389 id: t.identifier(name.value),
19390 signature: signature,
19391 isExternal: true
19392 });
19393 } else if (descrType === "global") {
19394 importDescr = parseGlobalType();
19395 var globalNode = t.global(importDescr, []);
19396 state.globalsInModule.push(globalNode);
19397 } else if (descrType === "table") {
19398 importDescr = parseTableType(i);
19399 } else if (descrType === "mem") {
19400 var memoryNode = parseMemoryType(0);
19401 state.memoriesInModule.push(memoryNode);
19402 importDescr = memoryNode;
19403 } else {
19404 throw new _helperApiError.CompileError("Unsupported import of type: " + descrType);
19405 }
19406
19407 imports.push(function () {
19408 var endLoc = getPosition();
19409 return t.withLoc(t.moduleImport(moduleName.value, name.value, importDescr), endLoc, _startLoc2);
19410 }());
19411 }
19412
19413 return imports;
19414 } // Function section
19415 // https://webassembly.github.io/spec/binary/modules.html#function-section
19416
19417
19418 function parseFuncSection(numberOfFunctions) {
19419 dump([numberOfFunctions], "num funcs");
19420
19421 for (var i = 0; i < numberOfFunctions; i++) {
19422 var indexU32 = readU32();
19423 var typeindex = indexU32.value;
19424 eatBytes(indexU32.nextIndex);
19425 dump([typeindex], "type index");
19426 var signature = state.typesInModule[typeindex];
19427
19428 if (typeof signature === "undefined") {
19429 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
19430 } // preserve anonymous, a name might be resolved later
19431
19432
19433 var id = t.withRaw(t.identifier(getUniqueName("func")), "");
19434 state.functionsInModule.push({
19435 id: id,
19436 signature: signature,
19437 isExternal: false
19438 });
19439 }
19440 } // Export section
19441 // https://webassembly.github.io/spec/binary/modules.html#export-section
19442
19443
19444 function parseExportSection(numberOfExport) {
19445 dump([numberOfExport], "num exports"); // Parse vector of exports
19446
19447 for (var i = 0; i < numberOfExport; i++) {
19448 var _startLoc3 = getPosition();
19449 /**
19450 * Name
19451 */
19452
19453
19454 var name = readUTF8String();
19455 eatBytes(name.nextIndex);
19456 dump([], "export name (".concat(name.value, ")"));
19457 /**
19458 * exportdescr
19459 */
19460
19461 var typeIndex = readByte();
19462 eatBytes(1);
19463 dump([typeIndex], "export kind");
19464 var indexu32 = readU32();
19465 var index = indexu32.value;
19466 eatBytes(indexu32.nextIndex);
19467 dump([index], "export index");
19468 var id = void 0,
19469 signature = void 0;
19470
19471 if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Func") {
19472 var func = state.functionsInModule[index];
19473
19474 if (typeof func === "undefined") {
19475 throw new _helperApiError.CompileError("unknown function (".concat(index, ")"));
19476 }
19477
19478 id = t.numberLiteralFromRaw(index, String(index));
19479 signature = func.signature;
19480 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Table") {
19481 var table = state.tablesInModule[index];
19482
19483 if (typeof table === "undefined") {
19484 throw new _helperApiError.CompileError("unknown table ".concat(index));
19485 }
19486
19487 id = t.numberLiteralFromRaw(index, String(index));
19488 signature = null;
19489 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Mem") {
19490 var memNode = state.memoriesInModule[index];
19491
19492 if (typeof memNode === "undefined") {
19493 throw new _helperApiError.CompileError("unknown memory ".concat(index));
19494 }
19495
19496 id = t.numberLiteralFromRaw(index, String(index));
19497 signature = null;
19498 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Global") {
19499 var global = state.globalsInModule[index];
19500
19501 if (typeof global === "undefined") {
19502 throw new _helperApiError.CompileError("unknown global ".concat(index));
19503 }
19504
19505 id = t.numberLiteralFromRaw(index, String(index));
19506 signature = null;
19507 } else {
19508 console.warn("Unsupported export type: " + toHex(typeIndex));
19509 return;
19510 }
19511
19512 var endLoc = getPosition();
19513 state.elementsInExportSection.push({
19514 name: name.value,
19515 type: _helperWasmBytecode.default.exportTypes[typeIndex],
19516 signature: signature,
19517 id: id,
19518 index: index,
19519 endLoc: endLoc,
19520 startLoc: _startLoc3
19521 });
19522 }
19523 } // Code section
19524 // https://webassembly.github.io/spec/binary/modules.html#code-section
19525
19526
19527 function parseCodeSection(numberOfFuncs) {
19528 dump([numberOfFuncs], "number functions"); // Parse vector of function
19529
19530 for (var i = 0; i < numberOfFuncs; i++) {
19531 var _startLoc4 = getPosition();
19532
19533 dumpSep("function body " + i); // the u32 size of the function code in bytes
19534 // Ignore it for now
19535
19536 var bodySizeU32 = readU32();
19537 eatBytes(bodySizeU32.nextIndex);
19538 dump([bodySizeU32.value], "function body size");
19539 var code = [];
19540 /**
19541 * Parse locals
19542 */
19543
19544 var funcLocalNumU32 = readU32();
19545 var funcLocalNum = funcLocalNumU32.value;
19546 eatBytes(funcLocalNumU32.nextIndex);
19547 dump([funcLocalNum], "num locals");
19548 var locals = [];
19549
19550 for (var _i = 0; _i < funcLocalNum; _i++) {
19551 var _startLoc5 = getPosition();
19552
19553 var localCountU32 = readU32();
19554 var localCount = localCountU32.value;
19555 eatBytes(localCountU32.nextIndex);
19556 dump([localCount], "num local");
19557 var valtypeByte = readByte();
19558 eatBytes(1);
19559 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
19560 var args = [];
19561
19562 for (var _i2 = 0; _i2 < localCount; _i2++) {
19563 args.push(t.valtypeLiteral(type));
19564 }
19565
19566 var localNode = function () {
19567 var endLoc = getPosition();
19568 return t.withLoc(t.instruction("local", args), endLoc, _startLoc5);
19569 }();
19570
19571 locals.push(localNode);
19572 dump([valtypeByte], type);
19573
19574 if (typeof type === "undefined") {
19575 throw new _helperApiError.CompileError("Unexpected valtype: " + toHex(valtypeByte));
19576 }
19577 }
19578
19579 code.push.apply(code, locals); // Decode instructions until the end
19580
19581 parseInstructionBlock(code);
19582 var endLoc = getPosition();
19583 state.elementsInCodeSection.push({
19584 code: code,
19585 locals: locals,
19586 endLoc: endLoc,
19587 startLoc: _startLoc4,
19588 bodySize: bodySizeU32.value
19589 });
19590 }
19591 }
19592
19593 function parseInstructionBlock(code) {
19594 while (true) {
19595 var _startLoc6 = getPosition();
19596
19597 var instructionAlreadyCreated = false;
19598 var instructionByte = readByte();
19599 eatBytes(1);
19600
19601 if (instructionByte === 0xfe) {
19602 throw new _helperApiError.CompileError("Atomic instructions are not implemented");
19603 }
19604
19605 var instruction = _helperWasmBytecode.default.symbolsByByte[instructionByte];
19606
19607 if (typeof instruction === "undefined") {
19608 throw new _helperApiError.CompileError("Unexpected instruction: " + toHex(instructionByte));
19609 }
19610
19611 if (typeof instruction.object === "string") {
19612 dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name));
19613 } else {
19614 dump([instructionByte], instruction.name);
19615 }
19616 /**
19617 * End of the function
19618 */
19619
19620
19621 if (instruction.name === "end") {
19622 var node = function () {
19623 var endLoc = getPosition();
19624 return t.withLoc(t.instruction(instruction.name), endLoc, _startLoc6);
19625 }();
19626
19627 code.push(node);
19628 break;
19629 }
19630
19631 var args = [];
19632
19633 if (instruction.name === "loop") {
19634 var _startLoc7 = getPosition();
19635
19636 var blocktypeByte = readByte();
19637 eatBytes(1);
19638 var blocktype = _helperWasmBytecode.default.blockTypes[blocktypeByte];
19639 dump([blocktypeByte], "blocktype");
19640
19641 if (typeof blocktype === "undefined") {
19642 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(blocktypeByte));
19643 }
19644
19645 var instr = [];
19646 parseInstructionBlock(instr); // preserve anonymous
19647
19648 var label = t.withRaw(t.identifier(getUniqueName("loop")), "");
19649
19650 var loopNode = function () {
19651 var endLoc = getPosition();
19652 return t.withLoc(t.loopInstruction(label, blocktype, instr), endLoc, _startLoc7);
19653 }();
19654
19655 code.push(loopNode);
19656 instructionAlreadyCreated = true;
19657 } else if (instruction.name === "if") {
19658 var _startLoc8 = getPosition();
19659
19660 var _blocktypeByte = readByte();
19661
19662 eatBytes(1);
19663 var _blocktype = _helperWasmBytecode.default.blockTypes[_blocktypeByte];
19664 dump([_blocktypeByte], "blocktype");
19665
19666 if (typeof _blocktype === "undefined") {
19667 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte));
19668 }
19669
19670 var testIndex = t.withRaw(t.identifier(getUniqueName("if")), "");
19671 var ifBody = [];
19672 parseInstructionBlock(ifBody); // Defaults to no alternate
19673
19674 var elseIndex = 0;
19675
19676 for (elseIndex = 0; elseIndex < ifBody.length; ++elseIndex) {
19677 var _instr = ifBody[elseIndex];
19678
19679 if (_instr.type === "Instr" && _instr.id === "else") {
19680 break;
19681 }
19682 }
19683
19684 var consequentInstr = ifBody.slice(0, elseIndex);
19685 var alternate = ifBody.slice(elseIndex + 1); // wast sugar
19686
19687 var testInstrs = [];
19688
19689 var ifNode = function () {
19690 var endLoc = getPosition();
19691 return t.withLoc(t.ifInstruction(testIndex, testInstrs, _blocktype, consequentInstr, alternate), endLoc, _startLoc8);
19692 }();
19693
19694 code.push(ifNode);
19695 instructionAlreadyCreated = true;
19696 } else if (instruction.name === "block") {
19697 var _startLoc9 = getPosition();
19698
19699 var _blocktypeByte2 = readByte();
19700
19701 eatBytes(1);
19702 var _blocktype2 = _helperWasmBytecode.default.blockTypes[_blocktypeByte2];
19703 dump([_blocktypeByte2], "blocktype");
19704
19705 if (typeof _blocktype2 === "undefined") {
19706 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte2));
19707 }
19708
19709 var _instr2 = [];
19710 parseInstructionBlock(_instr2); // preserve anonymous
19711
19712 var _label = t.withRaw(t.identifier(getUniqueName("block")), "");
19713
19714 var blockNode = function () {
19715 var endLoc = getPosition();
19716 return t.withLoc(t.blockInstruction(_label, _instr2, _blocktype2), endLoc, _startLoc9);
19717 }();
19718
19719 code.push(blockNode);
19720 instructionAlreadyCreated = true;
19721 } else if (instruction.name === "call") {
19722 var indexu32 = readU32();
19723 var index = indexu32.value;
19724 eatBytes(indexu32.nextIndex);
19725 dump([index], "index");
19726
19727 var callNode = function () {
19728 var endLoc = getPosition();
19729 return t.withLoc(t.callInstruction(t.indexLiteral(index)), endLoc, _startLoc6);
19730 }();
19731
19732 code.push(callNode);
19733 instructionAlreadyCreated = true;
19734 } else if (instruction.name === "call_indirect") {
19735 var _startLoc10 = getPosition();
19736
19737 var indexU32 = readU32();
19738 var typeindex = indexU32.value;
19739 eatBytes(indexU32.nextIndex);
19740 dump([typeindex], "type index");
19741 var signature = state.typesInModule[typeindex];
19742
19743 if (typeof signature === "undefined") {
19744 throw new _helperApiError.CompileError("call_indirect signature not found (".concat(typeindex, ")"));
19745 }
19746
19747 var _callNode = t.callIndirectInstruction(t.signature(signature.params, signature.result), []);
19748
19749 var flagU32 = readU32();
19750 var flag = flagU32.value; // 0x00 - reserved byte
19751
19752 eatBytes(flagU32.nextIndex);
19753
19754 if (flag !== 0) {
19755 throw new _helperApiError.CompileError("zero flag expected");
19756 }
19757
19758 code.push(function () {
19759 var endLoc = getPosition();
19760 return t.withLoc(_callNode, endLoc, _startLoc10);
19761 }());
19762 instructionAlreadyCreated = true;
19763 } else if (instruction.name === "br_table") {
19764 var indicesu32 = readU32();
19765 var indices = indicesu32.value;
19766 eatBytes(indicesu32.nextIndex);
19767 dump([indices], "num indices");
19768
19769 for (var i = 0; i <= indices; i++) {
19770 var _indexu = readU32();
19771
19772 var _index = _indexu.value;
19773 eatBytes(_indexu.nextIndex);
19774 dump([_index], "index");
19775 args.push(t.numberLiteralFromRaw(_indexu.value.toString(), "u32"));
19776 }
19777 } else if (instructionByte >= 0x28 && instructionByte <= 0x40) {
19778 /**
19779 * Memory instructions
19780 */
19781 if (instruction.name === "grow_memory" || instruction.name === "current_memory") {
19782 var _indexU = readU32();
19783
19784 var _index2 = _indexU.value;
19785 eatBytes(_indexU.nextIndex);
19786
19787 if (_index2 !== 0) {
19788 throw new Error("zero flag expected");
19789 }
19790
19791 dump([_index2], "index");
19792 } else {
19793 var aligun32 = readU32();
19794 var align = aligun32.value;
19795 eatBytes(aligun32.nextIndex);
19796 dump([align], "align");
19797 var offsetu32 = readU32();
19798 var _offset2 = offsetu32.value;
19799 eatBytes(offsetu32.nextIndex);
19800 dump([_offset2], "offset");
19801 }
19802 } else if (instructionByte >= 0x41 && instructionByte <= 0x44) {
19803 /**
19804 * Numeric instructions
19805 */
19806 if (instruction.object === "i32") {
19807 var value32 = read32();
19808 var value = value32.value;
19809 eatBytes(value32.nextIndex);
19810 dump([value], "i32 value");
19811 args.push(t.numberLiteralFromRaw(value));
19812 }
19813
19814 if (instruction.object === "u32") {
19815 var valueu32 = readU32();
19816 var _value = valueu32.value;
19817 eatBytes(valueu32.nextIndex);
19818 dump([_value], "u32 value");
19819 args.push(t.numberLiteralFromRaw(_value));
19820 }
19821
19822 if (instruction.object === "i64") {
19823 var value64 = read64();
19824 var _value2 = value64.value;
19825 eatBytes(value64.nextIndex);
19826 dump([Number(_value2.toString())], "i64 value");
19827 var high = _value2.high,
19828 low = _value2.low;
19829 var _node = {
19830 type: "LongNumberLiteral",
19831 value: {
19832 high: high,
19833 low: low
19834 }
19835 };
19836 args.push(_node);
19837 }
19838
19839 if (instruction.object === "u64") {
19840 var valueu64 = readU64();
19841 var _value3 = valueu64.value;
19842 eatBytes(valueu64.nextIndex);
19843 dump([Number(_value3.toString())], "u64 value");
19844 var _high = _value3.high,
19845 _low = _value3.low;
19846 var _node2 = {
19847 type: "LongNumberLiteral",
19848 value: {
19849 high: _high,
19850 low: _low
19851 }
19852 };
19853 args.push(_node2);
19854 }
19855
19856 if (instruction.object === "f32") {
19857 var valuef32 = readF32();
19858 var _value4 = valuef32.value;
19859 eatBytes(valuef32.nextIndex);
19860 dump([_value4], "f32 value");
19861 args.push( // $FlowIgnore
19862 t.floatLiteral(_value4, valuef32.nan, valuef32.inf, String(_value4)));
19863 }
19864
19865 if (instruction.object === "f64") {
19866 var valuef64 = readF64();
19867 var _value5 = valuef64.value;
19868 eatBytes(valuef64.nextIndex);
19869 dump([_value5], "f64 value");
19870 args.push( // $FlowIgnore
19871 t.floatLiteral(_value5, valuef64.nan, valuef64.inf, String(_value5)));
19872 }
19873 } else {
19874 for (var _i3 = 0; _i3 < instruction.numberOfArgs; _i3++) {
19875 var u32 = readU32();
19876 eatBytes(u32.nextIndex);
19877 dump([u32.value], "argument " + _i3);
19878 args.push(t.numberLiteralFromRaw(u32.value));
19879 }
19880 }
19881
19882 if (instructionAlreadyCreated === false) {
19883 if (typeof instruction.object === "string") {
19884 var _node3 = function () {
19885 var endLoc = getPosition();
19886 return t.withLoc(t.objectInstruction(instruction.name, instruction.object, args), endLoc, _startLoc6);
19887 }();
19888
19889 code.push(_node3);
19890 } else {
19891 var _node4 = function () {
19892 var endLoc = getPosition();
19893 return t.withLoc(t.instruction(instruction.name, args), endLoc, _startLoc6);
19894 }();
19895
19896 code.push(_node4);
19897 }
19898 }
19899 }
19900 } // https://webassembly.github.io/spec/core/binary/types.html#limits
19901
19902
19903 function parseLimits() {
19904 var limitType = readByte();
19905 eatBytes(1);
19906 dump([limitType], "limit type");
19907 var min, max;
19908
19909 if (limitType === 0x01 || limitType === 0x03 // shared limits
19910 ) {
19911 var u32min = readU32();
19912 min = parseInt(u32min.value);
19913 eatBytes(u32min.nextIndex);
19914 dump([min], "min");
19915 var u32max = readU32();
19916 max = parseInt(u32max.value);
19917 eatBytes(u32max.nextIndex);
19918 dump([max], "max");
19919 }
19920
19921 if (limitType === 0x00) {
19922 var _u32min = readU32();
19923
19924 min = parseInt(_u32min.value);
19925 eatBytes(_u32min.nextIndex);
19926 dump([min], "min");
19927 }
19928
19929 return t.limit(min, max);
19930 } // https://webassembly.github.io/spec/core/binary/types.html#binary-tabletype
19931
19932
19933 function parseTableType(index) {
19934 var name = t.withRaw(t.identifier(getUniqueName("table")), String(index));
19935 var elementTypeByte = readByte();
19936 eatBytes(1);
19937 dump([elementTypeByte], "element type");
19938 var elementType = _helperWasmBytecode.default.tableTypes[elementTypeByte];
19939
19940 if (typeof elementType === "undefined") {
19941 throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementType));
19942 }
19943
19944 var limits = parseLimits();
19945 return t.table(elementType, limits, name);
19946 } // https://webassembly.github.io/spec/binary/types.html#global-types
19947
19948
19949 function parseGlobalType() {
19950 var valtypeByte = readByte();
19951 eatBytes(1);
19952 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
19953 dump([valtypeByte], type);
19954
19955 if (typeof type === "undefined") {
19956 throw new _helperApiError.CompileError("Unknown valtype: " + toHex(valtypeByte));
19957 }
19958
19959 var globalTypeByte = readByte();
19960 eatBytes(1);
19961 var globalType = _helperWasmBytecode.default.globalTypes[globalTypeByte];
19962 dump([globalTypeByte], "global type (".concat(globalType, ")"));
19963
19964 if (typeof globalType === "undefined") {
19965 throw new _helperApiError.CompileError("Invalid mutability: " + toHex(globalTypeByte));
19966 }
19967
19968 return t.globalType(type, globalType);
19969 } // function parseNameModule() {
19970 // const lenu32 = readVaruint32();
19971 // eatBytes(lenu32.nextIndex);
19972 // console.log("len", lenu32);
19973 // const strlen = lenu32.value;
19974 // dump([strlen], "string length");
19975 // const bytes = readBytes(strlen);
19976 // eatBytes(strlen);
19977 // const value = utf8.decode(bytes);
19978 // return [t.moduleNameMetadata(value)];
19979 // }
19980 // this section contains an array of function names and indices
19981
19982
19983 function parseNameSectionFunctions() {
19984 var functionNames = [];
19985 var numberOfFunctionsu32 = readU32();
19986 var numbeOfFunctions = numberOfFunctionsu32.value;
19987 eatBytes(numberOfFunctionsu32.nextIndex);
19988
19989 for (var i = 0; i < numbeOfFunctions; i++) {
19990 var indexu32 = readU32();
19991 var index = indexu32.value;
19992 eatBytes(indexu32.nextIndex);
19993 var name = readUTF8String();
19994 eatBytes(name.nextIndex);
19995 functionNames.push(t.functionNameMetadata(name.value, index));
19996 }
19997
19998 return functionNames;
19999 }
20000
20001 function parseNameSectionLocals() {
20002 var localNames = [];
20003 var numbeOfFunctionsu32 = readU32();
20004 var numbeOfFunctions = numbeOfFunctionsu32.value;
20005 eatBytes(numbeOfFunctionsu32.nextIndex);
20006
20007 for (var i = 0; i < numbeOfFunctions; i++) {
20008 var functionIndexu32 = readU32();
20009 var functionIndex = functionIndexu32.value;
20010 eatBytes(functionIndexu32.nextIndex);
20011 var numLocalsu32 = readU32();
20012 var numLocals = numLocalsu32.value;
20013 eatBytes(numLocalsu32.nextIndex);
20014
20015 for (var _i4 = 0; _i4 < numLocals; _i4++) {
20016 var localIndexu32 = readU32();
20017 var localIndex = localIndexu32.value;
20018 eatBytes(localIndexu32.nextIndex);
20019 var name = readUTF8String();
20020 eatBytes(name.nextIndex);
20021 localNames.push(t.localNameMetadata(name.value, localIndex, functionIndex));
20022 }
20023 }
20024
20025 return localNames;
20026 } // this is a custom section used for name resolution
20027 // https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
20028
20029
20030 function parseNameSection(remainingBytes) {
20031 var nameMetadata = [];
20032 var initialOffset = offset;
20033
20034 while (offset - initialOffset < remainingBytes) {
20035 // name_type
20036 var sectionTypeByte = readVaruint7();
20037 eatBytes(sectionTypeByte.nextIndex); // name_payload_len
20038
20039 var subSectionSizeInBytesu32 = readVaruint32();
20040 eatBytes(subSectionSizeInBytesu32.nextIndex);
20041
20042 switch (sectionTypeByte.value) {
20043 // case 0: {
20044 // TODO(sven): re-enable that
20045 // Current status: it seems that when we decode the module's name
20046 // no name_payload_len is used.
20047 //
20048 // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
20049 //
20050 // nameMetadata.push(...parseNameModule());
20051 // break;
20052 // }
20053 case 1:
20054 {
20055 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions()));
20056 break;
20057 }
20058
20059 case 2:
20060 {
20061 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals()));
20062 break;
20063 }
20064
20065 default:
20066 {
20067 // skip unknown subsection
20068 eatBytes(subSectionSizeInBytesu32.value);
20069 }
20070 }
20071 }
20072
20073 return nameMetadata;
20074 } // this is a custom section used for information about the producers
20075 // https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md
20076
20077
20078 function parseProducersSection() {
20079 var metadata = t.producersSectionMetadata([]); // field_count
20080
20081 var sectionTypeByte = readVaruint32();
20082 eatBytes(sectionTypeByte.nextIndex);
20083 dump([sectionTypeByte.value], "num of producers");
20084 var fields = {
20085 language: [],
20086 "processed-by": [],
20087 sdk: []
20088 }; // fields
20089
20090 for (var fieldI = 0; fieldI < sectionTypeByte.value; fieldI++) {
20091 // field_name
20092 var fieldName = readUTF8String();
20093 eatBytes(fieldName.nextIndex); // field_value_count
20094
20095 var valueCount = readVaruint32();
20096 eatBytes(valueCount.nextIndex); // field_values
20097
20098 for (var producerI = 0; producerI < valueCount.value; producerI++) {
20099 var producerName = readUTF8String();
20100 eatBytes(producerName.nextIndex);
20101 var producerVersion = readUTF8String();
20102 eatBytes(producerVersion.nextIndex);
20103 fields[fieldName.value].push(t.producerMetadataVersionedName(producerName.value, producerVersion.value));
20104 }
20105
20106 metadata.producers.push(fields[fieldName.value]);
20107 }
20108
20109 return metadata;
20110 }
20111
20112 function parseGlobalSection(numberOfGlobals) {
20113 var globals = [];
20114 dump([numberOfGlobals], "num globals");
20115
20116 for (var i = 0; i < numberOfGlobals; i++) {
20117 var _startLoc11 = getPosition();
20118
20119 var globalType = parseGlobalType();
20120 /**
20121 * Global expressions
20122 */
20123
20124 var init = [];
20125 parseInstructionBlock(init);
20126
20127 var node = function () {
20128 var endLoc = getPosition();
20129 return t.withLoc(t.global(globalType, init), endLoc, _startLoc11);
20130 }();
20131
20132 globals.push(node);
20133 state.globalsInModule.push(node);
20134 }
20135
20136 return globals;
20137 }
20138
20139 function parseElemSection(numberOfElements) {
20140 var elems = [];
20141 dump([numberOfElements], "num elements");
20142
20143 for (var i = 0; i < numberOfElements; i++) {
20144 var _startLoc12 = getPosition();
20145
20146 var tableindexu32 = readU32();
20147 var tableindex = tableindexu32.value;
20148 eatBytes(tableindexu32.nextIndex);
20149 dump([tableindex], "table index");
20150 /**
20151 * Parse instructions
20152 */
20153
20154 var instr = [];
20155 parseInstructionBlock(instr);
20156 /**
20157 * Parse ( vector function index ) *
20158 */
20159
20160 var indicesu32 = readU32();
20161 var indices = indicesu32.value;
20162 eatBytes(indicesu32.nextIndex);
20163 dump([indices], "num indices");
20164 var indexValues = [];
20165
20166 for (var _i5 = 0; _i5 < indices; _i5++) {
20167 var indexu32 = readU32();
20168 var index = indexu32.value;
20169 eatBytes(indexu32.nextIndex);
20170 dump([index], "index");
20171 indexValues.push(t.indexLiteral(index));
20172 }
20173
20174 var elemNode = function () {
20175 var endLoc = getPosition();
20176 return t.withLoc(t.elem(t.indexLiteral(tableindex), instr, indexValues), endLoc, _startLoc12);
20177 }();
20178
20179 elems.push(elemNode);
20180 }
20181
20182 return elems;
20183 } // https://webassembly.github.io/spec/core/binary/types.html#memory-types
20184
20185
20186 function parseMemoryType(i) {
20187 var limits = parseLimits();
20188 return t.memory(limits, t.indexLiteral(i));
20189 } // https://webassembly.github.io/spec/binary/modules.html#table-section
20190
20191
20192 function parseTableSection(numberOfElements) {
20193 var tables = [];
20194 dump([numberOfElements], "num elements");
20195
20196 for (var i = 0; i < numberOfElements; i++) {
20197 var tablesNode = parseTableType(i);
20198 state.tablesInModule.push(tablesNode);
20199 tables.push(tablesNode);
20200 }
20201
20202 return tables;
20203 } // https://webassembly.github.io/spec/binary/modules.html#memory-section
20204
20205
20206 function parseMemorySection(numberOfElements) {
20207 var memories = [];
20208 dump([numberOfElements], "num elements");
20209
20210 for (var i = 0; i < numberOfElements; i++) {
20211 var memoryNode = parseMemoryType(i);
20212 state.memoriesInModule.push(memoryNode);
20213 memories.push(memoryNode);
20214 }
20215
20216 return memories;
20217 } // https://webassembly.github.io/spec/binary/modules.html#binary-startsec
20218
20219
20220 function parseStartSection() {
20221 var startLoc = getPosition();
20222 var u32 = readU32();
20223 var startFuncIndex = u32.value;
20224 eatBytes(u32.nextIndex);
20225 dump([startFuncIndex], "index");
20226 return function () {
20227 var endLoc = getPosition();
20228 return t.withLoc(t.start(t.indexLiteral(startFuncIndex)), endLoc, startLoc);
20229 }();
20230 } // https://webassembly.github.io/spec/binary/modules.html#data-section
20231
20232
20233 function parseDataSection(numberOfElements) {
20234 var dataEntries = [];
20235 dump([numberOfElements], "num elements");
20236
20237 for (var i = 0; i < numberOfElements; i++) {
20238 var memoryIndexu32 = readU32();
20239 var memoryIndex = memoryIndexu32.value;
20240 eatBytes(memoryIndexu32.nextIndex);
20241 dump([memoryIndex], "memory index");
20242 var instrs = [];
20243 parseInstructionBlock(instrs);
20244 var hasExtraInstrs = instrs.filter(function (i) {
20245 return i.id !== "end";
20246 }).length !== 1;
20247
20248 if (hasExtraInstrs) {
20249 throw new _helperApiError.CompileError("data section offset must be a single instruction");
20250 }
20251
20252 var bytes = parseVec(function (b) {
20253 return b;
20254 });
20255 dump([], "init");
20256 dataEntries.push(t.data(t.memIndexLiteral(memoryIndex), instrs[0], t.byteArray(bytes)));
20257 }
20258
20259 return dataEntries;
20260 } // https://webassembly.github.io/spec/binary/modules.html#binary-section
20261
20262
20263 function parseSection(sectionIndex) {
20264 var sectionId = readByte();
20265 eatBytes(1);
20266
20267 if (sectionId >= sectionIndex || sectionIndex === _helperWasmBytecode.default.sections.custom) {
20268 sectionIndex = sectionId + 1;
20269 } else {
20270 if (sectionId !== _helperWasmBytecode.default.sections.custom) throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
20271 }
20272
20273 var nextSectionIndex = sectionIndex;
20274 var startOffset = offset;
20275 var startLoc = getPosition();
20276 var u32 = readU32();
20277 var sectionSizeInBytes = u32.value;
20278 eatBytes(u32.nextIndex);
20279
20280 var sectionSizeInBytesNode = function () {
20281 var endLoc = getPosition();
20282 return t.withLoc(t.numberLiteralFromRaw(sectionSizeInBytes), endLoc, startLoc);
20283 }();
20284
20285 switch (sectionId) {
20286 case _helperWasmBytecode.default.sections.type:
20287 {
20288 dumpSep("section Type");
20289 dump([sectionId], "section code");
20290 dump([sectionSizeInBytes], "section size");
20291
20292 var _startLoc13 = getPosition();
20293
20294 var _u = readU32();
20295
20296 var numberOfTypes = _u.value;
20297 eatBytes(_u.nextIndex);
20298
20299 var _metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () {
20300 var endLoc = getPosition();
20301 return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13);
20302 }());
20303
20304 var _nodes = parseTypeSection(numberOfTypes);
20305
20306 return {
20307 nodes: _nodes,
20308 metadata: _metadata,
20309 nextSectionIndex: nextSectionIndex
20310 };
20311 }
20312
20313 case _helperWasmBytecode.default.sections.table:
20314 {
20315 dumpSep("section Table");
20316 dump([sectionId], "section code");
20317 dump([sectionSizeInBytes], "section size");
20318
20319 var _startLoc14 = getPosition();
20320
20321 var _u2 = readU32();
20322
20323 var numberOfTable = _u2.value;
20324 eatBytes(_u2.nextIndex);
20325 dump([numberOfTable], "num tables");
20326
20327 var _metadata2 = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, function () {
20328 var endLoc = getPosition();
20329 return t.withLoc(t.numberLiteralFromRaw(numberOfTable), endLoc, _startLoc14);
20330 }());
20331
20332 var _nodes2 = parseTableSection(numberOfTable);
20333
20334 return {
20335 nodes: _nodes2,
20336 metadata: _metadata2,
20337 nextSectionIndex: nextSectionIndex
20338 };
20339 }
20340
20341 case _helperWasmBytecode.default.sections.import:
20342 {
20343 dumpSep("section Import");
20344 dump([sectionId], "section code");
20345 dump([sectionSizeInBytes], "section size");
20346
20347 var _startLoc15 = getPosition();
20348
20349 var numberOfImportsu32 = readU32();
20350 var numberOfImports = numberOfImportsu32.value;
20351 eatBytes(numberOfImportsu32.nextIndex);
20352 dump([numberOfImports], "number of imports");
20353
20354 var _metadata3 = t.sectionMetadata("import", startOffset, sectionSizeInBytesNode, function () {
20355 var endLoc = getPosition();
20356 return t.withLoc(t.numberLiteralFromRaw(numberOfImports), endLoc, _startLoc15);
20357 }());
20358
20359 var _nodes3 = parseImportSection(numberOfImports);
20360
20361 return {
20362 nodes: _nodes3,
20363 metadata: _metadata3,
20364 nextSectionIndex: nextSectionIndex
20365 };
20366 }
20367
20368 case _helperWasmBytecode.default.sections.func:
20369 {
20370 dumpSep("section Function");
20371 dump([sectionId], "section code");
20372 dump([sectionSizeInBytes], "section size");
20373
20374 var _startLoc16 = getPosition();
20375
20376 var numberOfFunctionsu32 = readU32();
20377 var numberOfFunctions = numberOfFunctionsu32.value;
20378 eatBytes(numberOfFunctionsu32.nextIndex);
20379
20380 var _metadata4 = t.sectionMetadata("func", startOffset, sectionSizeInBytesNode, function () {
20381 var endLoc = getPosition();
20382 return t.withLoc(t.numberLiteralFromRaw(numberOfFunctions), endLoc, _startLoc16);
20383 }());
20384
20385 parseFuncSection(numberOfFunctions);
20386 var _nodes4 = [];
20387 return {
20388 nodes: _nodes4,
20389 metadata: _metadata4,
20390 nextSectionIndex: nextSectionIndex
20391 };
20392 }
20393
20394 case _helperWasmBytecode.default.sections.export:
20395 {
20396 dumpSep("section Export");
20397 dump([sectionId], "section code");
20398 dump([sectionSizeInBytes], "section size");
20399
20400 var _startLoc17 = getPosition();
20401
20402 var _u3 = readU32();
20403
20404 var numberOfExport = _u3.value;
20405 eatBytes(_u3.nextIndex);
20406
20407 var _metadata5 = t.sectionMetadata("export", startOffset, sectionSizeInBytesNode, function () {
20408 var endLoc = getPosition();
20409 return t.withLoc(t.numberLiteralFromRaw(numberOfExport), endLoc, _startLoc17);
20410 }());
20411
20412 parseExportSection(numberOfExport);
20413 var _nodes5 = [];
20414 return {
20415 nodes: _nodes5,
20416 metadata: _metadata5,
20417 nextSectionIndex: nextSectionIndex
20418 };
20419 }
20420
20421 case _helperWasmBytecode.default.sections.code:
20422 {
20423 dumpSep("section Code");
20424 dump([sectionId], "section code");
20425 dump([sectionSizeInBytes], "section size");
20426
20427 var _startLoc18 = getPosition();
20428
20429 var _u4 = readU32();
20430
20431 var numberOfFuncs = _u4.value;
20432 eatBytes(_u4.nextIndex);
20433
20434 var _metadata6 = t.sectionMetadata("code", startOffset, sectionSizeInBytesNode, function () {
20435 var endLoc = getPosition();
20436 return t.withLoc(t.numberLiteralFromRaw(numberOfFuncs), endLoc, _startLoc18);
20437 }());
20438
20439 if (opts.ignoreCodeSection === true) {
20440 var remainingBytes = sectionSizeInBytes - _u4.nextIndex;
20441 eatBytes(remainingBytes); // eat the entire section
20442 } else {
20443 parseCodeSection(numberOfFuncs);
20444 }
20445
20446 var _nodes6 = [];
20447 return {
20448 nodes: _nodes6,
20449 metadata: _metadata6,
20450 nextSectionIndex: nextSectionIndex
20451 };
20452 }
20453
20454 case _helperWasmBytecode.default.sections.start:
20455 {
20456 dumpSep("section Start");
20457 dump([sectionId], "section code");
20458 dump([sectionSizeInBytes], "section size");
20459
20460 var _metadata7 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode);
20461
20462 var _nodes7 = [parseStartSection()];
20463 return {
20464 nodes: _nodes7,
20465 metadata: _metadata7,
20466 nextSectionIndex: nextSectionIndex
20467 };
20468 }
20469
20470 case _helperWasmBytecode.default.sections.element:
20471 {
20472 dumpSep("section Element");
20473 dump([sectionId], "section code");
20474 dump([sectionSizeInBytes], "section size");
20475
20476 var _startLoc19 = getPosition();
20477
20478 var numberOfElementsu32 = readU32();
20479 var numberOfElements = numberOfElementsu32.value;
20480 eatBytes(numberOfElementsu32.nextIndex);
20481
20482 var _metadata8 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () {
20483 var endLoc = getPosition();
20484 return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19);
20485 }());
20486
20487 var _nodes8 = parseElemSection(numberOfElements);
20488
20489 return {
20490 nodes: _nodes8,
20491 metadata: _metadata8,
20492 nextSectionIndex: nextSectionIndex
20493 };
20494 }
20495
20496 case _helperWasmBytecode.default.sections.global:
20497 {
20498 dumpSep("section Global");
20499 dump([sectionId], "section code");
20500 dump([sectionSizeInBytes], "section size");
20501
20502 var _startLoc20 = getPosition();
20503
20504 var numberOfGlobalsu32 = readU32();
20505 var numberOfGlobals = numberOfGlobalsu32.value;
20506 eatBytes(numberOfGlobalsu32.nextIndex);
20507
20508 var _metadata9 = t.sectionMetadata("global", startOffset, sectionSizeInBytesNode, function () {
20509 var endLoc = getPosition();
20510 return t.withLoc(t.numberLiteralFromRaw(numberOfGlobals), endLoc, _startLoc20);
20511 }());
20512
20513 var _nodes9 = parseGlobalSection(numberOfGlobals);
20514
20515 return {
20516 nodes: _nodes9,
20517 metadata: _metadata9,
20518 nextSectionIndex: nextSectionIndex
20519 };
20520 }
20521
20522 case _helperWasmBytecode.default.sections.memory:
20523 {
20524 dumpSep("section Memory");
20525 dump([sectionId], "section code");
20526 dump([sectionSizeInBytes], "section size");
20527
20528 var _startLoc21 = getPosition();
20529
20530 var _numberOfElementsu = readU32();
20531
20532 var _numberOfElements = _numberOfElementsu.value;
20533 eatBytes(_numberOfElementsu.nextIndex);
20534
20535 var _metadata10 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () {
20536 var endLoc = getPosition();
20537 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21);
20538 }());
20539
20540 var _nodes10 = parseMemorySection(_numberOfElements);
20541
20542 return {
20543 nodes: _nodes10,
20544 metadata: _metadata10,
20545 nextSectionIndex: nextSectionIndex
20546 };
20547 }
20548
20549 case _helperWasmBytecode.default.sections.data:
20550 {
20551 dumpSep("section Data");
20552 dump([sectionId], "section code");
20553 dump([sectionSizeInBytes], "section size");
20554
20555 var _metadata11 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode);
20556
20557 var _startLoc22 = getPosition();
20558
20559 var _numberOfElementsu2 = readU32();
20560
20561 var _numberOfElements2 = _numberOfElementsu2.value;
20562 eatBytes(_numberOfElementsu2.nextIndex);
20563
20564 _metadata11.vectorOfSize = function () {
20565 var endLoc = getPosition();
20566 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), endLoc, _startLoc22);
20567 }();
20568
20569 if (opts.ignoreDataSection === true) {
20570 var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex;
20571
20572 eatBytes(_remainingBytes); // eat the entire section
20573
20574 dumpSep("ignore data (" + sectionSizeInBytes + " bytes)");
20575 return {
20576 nodes: [],
20577 metadata: _metadata11,
20578 nextSectionIndex: nextSectionIndex
20579 };
20580 } else {
20581 var _nodes11 = parseDataSection(_numberOfElements2);
20582
20583 return {
20584 nodes: _nodes11,
20585 metadata: _metadata11,
20586 nextSectionIndex: nextSectionIndex
20587 };
20588 }
20589 }
20590
20591 case _helperWasmBytecode.default.sections.custom:
20592 {
20593 dumpSep("section Custom");
20594 dump([sectionId], "section code");
20595 dump([sectionSizeInBytes], "section size");
20596 var _metadata12 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)];
20597 var sectionName = readUTF8String();
20598 eatBytes(sectionName.nextIndex);
20599 dump([], "section name (".concat(sectionName.value, ")"));
20600
20601 var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex;
20602
20603 if (sectionName.value === "name") {
20604 var initialOffset = offset;
20605
20606 try {
20607 _metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
20608 } catch (e) {
20609 console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
20610 eatBytes(offset - (initialOffset + _remainingBytes2));
20611 }
20612 } else if (sectionName.value === "producers") {
20613 var _initialOffset = offset;
20614
20615 try {
20616 _metadata12.push(parseProducersSection());
20617 } catch (e) {
20618 console.warn("Failed to decode custom \"producers\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
20619 eatBytes(offset - (_initialOffset + _remainingBytes2));
20620 }
20621 } else {
20622 // We don't parse the custom section
20623 eatBytes(_remainingBytes2);
20624 dumpSep("ignore custom " + JSON.stringify(sectionName.value) + " section (" + _remainingBytes2 + " bytes)");
20625 }
20626
20627 return {
20628 nodes: [],
20629 metadata: _metadata12,
20630 nextSectionIndex: nextSectionIndex
20631 };
20632 }
20633 }
20634
20635 throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
20636 }
20637
20638 parseModuleHeader();
20639 parseVersion();
20640 var moduleFields = [];
20641 var sectionIndex = 0;
20642 var moduleMetadata = {
20643 sections: [],
20644 functionNames: [],
20645 localNames: [],
20646 producers: []
20647 };
20648 /**
20649 * All the generate declaration are going to be stored in our state
20650 */
20651
20652 while (offset < buf.length) {
20653 var _parseSection = parseSection(sectionIndex),
20654 _nodes12 = _parseSection.nodes,
20655 _metadata13 = _parseSection.metadata,
20656 nextSectionIndex = _parseSection.nextSectionIndex;
20657
20658 moduleFields.push.apply(moduleFields, _toConsumableArray(_nodes12));
20659 var metadataArray = Array.isArray(_metadata13) ? _metadata13 : [_metadata13];
20660 metadataArray.forEach(function (metadataItem) {
20661 if (metadataItem.type === "FunctionNameMetadata") {
20662 moduleMetadata.functionNames.push(metadataItem);
20663 } else if (metadataItem.type === "LocalNameMetadata") {
20664 moduleMetadata.localNames.push(metadataItem);
20665 } else if (metadataItem.type === "ProducersSectionMetadata") {
20666 moduleMetadata.producers.push(metadataItem);
20667 } else {
20668 moduleMetadata.sections.push(metadataItem);
20669 }
20670 }); // Ignore custom section
20671
20672 if (nextSectionIndex) {
20673 sectionIndex = nextSectionIndex;
20674 }
20675 }
20676 /**
20677 * Transform the state into AST nodes
20678 */
20679
20680
20681 var funcIndex = 0;
20682 state.functionsInModule.forEach(function (func) {
20683 var params = func.signature.params;
20684 var result = func.signature.result;
20685 var body = []; // External functions doesn't provide any code, can skip it here
20686
20687 if (func.isExternal === true) {
20688 return;
20689 }
20690
20691 var decodedElementInCodeSection = state.elementsInCodeSection[funcIndex];
20692
20693 if (opts.ignoreCodeSection === false) {
20694 if (typeof decodedElementInCodeSection === "undefined") {
20695 throw new _helperApiError.CompileError("func " + toHex(funcIndex) + " code not found");
20696 }
20697
20698 body = decodedElementInCodeSection.code;
20699 }
20700
20701 funcIndex++;
20702 var funcNode = t.func(func.id, t.signature(params, result), body);
20703
20704 if (func.isExternal === true) {
20705 funcNode.isExternal = func.isExternal;
20706 } // Add function position in the binary if possible
20707
20708
20709 if (opts.ignoreCodeSection === false) {
20710 var _startLoc23 = decodedElementInCodeSection.startLoc,
20711 endLoc = decodedElementInCodeSection.endLoc,
20712 bodySize = decodedElementInCodeSection.bodySize;
20713 funcNode = t.withLoc(funcNode, endLoc, _startLoc23);
20714 funcNode.metadata = {
20715 bodySize: bodySize
20716 };
20717 }
20718
20719 moduleFields.push(funcNode);
20720 });
20721 state.elementsInExportSection.forEach(function (moduleExport) {
20722 /**
20723 * If the export has no id, we won't be able to call it from the outside
20724 * so we can omit it
20725 */
20726 if (moduleExport.id != null) {
20727 moduleFields.push(t.withLoc(t.moduleExport(moduleExport.name, t.moduleExportDescr(moduleExport.type, moduleExport.id)), moduleExport.endLoc, moduleExport.startLoc));
20728 }
20729 });
20730 dumpSep("end of program");
20731 var module = t.module(null, moduleFields, t.moduleMetadata(moduleMetadata.sections, moduleMetadata.functionNames, moduleMetadata.localNames, moduleMetadata.producers));
20732 return t.program([module]);
20733}
20734
20735/***/ }),
20736
20737/***/ 38070:
20738/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
20739
20740"use strict";
20741
20742
20743Object.defineProperty(exports, "__esModule", ({
20744 value: true
20745}));
20746exports.decode = decode;
20747
20748var decoder = _interopRequireWildcard(__webpack_require__(10514));
20749
20750var t = _interopRequireWildcard(__webpack_require__(25323));
20751
20752function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
20753
20754/**
20755 * TODO(sven): I added initial props, but we should rather fix
20756 * https://github.com/xtuc/webassemblyjs/issues/405
20757 */
20758var defaultDecoderOpts = {
20759 dump: false,
20760 ignoreCodeSection: false,
20761 ignoreDataSection: false,
20762 ignoreCustomNameSection: false
20763}; // traverses the AST, locating function name metadata, which is then
20764// used to update index-based identifiers with function names
20765
20766function restoreFunctionNames(ast) {
20767 var functionNames = [];
20768 t.traverse(ast, {
20769 FunctionNameMetadata: function FunctionNameMetadata(_ref) {
20770 var node = _ref.node;
20771 functionNames.push({
20772 name: node.value,
20773 index: node.index
20774 });
20775 }
20776 });
20777
20778 if (functionNames.length === 0) {
20779 return;
20780 }
20781
20782 t.traverse(ast, {
20783 Func: function (_Func) {
20784 function Func(_x) {
20785 return _Func.apply(this, arguments);
20786 }
20787
20788 Func.toString = function () {
20789 return _Func.toString();
20790 };
20791
20792 return Func;
20793 }(function (_ref2) {
20794 var node = _ref2.node;
20795 // $FlowIgnore
20796 var nodeName = node.name;
20797 var indexBasedFunctionName = nodeName.value;
20798 var index = Number(indexBasedFunctionName.replace("func_", ""));
20799 var functionName = functionNames.find(function (f) {
20800 return f.index === index;
20801 });
20802
20803 if (functionName) {
20804 var oldValue = nodeName.value;
20805 nodeName.value = functionName.name;
20806 nodeName.numeric = oldValue; // $FlowIgnore
20807
20808 delete nodeName.raw;
20809 }
20810 }),
20811 // Also update the reference in the export
20812 ModuleExport: function (_ModuleExport) {
20813 function ModuleExport(_x2) {
20814 return _ModuleExport.apply(this, arguments);
20815 }
20816
20817 ModuleExport.toString = function () {
20818 return _ModuleExport.toString();
20819 };
20820
20821 return ModuleExport;
20822 }(function (_ref3) {
20823 var node = _ref3.node;
20824
20825 if (node.descr.exportType === "Func") {
20826 // $FlowIgnore
20827 var nodeName = node.descr.id;
20828 var index = nodeName.value;
20829 var functionName = functionNames.find(function (f) {
20830 return f.index === index;
20831 });
20832
20833 if (functionName) {
20834 node.descr.id = t.identifier(functionName.name);
20835 }
20836 }
20837 }),
20838 ModuleImport: function (_ModuleImport) {
20839 function ModuleImport(_x3) {
20840 return _ModuleImport.apply(this, arguments);
20841 }
20842
20843 ModuleImport.toString = function () {
20844 return _ModuleImport.toString();
20845 };
20846
20847 return ModuleImport;
20848 }(function (_ref4) {
20849 var node = _ref4.node;
20850
20851 if (node.descr.type === "FuncImportDescr") {
20852 // $FlowIgnore
20853 var indexBasedFunctionName = node.descr.id;
20854 var index = Number(indexBasedFunctionName.replace("func_", ""));
20855 var functionName = functionNames.find(function (f) {
20856 return f.index === index;
20857 });
20858
20859 if (functionName) {
20860 // $FlowIgnore
20861 node.descr.id = t.identifier(functionName.name);
20862 }
20863 }
20864 }),
20865 CallInstruction: function (_CallInstruction) {
20866 function CallInstruction(_x4) {
20867 return _CallInstruction.apply(this, arguments);
20868 }
20869
20870 CallInstruction.toString = function () {
20871 return _CallInstruction.toString();
20872 };
20873
20874 return CallInstruction;
20875 }(function (nodePath) {
20876 var node = nodePath.node;
20877 var index = node.index.value;
20878 var functionName = functionNames.find(function (f) {
20879 return f.index === index;
20880 });
20881
20882 if (functionName) {
20883 var oldValue = node.index;
20884 node.index = t.identifier(functionName.name);
20885 node.numeric = oldValue; // $FlowIgnore
20886
20887 delete node.raw;
20888 }
20889 })
20890 });
20891}
20892
20893function restoreLocalNames(ast) {
20894 var localNames = [];
20895 t.traverse(ast, {
20896 LocalNameMetadata: function LocalNameMetadata(_ref5) {
20897 var node = _ref5.node;
20898 localNames.push({
20899 name: node.value,
20900 localIndex: node.localIndex,
20901 functionIndex: node.functionIndex
20902 });
20903 }
20904 });
20905
20906 if (localNames.length === 0) {
20907 return;
20908 }
20909
20910 t.traverse(ast, {
20911 Func: function (_Func2) {
20912 function Func(_x5) {
20913 return _Func2.apply(this, arguments);
20914 }
20915
20916 Func.toString = function () {
20917 return _Func2.toString();
20918 };
20919
20920 return Func;
20921 }(function (_ref6) {
20922 var node = _ref6.node;
20923 var signature = node.signature;
20924
20925 if (signature.type !== "Signature") {
20926 return;
20927 } // $FlowIgnore
20928
20929
20930 var nodeName = node.name;
20931 var indexBasedFunctionName = nodeName.value;
20932 var functionIndex = Number(indexBasedFunctionName.replace("func_", ""));
20933 signature.params.forEach(function (param, paramIndex) {
20934 var paramName = localNames.find(function (f) {
20935 return f.localIndex === paramIndex && f.functionIndex === functionIndex;
20936 });
20937
20938 if (paramName && paramName.name !== "") {
20939 param.id = paramName.name;
20940 }
20941 });
20942 })
20943 });
20944}
20945
20946function restoreModuleName(ast) {
20947 t.traverse(ast, {
20948 ModuleNameMetadata: function (_ModuleNameMetadata) {
20949 function ModuleNameMetadata(_x6) {
20950 return _ModuleNameMetadata.apply(this, arguments);
20951 }
20952
20953 ModuleNameMetadata.toString = function () {
20954 return _ModuleNameMetadata.toString();
20955 };
20956
20957 return ModuleNameMetadata;
20958 }(function (moduleNameMetadataPath) {
20959 // update module
20960 t.traverse(ast, {
20961 Module: function (_Module) {
20962 function Module(_x7) {
20963 return _Module.apply(this, arguments);
20964 }
20965
20966 Module.toString = function () {
20967 return _Module.toString();
20968 };
20969
20970 return Module;
20971 }(function (_ref7) {
20972 var node = _ref7.node;
20973 var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
20974
20975 if (name === "") {
20976 name = null;
20977 }
20978
20979 node.id = name;
20980 })
20981 });
20982 })
20983 });
20984}
20985
20986function decode(buf, customOpts) {
20987 var opts = Object.assign({}, defaultDecoderOpts, customOpts);
20988 var ast = decoder.decode(buf, opts);
20989
20990 if (opts.ignoreCustomNameSection === false) {
20991 restoreFunctionNames(ast);
20992 restoreLocalNames(ast);
20993 restoreModuleName(ast);
20994 }
20995
20996 return ast;
20997}
20998
20999/***/ }),
21000
21001/***/ 68693:
21002/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
21003
21004"use strict";
21005
21006
21007Object.defineProperty(exports, "__esModule", ({
21008 value: true
21009}));
21010exports.parse = parse;
21011
21012var _helperCodeFrame = __webpack_require__(48333);
21013
21014var t = _interopRequireWildcard(__webpack_require__(17373));
21015
21016var _numberLiterals = __webpack_require__(3425);
21017
21018var _stringLiterals = __webpack_require__(27481);
21019
21020var _tokenizer = __webpack_require__(57261);
21021
21022function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
21023
21024function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21025
21026function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
21027
21028function hasPlugin(name) {
21029 if (name !== "wast") throw new Error("unknow plugin");
21030 return true;
21031}
21032
21033function isKeyword(token, id) {
21034 return token.type === _tokenizer.tokens.keyword && token.value === id;
21035}
21036
21037function tokenToString(token) {
21038 if (token.type === "keyword") {
21039 return "keyword (".concat(token.value, ")");
21040 }
21041
21042 return token.type;
21043}
21044
21045function identifierFromToken(token) {
21046 var _token$loc = token.loc,
21047 end = _token$loc.end,
21048 start = _token$loc.start;
21049 return t.withLoc(t.identifier(token.value), end, start);
21050}
21051
21052function parse(tokensList, source) {
21053 var current = 0;
21054 var getUniqueName = t.getUniqueNameGenerator();
21055 var state = {
21056 registredExportedElements: []
21057 }; // But this time we're going to use recursion instead of a `while` loop. So we
21058 // define a `walk` function.
21059
21060 function walk() {
21061 var token = tokensList[current];
21062
21063 function eatToken() {
21064 token = tokensList[++current];
21065 }
21066
21067 function getEndLoc() {
21068 var currentToken = token;
21069
21070 if (typeof currentToken === "undefined") {
21071 var lastToken = tokensList[tokensList.length - 1];
21072 currentToken = lastToken;
21073 }
21074
21075 return currentToken.loc.end;
21076 }
21077
21078 function getStartLoc() {
21079 return token.loc.start;
21080 }
21081
21082 function eatTokenOfType(type) {
21083 if (token.type !== type) {
21084 throw new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "Assertion error: expected token of type " + type + ", given " + tokenToString(token));
21085 }
21086
21087 eatToken();
21088 }
21089
21090 function parseExportIndex(token) {
21091 if (token.type === _tokenizer.tokens.identifier) {
21092 var index = identifierFromToken(token);
21093 eatToken();
21094 return index;
21095 } else if (token.type === _tokenizer.tokens.number) {
21096 var _index = t.numberLiteralFromRaw(token.value);
21097
21098 eatToken();
21099 return _index;
21100 } else {
21101 throw function () {
21102 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "unknown export index" + ", given " + tokenToString(token));
21103 }();
21104 }
21105 }
21106
21107 function lookaheadAndCheck() {
21108 var len = arguments.length;
21109
21110 for (var i = 0; i < len; i++) {
21111 var tokenAhead = tokensList[current + i];
21112 var expectedToken = i < 0 || arguments.length <= i ? undefined : arguments[i];
21113
21114 if (tokenAhead.type === "keyword") {
21115 if (isKeyword(tokenAhead, expectedToken) === false) {
21116 return false;
21117 }
21118 } else if (expectedToken !== tokenAhead.type) {
21119 return false;
21120 }
21121 }
21122
21123 return true;
21124 } // TODO(sven): there is probably a better way to do this
21125 // can refactor it if it get out of hands
21126
21127
21128 function maybeIgnoreComment() {
21129 if (typeof token === "undefined") {
21130 // Ignore
21131 return;
21132 }
21133
21134 while (token.type === _tokenizer.tokens.comment) {
21135 eatToken();
21136
21137 if (typeof token === "undefined") {
21138 // Hit the end
21139 break;
21140 }
21141 }
21142 }
21143 /**
21144 * Parses a memory instruction
21145 *
21146 * WAST:
21147 *
21148 * memory: ( memory <name>? <memory_sig> )
21149 * ( memory <name>? ( export <string> ) <...> )
21150 * ( memory <name>? ( import <string> <string> ) <memory_sig> )
21151 * ( memory <name>? ( export <string> )* ( data <string>* )
21152 * memory_sig: <nat> <nat>?
21153 *
21154 */
21155
21156
21157 function parseMemory() {
21158 var id = t.identifier(getUniqueName("memory"));
21159 var limits = t.limit(0);
21160
21161 if (token.type === _tokenizer.tokens.string || token.type === _tokenizer.tokens.identifier) {
21162 id = t.identifier(token.value);
21163 eatToken();
21164 } else {
21165 id = t.withRaw(id, ""); // preserve anonymous
21166 }
21167 /**
21168 * Maybe data
21169 */
21170
21171
21172 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.data)) {
21173 eatToken(); // (
21174
21175 eatToken(); // data
21176 // TODO(sven): do something with the data collected here
21177
21178 var stringInitializer = token.value;
21179 eatTokenOfType(_tokenizer.tokens.string); // Update limits accordingly
21180
21181 limits = t.limit(stringInitializer.length);
21182 eatTokenOfType(_tokenizer.tokens.closeParen);
21183 }
21184 /**
21185 * Maybe export
21186 */
21187
21188
21189 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.export)) {
21190 eatToken(); // (
21191
21192 eatToken(); // export
21193
21194 if (token.type !== _tokenizer.tokens.string) {
21195 throw function () {
21196 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Expected string in export" + ", given " + tokenToString(token));
21197 }();
21198 }
21199
21200 var _name = token.value;
21201 eatToken();
21202 state.registredExportedElements.push({
21203 exportType: "Memory",
21204 name: _name,
21205 id: id
21206 });
21207 eatTokenOfType(_tokenizer.tokens.closeParen);
21208 }
21209 /**
21210 * Memory signature
21211 */
21212
21213
21214 if (token.type === _tokenizer.tokens.number) {
21215 limits = t.limit((0, _numberLiterals.parse32I)(token.value));
21216 eatToken();
21217
21218 if (token.type === _tokenizer.tokens.number) {
21219 limits.max = (0, _numberLiterals.parse32I)(token.value);
21220 eatToken();
21221 }
21222 }
21223
21224 return t.memory(limits, id);
21225 }
21226 /**
21227 * Parses a data section
21228 * https://webassembly.github.io/spec/core/text/modules.html#data-segments
21229 *
21230 * WAST:
21231 *
21232 * data: ( data <index>? <offset> <string> )
21233 */
21234
21235
21236 function parseData() {
21237 // optional memory index
21238 var memidx = 0;
21239
21240 if (token.type === _tokenizer.tokens.number) {
21241 memidx = token.value;
21242 eatTokenOfType(_tokenizer.tokens.number); // .
21243 }
21244
21245 eatTokenOfType(_tokenizer.tokens.openParen);
21246 var offset;
21247
21248 if (token.type === _tokenizer.tokens.valtype) {
21249 eatTokenOfType(_tokenizer.tokens.valtype); // i32
21250
21251 eatTokenOfType(_tokenizer.tokens.dot); // .
21252
21253 if (token.value !== "const") {
21254 throw new Error("constant expression required");
21255 }
21256
21257 eatTokenOfType(_tokenizer.tokens.name); // const
21258
21259 var numberLiteral = t.numberLiteralFromRaw(token.value, "i32");
21260 offset = t.objectInstruction("const", "i32", [numberLiteral]);
21261 eatToken();
21262 eatTokenOfType(_tokenizer.tokens.closeParen);
21263 } else {
21264 eatTokenOfType(_tokenizer.tokens.name); // get_global
21265
21266 var _numberLiteral = t.numberLiteralFromRaw(token.value, "i32");
21267
21268 offset = t.instruction("get_global", [_numberLiteral]);
21269 eatToken();
21270 eatTokenOfType(_tokenizer.tokens.closeParen);
21271 }
21272
21273 var byteArray = (0, _stringLiterals.parseString)(token.value);
21274 eatToken(); // "string"
21275
21276 return t.data(t.memIndexLiteral(memidx), offset, t.byteArray(byteArray));
21277 }
21278 /**
21279 * Parses a table instruction
21280 *
21281 * WAST:
21282 *
21283 * table: ( table <name>? <table_type> )
21284 * ( table <name>? ( export <string> ) <...> )
21285 * ( table <name>? ( import <string> <string> ) <table_type> )
21286 * ( table <name>? ( export <string> )* <elem_type> ( elem <var>* ) )
21287 *
21288 * table_type: <nat> <nat>? <elem_type>
21289 * elem_type: anyfunc
21290 *
21291 * elem: ( elem <var>? (offset <instr>* ) <var>* )
21292 * ( elem <var>? <expr> <var>* )
21293 */
21294
21295
21296 function parseTable() {
21297 var name = t.identifier(getUniqueName("table"));
21298 var limit = t.limit(0);
21299 var elemIndices = [];
21300 var elemType = "anyfunc";
21301
21302 if (token.type === _tokenizer.tokens.string || token.type === _tokenizer.tokens.identifier) {
21303 name = identifierFromToken(token);
21304 eatToken();
21305 } else {
21306 name = t.withRaw(name, ""); // preserve anonymous
21307 }
21308
21309 while (token.type !== _tokenizer.tokens.closeParen) {
21310 /**
21311 * Maybe export
21312 */
21313 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.elem)) {
21314 eatToken(); // (
21315
21316 eatToken(); // elem
21317
21318 while (token.type === _tokenizer.tokens.identifier) {
21319 elemIndices.push(t.identifier(token.value));
21320 eatToken();
21321 }
21322
21323 eatTokenOfType(_tokenizer.tokens.closeParen);
21324 } else if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.export)) {
21325 eatToken(); // (
21326
21327 eatToken(); // export
21328
21329 if (token.type !== _tokenizer.tokens.string) {
21330 throw function () {
21331 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Expected string in export" + ", given " + tokenToString(token));
21332 }();
21333 }
21334
21335 var exportName = token.value;
21336 eatToken();
21337 state.registredExportedElements.push({
21338 exportType: "Table",
21339 name: exportName,
21340 id: name
21341 });
21342 eatTokenOfType(_tokenizer.tokens.closeParen);
21343 } else if (isKeyword(token, _tokenizer.keywords.anyfunc)) {
21344 // It's the default value, we can ignore it
21345 eatToken(); // anyfunc
21346 } else if (token.type === _tokenizer.tokens.number) {
21347 /**
21348 * Table type
21349 */
21350 var min = parseInt(token.value);
21351 eatToken();
21352
21353 if (token.type === _tokenizer.tokens.number) {
21354 var max = parseInt(token.value);
21355 eatToken();
21356 limit = t.limit(min, max);
21357 } else {
21358 limit = t.limit(min);
21359 }
21360
21361 eatToken();
21362 } else {
21363 throw function () {
21364 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token" + ", given " + tokenToString(token));
21365 }();
21366 }
21367 }
21368
21369 if (elemIndices.length > 0) {
21370 return t.table(elemType, limit, name, elemIndices);
21371 } else {
21372 return t.table(elemType, limit, name);
21373 }
21374 }
21375 /**
21376 * Parses an import statement
21377 *
21378 * WAST:
21379 *
21380 * import: ( import <string> <string> <imkind> )
21381 * imkind: ( func <name>? <func_sig> )
21382 * ( global <name>? <global_sig> )
21383 * ( table <name>? <table_sig> )
21384 * ( memory <name>? <memory_sig> )
21385 *
21386 * global_sig: <type> | ( mut <type> )
21387 */
21388
21389
21390 function parseImport() {
21391 if (token.type !== _tokenizer.tokens.string) {
21392 throw new Error("Expected a string, " + token.type + " given.");
21393 }
21394
21395 var moduleName = token.value;
21396 eatToken();
21397
21398 if (token.type !== _tokenizer.tokens.string) {
21399 throw new Error("Expected a string, " + token.type + " given.");
21400 }
21401
21402 var name = token.value;
21403 eatToken();
21404 eatTokenOfType(_tokenizer.tokens.openParen);
21405 var descr;
21406
21407 if (isKeyword(token, _tokenizer.keywords.func)) {
21408 eatToken(); // keyword
21409
21410 var fnParams = [];
21411 var fnResult = [];
21412 var typeRef;
21413 var fnName = t.identifier(getUniqueName("func"));
21414
21415 if (token.type === _tokenizer.tokens.identifier) {
21416 fnName = identifierFromToken(token);
21417 eatToken();
21418 }
21419
21420 while (token.type === _tokenizer.tokens.openParen) {
21421 eatToken();
21422
21423 if (lookaheadAndCheck(_tokenizer.keywords.type) === true) {
21424 eatToken();
21425 typeRef = parseTypeReference();
21426 } else if (lookaheadAndCheck(_tokenizer.keywords.param) === true) {
21427 eatToken();
21428 fnParams.push.apply(fnParams, _toConsumableArray(parseFuncParam()));
21429 } else if (lookaheadAndCheck(_tokenizer.keywords.result) === true) {
21430 eatToken();
21431 fnResult.push.apply(fnResult, _toConsumableArray(parseFuncResult()));
21432 } else {
21433 throw function () {
21434 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in import of type" + ", given " + tokenToString(token));
21435 }();
21436 }
21437
21438 eatTokenOfType(_tokenizer.tokens.closeParen);
21439 }
21440
21441 if (typeof fnName === "undefined") {
21442 throw new Error("Imported function must have a name");
21443 }
21444
21445 descr = t.funcImportDescr(fnName, typeRef !== undefined ? typeRef : t.signature(fnParams, fnResult));
21446 } else if (isKeyword(token, _tokenizer.keywords.global)) {
21447 eatToken(); // keyword
21448
21449 if (token.type === _tokenizer.tokens.openParen) {
21450 eatToken(); // (
21451
21452 eatTokenOfType(_tokenizer.tokens.keyword); // mut keyword
21453
21454 var valtype = token.value;
21455 eatToken();
21456 descr = t.globalType(valtype, "var");
21457 eatTokenOfType(_tokenizer.tokens.closeParen);
21458 } else {
21459 var _valtype = token.value;
21460 eatTokenOfType(_tokenizer.tokens.valtype);
21461 descr = t.globalType(_valtype, "const");
21462 }
21463 } else if (isKeyword(token, _tokenizer.keywords.memory) === true) {
21464 eatToken(); // Keyword
21465
21466 descr = parseMemory();
21467 } else if (isKeyword(token, _tokenizer.keywords.table) === true) {
21468 eatToken(); // Keyword
21469
21470 descr = parseTable();
21471 } else {
21472 throw new Error("Unsupported import type: " + tokenToString(token));
21473 }
21474
21475 eatTokenOfType(_tokenizer.tokens.closeParen);
21476 return t.moduleImport(moduleName, name, descr);
21477 }
21478 /**
21479 * Parses a block instruction
21480 *
21481 * WAST:
21482 *
21483 * expr: ( block <name>? <block_sig> <instr>* )
21484 * instr: block <name>? <block_sig> <instr>* end <name>?
21485 * block_sig : ( result <type>* )*
21486 *
21487 */
21488
21489
21490 function parseBlock() {
21491 var label = t.identifier(getUniqueName("block"));
21492 var blockResult = null;
21493 var instr = [];
21494
21495 if (token.type === _tokenizer.tokens.identifier) {
21496 label = identifierFromToken(token);
21497 eatToken();
21498 } else {
21499 label = t.withRaw(label, ""); // preserve anonymous
21500 }
21501
21502 while (token.type === _tokenizer.tokens.openParen) {
21503 eatToken();
21504
21505 if (lookaheadAndCheck(_tokenizer.keywords.result) === true) {
21506 eatToken();
21507 blockResult = token.value;
21508 eatToken();
21509 } else if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21510 ) {
21511 // Instruction
21512 instr.push(parseFuncInstr());
21513 } else {
21514 throw function () {
21515 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in block body of type" + ", given " + tokenToString(token));
21516 }();
21517 }
21518
21519 maybeIgnoreComment();
21520 eatTokenOfType(_tokenizer.tokens.closeParen);
21521 }
21522
21523 return t.blockInstruction(label, instr, blockResult);
21524 }
21525 /**
21526 * Parses a if instruction
21527 *
21528 * WAST:
21529 *
21530 * expr:
21531 * ( if <name>? <block_sig> ( then <instr>* ) ( else <instr>* )? )
21532 * ( if <name>? <block_sig> <expr>+ ( then <instr>* ) ( else <instr>* )? )
21533 *
21534 * instr:
21535 * if <name>? <block_sig> <instr>* end <name>?
21536 * if <name>? <block_sig> <instr>* else <name>? <instr>* end <name>?
21537 *
21538 * block_sig : ( result <type>* )*
21539 *
21540 */
21541
21542
21543 function parseIf() {
21544 var blockResult = null;
21545 var label = t.identifier(getUniqueName("if"));
21546 var testInstrs = [];
21547 var consequent = [];
21548 var alternate = [];
21549
21550 if (token.type === _tokenizer.tokens.identifier) {
21551 label = identifierFromToken(token);
21552 eatToken();
21553 } else {
21554 label = t.withRaw(label, ""); // preserve anonymous
21555 }
21556
21557 while (token.type === _tokenizer.tokens.openParen) {
21558 eatToken(); // (
21559
21560 /**
21561 * Block signature
21562 */
21563
21564 if (isKeyword(token, _tokenizer.keywords.result) === true) {
21565 eatToken();
21566 blockResult = token.value;
21567 eatTokenOfType(_tokenizer.tokens.valtype);
21568 eatTokenOfType(_tokenizer.tokens.closeParen);
21569 continue;
21570 }
21571 /**
21572 * Then
21573 */
21574
21575
21576 if (isKeyword(token, _tokenizer.keywords.then) === true) {
21577 eatToken(); // then
21578
21579 while (token.type === _tokenizer.tokens.openParen) {
21580 eatToken(); // Instruction
21581
21582 if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21583 ) {
21584 consequent.push(parseFuncInstr());
21585 } else {
21586 throw function () {
21587 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in consequent body of type" + ", given " + tokenToString(token));
21588 }();
21589 }
21590
21591 eatTokenOfType(_tokenizer.tokens.closeParen);
21592 }
21593
21594 eatTokenOfType(_tokenizer.tokens.closeParen);
21595 continue;
21596 }
21597 /**
21598 * Alternate
21599 */
21600
21601
21602 if (isKeyword(token, _tokenizer.keywords.else)) {
21603 eatToken(); // else
21604
21605 while (token.type === _tokenizer.tokens.openParen) {
21606 eatToken(); // Instruction
21607
21608 if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21609 ) {
21610 alternate.push(parseFuncInstr());
21611 } else {
21612 throw function () {
21613 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in alternate body of type" + ", given " + tokenToString(token));
21614 }();
21615 }
21616
21617 eatTokenOfType(_tokenizer.tokens.closeParen);
21618 }
21619
21620 eatTokenOfType(_tokenizer.tokens.closeParen);
21621 continue;
21622 }
21623 /**
21624 * Test instruction
21625 */
21626
21627
21628 if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21629 ) {
21630 testInstrs.push(parseFuncInstr());
21631 eatTokenOfType(_tokenizer.tokens.closeParen);
21632 continue;
21633 }
21634
21635 throw function () {
21636 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in if body" + ", given " + tokenToString(token));
21637 }();
21638 }
21639
21640 return t.ifInstruction(label, testInstrs, blockResult, consequent, alternate);
21641 }
21642 /**
21643 * Parses a loop instruction
21644 *
21645 * WAT:
21646 *
21647 * blockinstr :: 'loop' I:label rt:resulttype (in:instr*) 'end' id?
21648 *
21649 * WAST:
21650 *
21651 * instr :: loop <name>? <block_sig> <instr>* end <name>?
21652 * expr :: ( loop <name>? <block_sig> <instr>* )
21653 * block_sig :: ( result <type>* )*
21654 *
21655 */
21656
21657
21658 function parseLoop() {
21659 var label = t.identifier(getUniqueName("loop"));
21660 var blockResult;
21661 var instr = [];
21662
21663 if (token.type === _tokenizer.tokens.identifier) {
21664 label = identifierFromToken(token);
21665 eatToken();
21666 } else {
21667 label = t.withRaw(label, ""); // preserve anonymous
21668 }
21669
21670 while (token.type === _tokenizer.tokens.openParen) {
21671 eatToken();
21672
21673 if (lookaheadAndCheck(_tokenizer.keywords.result) === true) {
21674 eatToken();
21675 blockResult = token.value;
21676 eatToken();
21677 } else if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21678 ) {
21679 // Instruction
21680 instr.push(parseFuncInstr());
21681 } else {
21682 throw function () {
21683 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in loop body" + ", given " + tokenToString(token));
21684 }();
21685 }
21686
21687 eatTokenOfType(_tokenizer.tokens.closeParen);
21688 }
21689
21690 return t.loopInstruction(label, blockResult, instr);
21691 }
21692
21693 function parseCallIndirect() {
21694 var typeRef;
21695 var params = [];
21696 var results = [];
21697 var instrs = [];
21698
21699 while (token.type !== _tokenizer.tokens.closeParen) {
21700 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.type)) {
21701 eatToken(); // (
21702
21703 eatToken(); // type
21704
21705 typeRef = parseTypeReference();
21706 } else if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.param)) {
21707 eatToken(); // (
21708
21709 eatToken(); // param
21710
21711 /**
21712 * Params can be empty:
21713 * (params)`
21714 */
21715
21716 if (token.type !== _tokenizer.tokens.closeParen) {
21717 params.push.apply(params, _toConsumableArray(parseFuncParam()));
21718 }
21719 } else if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.result)) {
21720 eatToken(); // (
21721
21722 eatToken(); // result
21723
21724 /**
21725 * Results can be empty:
21726 * (result)`
21727 */
21728
21729 if (token.type !== _tokenizer.tokens.closeParen) {
21730 results.push.apply(results, _toConsumableArray(parseFuncResult()));
21731 }
21732 } else {
21733 eatTokenOfType(_tokenizer.tokens.openParen);
21734 instrs.push(parseFuncInstr());
21735 }
21736
21737 eatTokenOfType(_tokenizer.tokens.closeParen);
21738 }
21739
21740 return t.callIndirectInstruction(typeRef !== undefined ? typeRef : t.signature(params, results), instrs);
21741 }
21742 /**
21743 * Parses an export instruction
21744 *
21745 * WAT:
21746 *
21747 * export: ( export <string> <exkind> )
21748 * exkind: ( func <var> )
21749 * ( global <var> )
21750 * ( table <var> )
21751 * ( memory <var> )
21752 * var: <nat> | <name>
21753 *
21754 */
21755
21756
21757 function parseExport() {
21758 if (token.type !== _tokenizer.tokens.string) {
21759 throw new Error("Expected string after export, got: " + token.type);
21760 }
21761
21762 var name = token.value;
21763 eatToken();
21764 var moduleExportDescr = parseModuleExportDescr();
21765 return t.moduleExport(name, moduleExportDescr);
21766 }
21767
21768 function parseModuleExportDescr() {
21769 var startLoc = getStartLoc();
21770 var type = "";
21771 var index;
21772 eatTokenOfType(_tokenizer.tokens.openParen);
21773
21774 while (token.type !== _tokenizer.tokens.closeParen) {
21775 if (isKeyword(token, _tokenizer.keywords.func)) {
21776 type = "Func";
21777 eatToken();
21778 index = parseExportIndex(token);
21779 } else if (isKeyword(token, _tokenizer.keywords.table)) {
21780 type = "Table";
21781 eatToken();
21782 index = parseExportIndex(token);
21783 } else if (isKeyword(token, _tokenizer.keywords.global)) {
21784 type = "Global";
21785 eatToken();
21786 index = parseExportIndex(token);
21787 } else if (isKeyword(token, _tokenizer.keywords.memory)) {
21788 type = "Memory";
21789 eatToken();
21790 index = parseExportIndex(token);
21791 }
21792
21793 eatToken();
21794 }
21795
21796 if (type === "") {
21797 throw new Error("Unknown export type");
21798 }
21799
21800 if (index === undefined) {
21801 throw new Error("Exported function must have a name");
21802 }
21803
21804 var node = t.moduleExportDescr(type, index);
21805 var endLoc = getEndLoc();
21806 eatTokenOfType(_tokenizer.tokens.closeParen);
21807 return t.withLoc(node, endLoc, startLoc);
21808 }
21809
21810 function parseModule() {
21811 var name = null;
21812 var isBinary = false;
21813 var isQuote = false;
21814 var moduleFields = [];
21815
21816 if (token.type === _tokenizer.tokens.identifier) {
21817 name = token.value;
21818 eatToken();
21819 }
21820
21821 if (hasPlugin("wast") && token.type === _tokenizer.tokens.name && token.value === "binary") {
21822 eatToken();
21823 isBinary = true;
21824 }
21825
21826 if (hasPlugin("wast") && token.type === _tokenizer.tokens.name && token.value === "quote") {
21827 eatToken();
21828 isQuote = true;
21829 }
21830
21831 if (isBinary === true) {
21832 var blob = [];
21833
21834 while (token.type === _tokenizer.tokens.string) {
21835 blob.push(token.value);
21836 eatToken();
21837 maybeIgnoreComment();
21838 }
21839
21840 eatTokenOfType(_tokenizer.tokens.closeParen);
21841 return t.binaryModule(name, blob);
21842 }
21843
21844 if (isQuote === true) {
21845 var string = [];
21846
21847 while (token.type === _tokenizer.tokens.string) {
21848 string.push(token.value);
21849 eatToken();
21850 }
21851
21852 eatTokenOfType(_tokenizer.tokens.closeParen);
21853 return t.quoteModule(name, string);
21854 }
21855
21856 while (token.type !== _tokenizer.tokens.closeParen) {
21857 moduleFields.push(walk());
21858
21859 if (state.registredExportedElements.length > 0) {
21860 state.registredExportedElements.forEach(function (decl) {
21861 moduleFields.push(t.moduleExport(decl.name, t.moduleExportDescr(decl.exportType, decl.id)));
21862 });
21863 state.registredExportedElements = [];
21864 }
21865
21866 token = tokensList[current];
21867 }
21868
21869 eatTokenOfType(_tokenizer.tokens.closeParen);
21870 return t.module(name, moduleFields);
21871 }
21872 /**
21873 * Parses the arguments of an instruction
21874 */
21875
21876
21877 function parseFuncInstrArguments(signature) {
21878 var args = [];
21879 var namedArgs = {};
21880 var signaturePtr = 0;
21881
21882 while (token.type === _tokenizer.tokens.name || isKeyword(token, _tokenizer.keywords.offset)) {
21883 var key = token.value;
21884 eatToken();
21885 eatTokenOfType(_tokenizer.tokens.equal);
21886 var value = void 0;
21887
21888 if (token.type === _tokenizer.tokens.number) {
21889 value = t.numberLiteralFromRaw(token.value);
21890 } else {
21891 throw new Error("Unexpected type for argument: " + token.type);
21892 }
21893
21894 namedArgs[key] = value;
21895 eatToken();
21896 } // $FlowIgnore
21897
21898
21899 var signatureLength = signature.vector ? Infinity : signature.length;
21900
21901 while (token.type !== _tokenizer.tokens.closeParen && ( // $FlowIgnore
21902 token.type === _tokenizer.tokens.openParen || signaturePtr < signatureLength)) {
21903 if (token.type === _tokenizer.tokens.identifier) {
21904 args.push(t.identifier(token.value));
21905 eatToken();
21906 } else if (token.type === _tokenizer.tokens.valtype) {
21907 // Handle locals
21908 args.push(t.valtypeLiteral(token.value));
21909 eatToken();
21910 } else if (token.type === _tokenizer.tokens.string) {
21911 args.push(t.stringLiteral(token.value));
21912 eatToken();
21913 } else if (token.type === _tokenizer.tokens.number) {
21914 args.push( // TODO(sven): refactor the type signature handling
21915 // https://github.com/xtuc/webassemblyjs/pull/129 is a good start
21916 t.numberLiteralFromRaw(token.value, // $FlowIgnore
21917 signature[signaturePtr] || "f64")); // $FlowIgnore
21918
21919 if (!signature.vector) {
21920 ++signaturePtr;
21921 }
21922
21923 eatToken();
21924 } else if (token.type === _tokenizer.tokens.openParen) {
21925 /**
21926 * Maybe some nested instructions
21927 */
21928 eatToken(); // Instruction
21929
21930 if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
21931 ) {
21932 // $FlowIgnore
21933 args.push(parseFuncInstr());
21934 } else {
21935 throw function () {
21936 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in nested instruction" + ", given " + tokenToString(token));
21937 }();
21938 }
21939
21940 if (token.type === _tokenizer.tokens.closeParen) {
21941 eatToken();
21942 }
21943 } else {
21944 throw function () {
21945 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in instruction argument" + ", given " + tokenToString(token));
21946 }();
21947 }
21948 }
21949
21950 return {
21951 args: args,
21952 namedArgs: namedArgs
21953 };
21954 }
21955 /**
21956 * Parses an instruction
21957 *
21958 * WAT:
21959 *
21960 * instr :: plaininst
21961 * blockinstr
21962 *
21963 * blockinstr :: 'block' I:label rt:resulttype (in:instr*) 'end' id?
21964 * 'loop' I:label rt:resulttype (in:instr*) 'end' id?
21965 * 'if' I:label rt:resulttype (in:instr*) 'else' id? (in2:intr*) 'end' id?
21966 *
21967 * plaininst :: 'unreachable'
21968 * 'nop'
21969 * 'br' l:labelidx
21970 * 'br_if' l:labelidx
21971 * 'br_table' l*:vec(labelidx) ln:labelidx
21972 * 'return'
21973 * 'call' x:funcidx
21974 * 'call_indirect' x, I:typeuse
21975 *
21976 * WAST:
21977 *
21978 * instr:
21979 * <expr>
21980 * <op>
21981 * block <name>? <block_sig> <instr>* end <name>?
21982 * loop <name>? <block_sig> <instr>* end <name>?
21983 * if <name>? <block_sig> <instr>* end <name>?
21984 * if <name>? <block_sig> <instr>* else <name>? <instr>* end <name>?
21985 *
21986 * expr:
21987 * ( <op> )
21988 * ( <op> <expr>+ )
21989 * ( block <name>? <block_sig> <instr>* )
21990 * ( loop <name>? <block_sig> <instr>* )
21991 * ( if <name>? <block_sig> ( then <instr>* ) ( else <instr>* )? )
21992 * ( if <name>? <block_sig> <expr>+ ( then <instr>* ) ( else <instr>* )? )
21993 *
21994 * op:
21995 * unreachable
21996 * nop
21997 * br <var>
21998 * br_if <var>
21999 * br_table <var>+
22000 * return
22001 * call <var>
22002 * call_indirect <func_sig>
22003 * drop
22004 * select
22005 * get_local <var>
22006 * set_local <var>
22007 * tee_local <var>
22008 * get_global <var>
22009 * set_global <var>
22010 * <type>.load((8|16|32)_<sign>)? <offset>? <align>?
22011 * <type>.store(8|16|32)? <offset>? <align>?
22012 * current_memory
22013 * grow_memory
22014 * <type>.const <value>
22015 * <type>.<unop>
22016 * <type>.<binop>
22017 * <type>.<testop>
22018 * <type>.<relop>
22019 * <type>.<cvtop>/<type>
22020 *
22021 * func_type: ( type <var> )? <param>* <result>*
22022 */
22023
22024
22025 function parseFuncInstr() {
22026 var startLoc = getStartLoc();
22027 maybeIgnoreComment();
22028 /**
22029 * A simple instruction
22030 */
22031
22032 if (token.type === _tokenizer.tokens.name || token.type === _tokenizer.tokens.valtype) {
22033 var _name2 = token.value;
22034 var object;
22035 eatToken();
22036
22037 if (token.type === _tokenizer.tokens.dot) {
22038 object = _name2;
22039 eatToken();
22040
22041 if (token.type !== _tokenizer.tokens.name) {
22042 throw new TypeError("Unknown token: " + token.type + ", name expected");
22043 }
22044
22045 _name2 = token.value;
22046 eatToken();
22047 }
22048
22049 if (token.type === _tokenizer.tokens.closeParen) {
22050 var _endLoc = token.loc.end;
22051
22052 if (typeof object === "undefined") {
22053 return t.withLoc(t.instruction(_name2), _endLoc, startLoc);
22054 } else {
22055 return t.withLoc(t.objectInstruction(_name2, object, []), _endLoc, startLoc);
22056 }
22057 }
22058
22059 var signature = t.signatureForOpcode(object || "", _name2);
22060
22061 var _parseFuncInstrArgume = parseFuncInstrArguments(signature),
22062 _args = _parseFuncInstrArgume.args,
22063 _namedArgs = _parseFuncInstrArgume.namedArgs;
22064
22065 var endLoc = token.loc.end;
22066
22067 if (typeof object === "undefined") {
22068 return t.withLoc(t.instruction(_name2, _args, _namedArgs), endLoc, startLoc);
22069 } else {
22070 return t.withLoc(t.objectInstruction(_name2, object, _args, _namedArgs), endLoc, startLoc);
22071 }
22072 } else if (isKeyword(token, _tokenizer.keywords.loop)) {
22073 /**
22074 * Else a instruction with a keyword (loop or block)
22075 */
22076 eatToken(); // keyword
22077
22078 return parseLoop();
22079 } else if (isKeyword(token, _tokenizer.keywords.block)) {
22080 eatToken(); // keyword
22081
22082 return parseBlock();
22083 } else if (isKeyword(token, _tokenizer.keywords.call_indirect)) {
22084 eatToken(); // keyword
22085
22086 return parseCallIndirect();
22087 } else if (isKeyword(token, _tokenizer.keywords.call)) {
22088 eatToken(); // keyword
22089
22090 var index;
22091
22092 if (token.type === _tokenizer.tokens.identifier) {
22093 index = identifierFromToken(token);
22094 eatToken();
22095 } else if (token.type === _tokenizer.tokens.number) {
22096 index = t.indexLiteral(token.value);
22097 eatToken();
22098 }
22099
22100 var instrArgs = []; // Nested instruction
22101
22102 while (token.type === _tokenizer.tokens.openParen) {
22103 eatToken();
22104 instrArgs.push(parseFuncInstr());
22105 eatTokenOfType(_tokenizer.tokens.closeParen);
22106 }
22107
22108 if (typeof index === "undefined") {
22109 throw new Error("Missing argument in call instruciton");
22110 }
22111
22112 if (instrArgs.length > 0) {
22113 return t.callInstruction(index, instrArgs);
22114 } else {
22115 return t.callInstruction(index);
22116 }
22117 } else if (isKeyword(token, _tokenizer.keywords.if)) {
22118 eatToken(); // Keyword
22119
22120 return parseIf();
22121 } else if (isKeyword(token, _tokenizer.keywords.module) && hasPlugin("wast")) {
22122 eatToken(); // In WAST you can have a module as an instruction's argument
22123 // we will cast it into a instruction to not break the flow
22124 // $FlowIgnore
22125
22126 var module = parseModule();
22127 return module;
22128 } else {
22129 throw function () {
22130 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected instruction in function body" + ", given " + tokenToString(token));
22131 }();
22132 }
22133 }
22134 /*
22135 * Parses a function
22136 *
22137 * WAT:
22138 *
22139 * functype :: ( 'func' t1:vec(param) t2:vec(result) )
22140 * param :: ( 'param' id? t:valtype )
22141 * result :: ( 'result' t:valtype )
22142 *
22143 * WAST:
22144 *
22145 * func :: ( func <name>? <func_sig> <local>* <instr>* )
22146 * ( func <name>? ( export <string> ) <...> )
22147 * ( func <name>? ( import <string> <string> ) <func_sig> )
22148 * func_sig :: ( type <var> )? <param>* <result>*
22149 * param :: ( param <type>* ) | ( param <name> <type> )
22150 * result :: ( result <type>* )
22151 * local :: ( local <type>* ) | ( local <name> <type> )
22152 *
22153 */
22154
22155
22156 function parseFunc() {
22157 var fnName = t.identifier(getUniqueName("func"));
22158 var typeRef;
22159 var fnBody = [];
22160 var fnParams = [];
22161 var fnResult = []; // name
22162
22163 if (token.type === _tokenizer.tokens.identifier) {
22164 fnName = identifierFromToken(token);
22165 eatToken();
22166 } else {
22167 fnName = t.withRaw(fnName, ""); // preserve anonymous
22168 }
22169
22170 maybeIgnoreComment();
22171
22172 while (token.type === _tokenizer.tokens.openParen || token.type === _tokenizer.tokens.name || token.type === _tokenizer.tokens.valtype) {
22173 // Instructions without parens
22174 if (token.type === _tokenizer.tokens.name || token.type === _tokenizer.tokens.valtype) {
22175 fnBody.push(parseFuncInstr());
22176 continue;
22177 }
22178
22179 eatToken();
22180
22181 if (lookaheadAndCheck(_tokenizer.keywords.param) === true) {
22182 eatToken();
22183 fnParams.push.apply(fnParams, _toConsumableArray(parseFuncParam()));
22184 } else if (lookaheadAndCheck(_tokenizer.keywords.result) === true) {
22185 eatToken();
22186 fnResult.push.apply(fnResult, _toConsumableArray(parseFuncResult()));
22187 } else if (lookaheadAndCheck(_tokenizer.keywords.export) === true) {
22188 eatToken();
22189 parseFuncExport(fnName);
22190 } else if (lookaheadAndCheck(_tokenizer.keywords.type) === true) {
22191 eatToken();
22192 typeRef = parseTypeReference();
22193 } else if (lookaheadAndCheck(_tokenizer.tokens.name) === true || lookaheadAndCheck(_tokenizer.tokens.valtype) === true || token.type === "keyword" // is any keyword
22194 ) {
22195 // Instruction
22196 fnBody.push(parseFuncInstr());
22197 } else {
22198 throw function () {
22199 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in func body" + ", given " + tokenToString(token));
22200 }();
22201 }
22202
22203 eatTokenOfType(_tokenizer.tokens.closeParen);
22204 }
22205
22206 return t.func(fnName, typeRef !== undefined ? typeRef : t.signature(fnParams, fnResult), fnBody);
22207 }
22208 /**
22209 * Parses shorthand export in func
22210 *
22211 * export :: ( export <string> )
22212 */
22213
22214
22215 function parseFuncExport(funcId) {
22216 if (token.type !== _tokenizer.tokens.string) {
22217 throw function () {
22218 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Function export expected a string" + ", given " + tokenToString(token));
22219 }();
22220 }
22221
22222 var name = token.value;
22223 eatToken();
22224 /**
22225 * Func export shorthand, we trait it as a syntaxic sugar.
22226 * A export ModuleField will be added later.
22227 *
22228 * We give the anonymous function a generated name and export it.
22229 */
22230
22231 var id = t.identifier(funcId.value);
22232 state.registredExportedElements.push({
22233 exportType: "Func",
22234 name: name,
22235 id: id
22236 });
22237 }
22238 /**
22239 * Parses a type instruction
22240 *
22241 * WAST:
22242 *
22243 * typedef: ( type <name>? ( func <param>* <result>* ) )
22244 */
22245
22246
22247 function parseType() {
22248 var id;
22249 var params = [];
22250 var result = [];
22251
22252 if (token.type === _tokenizer.tokens.identifier) {
22253 id = identifierFromToken(token);
22254 eatToken();
22255 }
22256
22257 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.func)) {
22258 eatToken(); // (
22259
22260 eatToken(); // func
22261
22262 if (token.type === _tokenizer.tokens.closeParen) {
22263 eatToken(); // function with an empty signature, we can abort here
22264
22265 return t.typeInstruction(id, t.signature([], []));
22266 }
22267
22268 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.param)) {
22269 eatToken(); // (
22270
22271 eatToken(); // param
22272
22273 params = parseFuncParam();
22274 eatTokenOfType(_tokenizer.tokens.closeParen);
22275 }
22276
22277 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.result)) {
22278 eatToken(); // (
22279
22280 eatToken(); // result
22281
22282 result = parseFuncResult();
22283 eatTokenOfType(_tokenizer.tokens.closeParen);
22284 }
22285
22286 eatTokenOfType(_tokenizer.tokens.closeParen);
22287 }
22288
22289 return t.typeInstruction(id, t.signature(params, result));
22290 }
22291 /**
22292 * Parses a function result
22293 *
22294 * WAST:
22295 *
22296 * result :: ( result <type>* )
22297 */
22298
22299
22300 function parseFuncResult() {
22301 var results = [];
22302
22303 while (token.type !== _tokenizer.tokens.closeParen) {
22304 if (token.type !== _tokenizer.tokens.valtype) {
22305 throw function () {
22306 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unexpected token in func result" + ", given " + tokenToString(token));
22307 }();
22308 }
22309
22310 var valtype = token.value;
22311 eatToken();
22312 results.push(valtype);
22313 }
22314
22315 return results;
22316 }
22317 /**
22318 * Parses a type reference
22319 *
22320 */
22321
22322
22323 function parseTypeReference() {
22324 var ref;
22325
22326 if (token.type === _tokenizer.tokens.identifier) {
22327 ref = identifierFromToken(token);
22328 eatToken();
22329 } else if (token.type === _tokenizer.tokens.number) {
22330 ref = t.numberLiteralFromRaw(token.value);
22331 eatToken();
22332 }
22333
22334 return ref;
22335 }
22336 /**
22337 * Parses a global instruction
22338 *
22339 * WAST:
22340 *
22341 * global: ( global <name>? <global_sig> <instr>* )
22342 * ( global <name>? ( export <string> ) <...> )
22343 * ( global <name>? ( import <string> <string> ) <global_sig> )
22344 *
22345 * global_sig: <type> | ( mut <type> )
22346 *
22347 */
22348
22349
22350 function parseGlobal() {
22351 var name = t.identifier(getUniqueName("global"));
22352 var type; // Keep informations in case of a shorthand import
22353
22354 var importing = null;
22355 maybeIgnoreComment();
22356
22357 if (token.type === _tokenizer.tokens.identifier) {
22358 name = identifierFromToken(token);
22359 eatToken();
22360 } else {
22361 name = t.withRaw(name, ""); // preserve anonymous
22362 }
22363 /**
22364 * maybe export
22365 */
22366
22367
22368 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.export)) {
22369 eatToken(); // (
22370
22371 eatToken(); // export
22372
22373 var exportName = token.value;
22374 eatTokenOfType(_tokenizer.tokens.string);
22375 state.registredExportedElements.push({
22376 exportType: "Global",
22377 name: exportName,
22378 id: name
22379 });
22380 eatTokenOfType(_tokenizer.tokens.closeParen);
22381 }
22382 /**
22383 * maybe import
22384 */
22385
22386
22387 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.import)) {
22388 eatToken(); // (
22389
22390 eatToken(); // import
22391
22392 var moduleName = token.value;
22393 eatTokenOfType(_tokenizer.tokens.string);
22394 var _name3 = token.value;
22395 eatTokenOfType(_tokenizer.tokens.string);
22396 importing = {
22397 module: moduleName,
22398 name: _name3,
22399 descr: undefined
22400 };
22401 eatTokenOfType(_tokenizer.tokens.closeParen);
22402 }
22403 /**
22404 * global_sig
22405 */
22406
22407
22408 if (token.type === _tokenizer.tokens.valtype) {
22409 type = t.globalType(token.value, "const");
22410 eatToken();
22411 } else if (token.type === _tokenizer.tokens.openParen) {
22412 eatToken(); // (
22413
22414 if (isKeyword(token, _tokenizer.keywords.mut) === false) {
22415 throw function () {
22416 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unsupported global type, expected mut" + ", given " + tokenToString(token));
22417 }();
22418 }
22419
22420 eatToken(); // mut
22421
22422 type = t.globalType(token.value, "var");
22423 eatToken();
22424 eatTokenOfType(_tokenizer.tokens.closeParen);
22425 }
22426
22427 if (type === undefined) {
22428 throw function () {
22429 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Could not determine global type" + ", given " + tokenToString(token));
22430 }();
22431 }
22432
22433 maybeIgnoreComment();
22434 var init = [];
22435
22436 if (importing != null) {
22437 importing.descr = type;
22438 init.push(t.moduleImport(importing.module, importing.name, importing.descr));
22439 }
22440 /**
22441 * instr*
22442 */
22443
22444
22445 while (token.type === _tokenizer.tokens.openParen) {
22446 eatToken();
22447 init.push(parseFuncInstr());
22448 eatTokenOfType(_tokenizer.tokens.closeParen);
22449 }
22450
22451 return t.global(type, init, name);
22452 }
22453 /**
22454 * Parses a function param
22455 *
22456 * WAST:
22457 *
22458 * param :: ( param <type>* ) | ( param <name> <type> )
22459 */
22460
22461
22462 function parseFuncParam() {
22463 var params = [];
22464 var id;
22465 var valtype;
22466
22467 if (token.type === _tokenizer.tokens.identifier) {
22468 id = token.value;
22469 eatToken();
22470 }
22471
22472 if (token.type === _tokenizer.tokens.valtype) {
22473 valtype = token.value;
22474 eatToken();
22475 params.push({
22476 id: id,
22477 valtype: valtype
22478 });
22479 /**
22480 * Shorthand notation for multiple anonymous parameters
22481 * @see https://webassembly.github.io/spec/core/text/types.html#function-types
22482 * @see https://github.com/xtuc/webassemblyjs/issues/6
22483 */
22484
22485 if (id === undefined) {
22486 while (token.type === _tokenizer.tokens.valtype) {
22487 valtype = token.value;
22488 eatToken();
22489 params.push({
22490 id: undefined,
22491 valtype: valtype
22492 });
22493 }
22494 }
22495 } else {// ignore
22496 }
22497
22498 return params;
22499 }
22500 /**
22501 * Parses an element segments instruction
22502 *
22503 * WAST:
22504 *
22505 * elem: ( elem <var>? (offset <instr>* ) <var>* )
22506 * ( elem <var>? <expr> <var>* )
22507 *
22508 * var: <nat> | <name>
22509 */
22510
22511
22512 function parseElem() {
22513 var tableIndex = t.indexLiteral(0);
22514 var offset = [];
22515 var funcs = [];
22516
22517 if (token.type === _tokenizer.tokens.identifier) {
22518 tableIndex = identifierFromToken(token);
22519 eatToken();
22520 }
22521
22522 if (token.type === _tokenizer.tokens.number) {
22523 tableIndex = t.indexLiteral(token.value);
22524 eatToken();
22525 }
22526
22527 while (token.type !== _tokenizer.tokens.closeParen) {
22528 if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.offset)) {
22529 eatToken(); // (
22530
22531 eatToken(); // offset
22532
22533 while (token.type !== _tokenizer.tokens.closeParen) {
22534 eatTokenOfType(_tokenizer.tokens.openParen);
22535 offset.push(parseFuncInstr());
22536 eatTokenOfType(_tokenizer.tokens.closeParen);
22537 }
22538
22539 eatTokenOfType(_tokenizer.tokens.closeParen);
22540 } else if (token.type === _tokenizer.tokens.identifier) {
22541 funcs.push(t.identifier(token.value));
22542 eatToken();
22543 } else if (token.type === _tokenizer.tokens.number) {
22544 funcs.push(t.indexLiteral(token.value));
22545 eatToken();
22546 } else if (token.type === _tokenizer.tokens.openParen) {
22547 eatToken(); // (
22548
22549 offset.push(parseFuncInstr());
22550 eatTokenOfType(_tokenizer.tokens.closeParen);
22551 } else {
22552 throw function () {
22553 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unsupported token in elem" + ", given " + tokenToString(token));
22554 }();
22555 }
22556 }
22557
22558 return t.elem(tableIndex, offset, funcs);
22559 }
22560 /**
22561 * Parses the start instruction in a module
22562 *
22563 * WAST:
22564 *
22565 * start: ( start <var> )
22566 * var: <nat> | <name>
22567 *
22568 * WAT:
22569 * start ::= ‘(’ ‘start’ x:funcidx ‘)’
22570 */
22571
22572
22573 function parseStart() {
22574 if (token.type === _tokenizer.tokens.identifier) {
22575 var index = identifierFromToken(token);
22576 eatToken();
22577 return t.start(index);
22578 }
22579
22580 if (token.type === _tokenizer.tokens.number) {
22581 var _index2 = t.indexLiteral(token.value);
22582
22583 eatToken();
22584 return t.start(_index2);
22585 }
22586
22587 throw new Error("Unknown start, token: " + tokenToString(token));
22588 }
22589
22590 if (token.type === _tokenizer.tokens.openParen) {
22591 eatToken();
22592 var startLoc = getStartLoc();
22593
22594 if (isKeyword(token, _tokenizer.keywords.export)) {
22595 eatToken();
22596 var node = parseExport();
22597
22598 var _endLoc2 = getEndLoc();
22599
22600 return t.withLoc(node, _endLoc2, startLoc);
22601 }
22602
22603 if (isKeyword(token, _tokenizer.keywords.loop)) {
22604 eatToken();
22605
22606 var _node = parseLoop();
22607
22608 var _endLoc3 = getEndLoc();
22609
22610 return t.withLoc(_node, _endLoc3, startLoc);
22611 }
22612
22613 if (isKeyword(token, _tokenizer.keywords.func)) {
22614 eatToken();
22615
22616 var _node2 = parseFunc();
22617
22618 var _endLoc4 = getEndLoc();
22619
22620 maybeIgnoreComment();
22621 eatTokenOfType(_tokenizer.tokens.closeParen);
22622 return t.withLoc(_node2, _endLoc4, startLoc);
22623 }
22624
22625 if (isKeyword(token, _tokenizer.keywords.module)) {
22626 eatToken();
22627
22628 var _node3 = parseModule();
22629
22630 var _endLoc5 = getEndLoc();
22631
22632 return t.withLoc(_node3, _endLoc5, startLoc);
22633 }
22634
22635 if (isKeyword(token, _tokenizer.keywords.import)) {
22636 eatToken();
22637
22638 var _node4 = parseImport();
22639
22640 var _endLoc6 = getEndLoc();
22641
22642 eatTokenOfType(_tokenizer.tokens.closeParen);
22643 return t.withLoc(_node4, _endLoc6, startLoc);
22644 }
22645
22646 if (isKeyword(token, _tokenizer.keywords.block)) {
22647 eatToken();
22648
22649 var _node5 = parseBlock();
22650
22651 var _endLoc7 = getEndLoc();
22652
22653 eatTokenOfType(_tokenizer.tokens.closeParen);
22654 return t.withLoc(_node5, _endLoc7, startLoc);
22655 }
22656
22657 if (isKeyword(token, _tokenizer.keywords.memory)) {
22658 eatToken();
22659
22660 var _node6 = parseMemory();
22661
22662 var _endLoc8 = getEndLoc();
22663
22664 eatTokenOfType(_tokenizer.tokens.closeParen);
22665 return t.withLoc(_node6, _endLoc8, startLoc);
22666 }
22667
22668 if (isKeyword(token, _tokenizer.keywords.data)) {
22669 eatToken();
22670
22671 var _node7 = parseData();
22672
22673 var _endLoc9 = getEndLoc();
22674
22675 eatTokenOfType(_tokenizer.tokens.closeParen);
22676 return t.withLoc(_node7, _endLoc9, startLoc);
22677 }
22678
22679 if (isKeyword(token, _tokenizer.keywords.table)) {
22680 eatToken();
22681
22682 var _node8 = parseTable();
22683
22684 var _endLoc10 = getEndLoc();
22685
22686 eatTokenOfType(_tokenizer.tokens.closeParen);
22687 return t.withLoc(_node8, _endLoc10, startLoc);
22688 }
22689
22690 if (isKeyword(token, _tokenizer.keywords.global)) {
22691 eatToken();
22692
22693 var _node9 = parseGlobal();
22694
22695 var _endLoc11 = getEndLoc();
22696
22697 eatTokenOfType(_tokenizer.tokens.closeParen);
22698 return t.withLoc(_node9, _endLoc11, startLoc);
22699 }
22700
22701 if (isKeyword(token, _tokenizer.keywords.type)) {
22702 eatToken();
22703
22704 var _node10 = parseType();
22705
22706 var _endLoc12 = getEndLoc();
22707
22708 eatTokenOfType(_tokenizer.tokens.closeParen);
22709 return t.withLoc(_node10, _endLoc12, startLoc);
22710 }
22711
22712 if (isKeyword(token, _tokenizer.keywords.start)) {
22713 eatToken();
22714
22715 var _node11 = parseStart();
22716
22717 var _endLoc13 = getEndLoc();
22718
22719 eatTokenOfType(_tokenizer.tokens.closeParen);
22720 return t.withLoc(_node11, _endLoc13, startLoc);
22721 }
22722
22723 if (isKeyword(token, _tokenizer.keywords.elem)) {
22724 eatToken();
22725
22726 var _node12 = parseElem();
22727
22728 var _endLoc14 = getEndLoc();
22729
22730 eatTokenOfType(_tokenizer.tokens.closeParen);
22731 return t.withLoc(_node12, _endLoc14, startLoc);
22732 }
22733
22734 var instruction = parseFuncInstr();
22735 var endLoc = getEndLoc();
22736 maybeIgnoreComment();
22737
22738 if (_typeof(instruction) === "object") {
22739 if (typeof token !== "undefined") {
22740 eatTokenOfType(_tokenizer.tokens.closeParen);
22741 }
22742
22743 return t.withLoc(instruction, endLoc, startLoc);
22744 }
22745 }
22746
22747 if (token.type === _tokenizer.tokens.comment) {
22748 var _startLoc = getStartLoc();
22749
22750 var builder = token.opts.type === "leading" ? t.leadingComment : t.blockComment;
22751
22752 var _node13 = builder(token.value);
22753
22754 eatToken(); // comment
22755
22756 var _endLoc15 = getEndLoc();
22757
22758 return t.withLoc(_node13, _endLoc15, _startLoc);
22759 }
22760
22761 throw function () {
22762 return new Error("\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, token.loc) + "\n" + "Unknown token" + ", given " + tokenToString(token));
22763 }();
22764 }
22765
22766 var body = [];
22767
22768 while (current < tokensList.length) {
22769 body.push(walk());
22770 }
22771
22772 return t.program(body);
22773}
22774
22775/***/ }),
22776
22777/***/ 9016:
22778/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
22779
22780"use strict";
22781
22782
22783Object.defineProperty(exports, "__esModule", ({
22784 value: true
22785}));
22786var _exportNames = {
22787 parse: true
22788};
22789exports.parse = parse;
22790
22791var parser = _interopRequireWildcard(__webpack_require__(68693));
22792
22793var _tokenizer = __webpack_require__(57261);
22794
22795var _numberLiterals = __webpack_require__(3425);
22796
22797Object.keys(_numberLiterals).forEach(function (key) {
22798 if (key === "default" || key === "__esModule") return;
22799 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
22800 Object.defineProperty(exports, key, {
22801 enumerable: true,
22802 get: function get() {
22803 return _numberLiterals[key];
22804 }
22805 });
22806});
22807
22808function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
22809
22810function parse(source) {
22811 var tokens = (0, _tokenizer.tokenize)(source); // We pass the source here to show code frames
22812
22813 var ast = parser.parse(tokens, source);
22814 return ast;
22815}
22816
22817/***/ }),
22818
22819/***/ 3425:
22820/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
22821
22822"use strict";
22823
22824
22825Object.defineProperty(exports, "__esModule", ({
22826 value: true
22827}));
22828exports.parse32F = parse32F;
22829exports.parse64F = parse64F;
22830exports.parse32I = parse32I;
22831exports.parseU32 = parseU32;
22832exports.parse64I = parse64I;
22833exports.isInfLiteral = isInfLiteral;
22834exports.isNanLiteral = isNanLiteral;
22835
22836var _long = _interopRequireDefault(__webpack_require__(77960));
22837
22838var _floatingPointHexParser = _interopRequireDefault(__webpack_require__(54236));
22839
22840var _helperApiError = __webpack_require__(44706);
22841
22842function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22843
22844function parse32F(sourceString) {
22845 if (isHexLiteral(sourceString)) {
22846 return (0, _floatingPointHexParser.default)(sourceString);
22847 }
22848
22849 if (isInfLiteral(sourceString)) {
22850 return sourceString[0] === "-" ? -1 : 1;
22851 }
22852
22853 if (isNanLiteral(sourceString)) {
22854 return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x400000);
22855 }
22856
22857 return parseFloat(sourceString);
22858}
22859
22860function parse64F(sourceString) {
22861 if (isHexLiteral(sourceString)) {
22862 return (0, _floatingPointHexParser.default)(sourceString);
22863 }
22864
22865 if (isInfLiteral(sourceString)) {
22866 return sourceString[0] === "-" ? -1 : 1;
22867 }
22868
22869 if (isNanLiteral(sourceString)) {
22870 return (sourceString[0] === "-" ? -1 : 1) * (sourceString.includes(":") ? parseInt(sourceString.substring(sourceString.indexOf(":") + 1), 16) : 0x8000000000000);
22871 }
22872
22873 if (isHexLiteral(sourceString)) {
22874 return (0, _floatingPointHexParser.default)(sourceString);
22875 }
22876
22877 return parseFloat(sourceString);
22878}
22879
22880function parse32I(sourceString) {
22881 var value = 0;
22882
22883 if (isHexLiteral(sourceString)) {
22884 value = ~~parseInt(sourceString, 16);
22885 } else if (isDecimalExponentLiteral(sourceString)) {
22886 throw new Error("This number literal format is yet to be implemented.");
22887 } else {
22888 value = parseInt(sourceString, 10);
22889 }
22890
22891 return value;
22892}
22893
22894function parseU32(sourceString) {
22895 var value = parse32I(sourceString);
22896
22897 if (value < 0) {
22898 throw new _helperApiError.CompileError("Illegal value for u32: " + sourceString);
22899 }
22900
22901 return value;
22902}
22903
22904function parse64I(sourceString) {
22905 var long;
22906
22907 if (isHexLiteral(sourceString)) {
22908 long = _long.default.fromString(sourceString, false, 16);
22909 } else if (isDecimalExponentLiteral(sourceString)) {
22910 throw new Error("This number literal format is yet to be implemented.");
22911 } else {
22912 long = _long.default.fromString(sourceString);
22913 }
22914
22915 return {
22916 high: long.high,
22917 low: long.low
22918 };
22919}
22920
22921var NAN_WORD = /^\+?-?nan/;
22922var INF_WORD = /^\+?-?inf/;
22923
22924function isInfLiteral(sourceString) {
22925 return INF_WORD.test(sourceString.toLowerCase());
22926}
22927
22928function isNanLiteral(sourceString) {
22929 return NAN_WORD.test(sourceString.toLowerCase());
22930}
22931
22932function isDecimalExponentLiteral(sourceString) {
22933 return !isHexLiteral(sourceString) && sourceString.toUpperCase().includes("E");
22934}
22935
22936function isHexLiteral(sourceString) {
22937 return sourceString.substring(0, 2).toUpperCase() === "0X" || sourceString.substring(0, 3).toUpperCase() === "-0X";
22938}
22939
22940/***/ }),
22941
22942/***/ 27481:
22943/***/ (function(__unused_webpack_module, exports) {
22944
22945"use strict";
22946
22947
22948Object.defineProperty(exports, "__esModule", ({
22949 value: true
22950}));
22951exports.parseString = parseString;
22952// string literal characters cannot contain control codes
22953var CONTROL_CODES = [0, // null
229547, // bell
229558, // backspace
229569, // horizontal
2295710, // line feed
2295811, // vertical tab
2295912, // form feed
2296013, // carriage return
2296126, // Control-Z
2296227, // escape
22963127 // delete
22964]; // escaped sequences can either be a two character hex value, or one of the
22965// following single character codes
22966
22967function decodeControlCharacter(char) {
22968 switch (char) {
22969 case "t":
22970 return 0x09;
22971
22972 case "n":
22973 return 0x0a;
22974
22975 case "r":
22976 return 0x0d;
22977
22978 case '"':
22979 return 0x22;
22980
22981 case "′":
22982 return 0x27;
22983
22984 case "\\":
22985 return 0x5c;
22986 }
22987
22988 return -1;
22989}
22990
22991var ESCAPE_CHAR = 92; // backslash
22992
22993var QUOTE_CHAR = 34; // backslash
22994// parse string as per the spec:
22995// https://webassembly.github.io/spec/core/multipage/text/values.html#text-string
22996
22997function parseString(value) {
22998 var byteArray = [];
22999 var index = 0;
23000
23001 while (index < value.length) {
23002 var charCode = value.charCodeAt(index);
23003
23004 if (CONTROL_CODES.indexOf(charCode) !== -1) {
23005 throw new Error("ASCII control characters are not permitted within string literals");
23006 }
23007
23008 if (charCode === QUOTE_CHAR) {
23009 throw new Error("quotes are not permitted within string literals");
23010 }
23011
23012 if (charCode === ESCAPE_CHAR) {
23013 var firstChar = value.substr(index + 1, 1);
23014 var decodedControlChar = decodeControlCharacter(firstChar);
23015
23016 if (decodedControlChar !== -1) {
23017 // single character escaped values, e.g. \r
23018 byteArray.push(decodedControlChar);
23019 index += 2;
23020 } else {
23021 // hex escaped values, e.g. \2a
23022 var hexValue = value.substr(index + 1, 2);
23023
23024 if (!/^[0-9A-F]{2}$/i.test(hexValue)) {
23025 throw new Error("invalid character encoding");
23026 }
23027
23028 byteArray.push(parseInt(hexValue, 16));
23029 index += 3;
23030 }
23031 } else {
23032 // ASCII encoded values
23033 byteArray.push(charCode);
23034 index++;
23035 }
23036 }
23037
23038 return byteArray;
23039}
23040
23041/***/ }),
23042
23043/***/ 57261:
23044/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
23045
23046"use strict";
23047
23048
23049Object.defineProperty(exports, "__esModule", ({
23050 value: true
23051}));
23052exports.tokenize = tokenize;
23053exports.tokens = exports.keywords = void 0;
23054
23055var _helperFsm = __webpack_require__(38902);
23056
23057var _helperCodeFrame = __webpack_require__(48333);
23058
23059// eslint-disable-next-line
23060function getCodeFrame(source, line, column) {
23061 var loc = {
23062 start: {
23063 line: line,
23064 column: column
23065 }
23066 };
23067 return "\n" + (0, _helperCodeFrame.codeFrameFromSource)(source, loc) + "\n";
23068}
23069
23070var WHITESPACE = /\s/;
23071var PARENS = /\(|\)/;
23072var LETTERS = /[a-z0-9_/]/i;
23073var idchar = /[a-z0-9!#$%&*+./:<=>?@\\[\]^_`|~-]/i;
23074var valtypes = ["i32", "i64", "f32", "f64"];
23075var NUMBERS = /[0-9|.|_]/;
23076var NUMBER_KEYWORDS = /nan|inf/;
23077
23078function isNewLine(char) {
23079 return char.charCodeAt(0) === 10 || char.charCodeAt(0) === 13;
23080}
23081
23082function Token(type, value, start, end) {
23083 var opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
23084 var token = {
23085 type: type,
23086 value: value,
23087 loc: {
23088 start: start,
23089 end: end
23090 }
23091 };
23092
23093 if (Object.keys(opts).length > 0) {
23094 // $FlowIgnore
23095 token["opts"] = opts;
23096 }
23097
23098 return token;
23099}
23100
23101var tokenTypes = {
23102 openParen: "openParen",
23103 closeParen: "closeParen",
23104 number: "number",
23105 string: "string",
23106 name: "name",
23107 identifier: "identifier",
23108 valtype: "valtype",
23109 dot: "dot",
23110 comment: "comment",
23111 equal: "equal",
23112 keyword: "keyword"
23113};
23114var keywords = {
23115 module: "module",
23116 func: "func",
23117 param: "param",
23118 result: "result",
23119 export: "export",
23120 loop: "loop",
23121 block: "block",
23122 if: "if",
23123 then: "then",
23124 else: "else",
23125 call: "call",
23126 call_indirect: "call_indirect",
23127 import: "import",
23128 memory: "memory",
23129 table: "table",
23130 global: "global",
23131 anyfunc: "anyfunc",
23132 mut: "mut",
23133 data: "data",
23134 type: "type",
23135 elem: "elem",
23136 start: "start",
23137 offset: "offset"
23138};
23139exports.keywords = keywords;
23140var NUMERIC_SEPARATOR = "_";
23141/**
23142 * Build the FSM for number literals
23143 */
23144
23145var numberLiteralFSM = new _helperFsm.FSM({
23146 START: [(0, _helperFsm.makeTransition)(/-|\+/, "AFTER_SIGN"), (0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
23147 n: 6
23148 }), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
23149 n: 3
23150 }), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
23151 n: 2
23152 }), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
23153 AFTER_SIGN: [(0, _helperFsm.makeTransition)(/nan:0x/, "NAN_HEX", {
23154 n: 6
23155 }), (0, _helperFsm.makeTransition)(/nan|inf/, "STOP", {
23156 n: 3
23157 }), (0, _helperFsm.makeTransition)(/0x/, "HEX", {
23158 n: 2
23159 }), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC"), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC")],
23160 DEC_FRAC: [(0, _helperFsm.makeTransition)(/[0-9]/, "DEC_FRAC", {
23161 allowedSeparator: NUMERIC_SEPARATOR
23162 }), (0, _helperFsm.makeTransition)(/e|E/, "DEC_SIGNED_EXP")],
23163 DEC: [(0, _helperFsm.makeTransition)(/[0-9]/, "DEC", {
23164 allowedSeparator: NUMERIC_SEPARATOR
23165 }), (0, _helperFsm.makeTransition)(/\./, "DEC_FRAC"), (0, _helperFsm.makeTransition)(/e|E/, "DEC_SIGNED_EXP")],
23166 DEC_SIGNED_EXP: [(0, _helperFsm.makeTransition)(/\+|-/, "DEC_EXP"), (0, _helperFsm.makeTransition)(/[0-9]/, "DEC_EXP")],
23167 DEC_EXP: [(0, _helperFsm.makeTransition)(/[0-9]/, "DEC_EXP", {
23168 allowedSeparator: NUMERIC_SEPARATOR
23169 })],
23170 HEX: [(0, _helperFsm.makeTransition)(/[0-9|A-F|a-f]/, "HEX", {
23171 allowedSeparator: NUMERIC_SEPARATOR
23172 }), (0, _helperFsm.makeTransition)(/\./, "HEX_FRAC"), (0, _helperFsm.makeTransition)(/p|P/, "HEX_SIGNED_EXP")],
23173 HEX_FRAC: [(0, _helperFsm.makeTransition)(/[0-9|A-F|a-f]/, "HEX_FRAC", {
23174 allowedSeparator: NUMERIC_SEPARATOR
23175 }), (0, _helperFsm.makeTransition)(/p|P|/, "HEX_SIGNED_EXP")],
23176 HEX_SIGNED_EXP: [(0, _helperFsm.makeTransition)(/[0-9|+|-]/, "HEX_EXP")],
23177 HEX_EXP: [(0, _helperFsm.makeTransition)(/[0-9]/, "HEX_EXP", {
23178 allowedSeparator: NUMERIC_SEPARATOR
23179 })],
23180 NAN_HEX: [(0, _helperFsm.makeTransition)(/[0-9|A-F|a-f]/, "NAN_HEX", {
23181 allowedSeparator: NUMERIC_SEPARATOR
23182 })],
23183 STOP: []
23184}, "START", "STOP");
23185
23186function tokenize(input) {
23187 var current = 0;
23188 var char = input[current]; // Used by SourceLocation
23189
23190 var column = 1;
23191 var line = 1;
23192 var tokens = [];
23193 /**
23194 * Creates a pushToken function for a given type
23195 */
23196
23197 function pushToken(type) {
23198 return function (v) {
23199 var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23200 var startColumn = opts.startColumn || column - String(v).length;
23201 delete opts.startColumn;
23202 var endColumn = opts.endColumn || startColumn + String(v).length - 1;
23203 delete opts.endColumn;
23204 var start = {
23205 line: line,
23206 column: startColumn
23207 };
23208 var end = {
23209 line: line,
23210 column: endColumn
23211 };
23212 tokens.push(Token(type, v, start, end, opts));
23213 };
23214 }
23215 /**
23216 * Functions to save newly encountered tokens
23217 */
23218
23219
23220 var pushCloseParenToken = pushToken(tokenTypes.closeParen);
23221 var pushOpenParenToken = pushToken(tokenTypes.openParen);
23222 var pushNumberToken = pushToken(tokenTypes.number);
23223 var pushValtypeToken = pushToken(tokenTypes.valtype);
23224 var pushNameToken = pushToken(tokenTypes.name);
23225 var pushIdentifierToken = pushToken(tokenTypes.identifier);
23226 var pushKeywordToken = pushToken(tokenTypes.keyword);
23227 var pushDotToken = pushToken(tokenTypes.dot);
23228 var pushStringToken = pushToken(tokenTypes.string);
23229 var pushCommentToken = pushToken(tokenTypes.comment);
23230 var pushEqualToken = pushToken(tokenTypes.equal);
23231 /**
23232 * Can be used to look at the next character(s).
23233 *
23234 * The default behavior `lookahead()` simply returns the next character without consuming it.
23235 * Letters are always returned in lowercase.
23236 *
23237 * @param {number} length How many characters to query. Default = 1
23238 * @param {number} offset How many characters to skip forward from current one. Default = 1
23239 *
23240 */
23241
23242 function lookahead() {
23243 var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
23244 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
23245 return input.substring(current + offset, current + offset + length).toLowerCase();
23246 }
23247 /**
23248 * Advances the cursor in the input by a certain amount
23249 *
23250 * @param {number} amount How many characters to consume. Default = 1
23251 */
23252
23253
23254 function eatCharacter() {
23255 var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
23256 column += amount;
23257 current += amount;
23258 char = input[current];
23259 }
23260
23261 while (current < input.length) {
23262 // ;;
23263 if (char === ";" && lookahead() === ";") {
23264 var startColumn = column;
23265 eatCharacter(2);
23266 var text = "";
23267
23268 while (!isNewLine(char)) {
23269 text += char;
23270 eatCharacter();
23271
23272 if (char === undefined) {
23273 break;
23274 }
23275 }
23276
23277 var endColumn = column;
23278 pushCommentToken(text, {
23279 type: "leading",
23280 startColumn: startColumn,
23281 endColumn: endColumn
23282 });
23283 continue;
23284 } // (;
23285
23286
23287 if (char === "(" && lookahead() === ";") {
23288 var _startColumn = column;
23289 eatCharacter(2);
23290 var _text = ""; // ;)
23291
23292 while (true) {
23293 char = input[current];
23294
23295 if (char === ";" && lookahead() === ")") {
23296 eatCharacter(2);
23297 break;
23298 }
23299
23300 _text += char;
23301 eatCharacter();
23302
23303 if (isNewLine(char)) {
23304 line++;
23305 column = 0;
23306 }
23307 }
23308
23309 var _endColumn = column;
23310 pushCommentToken(_text, {
23311 type: "block",
23312 startColumn: _startColumn,
23313 endColumn: _endColumn
23314 });
23315 continue;
23316 }
23317
23318 if (char === "(") {
23319 pushOpenParenToken(char);
23320 eatCharacter();
23321 continue;
23322 }
23323
23324 if (char === "=") {
23325 pushEqualToken(char);
23326 eatCharacter();
23327 continue;
23328 }
23329
23330 if (char === ")") {
23331 pushCloseParenToken(char);
23332 eatCharacter();
23333 continue;
23334 }
23335
23336 if (isNewLine(char)) {
23337 line++;
23338 eatCharacter();
23339 column = 0;
23340 continue;
23341 }
23342
23343 if (WHITESPACE.test(char)) {
23344 eatCharacter();
23345 continue;
23346 }
23347
23348 if (char === "$") {
23349 var _startColumn2 = column;
23350 eatCharacter();
23351 var value = "";
23352
23353 while (idchar.test(char)) {
23354 value += char;
23355 eatCharacter();
23356 }
23357
23358 var _endColumn2 = column;
23359 pushIdentifierToken(value, {
23360 startColumn: _startColumn2,
23361 endColumn: _endColumn2
23362 });
23363 continue;
23364 }
23365
23366 if (NUMBERS.test(char) || NUMBER_KEYWORDS.test(lookahead(3, 0)) || char === "-" || char === "+") {
23367 var _startColumn3 = column;
23368
23369 var _value = numberLiteralFSM.run(input.slice(current));
23370
23371 if (_value === "") {
23372 throw new Error(getCodeFrame(input, line, column) + "Unexpected character " + JSON.stringify(char));
23373 }
23374
23375 pushNumberToken(_value, {
23376 startColumn: _startColumn3
23377 });
23378 eatCharacter(_value.length);
23379
23380 if (char && !PARENS.test(char) && !WHITESPACE.test(char)) {
23381 throw new Error(getCodeFrame(input, line, column) + "Unexpected character " + JSON.stringify(char));
23382 }
23383
23384 continue;
23385 }
23386
23387 if (char === '"') {
23388 var _startColumn4 = column;
23389 var _value2 = "";
23390 eatCharacter(); // "
23391
23392 while (char !== '"') {
23393 if (isNewLine(char)) {
23394 throw new Error(getCodeFrame(input, line, column) + "Unexpected character " + JSON.stringify(char));
23395 }
23396
23397 _value2 += char;
23398 eatCharacter(); // char
23399 }
23400
23401 eatCharacter(); // "
23402
23403 var _endColumn3 = column;
23404 pushStringToken(_value2, {
23405 startColumn: _startColumn4,
23406 endColumn: _endColumn3
23407 });
23408 continue;
23409 }
23410
23411 if (LETTERS.test(char)) {
23412 var _value3 = "";
23413 var _startColumn5 = column;
23414
23415 while (char && LETTERS.test(char)) {
23416 _value3 += char;
23417 eatCharacter();
23418 }
23419 /*
23420 * Handle MemberAccess
23421 */
23422
23423
23424 if (char === ".") {
23425 var dotStartColumn = column;
23426
23427 if (valtypes.indexOf(_value3) !== -1) {
23428 pushValtypeToken(_value3, {
23429 startColumn: _startColumn5
23430 });
23431 } else {
23432 pushNameToken(_value3);
23433 }
23434
23435 eatCharacter();
23436 _value3 = "";
23437 var nameStartColumn = column;
23438
23439 while (LETTERS.test(char)) {
23440 _value3 += char;
23441 eatCharacter();
23442 }
23443
23444 pushDotToken(".", {
23445 startColumn: dotStartColumn
23446 });
23447 pushNameToken(_value3, {
23448 startColumn: nameStartColumn
23449 });
23450 continue;
23451 }
23452 /*
23453 * Handle keywords
23454 */
23455 // $FlowIgnore
23456
23457
23458 if (typeof keywords[_value3] === "string") {
23459 pushKeywordToken(_value3, {
23460 startColumn: _startColumn5
23461 });
23462 continue;
23463 }
23464 /*
23465 * Handle types
23466 */
23467
23468
23469 if (valtypes.indexOf(_value3) !== -1) {
23470 pushValtypeToken(_value3, {
23471 startColumn: _startColumn5
23472 });
23473 continue;
23474 }
23475 /*
23476 * Handle literals
23477 */
23478
23479
23480 pushNameToken(_value3, {
23481 startColumn: _startColumn5
23482 });
23483 continue;
23484 }
23485
23486 throw new Error(getCodeFrame(input, line, column) + "Unexpected character " + JSON.stringify(char));
23487 }
23488
23489 return tokens;
23490}
23491
23492var tokens = tokenTypes;
23493exports.tokens = tokens;
23494
23495/***/ }),
23496
23497/***/ 64500:
23498/***/ (function(__unused_webpack_module, exports) {
23499
23500"use strict";
23501
23502
23503Object.defineProperty(exports, "__esModule", ({
23504 value: true
23505}));
23506exports.cloneNode = cloneNode;
23507
23508function cloneNode(n) {
23509 // $FlowIgnore
23510 var newObj = {};
23511
23512 for (var k in n) {
23513 newObj[k] = n[k];
23514 }
23515
23516 return newObj;
23517}
23518
23519/***/ }),
23520
23521/***/ 17373:
23522/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
23523
23524"use strict";
23525
23526
23527Object.defineProperty(exports, "__esModule", ({
23528 value: true
23529}));
23530var _exportNames = {
23531 numberLiteralFromRaw: true,
23532 withLoc: true,
23533 withRaw: true,
23534 funcParam: true,
23535 indexLiteral: true,
23536 memIndexLiteral: true,
23537 instruction: true,
23538 objectInstruction: true,
23539 traverse: true,
23540 signatures: true,
23541 cloneNode: true
23542};
23543Object.defineProperty(exports, "numberLiteralFromRaw", ({
23544 enumerable: true,
23545 get: function get() {
23546 return _nodeHelpers.numberLiteralFromRaw;
23547 }
23548}));
23549Object.defineProperty(exports, "withLoc", ({
23550 enumerable: true,
23551 get: function get() {
23552 return _nodeHelpers.withLoc;
23553 }
23554}));
23555Object.defineProperty(exports, "withRaw", ({
23556 enumerable: true,
23557 get: function get() {
23558 return _nodeHelpers.withRaw;
23559 }
23560}));
23561Object.defineProperty(exports, "funcParam", ({
23562 enumerable: true,
23563 get: function get() {
23564 return _nodeHelpers.funcParam;
23565 }
23566}));
23567Object.defineProperty(exports, "indexLiteral", ({
23568 enumerable: true,
23569 get: function get() {
23570 return _nodeHelpers.indexLiteral;
23571 }
23572}));
23573Object.defineProperty(exports, "memIndexLiteral", ({
23574 enumerable: true,
23575 get: function get() {
23576 return _nodeHelpers.memIndexLiteral;
23577 }
23578}));
23579Object.defineProperty(exports, "instruction", ({
23580 enumerable: true,
23581 get: function get() {
23582 return _nodeHelpers.instruction;
23583 }
23584}));
23585Object.defineProperty(exports, "objectInstruction", ({
23586 enumerable: true,
23587 get: function get() {
23588 return _nodeHelpers.objectInstruction;
23589 }
23590}));
23591Object.defineProperty(exports, "traverse", ({
23592 enumerable: true,
23593 get: function get() {
23594 return _traverse.traverse;
23595 }
23596}));
23597Object.defineProperty(exports, "signatures", ({
23598 enumerable: true,
23599 get: function get() {
23600 return _signatures.signatures;
23601 }
23602}));
23603Object.defineProperty(exports, "cloneNode", ({
23604 enumerable: true,
23605 get: function get() {
23606 return _clone.cloneNode;
23607 }
23608}));
23609
23610var _nodes = __webpack_require__(53315);
23611
23612Object.keys(_nodes).forEach(function (key) {
23613 if (key === "default" || key === "__esModule") return;
23614 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
23615 Object.defineProperty(exports, key, {
23616 enumerable: true,
23617 get: function get() {
23618 return _nodes[key];
23619 }
23620 });
23621});
23622
23623var _nodeHelpers = __webpack_require__(73846);
23624
23625var _traverse = __webpack_require__(9469);
23626
23627var _signatures = __webpack_require__(51085);
23628
23629var _utils = __webpack_require__(1562);
23630
23631Object.keys(_utils).forEach(function (key) {
23632 if (key === "default" || key === "__esModule") return;
23633 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
23634 Object.defineProperty(exports, key, {
23635 enumerable: true,
23636 get: function get() {
23637 return _utils[key];
23638 }
23639 });
23640});
23641
23642var _clone = __webpack_require__(64500);
23643
23644/***/ }),
23645
23646/***/ 73846:
23647/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
23648
23649"use strict";
23650
23651
23652Object.defineProperty(exports, "__esModule", ({
23653 value: true
23654}));
23655exports.numberLiteralFromRaw = numberLiteralFromRaw;
23656exports.instruction = instruction;
23657exports.objectInstruction = objectInstruction;
23658exports.withLoc = withLoc;
23659exports.withRaw = withRaw;
23660exports.funcParam = funcParam;
23661exports.indexLiteral = indexLiteral;
23662exports.memIndexLiteral = memIndexLiteral;
23663
23664var _wastParser = __webpack_require__(9016);
23665
23666var _nodes = __webpack_require__(53315);
23667
23668function numberLiteralFromRaw(rawValue) {
23669 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
23670 var original = rawValue; // Remove numeric separators _
23671
23672 if (typeof rawValue === "string") {
23673 rawValue = rawValue.replace(/_/g, "");
23674 }
23675
23676 if (typeof rawValue === "number") {
23677 return (0, _nodes.numberLiteral)(rawValue, String(original));
23678 } else {
23679 switch (instructionType) {
23680 case "i32":
23681 {
23682 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
23683 }
23684
23685 case "u32":
23686 {
23687 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
23688 }
23689
23690 case "i64":
23691 {
23692 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
23693 }
23694
23695 case "f32":
23696 {
23697 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
23698 }
23699 // f64
23700
23701 default:
23702 {
23703 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
23704 }
23705 }
23706 }
23707}
23708
23709function instruction(id) {
23710 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
23711 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
23712 return (0, _nodes.instr)(id, undefined, args, namedArgs);
23713}
23714
23715function objectInstruction(id, object) {
23716 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
23717 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
23718 return (0, _nodes.instr)(id, object, args, namedArgs);
23719}
23720/**
23721 * Decorators
23722 */
23723
23724
23725function withLoc(n, end, start) {
23726 var loc = {
23727 start: start,
23728 end: end
23729 };
23730 n.loc = loc;
23731 return n;
23732}
23733
23734function withRaw(n, raw) {
23735 n.raw = raw;
23736 return n;
23737}
23738
23739function funcParam(valtype, id) {
23740 return {
23741 id: id,
23742 valtype: valtype
23743 };
23744}
23745
23746function indexLiteral(value) {
23747 // $FlowIgnore
23748 var x = numberLiteralFromRaw(value, "u32");
23749 return x;
23750}
23751
23752function memIndexLiteral(value) {
23753 // $FlowIgnore
23754 var x = numberLiteralFromRaw(value, "u32");
23755 return x;
23756}
23757
23758/***/ }),
23759
23760/***/ 39068:
23761/***/ (function(__unused_webpack_module, exports) {
23762
23763"use strict";
23764
23765
23766Object.defineProperty(exports, "__esModule", ({
23767 value: true
23768}));
23769exports.createPath = createPath;
23770
23771function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23772
23773function findParent(_ref, cb) {
23774 var parentPath = _ref.parentPath;
23775
23776 if (parentPath == null) {
23777 throw new Error("node is root");
23778 }
23779
23780 var currentPath = parentPath;
23781
23782 while (cb(currentPath) !== false) {
23783 // Hit the root node, stop
23784 // $FlowIgnore
23785 if (currentPath.parentPath == null) {
23786 return null;
23787 } // $FlowIgnore
23788
23789
23790 currentPath = currentPath.parentPath;
23791 }
23792
23793 return currentPath.node;
23794}
23795
23796function insertBefore(context, newNode) {
23797 return insert(context, newNode);
23798}
23799
23800function insertAfter(context, newNode) {
23801 return insert(context, newNode, 1);
23802}
23803
23804function insert(_ref2, newNode) {
23805 var node = _ref2.node,
23806 inList = _ref2.inList,
23807 parentPath = _ref2.parentPath,
23808 parentKey = _ref2.parentKey;
23809 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
23810
23811 if (!inList) {
23812 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
23813 }
23814
23815 if (!(parentPath != null)) {
23816 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
23817 }
23818
23819 // $FlowIgnore
23820 var parentList = parentPath.node[parentKey];
23821 var indexInList = parentList.findIndex(function (n) {
23822 return n === node;
23823 });
23824 parentList.splice(indexInList + indexOffset, 0, newNode);
23825}
23826
23827function remove(_ref3) {
23828 var node = _ref3.node,
23829 parentKey = _ref3.parentKey,
23830 parentPath = _ref3.parentPath;
23831
23832 if (!(parentPath != null)) {
23833 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
23834 }
23835
23836 // $FlowIgnore
23837 var parentNode = parentPath.node; // $FlowIgnore
23838
23839 var parentProperty = parentNode[parentKey];
23840
23841 if (Array.isArray(parentProperty)) {
23842 // $FlowIgnore
23843 parentNode[parentKey] = parentProperty.filter(function (n) {
23844 return n !== node;
23845 });
23846 } else {
23847 // $FlowIgnore
23848 delete parentNode[parentKey];
23849 }
23850
23851 node._deleted = true;
23852}
23853
23854function stop(context) {
23855 context.shouldStop = true;
23856}
23857
23858function replaceWith(context, newNode) {
23859 // $FlowIgnore
23860 var parentNode = context.parentPath.node; // $FlowIgnore
23861
23862 var parentProperty = parentNode[context.parentKey];
23863
23864 if (Array.isArray(parentProperty)) {
23865 var indexInList = parentProperty.findIndex(function (n) {
23866 return n === context.node;
23867 });
23868 parentProperty.splice(indexInList, 1, newNode);
23869 } else {
23870 // $FlowIgnore
23871 parentNode[context.parentKey] = newNode;
23872 }
23873
23874 context.node._deleted = true;
23875 context.node = newNode;
23876} // bind the context to the first argument of node operations
23877
23878
23879function bindNodeOperations(operations, context) {
23880 var keys = Object.keys(operations);
23881 var boundOperations = {};
23882 keys.forEach(function (key) {
23883 boundOperations[key] = operations[key].bind(null, context);
23884 });
23885 return boundOperations;
23886}
23887
23888function createPathOperations(context) {
23889 // $FlowIgnore
23890 return bindNodeOperations({
23891 findParent: findParent,
23892 replaceWith: replaceWith,
23893 remove: remove,
23894 insertBefore: insertBefore,
23895 insertAfter: insertAfter,
23896 stop: stop
23897 }, context);
23898}
23899
23900function createPath(context) {
23901 var path = _extends({}, context); // $FlowIgnore
23902
23903
23904 Object.assign(path, createPathOperations(path)); // $FlowIgnore
23905
23906 return path;
23907}
23908
23909/***/ }),
23910
23911/***/ 53315:
23912/***/ (function(__unused_webpack_module, exports) {
23913
23914"use strict";
23915
23916
23917Object.defineProperty(exports, "__esModule", ({
23918 value: true
23919}));
23920exports.module = _module;
23921exports.moduleMetadata = moduleMetadata;
23922exports.moduleNameMetadata = moduleNameMetadata;
23923exports.functionNameMetadata = functionNameMetadata;
23924exports.localNameMetadata = localNameMetadata;
23925exports.binaryModule = binaryModule;
23926exports.quoteModule = quoteModule;
23927exports.sectionMetadata = sectionMetadata;
23928exports.producersSectionMetadata = producersSectionMetadata;
23929exports.producerMetadata = producerMetadata;
23930exports.producerMetadataVersionedName = producerMetadataVersionedName;
23931exports.loopInstruction = loopInstruction;
23932exports.instr = instr;
23933exports.ifInstruction = ifInstruction;
23934exports.stringLiteral = stringLiteral;
23935exports.numberLiteral = numberLiteral;
23936exports.longNumberLiteral = longNumberLiteral;
23937exports.floatLiteral = floatLiteral;
23938exports.elem = elem;
23939exports.indexInFuncSection = indexInFuncSection;
23940exports.valtypeLiteral = valtypeLiteral;
23941exports.typeInstruction = typeInstruction;
23942exports.start = start;
23943exports.globalType = globalType;
23944exports.leadingComment = leadingComment;
23945exports.blockComment = blockComment;
23946exports.data = data;
23947exports.global = global;
23948exports.table = table;
23949exports.memory = memory;
23950exports.funcImportDescr = funcImportDescr;
23951exports.moduleImport = moduleImport;
23952exports.moduleExportDescr = moduleExportDescr;
23953exports.moduleExport = moduleExport;
23954exports.limit = limit;
23955exports.signature = signature;
23956exports.program = program;
23957exports.identifier = identifier;
23958exports.blockInstruction = blockInstruction;
23959exports.callInstruction = callInstruction;
23960exports.callIndirectInstruction = callIndirectInstruction;
23961exports.byteArray = byteArray;
23962exports.func = func;
23963exports.internalBrUnless = internalBrUnless;
23964exports.internalGoto = internalGoto;
23965exports.internalCallExtern = internalCallExtern;
23966exports.internalEndAndReturn = internalEndAndReturn;
23967exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
23968exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
23969
23970function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23971
23972// THIS FILE IS AUTOGENERATED
23973// see scripts/generateNodeUtils.js
23974function isTypeOf(t) {
23975 return function (n) {
23976 return n.type === t;
23977 };
23978}
23979
23980function assertTypeOf(t) {
23981 return function (n) {
23982 return function () {
23983 if (!(n.type === t)) {
23984 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
23985 }
23986 }();
23987 };
23988}
23989
23990function _module(id, fields, metadata) {
23991 if (id !== null && id !== undefined) {
23992 if (!(typeof id === "string")) {
23993 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
23994 }
23995 }
23996
23997 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
23998 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
23999 }
24000
24001 var node = {
24002 type: "Module",
24003 id: id,
24004 fields: fields
24005 };
24006
24007 if (typeof metadata !== "undefined") {
24008 node.metadata = metadata;
24009 }
24010
24011 return node;
24012}
24013
24014function moduleMetadata(sections, functionNames, localNames, producers) {
24015 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
24016 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
24017 }
24018
24019 if (functionNames !== null && functionNames !== undefined) {
24020 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
24021 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
24022 }
24023 }
24024
24025 if (localNames !== null && localNames !== undefined) {
24026 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
24027 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
24028 }
24029 }
24030
24031 if (producers !== null && producers !== undefined) {
24032 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
24033 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
24034 }
24035 }
24036
24037 var node = {
24038 type: "ModuleMetadata",
24039 sections: sections
24040 };
24041
24042 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
24043 node.functionNames = functionNames;
24044 }
24045
24046 if (typeof localNames !== "undefined" && localNames.length > 0) {
24047 node.localNames = localNames;
24048 }
24049
24050 if (typeof producers !== "undefined" && producers.length > 0) {
24051 node.producers = producers;
24052 }
24053
24054 return node;
24055}
24056
24057function moduleNameMetadata(value) {
24058 if (!(typeof value === "string")) {
24059 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24060 }
24061
24062 var node = {
24063 type: "ModuleNameMetadata",
24064 value: value
24065 };
24066 return node;
24067}
24068
24069function functionNameMetadata(value, index) {
24070 if (!(typeof value === "string")) {
24071 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24072 }
24073
24074 if (!(typeof index === "number")) {
24075 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
24076 }
24077
24078 var node = {
24079 type: "FunctionNameMetadata",
24080 value: value,
24081 index: index
24082 };
24083 return node;
24084}
24085
24086function localNameMetadata(value, localIndex, functionIndex) {
24087 if (!(typeof value === "string")) {
24088 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24089 }
24090
24091 if (!(typeof localIndex === "number")) {
24092 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
24093 }
24094
24095 if (!(typeof functionIndex === "number")) {
24096 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
24097 }
24098
24099 var node = {
24100 type: "LocalNameMetadata",
24101 value: value,
24102 localIndex: localIndex,
24103 functionIndex: functionIndex
24104 };
24105 return node;
24106}
24107
24108function binaryModule(id, blob) {
24109 if (id !== null && id !== undefined) {
24110 if (!(typeof id === "string")) {
24111 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
24112 }
24113 }
24114
24115 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
24116 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
24117 }
24118
24119 var node = {
24120 type: "BinaryModule",
24121 id: id,
24122 blob: blob
24123 };
24124 return node;
24125}
24126
24127function quoteModule(id, string) {
24128 if (id !== null && id !== undefined) {
24129 if (!(typeof id === "string")) {
24130 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
24131 }
24132 }
24133
24134 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
24135 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
24136 }
24137
24138 var node = {
24139 type: "QuoteModule",
24140 id: id,
24141 string: string
24142 };
24143 return node;
24144}
24145
24146function sectionMetadata(section, startOffset, size, vectorOfSize) {
24147 if (!(typeof startOffset === "number")) {
24148 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
24149 }
24150
24151 var node = {
24152 type: "SectionMetadata",
24153 section: section,
24154 startOffset: startOffset,
24155 size: size,
24156 vectorOfSize: vectorOfSize
24157 };
24158 return node;
24159}
24160
24161function producersSectionMetadata(producers) {
24162 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
24163 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
24164 }
24165
24166 var node = {
24167 type: "ProducersSectionMetadata",
24168 producers: producers
24169 };
24170 return node;
24171}
24172
24173function producerMetadata(language, processedBy, sdk) {
24174 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
24175 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
24176 }
24177
24178 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
24179 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
24180 }
24181
24182 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
24183 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
24184 }
24185
24186 var node = {
24187 type: "ProducerMetadata",
24188 language: language,
24189 processedBy: processedBy,
24190 sdk: sdk
24191 };
24192 return node;
24193}
24194
24195function producerMetadataVersionedName(name, version) {
24196 if (!(typeof name === "string")) {
24197 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
24198 }
24199
24200 if (!(typeof version === "string")) {
24201 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
24202 }
24203
24204 var node = {
24205 type: "ProducerMetadataVersionedName",
24206 name: name,
24207 version: version
24208 };
24209 return node;
24210}
24211
24212function loopInstruction(label, resulttype, instr) {
24213 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
24214 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
24215 }
24216
24217 var node = {
24218 type: "LoopInstruction",
24219 id: "loop",
24220 label: label,
24221 resulttype: resulttype,
24222 instr: instr
24223 };
24224 return node;
24225}
24226
24227function instr(id, object, args, namedArgs) {
24228 if (!(typeof id === "string")) {
24229 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
24230 }
24231
24232 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
24233 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
24234 }
24235
24236 var node = {
24237 type: "Instr",
24238 id: id,
24239 args: args
24240 };
24241
24242 if (typeof object !== "undefined") {
24243 node.object = object;
24244 }
24245
24246 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
24247 node.namedArgs = namedArgs;
24248 }
24249
24250 return node;
24251}
24252
24253function ifInstruction(testLabel, test, result, consequent, alternate) {
24254 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
24255 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
24256 }
24257
24258 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
24259 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
24260 }
24261
24262 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
24263 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
24264 }
24265
24266 var node = {
24267 type: "IfInstruction",
24268 id: "if",
24269 testLabel: testLabel,
24270 test: test,
24271 result: result,
24272 consequent: consequent,
24273 alternate: alternate
24274 };
24275 return node;
24276}
24277
24278function stringLiteral(value) {
24279 if (!(typeof value === "string")) {
24280 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24281 }
24282
24283 var node = {
24284 type: "StringLiteral",
24285 value: value
24286 };
24287 return node;
24288}
24289
24290function numberLiteral(value, raw) {
24291 if (!(typeof value === "number")) {
24292 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
24293 }
24294
24295 if (!(typeof raw === "string")) {
24296 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
24297 }
24298
24299 var node = {
24300 type: "NumberLiteral",
24301 value: value,
24302 raw: raw
24303 };
24304 return node;
24305}
24306
24307function longNumberLiteral(value, raw) {
24308 if (!(typeof raw === "string")) {
24309 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
24310 }
24311
24312 var node = {
24313 type: "LongNumberLiteral",
24314 value: value,
24315 raw: raw
24316 };
24317 return node;
24318}
24319
24320function floatLiteral(value, nan, inf, raw) {
24321 if (!(typeof value === "number")) {
24322 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
24323 }
24324
24325 if (nan !== null && nan !== undefined) {
24326 if (!(typeof nan === "boolean")) {
24327 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
24328 }
24329 }
24330
24331 if (inf !== null && inf !== undefined) {
24332 if (!(typeof inf === "boolean")) {
24333 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
24334 }
24335 }
24336
24337 if (!(typeof raw === "string")) {
24338 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
24339 }
24340
24341 var node = {
24342 type: "FloatLiteral",
24343 value: value,
24344 raw: raw
24345 };
24346
24347 if (nan === true) {
24348 node.nan = true;
24349 }
24350
24351 if (inf === true) {
24352 node.inf = true;
24353 }
24354
24355 return node;
24356}
24357
24358function elem(table, offset, funcs) {
24359 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
24360 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
24361 }
24362
24363 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
24364 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
24365 }
24366
24367 var node = {
24368 type: "Elem",
24369 table: table,
24370 offset: offset,
24371 funcs: funcs
24372 };
24373 return node;
24374}
24375
24376function indexInFuncSection(index) {
24377 var node = {
24378 type: "IndexInFuncSection",
24379 index: index
24380 };
24381 return node;
24382}
24383
24384function valtypeLiteral(name) {
24385 var node = {
24386 type: "ValtypeLiteral",
24387 name: name
24388 };
24389 return node;
24390}
24391
24392function typeInstruction(id, functype) {
24393 var node = {
24394 type: "TypeInstruction",
24395 id: id,
24396 functype: functype
24397 };
24398 return node;
24399}
24400
24401function start(index) {
24402 var node = {
24403 type: "Start",
24404 index: index
24405 };
24406 return node;
24407}
24408
24409function globalType(valtype, mutability) {
24410 var node = {
24411 type: "GlobalType",
24412 valtype: valtype,
24413 mutability: mutability
24414 };
24415 return node;
24416}
24417
24418function leadingComment(value) {
24419 if (!(typeof value === "string")) {
24420 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24421 }
24422
24423 var node = {
24424 type: "LeadingComment",
24425 value: value
24426 };
24427 return node;
24428}
24429
24430function blockComment(value) {
24431 if (!(typeof value === "string")) {
24432 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24433 }
24434
24435 var node = {
24436 type: "BlockComment",
24437 value: value
24438 };
24439 return node;
24440}
24441
24442function data(memoryIndex, offset, init) {
24443 var node = {
24444 type: "Data",
24445 memoryIndex: memoryIndex,
24446 offset: offset,
24447 init: init
24448 };
24449 return node;
24450}
24451
24452function global(globalType, init, name) {
24453 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
24454 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
24455 }
24456
24457 var node = {
24458 type: "Global",
24459 globalType: globalType,
24460 init: init,
24461 name: name
24462 };
24463 return node;
24464}
24465
24466function table(elementType, limits, name, elements) {
24467 if (!(limits.type === "Limit")) {
24468 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
24469 }
24470
24471 if (elements !== null && elements !== undefined) {
24472 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
24473 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
24474 }
24475 }
24476
24477 var node = {
24478 type: "Table",
24479 elementType: elementType,
24480 limits: limits,
24481 name: name
24482 };
24483
24484 if (typeof elements !== "undefined" && elements.length > 0) {
24485 node.elements = elements;
24486 }
24487
24488 return node;
24489}
24490
24491function memory(limits, id) {
24492 var node = {
24493 type: "Memory",
24494 limits: limits,
24495 id: id
24496 };
24497 return node;
24498}
24499
24500function funcImportDescr(id, signature) {
24501 var node = {
24502 type: "FuncImportDescr",
24503 id: id,
24504 signature: signature
24505 };
24506 return node;
24507}
24508
24509function moduleImport(module, name, descr) {
24510 if (!(typeof module === "string")) {
24511 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
24512 }
24513
24514 if (!(typeof name === "string")) {
24515 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
24516 }
24517
24518 var node = {
24519 type: "ModuleImport",
24520 module: module,
24521 name: name,
24522 descr: descr
24523 };
24524 return node;
24525}
24526
24527function moduleExportDescr(exportType, id) {
24528 var node = {
24529 type: "ModuleExportDescr",
24530 exportType: exportType,
24531 id: id
24532 };
24533 return node;
24534}
24535
24536function moduleExport(name, descr) {
24537 if (!(typeof name === "string")) {
24538 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
24539 }
24540
24541 var node = {
24542 type: "ModuleExport",
24543 name: name,
24544 descr: descr
24545 };
24546 return node;
24547}
24548
24549function limit(min, max) {
24550 if (!(typeof min === "number")) {
24551 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
24552 }
24553
24554 if (max !== null && max !== undefined) {
24555 if (!(typeof max === "number")) {
24556 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
24557 }
24558 }
24559
24560 var node = {
24561 type: "Limit",
24562 min: min
24563 };
24564
24565 if (typeof max !== "undefined") {
24566 node.max = max;
24567 }
24568
24569 return node;
24570}
24571
24572function signature(params, results) {
24573 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
24574 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
24575 }
24576
24577 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
24578 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
24579 }
24580
24581 var node = {
24582 type: "Signature",
24583 params: params,
24584 results: results
24585 };
24586 return node;
24587}
24588
24589function program(body) {
24590 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
24591 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
24592 }
24593
24594 var node = {
24595 type: "Program",
24596 body: body
24597 };
24598 return node;
24599}
24600
24601function identifier(value, raw) {
24602 if (!(typeof value === "string")) {
24603 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
24604 }
24605
24606 if (raw !== null && raw !== undefined) {
24607 if (!(typeof raw === "string")) {
24608 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
24609 }
24610 }
24611
24612 var node = {
24613 type: "Identifier",
24614 value: value
24615 };
24616
24617 if (typeof raw !== "undefined") {
24618 node.raw = raw;
24619 }
24620
24621 return node;
24622}
24623
24624function blockInstruction(label, instr, result) {
24625 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
24626 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
24627 }
24628
24629 var node = {
24630 type: "BlockInstruction",
24631 id: "block",
24632 label: label,
24633 instr: instr,
24634 result: result
24635 };
24636 return node;
24637}
24638
24639function callInstruction(index, instrArgs, numeric) {
24640 if (instrArgs !== null && instrArgs !== undefined) {
24641 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
24642 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
24643 }
24644 }
24645
24646 var node = {
24647 type: "CallInstruction",
24648 id: "call",
24649 index: index
24650 };
24651
24652 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
24653 node.instrArgs = instrArgs;
24654 }
24655
24656 if (typeof numeric !== "undefined") {
24657 node.numeric = numeric;
24658 }
24659
24660 return node;
24661}
24662
24663function callIndirectInstruction(signature, intrs) {
24664 if (intrs !== null && intrs !== undefined) {
24665 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
24666 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
24667 }
24668 }
24669
24670 var node = {
24671 type: "CallIndirectInstruction",
24672 id: "call_indirect",
24673 signature: signature
24674 };
24675
24676 if (typeof intrs !== "undefined" && intrs.length > 0) {
24677 node.intrs = intrs;
24678 }
24679
24680 return node;
24681}
24682
24683function byteArray(values) {
24684 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
24685 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
24686 }
24687
24688 var node = {
24689 type: "ByteArray",
24690 values: values
24691 };
24692 return node;
24693}
24694
24695function func(name, signature, body, isExternal, metadata) {
24696 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
24697 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
24698 }
24699
24700 if (isExternal !== null && isExternal !== undefined) {
24701 if (!(typeof isExternal === "boolean")) {
24702 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
24703 }
24704 }
24705
24706 var node = {
24707 type: "Func",
24708 name: name,
24709 signature: signature,
24710 body: body
24711 };
24712
24713 if (isExternal === true) {
24714 node.isExternal = true;
24715 }
24716
24717 if (typeof metadata !== "undefined") {
24718 node.metadata = metadata;
24719 }
24720
24721 return node;
24722}
24723
24724function internalBrUnless(target) {
24725 if (!(typeof target === "number")) {
24726 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
24727 }
24728
24729 var node = {
24730 type: "InternalBrUnless",
24731 target: target
24732 };
24733 return node;
24734}
24735
24736function internalGoto(target) {
24737 if (!(typeof target === "number")) {
24738 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
24739 }
24740
24741 var node = {
24742 type: "InternalGoto",
24743 target: target
24744 };
24745 return node;
24746}
24747
24748function internalCallExtern(target) {
24749 if (!(typeof target === "number")) {
24750 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
24751 }
24752
24753 var node = {
24754 type: "InternalCallExtern",
24755 target: target
24756 };
24757 return node;
24758}
24759
24760function internalEndAndReturn() {
24761 var node = {
24762 type: "InternalEndAndReturn"
24763 };
24764 return node;
24765}
24766
24767var isModule = isTypeOf("Module");
24768exports.isModule = isModule;
24769var isModuleMetadata = isTypeOf("ModuleMetadata");
24770exports.isModuleMetadata = isModuleMetadata;
24771var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
24772exports.isModuleNameMetadata = isModuleNameMetadata;
24773var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
24774exports.isFunctionNameMetadata = isFunctionNameMetadata;
24775var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
24776exports.isLocalNameMetadata = isLocalNameMetadata;
24777var isBinaryModule = isTypeOf("BinaryModule");
24778exports.isBinaryModule = isBinaryModule;
24779var isQuoteModule = isTypeOf("QuoteModule");
24780exports.isQuoteModule = isQuoteModule;
24781var isSectionMetadata = isTypeOf("SectionMetadata");
24782exports.isSectionMetadata = isSectionMetadata;
24783var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
24784exports.isProducersSectionMetadata = isProducersSectionMetadata;
24785var isProducerMetadata = isTypeOf("ProducerMetadata");
24786exports.isProducerMetadata = isProducerMetadata;
24787var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
24788exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
24789var isLoopInstruction = isTypeOf("LoopInstruction");
24790exports.isLoopInstruction = isLoopInstruction;
24791var isInstr = isTypeOf("Instr");
24792exports.isInstr = isInstr;
24793var isIfInstruction = isTypeOf("IfInstruction");
24794exports.isIfInstruction = isIfInstruction;
24795var isStringLiteral = isTypeOf("StringLiteral");
24796exports.isStringLiteral = isStringLiteral;
24797var isNumberLiteral = isTypeOf("NumberLiteral");
24798exports.isNumberLiteral = isNumberLiteral;
24799var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
24800exports.isLongNumberLiteral = isLongNumberLiteral;
24801var isFloatLiteral = isTypeOf("FloatLiteral");
24802exports.isFloatLiteral = isFloatLiteral;
24803var isElem = isTypeOf("Elem");
24804exports.isElem = isElem;
24805var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
24806exports.isIndexInFuncSection = isIndexInFuncSection;
24807var isValtypeLiteral = isTypeOf("ValtypeLiteral");
24808exports.isValtypeLiteral = isValtypeLiteral;
24809var isTypeInstruction = isTypeOf("TypeInstruction");
24810exports.isTypeInstruction = isTypeInstruction;
24811var isStart = isTypeOf("Start");
24812exports.isStart = isStart;
24813var isGlobalType = isTypeOf("GlobalType");
24814exports.isGlobalType = isGlobalType;
24815var isLeadingComment = isTypeOf("LeadingComment");
24816exports.isLeadingComment = isLeadingComment;
24817var isBlockComment = isTypeOf("BlockComment");
24818exports.isBlockComment = isBlockComment;
24819var isData = isTypeOf("Data");
24820exports.isData = isData;
24821var isGlobal = isTypeOf("Global");
24822exports.isGlobal = isGlobal;
24823var isTable = isTypeOf("Table");
24824exports.isTable = isTable;
24825var isMemory = isTypeOf("Memory");
24826exports.isMemory = isMemory;
24827var isFuncImportDescr = isTypeOf("FuncImportDescr");
24828exports.isFuncImportDescr = isFuncImportDescr;
24829var isModuleImport = isTypeOf("ModuleImport");
24830exports.isModuleImport = isModuleImport;
24831var isModuleExportDescr = isTypeOf("ModuleExportDescr");
24832exports.isModuleExportDescr = isModuleExportDescr;
24833var isModuleExport = isTypeOf("ModuleExport");
24834exports.isModuleExport = isModuleExport;
24835var isLimit = isTypeOf("Limit");
24836exports.isLimit = isLimit;
24837var isSignature = isTypeOf("Signature");
24838exports.isSignature = isSignature;
24839var isProgram = isTypeOf("Program");
24840exports.isProgram = isProgram;
24841var isIdentifier = isTypeOf("Identifier");
24842exports.isIdentifier = isIdentifier;
24843var isBlockInstruction = isTypeOf("BlockInstruction");
24844exports.isBlockInstruction = isBlockInstruction;
24845var isCallInstruction = isTypeOf("CallInstruction");
24846exports.isCallInstruction = isCallInstruction;
24847var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
24848exports.isCallIndirectInstruction = isCallIndirectInstruction;
24849var isByteArray = isTypeOf("ByteArray");
24850exports.isByteArray = isByteArray;
24851var isFunc = isTypeOf("Func");
24852exports.isFunc = isFunc;
24853var isInternalBrUnless = isTypeOf("InternalBrUnless");
24854exports.isInternalBrUnless = isInternalBrUnless;
24855var isInternalGoto = isTypeOf("InternalGoto");
24856exports.isInternalGoto = isInternalGoto;
24857var isInternalCallExtern = isTypeOf("InternalCallExtern");
24858exports.isInternalCallExtern = isInternalCallExtern;
24859var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
24860exports.isInternalEndAndReturn = isInternalEndAndReturn;
24861
24862var isNode = function isNode(node) {
24863 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
24864};
24865
24866exports.isNode = isNode;
24867
24868var isBlock = function isBlock(node) {
24869 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
24870};
24871
24872exports.isBlock = isBlock;
24873
24874var isInstruction = function isInstruction(node) {
24875 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
24876};
24877
24878exports.isInstruction = isInstruction;
24879
24880var isExpression = function isExpression(node) {
24881 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
24882};
24883
24884exports.isExpression = isExpression;
24885
24886var isNumericLiteral = function isNumericLiteral(node) {
24887 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
24888};
24889
24890exports.isNumericLiteral = isNumericLiteral;
24891
24892var isImportDescr = function isImportDescr(node) {
24893 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
24894};
24895
24896exports.isImportDescr = isImportDescr;
24897
24898var isIntrinsic = function isIntrinsic(node) {
24899 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
24900};
24901
24902exports.isIntrinsic = isIntrinsic;
24903var assertModule = assertTypeOf("Module");
24904exports.assertModule = assertModule;
24905var assertModuleMetadata = assertTypeOf("ModuleMetadata");
24906exports.assertModuleMetadata = assertModuleMetadata;
24907var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
24908exports.assertModuleNameMetadata = assertModuleNameMetadata;
24909var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
24910exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
24911var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
24912exports.assertLocalNameMetadata = assertLocalNameMetadata;
24913var assertBinaryModule = assertTypeOf("BinaryModule");
24914exports.assertBinaryModule = assertBinaryModule;
24915var assertQuoteModule = assertTypeOf("QuoteModule");
24916exports.assertQuoteModule = assertQuoteModule;
24917var assertSectionMetadata = assertTypeOf("SectionMetadata");
24918exports.assertSectionMetadata = assertSectionMetadata;
24919var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
24920exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
24921var assertProducerMetadata = assertTypeOf("ProducerMetadata");
24922exports.assertProducerMetadata = assertProducerMetadata;
24923var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
24924exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
24925var assertLoopInstruction = assertTypeOf("LoopInstruction");
24926exports.assertLoopInstruction = assertLoopInstruction;
24927var assertInstr = assertTypeOf("Instr");
24928exports.assertInstr = assertInstr;
24929var assertIfInstruction = assertTypeOf("IfInstruction");
24930exports.assertIfInstruction = assertIfInstruction;
24931var assertStringLiteral = assertTypeOf("StringLiteral");
24932exports.assertStringLiteral = assertStringLiteral;
24933var assertNumberLiteral = assertTypeOf("NumberLiteral");
24934exports.assertNumberLiteral = assertNumberLiteral;
24935var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
24936exports.assertLongNumberLiteral = assertLongNumberLiteral;
24937var assertFloatLiteral = assertTypeOf("FloatLiteral");
24938exports.assertFloatLiteral = assertFloatLiteral;
24939var assertElem = assertTypeOf("Elem");
24940exports.assertElem = assertElem;
24941var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
24942exports.assertIndexInFuncSection = assertIndexInFuncSection;
24943var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
24944exports.assertValtypeLiteral = assertValtypeLiteral;
24945var assertTypeInstruction = assertTypeOf("TypeInstruction");
24946exports.assertTypeInstruction = assertTypeInstruction;
24947var assertStart = assertTypeOf("Start");
24948exports.assertStart = assertStart;
24949var assertGlobalType = assertTypeOf("GlobalType");
24950exports.assertGlobalType = assertGlobalType;
24951var assertLeadingComment = assertTypeOf("LeadingComment");
24952exports.assertLeadingComment = assertLeadingComment;
24953var assertBlockComment = assertTypeOf("BlockComment");
24954exports.assertBlockComment = assertBlockComment;
24955var assertData = assertTypeOf("Data");
24956exports.assertData = assertData;
24957var assertGlobal = assertTypeOf("Global");
24958exports.assertGlobal = assertGlobal;
24959var assertTable = assertTypeOf("Table");
24960exports.assertTable = assertTable;
24961var assertMemory = assertTypeOf("Memory");
24962exports.assertMemory = assertMemory;
24963var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
24964exports.assertFuncImportDescr = assertFuncImportDescr;
24965var assertModuleImport = assertTypeOf("ModuleImport");
24966exports.assertModuleImport = assertModuleImport;
24967var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
24968exports.assertModuleExportDescr = assertModuleExportDescr;
24969var assertModuleExport = assertTypeOf("ModuleExport");
24970exports.assertModuleExport = assertModuleExport;
24971var assertLimit = assertTypeOf("Limit");
24972exports.assertLimit = assertLimit;
24973var assertSignature = assertTypeOf("Signature");
24974exports.assertSignature = assertSignature;
24975var assertProgram = assertTypeOf("Program");
24976exports.assertProgram = assertProgram;
24977var assertIdentifier = assertTypeOf("Identifier");
24978exports.assertIdentifier = assertIdentifier;
24979var assertBlockInstruction = assertTypeOf("BlockInstruction");
24980exports.assertBlockInstruction = assertBlockInstruction;
24981var assertCallInstruction = assertTypeOf("CallInstruction");
24982exports.assertCallInstruction = assertCallInstruction;
24983var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
24984exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
24985var assertByteArray = assertTypeOf("ByteArray");
24986exports.assertByteArray = assertByteArray;
24987var assertFunc = assertTypeOf("Func");
24988exports.assertFunc = assertFunc;
24989var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
24990exports.assertInternalBrUnless = assertInternalBrUnless;
24991var assertInternalGoto = assertTypeOf("InternalGoto");
24992exports.assertInternalGoto = assertInternalGoto;
24993var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
24994exports.assertInternalCallExtern = assertInternalCallExtern;
24995var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
24996exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
24997var unionTypesMap = {
24998 Module: ["Node"],
24999 ModuleMetadata: ["Node"],
25000 ModuleNameMetadata: ["Node"],
25001 FunctionNameMetadata: ["Node"],
25002 LocalNameMetadata: ["Node"],
25003 BinaryModule: ["Node"],
25004 QuoteModule: ["Node"],
25005 SectionMetadata: ["Node"],
25006 ProducersSectionMetadata: ["Node"],
25007 ProducerMetadata: ["Node"],
25008 ProducerMetadataVersionedName: ["Node"],
25009 LoopInstruction: ["Node", "Block", "Instruction"],
25010 Instr: ["Node", "Expression", "Instruction"],
25011 IfInstruction: ["Node", "Instruction"],
25012 StringLiteral: ["Node", "Expression"],
25013 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
25014 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
25015 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
25016 Elem: ["Node"],
25017 IndexInFuncSection: ["Node"],
25018 ValtypeLiteral: ["Node", "Expression"],
25019 TypeInstruction: ["Node", "Instruction"],
25020 Start: ["Node"],
25021 GlobalType: ["Node", "ImportDescr"],
25022 LeadingComment: ["Node"],
25023 BlockComment: ["Node"],
25024 Data: ["Node"],
25025 Global: ["Node"],
25026 Table: ["Node", "ImportDescr"],
25027 Memory: ["Node", "ImportDescr"],
25028 FuncImportDescr: ["Node", "ImportDescr"],
25029 ModuleImport: ["Node"],
25030 ModuleExportDescr: ["Node"],
25031 ModuleExport: ["Node"],
25032 Limit: ["Node"],
25033 Signature: ["Node"],
25034 Program: ["Node"],
25035 Identifier: ["Node", "Expression"],
25036 BlockInstruction: ["Node", "Block", "Instruction"],
25037 CallInstruction: ["Node", "Instruction"],
25038 CallIndirectInstruction: ["Node", "Instruction"],
25039 ByteArray: ["Node"],
25040 Func: ["Node", "Block"],
25041 InternalBrUnless: ["Node", "Intrinsic"],
25042 InternalGoto: ["Node", "Intrinsic"],
25043 InternalCallExtern: ["Node", "Intrinsic"],
25044 InternalEndAndReturn: ["Node", "Intrinsic"]
25045};
25046exports.unionTypesMap = unionTypesMap;
25047var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
25048exports.nodeAndUnionTypes = nodeAndUnionTypes;
25049
25050/***/ }),
25051
25052/***/ 51085:
25053/***/ (function(__unused_webpack_module, exports) {
25054
25055"use strict";
25056
25057
25058Object.defineProperty(exports, "__esModule", ({
25059 value: true
25060}));
25061exports.signatures = void 0;
25062
25063function sign(input, output) {
25064 return [input, output];
25065}
25066
25067var u32 = "u32";
25068var i32 = "i32";
25069var i64 = "i64";
25070var f32 = "f32";
25071var f64 = "f64";
25072
25073var vector = function vector(t) {
25074 var vecType = [t]; // $FlowIgnore
25075
25076 vecType.vector = true;
25077 return vecType;
25078};
25079
25080var controlInstructions = {
25081 unreachable: sign([], []),
25082 nop: sign([], []),
25083 // block ?
25084 // loop ?
25085 // if ?
25086 // if else ?
25087 br: sign([u32], []),
25088 br_if: sign([u32], []),
25089 br_table: sign(vector(u32), []),
25090 return: sign([], []),
25091 call: sign([u32], []),
25092 call_indirect: sign([u32], [])
25093};
25094var parametricInstructions = {
25095 drop: sign([], []),
25096 select: sign([], [])
25097};
25098var variableInstructions = {
25099 get_local: sign([u32], []),
25100 set_local: sign([u32], []),
25101 tee_local: sign([u32], []),
25102 get_global: sign([u32], []),
25103 set_global: sign([u32], [])
25104};
25105var memoryInstructions = {
25106 "i32.load": sign([u32, u32], [i32]),
25107 "i64.load": sign([u32, u32], []),
25108 "f32.load": sign([u32, u32], []),
25109 "f64.load": sign([u32, u32], []),
25110 "i32.load8_s": sign([u32, u32], [i32]),
25111 "i32.load8_u": sign([u32, u32], [i32]),
25112 "i32.load16_s": sign([u32, u32], [i32]),
25113 "i32.load16_u": sign([u32, u32], [i32]),
25114 "i64.load8_s": sign([u32, u32], [i64]),
25115 "i64.load8_u": sign([u32, u32], [i64]),
25116 "i64.load16_s": sign([u32, u32], [i64]),
25117 "i64.load16_u": sign([u32, u32], [i64]),
25118 "i64.load32_s": sign([u32, u32], [i64]),
25119 "i64.load32_u": sign([u32, u32], [i64]),
25120 "i32.store": sign([u32, u32], []),
25121 "i64.store": sign([u32, u32], []),
25122 "f32.store": sign([u32, u32], []),
25123 "f64.store": sign([u32, u32], []),
25124 "i32.store8": sign([u32, u32], []),
25125 "i32.store16": sign([u32, u32], []),
25126 "i64.store8": sign([u32, u32], []),
25127 "i64.store16": sign([u32, u32], []),
25128 "i64.store32": sign([u32, u32], []),
25129 current_memory: sign([], []),
25130 grow_memory: sign([], [])
25131};
25132var numericInstructions = {
25133 "i32.const": sign([i32], [i32]),
25134 "i64.const": sign([i64], [i64]),
25135 "f32.const": sign([f32], [f32]),
25136 "f64.const": sign([f64], [f64]),
25137 "i32.eqz": sign([i32], [i32]),
25138 "i32.eq": sign([i32, i32], [i32]),
25139 "i32.ne": sign([i32, i32], [i32]),
25140 "i32.lt_s": sign([i32, i32], [i32]),
25141 "i32.lt_u": sign([i32, i32], [i32]),
25142 "i32.gt_s": sign([i32, i32], [i32]),
25143 "i32.gt_u": sign([i32, i32], [i32]),
25144 "i32.le_s": sign([i32, i32], [i32]),
25145 "i32.le_u": sign([i32, i32], [i32]),
25146 "i32.ge_s": sign([i32, i32], [i32]),
25147 "i32.ge_u": sign([i32, i32], [i32]),
25148 "i64.eqz": sign([i64], [i64]),
25149 "i64.eq": sign([i64, i64], [i32]),
25150 "i64.ne": sign([i64, i64], [i32]),
25151 "i64.lt_s": sign([i64, i64], [i32]),
25152 "i64.lt_u": sign([i64, i64], [i32]),
25153 "i64.gt_s": sign([i64, i64], [i32]),
25154 "i64.gt_u": sign([i64, i64], [i32]),
25155 "i64.le_s": sign([i64, i64], [i32]),
25156 "i64.le_u": sign([i64, i64], [i32]),
25157 "i64.ge_s": sign([i64, i64], [i32]),
25158 "i64.ge_u": sign([i64, i64], [i32]),
25159 "f32.eq": sign([f32, f32], [i32]),
25160 "f32.ne": sign([f32, f32], [i32]),
25161 "f32.lt": sign([f32, f32], [i32]),
25162 "f32.gt": sign([f32, f32], [i32]),
25163 "f32.le": sign([f32, f32], [i32]),
25164 "f32.ge": sign([f32, f32], [i32]),
25165 "f64.eq": sign([f64, f64], [i32]),
25166 "f64.ne": sign([f64, f64], [i32]),
25167 "f64.lt": sign([f64, f64], [i32]),
25168 "f64.gt": sign([f64, f64], [i32]),
25169 "f64.le": sign([f64, f64], [i32]),
25170 "f64.ge": sign([f64, f64], [i32]),
25171 "i32.clz": sign([i32], [i32]),
25172 "i32.ctz": sign([i32], [i32]),
25173 "i32.popcnt": sign([i32], [i32]),
25174 "i32.add": sign([i32, i32], [i32]),
25175 "i32.sub": sign([i32, i32], [i32]),
25176 "i32.mul": sign([i32, i32], [i32]),
25177 "i32.div_s": sign([i32, i32], [i32]),
25178 "i32.div_u": sign([i32, i32], [i32]),
25179 "i32.rem_s": sign([i32, i32], [i32]),
25180 "i32.rem_u": sign([i32, i32], [i32]),
25181 "i32.and": sign([i32, i32], [i32]),
25182 "i32.or": sign([i32, i32], [i32]),
25183 "i32.xor": sign([i32, i32], [i32]),
25184 "i32.shl": sign([i32, i32], [i32]),
25185 "i32.shr_s": sign([i32, i32], [i32]),
25186 "i32.shr_u": sign([i32, i32], [i32]),
25187 "i32.rotl": sign([i32, i32], [i32]),
25188 "i32.rotr": sign([i32, i32], [i32]),
25189 "i64.clz": sign([i64], [i64]),
25190 "i64.ctz": sign([i64], [i64]),
25191 "i64.popcnt": sign([i64], [i64]),
25192 "i64.add": sign([i64, i64], [i64]),
25193 "i64.sub": sign([i64, i64], [i64]),
25194 "i64.mul": sign([i64, i64], [i64]),
25195 "i64.div_s": sign([i64, i64], [i64]),
25196 "i64.div_u": sign([i64, i64], [i64]),
25197 "i64.rem_s": sign([i64, i64], [i64]),
25198 "i64.rem_u": sign([i64, i64], [i64]),
25199 "i64.and": sign([i64, i64], [i64]),
25200 "i64.or": sign([i64, i64], [i64]),
25201 "i64.xor": sign([i64, i64], [i64]),
25202 "i64.shl": sign([i64, i64], [i64]),
25203 "i64.shr_s": sign([i64, i64], [i64]),
25204 "i64.shr_u": sign([i64, i64], [i64]),
25205 "i64.rotl": sign([i64, i64], [i64]),
25206 "i64.rotr": sign([i64, i64], [i64]),
25207 "f32.abs": sign([f32], [f32]),
25208 "f32.neg": sign([f32], [f32]),
25209 "f32.ceil": sign([f32], [f32]),
25210 "f32.floor": sign([f32], [f32]),
25211 "f32.trunc": sign([f32], [f32]),
25212 "f32.nearest": sign([f32], [f32]),
25213 "f32.sqrt": sign([f32], [f32]),
25214 "f32.add": sign([f32, f32], [f32]),
25215 "f32.sub": sign([f32, f32], [f32]),
25216 "f32.mul": sign([f32, f32], [f32]),
25217 "f32.div": sign([f32, f32], [f32]),
25218 "f32.min": sign([f32, f32], [f32]),
25219 "f32.max": sign([f32, f32], [f32]),
25220 "f32.copysign": sign([f32, f32], [f32]),
25221 "f64.abs": sign([f64], [f64]),
25222 "f64.neg": sign([f64], [f64]),
25223 "f64.ceil": sign([f64], [f64]),
25224 "f64.floor": sign([f64], [f64]),
25225 "f64.trunc": sign([f64], [f64]),
25226 "f64.nearest": sign([f64], [f64]),
25227 "f64.sqrt": sign([f64], [f64]),
25228 "f64.add": sign([f64, f64], [f64]),
25229 "f64.sub": sign([f64, f64], [f64]),
25230 "f64.mul": sign([f64, f64], [f64]),
25231 "f64.div": sign([f64, f64], [f64]),
25232 "f64.min": sign([f64, f64], [f64]),
25233 "f64.max": sign([f64, f64], [f64]),
25234 "f64.copysign": sign([f64, f64], [f64]),
25235 "i32.wrap/i64": sign([i64], [i32]),
25236 "i32.trunc_s/f32": sign([f32], [i32]),
25237 "i32.trunc_u/f32": sign([f32], [i32]),
25238 "i32.trunc_s/f64": sign([f32], [i32]),
25239 "i32.trunc_u/f64": sign([f64], [i32]),
25240 "i64.extend_s/i32": sign([i32], [i64]),
25241 "i64.extend_u/i32": sign([i32], [i64]),
25242 "i64.trunc_s/f32": sign([f32], [i64]),
25243 "i64.trunc_u/f32": sign([f32], [i64]),
25244 "i64.trunc_s/f64": sign([f64], [i64]),
25245 "i64.trunc_u/f64": sign([f64], [i64]),
25246 "f32.convert_s/i32": sign([i32], [f32]),
25247 "f32.convert_u/i32": sign([i32], [f32]),
25248 "f32.convert_s/i64": sign([i64], [f32]),
25249 "f32.convert_u/i64": sign([i64], [f32]),
25250 "f32.demote/f64": sign([f64], [f32]),
25251 "f64.convert_s/i32": sign([i32], [f64]),
25252 "f64.convert_u/i32": sign([i32], [f64]),
25253 "f64.convert_s/i64": sign([i64], [f64]),
25254 "f64.convert_u/i64": sign([i64], [f64]),
25255 "f64.promote/f32": sign([f32], [f64]),
25256 "i32.reinterpret/f32": sign([f32], [i32]),
25257 "i64.reinterpret/f64": sign([f64], [i64]),
25258 "f32.reinterpret/i32": sign([i32], [f32]),
25259 "f64.reinterpret/i64": sign([i64], [f64])
25260};
25261var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
25262exports.signatures = signatures;
25263
25264/***/ }),
25265
25266/***/ 9469:
25267/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
25268
25269"use strict";
25270
25271
25272Object.defineProperty(exports, "__esModule", ({
25273 value: true
25274}));
25275exports.traverse = traverse;
25276
25277var _nodePath = __webpack_require__(39068);
25278
25279var _nodes = __webpack_require__(53315);
25280
25281// recursively walks the AST starting at the given node. The callback is invoked for
25282// and object that has a 'type' property.
25283function walk(context, callback) {
25284 var stop = false;
25285
25286 function innerWalk(context, callback) {
25287 if (stop) {
25288 return;
25289 }
25290
25291 var node = context.node;
25292
25293 if (node === undefined) {
25294 console.warn("traversing with an empty context");
25295 return;
25296 }
25297
25298 if (node._deleted === true) {
25299 return;
25300 }
25301
25302 var path = (0, _nodePath.createPath)(context);
25303 callback(node.type, path);
25304
25305 if (path.shouldStop) {
25306 stop = true;
25307 return;
25308 }
25309
25310 Object.keys(node).forEach(function (prop) {
25311 var value = node[prop];
25312
25313 if (value === null || value === undefined) {
25314 return;
25315 }
25316
25317 var valueAsArray = Array.isArray(value) ? value : [value];
25318 valueAsArray.forEach(function (childNode) {
25319 if (typeof childNode.type === "string") {
25320 var childContext = {
25321 node: childNode,
25322 parentKey: prop,
25323 parentPath: path,
25324 shouldStop: false,
25325 inList: Array.isArray(value)
25326 };
25327 innerWalk(childContext, callback);
25328 }
25329 });
25330 });
25331 }
25332
25333 innerWalk(context, callback);
25334}
25335
25336var noop = function noop() {};
25337
25338function traverse(node, visitors) {
25339 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
25340 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
25341 Object.keys(visitors).forEach(function (visitor) {
25342 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
25343 throw new Error("Unexpected visitor ".concat(visitor));
25344 }
25345 });
25346 var context = {
25347 node: node,
25348 inList: false,
25349 shouldStop: false,
25350 parentPath: null,
25351 parentKey: null
25352 };
25353 walk(context, function (type, path) {
25354 if (typeof visitors[type] === "function") {
25355 before(type, path);
25356 visitors[type](path);
25357 after(type, path);
25358 }
25359
25360 var unionTypes = _nodes.unionTypesMap[type];
25361
25362 if (!unionTypes) {
25363 throw new Error("Unexpected node type ".concat(type));
25364 }
25365
25366 unionTypes.forEach(function (unionType) {
25367 if (typeof visitors[unionType] === "function") {
25368 before(unionType, path);
25369 visitors[unionType](path);
25370 after(unionType, path);
25371 }
25372 });
25373 });
25374}
25375
25376/***/ }),
25377
25378/***/ 1562:
25379/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
25380
25381"use strict";
25382
25383
25384Object.defineProperty(exports, "__esModule", ({
25385 value: true
25386}));
25387exports.isAnonymous = isAnonymous;
25388exports.getSectionMetadata = getSectionMetadata;
25389exports.getSectionMetadatas = getSectionMetadatas;
25390exports.sortSectionMetadata = sortSectionMetadata;
25391exports.orderedInsertNode = orderedInsertNode;
25392exports.assertHasLoc = assertHasLoc;
25393exports.getEndOfSection = getEndOfSection;
25394exports.shiftLoc = shiftLoc;
25395exports.shiftSection = shiftSection;
25396exports.signatureForOpcode = signatureForOpcode;
25397exports.getUniqueNameGenerator = getUniqueNameGenerator;
25398exports.getStartByteOffset = getStartByteOffset;
25399exports.getEndByteOffset = getEndByteOffset;
25400exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
25401exports.getEndBlockByteOffset = getEndBlockByteOffset;
25402exports.getStartBlockByteOffset = getStartBlockByteOffset;
25403
25404var _signatures = __webpack_require__(51085);
25405
25406var _traverse = __webpack_require__(9469);
25407
25408var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(51028));
25409
25410function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
25411
25412function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
25413
25414function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
25415
25416function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
25417
25418function isAnonymous(ident) {
25419 return ident.raw === "";
25420}
25421
25422function getSectionMetadata(ast, name) {
25423 var section;
25424 (0, _traverse.traverse)(ast, {
25425 SectionMetadata: function (_SectionMetadata) {
25426 function SectionMetadata(_x) {
25427 return _SectionMetadata.apply(this, arguments);
25428 }
25429
25430 SectionMetadata.toString = function () {
25431 return _SectionMetadata.toString();
25432 };
25433
25434 return SectionMetadata;
25435 }(function (_ref) {
25436 var node = _ref.node;
25437
25438 if (node.section === name) {
25439 section = node;
25440 }
25441 })
25442 });
25443 return section;
25444}
25445
25446function getSectionMetadatas(ast, name) {
25447 var sections = [];
25448 (0, _traverse.traverse)(ast, {
25449 SectionMetadata: function (_SectionMetadata2) {
25450 function SectionMetadata(_x2) {
25451 return _SectionMetadata2.apply(this, arguments);
25452 }
25453
25454 SectionMetadata.toString = function () {
25455 return _SectionMetadata2.toString();
25456 };
25457
25458 return SectionMetadata;
25459 }(function (_ref2) {
25460 var node = _ref2.node;
25461
25462 if (node.section === name) {
25463 sections.push(node);
25464 }
25465 })
25466 });
25467 return sections;
25468}
25469
25470function sortSectionMetadata(m) {
25471 if (m.metadata == null) {
25472 console.warn("sortSectionMetadata: no metadata to sort");
25473 return;
25474 } // $FlowIgnore
25475
25476
25477 m.metadata.sections.sort(function (a, b) {
25478 var aId = _helperWasmBytecode.default.sections[a.section];
25479 var bId = _helperWasmBytecode.default.sections[b.section];
25480
25481 if (typeof aId !== "number" || typeof bId !== "number") {
25482 throw new Error("Section id not found");
25483 }
25484
25485 return aId - bId;
25486 });
25487}
25488
25489function orderedInsertNode(m, n) {
25490 assertHasLoc(n);
25491 var didInsert = false;
25492
25493 if (n.type === "ModuleExport") {
25494 m.fields.push(n);
25495 return;
25496 }
25497
25498 m.fields = m.fields.reduce(function (acc, field) {
25499 var fieldEndCol = Infinity;
25500
25501 if (field.loc != null) {
25502 // $FlowIgnore
25503 fieldEndCol = field.loc.end.column;
25504 } // $FlowIgnore: assertHasLoc ensures that
25505
25506
25507 if (didInsert === false && n.loc.start.column < fieldEndCol) {
25508 didInsert = true;
25509 acc.push(n);
25510 }
25511
25512 acc.push(field);
25513 return acc;
25514 }, []); // Handles empty modules or n is the last element
25515
25516 if (didInsert === false) {
25517 m.fields.push(n);
25518 }
25519}
25520
25521function assertHasLoc(n) {
25522 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
25523 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
25524 }
25525}
25526
25527function getEndOfSection(s) {
25528 assertHasLoc(s.size);
25529 return s.startOffset + s.size.value + ( // $FlowIgnore
25530 s.size.loc.end.column - s.size.loc.start.column);
25531}
25532
25533function shiftLoc(node, delta) {
25534 // $FlowIgnore
25535 node.loc.start.column += delta; // $FlowIgnore
25536
25537 node.loc.end.column += delta;
25538}
25539
25540function shiftSection(ast, node, delta) {
25541 if (node.type !== "SectionMetadata") {
25542 throw new Error("Can not shift node " + JSON.stringify(node.type));
25543 }
25544
25545 node.startOffset += delta;
25546
25547 if (_typeof(node.size.loc) === "object") {
25548 shiftLoc(node.size, delta);
25549 } // Custom sections doesn't have vectorOfSize
25550
25551
25552 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
25553 shiftLoc(node.vectorOfSize, delta);
25554 }
25555
25556 var sectionName = node.section; // shift node locations within that section
25557
25558 (0, _traverse.traverse)(ast, {
25559 Node: function Node(_ref3) {
25560 var node = _ref3.node;
25561 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
25562
25563 if (section === sectionName && _typeof(node.loc) === "object") {
25564 shiftLoc(node, delta);
25565 }
25566 }
25567 });
25568}
25569
25570function signatureForOpcode(object, name) {
25571 var opcodeName = name;
25572
25573 if (object !== undefined && object !== "") {
25574 opcodeName = object + "." + name;
25575 }
25576
25577 var sign = _signatures.signatures[opcodeName];
25578
25579 if (sign == undefined) {
25580 // TODO: Uncomment this when br_table and others has been done
25581 //throw new Error("Invalid opcode: "+opcodeName);
25582 return [object, object];
25583 }
25584
25585 return sign[0];
25586}
25587
25588function getUniqueNameGenerator() {
25589 var inc = {};
25590 return function () {
25591 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
25592
25593 if (!(prefix in inc)) {
25594 inc[prefix] = 0;
25595 } else {
25596 inc[prefix] = inc[prefix] + 1;
25597 }
25598
25599 return prefix + "_" + inc[prefix];
25600 };
25601}
25602
25603function getStartByteOffset(n) {
25604 // $FlowIgnore
25605 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
25606 throw new Error( // $FlowIgnore
25607 "Can not get byte offset without loc informations, node: " + String(n.id));
25608 }
25609
25610 return n.loc.start.column;
25611}
25612
25613function getEndByteOffset(n) {
25614 // $FlowIgnore
25615 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
25616 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
25617 }
25618
25619 return n.loc.end.column;
25620}
25621
25622function getFunctionBeginingByteOffset(n) {
25623 if (!(n.body.length > 0)) {
25624 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
25625 }
25626
25627 var _n$body = _slicedToArray(n.body, 1),
25628 firstInstruction = _n$body[0];
25629
25630 return getStartByteOffset(firstInstruction);
25631}
25632
25633function getEndBlockByteOffset(n) {
25634 // $FlowIgnore
25635 if (!(n.instr.length > 0 || n.body.length > 0)) {
25636 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
25637 }
25638
25639 var lastInstruction;
25640
25641 if (n.instr) {
25642 // $FlowIgnore
25643 lastInstruction = n.instr[n.instr.length - 1];
25644 }
25645
25646 if (n.body) {
25647 // $FlowIgnore
25648 lastInstruction = n.body[n.body.length - 1];
25649 }
25650
25651 if (!(_typeof(lastInstruction) === "object")) {
25652 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
25653 }
25654
25655 // $FlowIgnore
25656 return getStartByteOffset(lastInstruction);
25657}
25658
25659function getStartBlockByteOffset(n) {
25660 // $FlowIgnore
25661 if (!(n.instr.length > 0 || n.body.length > 0)) {
25662 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
25663 }
25664
25665 var fistInstruction;
25666
25667 if (n.instr) {
25668 // $FlowIgnore
25669 var _n$instr = _slicedToArray(n.instr, 1);
25670
25671 fistInstruction = _n$instr[0];
25672 }
25673
25674 if (n.body) {
25675 // $FlowIgnore
25676 var _n$body2 = _slicedToArray(n.body, 1);
25677
25678 fistInstruction = _n$body2[0];
25679 }
25680
25681 if (!(_typeof(fistInstruction) === "object")) {
25682 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
25683 }
25684
25685 // $FlowIgnore
25686 return getStartByteOffset(fistInstruction);
25687}
25688
25689/***/ }),
25690
25691/***/ 54236:
25692/***/ (function(__unused_webpack_module, exports) {
25693
25694"use strict";
25695
25696
25697Object.defineProperty(exports, "__esModule", ({
25698 value: true
25699}));
25700exports.default = parse;
25701
25702function parse(input) {
25703 input = input.toUpperCase();
25704 var splitIndex = input.indexOf("P");
25705 var mantissa, exponent;
25706
25707 if (splitIndex !== -1) {
25708 mantissa = input.substring(0, splitIndex);
25709 exponent = parseInt(input.substring(splitIndex + 1));
25710 } else {
25711 mantissa = input;
25712 exponent = 0;
25713 }
25714
25715 var dotIndex = mantissa.indexOf(".");
25716
25717 if (dotIndex !== -1) {
25718 var integerPart = parseInt(mantissa.substring(0, dotIndex), 16);
25719 var sign = Math.sign(integerPart);
25720 integerPart = sign * integerPart;
25721 var fractionLength = mantissa.length - dotIndex - 1;
25722 var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16);
25723 var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0;
25724
25725 if (sign === 0) {
25726 if (fraction === 0) {
25727 mantissa = sign;
25728 } else {
25729 if (Object.is(sign, -0)) {
25730 mantissa = -fraction;
25731 } else {
25732 mantissa = fraction;
25733 }
25734 }
25735 } else {
25736 mantissa = sign * (integerPart + fraction);
25737 }
25738 } else {
25739 mantissa = parseInt(mantissa, 16);
25740 }
25741
25742 return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1);
25743}
25744
25745/***/ }),
25746
25747/***/ 44706:
25748/***/ (function(__unused_webpack_module, exports) {
25749
25750"use strict";
25751
25752
25753Object.defineProperty(exports, "__esModule", ({
25754 value: true
25755}));
25756exports.LinkError = exports.CompileError = exports.RuntimeError = void 0;
25757
25758function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
25759
25760function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25761
25762function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25763
25764function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
25765
25766var RuntimeError =
25767/*#__PURE__*/
25768function (_Error) {
25769 _inherits(RuntimeError, _Error);
25770
25771 function RuntimeError() {
25772 _classCallCheck(this, RuntimeError);
25773
25774 return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
25775 }
25776
25777 return RuntimeError;
25778}(Error);
25779
25780exports.RuntimeError = RuntimeError;
25781
25782var CompileError =
25783/*#__PURE__*/
25784function (_Error2) {
25785 _inherits(CompileError, _Error2);
25786
25787 function CompileError() {
25788 _classCallCheck(this, CompileError);
25789
25790 return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
25791 }
25792
25793 return CompileError;
25794}(Error);
25795
25796exports.CompileError = CompileError;
25797
25798var LinkError =
25799/*#__PURE__*/
25800function (_Error3) {
25801 _inherits(LinkError, _Error3);
25802
25803 function LinkError() {
25804 _classCallCheck(this, LinkError);
25805
25806 return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
25807 }
25808
25809 return LinkError;
25810}(Error);
25811
25812exports.LinkError = LinkError;
25813
25814/***/ }),
25815
25816/***/ 51028:
25817/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
25818
25819"use strict";
25820
25821
25822Object.defineProperty(exports, "__esModule", ({
25823 value: true
25824}));
25825Object.defineProperty(exports, "getSectionForNode", ({
25826 enumerable: true,
25827 get: function get() {
25828 return _section.getSectionForNode;
25829 }
25830}));
25831exports.default = void 0;
25832
25833var _section = __webpack_require__(98933);
25834
25835var illegalop = "illegal";
25836var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
25837var moduleVersion = [0x01, 0x00, 0x00, 0x00];
25838
25839function invertMap(obj) {
25840 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
25841 return k;
25842 };
25843 var result = {};
25844 var keys = Object.keys(obj);
25845
25846 for (var i = 0, length = keys.length; i < length; i++) {
25847 result[keyModifierFn(obj[keys[i]])] = keys[i];
25848 }
25849
25850 return result;
25851}
25852
25853function createSymbolObject(name
25854/*: string */
25855, object
25856/*: string */
25857)
25858/*: Symbol*/
25859{
25860 var numberOfArgs
25861 /*: number*/
25862 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
25863 return {
25864 name: name,
25865 object: object,
25866 numberOfArgs: numberOfArgs
25867 };
25868}
25869
25870function createSymbol(name
25871/*: string */
25872)
25873/*: Symbol*/
25874{
25875 var numberOfArgs
25876 /*: number*/
25877 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
25878 return {
25879 name: name,
25880 numberOfArgs: numberOfArgs
25881 };
25882}
25883
25884var types = {
25885 func: 0x60,
25886 result: 0x40
25887};
25888var exportTypes = {
25889 0x00: "Func",
25890 0x01: "Table",
25891 0x02: "Mem",
25892 0x03: "Global"
25893};
25894var exportTypesByName = invertMap(exportTypes);
25895var valtypes = {
25896 0x7f: "i32",
25897 0x7e: "i64",
25898 0x7d: "f32",
25899 0x7c: "f64",
25900 0x7b: "v128"
25901};
25902var valtypesByString = invertMap(valtypes);
25903var tableTypes = {
25904 0x70: "anyfunc"
25905};
25906var blockTypes = Object.assign({}, valtypes, {
25907 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
25908 0x40: null,
25909 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
25910 0x7f: "i32",
25911 0x7e: "i64",
25912 0x7d: "f32",
25913 0x7c: "f64"
25914});
25915var globalTypes = {
25916 0x00: "const",
25917 0x01: "var"
25918};
25919var globalTypesByString = invertMap(globalTypes);
25920var importTypes = {
25921 0x00: "func",
25922 0x01: "table",
25923 0x02: "mem",
25924 0x03: "global"
25925};
25926var sections = {
25927 custom: 0,
25928 type: 1,
25929 import: 2,
25930 func: 3,
25931 table: 4,
25932 memory: 5,
25933 global: 6,
25934 export: 7,
25935 start: 8,
25936 element: 9,
25937 code: 10,
25938 data: 11
25939};
25940var symbolsByByte = {
25941 0x00: createSymbol("unreachable"),
25942 0x01: createSymbol("nop"),
25943 0x02: createSymbol("block"),
25944 0x03: createSymbol("loop"),
25945 0x04: createSymbol("if"),
25946 0x05: createSymbol("else"),
25947 0x06: illegalop,
25948 0x07: illegalop,
25949 0x08: illegalop,
25950 0x09: illegalop,
25951 0x0a: illegalop,
25952 0x0b: createSymbol("end"),
25953 0x0c: createSymbol("br", 1),
25954 0x0d: createSymbol("br_if", 1),
25955 0x0e: createSymbol("br_table"),
25956 0x0f: createSymbol("return"),
25957 0x10: createSymbol("call", 1),
25958 0x11: createSymbol("call_indirect", 2),
25959 0x12: illegalop,
25960 0x13: illegalop,
25961 0x14: illegalop,
25962 0x15: illegalop,
25963 0x16: illegalop,
25964 0x17: illegalop,
25965 0x18: illegalop,
25966 0x19: illegalop,
25967 0x1a: createSymbol("drop"),
25968 0x1b: createSymbol("select"),
25969 0x1c: illegalop,
25970 0x1d: illegalop,
25971 0x1e: illegalop,
25972 0x1f: illegalop,
25973 0x20: createSymbol("get_local", 1),
25974 0x21: createSymbol("set_local", 1),
25975 0x22: createSymbol("tee_local", 1),
25976 0x23: createSymbol("get_global", 1),
25977 0x24: createSymbol("set_global", 1),
25978 0x25: illegalop,
25979 0x26: illegalop,
25980 0x27: illegalop,
25981 0x28: createSymbolObject("load", "u32", 1),
25982 0x29: createSymbolObject("load", "u64", 1),
25983 0x2a: createSymbolObject("load", "f32", 1),
25984 0x2b: createSymbolObject("load", "f64", 1),
25985 0x2c: createSymbolObject("load8_s", "u32", 1),
25986 0x2d: createSymbolObject("load8_u", "u32", 1),
25987 0x2e: createSymbolObject("load16_s", "u32", 1),
25988 0x2f: createSymbolObject("load16_u", "u32", 1),
25989 0x30: createSymbolObject("load8_s", "u64", 1),
25990 0x31: createSymbolObject("load8_u", "u64", 1),
25991 0x32: createSymbolObject("load16_s", "u64", 1),
25992 0x33: createSymbolObject("load16_u", "u64", 1),
25993 0x34: createSymbolObject("load32_s", "u64", 1),
25994 0x35: createSymbolObject("load32_u", "u64", 1),
25995 0x36: createSymbolObject("store", "u32", 1),
25996 0x37: createSymbolObject("store", "u64", 1),
25997 0x38: createSymbolObject("store", "f32", 1),
25998 0x39: createSymbolObject("store", "f64", 1),
25999 0x3a: createSymbolObject("store8", "u32", 1),
26000 0x3b: createSymbolObject("store16", "u32", 1),
26001 0x3c: createSymbolObject("store8", "u64", 1),
26002 0x3d: createSymbolObject("store16", "u64", 1),
26003 0x3e: createSymbolObject("store32", "u64", 1),
26004 0x3f: createSymbolObject("current_memory"),
26005 0x40: createSymbolObject("grow_memory"),
26006 0x41: createSymbolObject("const", "i32", 1),
26007 0x42: createSymbolObject("const", "i64", 1),
26008 0x43: createSymbolObject("const", "f32", 1),
26009 0x44: createSymbolObject("const", "f64", 1),
26010 0x45: createSymbolObject("eqz", "i32"),
26011 0x46: createSymbolObject("eq", "i32"),
26012 0x47: createSymbolObject("ne", "i32"),
26013 0x48: createSymbolObject("lt_s", "i32"),
26014 0x49: createSymbolObject("lt_u", "i32"),
26015 0x4a: createSymbolObject("gt_s", "i32"),
26016 0x4b: createSymbolObject("gt_u", "i32"),
26017 0x4c: createSymbolObject("le_s", "i32"),
26018 0x4d: createSymbolObject("le_u", "i32"),
26019 0x4e: createSymbolObject("ge_s", "i32"),
26020 0x4f: createSymbolObject("ge_u", "i32"),
26021 0x50: createSymbolObject("eqz", "i64"),
26022 0x51: createSymbolObject("eq", "i64"),
26023 0x52: createSymbolObject("ne", "i64"),
26024 0x53: createSymbolObject("lt_s", "i64"),
26025 0x54: createSymbolObject("lt_u", "i64"),
26026 0x55: createSymbolObject("gt_s", "i64"),
26027 0x56: createSymbolObject("gt_u", "i64"),
26028 0x57: createSymbolObject("le_s", "i64"),
26029 0x58: createSymbolObject("le_u", "i64"),
26030 0x59: createSymbolObject("ge_s", "i64"),
26031 0x5a: createSymbolObject("ge_u", "i64"),
26032 0x5b: createSymbolObject("eq", "f32"),
26033 0x5c: createSymbolObject("ne", "f32"),
26034 0x5d: createSymbolObject("lt", "f32"),
26035 0x5e: createSymbolObject("gt", "f32"),
26036 0x5f: createSymbolObject("le", "f32"),
26037 0x60: createSymbolObject("ge", "f32"),
26038 0x61: createSymbolObject("eq", "f64"),
26039 0x62: createSymbolObject("ne", "f64"),
26040 0x63: createSymbolObject("lt", "f64"),
26041 0x64: createSymbolObject("gt", "f64"),
26042 0x65: createSymbolObject("le", "f64"),
26043 0x66: createSymbolObject("ge", "f64"),
26044 0x67: createSymbolObject("clz", "i32"),
26045 0x68: createSymbolObject("ctz", "i32"),
26046 0x69: createSymbolObject("popcnt", "i32"),
26047 0x6a: createSymbolObject("add", "i32"),
26048 0x6b: createSymbolObject("sub", "i32"),
26049 0x6c: createSymbolObject("mul", "i32"),
26050 0x6d: createSymbolObject("div_s", "i32"),
26051 0x6e: createSymbolObject("div_u", "i32"),
26052 0x6f: createSymbolObject("rem_s", "i32"),
26053 0x70: createSymbolObject("rem_u", "i32"),
26054 0x71: createSymbolObject("and", "i32"),
26055 0x72: createSymbolObject("or", "i32"),
26056 0x73: createSymbolObject("xor", "i32"),
26057 0x74: createSymbolObject("shl", "i32"),
26058 0x75: createSymbolObject("shr_s", "i32"),
26059 0x76: createSymbolObject("shr_u", "i32"),
26060 0x77: createSymbolObject("rotl", "i32"),
26061 0x78: createSymbolObject("rotr", "i32"),
26062 0x79: createSymbolObject("clz", "i64"),
26063 0x7a: createSymbolObject("ctz", "i64"),
26064 0x7b: createSymbolObject("popcnt", "i64"),
26065 0x7c: createSymbolObject("add", "i64"),
26066 0x7d: createSymbolObject("sub", "i64"),
26067 0x7e: createSymbolObject("mul", "i64"),
26068 0x7f: createSymbolObject("div_s", "i64"),
26069 0x80: createSymbolObject("div_u", "i64"),
26070 0x81: createSymbolObject("rem_s", "i64"),
26071 0x82: createSymbolObject("rem_u", "i64"),
26072 0x83: createSymbolObject("and", "i64"),
26073 0x84: createSymbolObject("or", "i64"),
26074 0x85: createSymbolObject("xor", "i64"),
26075 0x86: createSymbolObject("shl", "i64"),
26076 0x87: createSymbolObject("shr_s", "i64"),
26077 0x88: createSymbolObject("shr_u", "i64"),
26078 0x89: createSymbolObject("rotl", "i64"),
26079 0x8a: createSymbolObject("rotr", "i64"),
26080 0x8b: createSymbolObject("abs", "f32"),
26081 0x8c: createSymbolObject("neg", "f32"),
26082 0x8d: createSymbolObject("ceil", "f32"),
26083 0x8e: createSymbolObject("floor", "f32"),
26084 0x8f: createSymbolObject("trunc", "f32"),
26085 0x90: createSymbolObject("nearest", "f32"),
26086 0x91: createSymbolObject("sqrt", "f32"),
26087 0x92: createSymbolObject("add", "f32"),
26088 0x93: createSymbolObject("sub", "f32"),
26089 0x94: createSymbolObject("mul", "f32"),
26090 0x95: createSymbolObject("div", "f32"),
26091 0x96: createSymbolObject("min", "f32"),
26092 0x97: createSymbolObject("max", "f32"),
26093 0x98: createSymbolObject("copysign", "f32"),
26094 0x99: createSymbolObject("abs", "f64"),
26095 0x9a: createSymbolObject("neg", "f64"),
26096 0x9b: createSymbolObject("ceil", "f64"),
26097 0x9c: createSymbolObject("floor", "f64"),
26098 0x9d: createSymbolObject("trunc", "f64"),
26099 0x9e: createSymbolObject("nearest", "f64"),
26100 0x9f: createSymbolObject("sqrt", "f64"),
26101 0xa0: createSymbolObject("add", "f64"),
26102 0xa1: createSymbolObject("sub", "f64"),
26103 0xa2: createSymbolObject("mul", "f64"),
26104 0xa3: createSymbolObject("div", "f64"),
26105 0xa4: createSymbolObject("min", "f64"),
26106 0xa5: createSymbolObject("max", "f64"),
26107 0xa6: createSymbolObject("copysign", "f64"),
26108 0xa7: createSymbolObject("wrap/i64", "i32"),
26109 0xa8: createSymbolObject("trunc_s/f32", "i32"),
26110 0xa9: createSymbolObject("trunc_u/f32", "i32"),
26111 0xaa: createSymbolObject("trunc_s/f64", "i32"),
26112 0xab: createSymbolObject("trunc_u/f64", "i32"),
26113 0xac: createSymbolObject("extend_s/i32", "i64"),
26114 0xad: createSymbolObject("extend_u/i32", "i64"),
26115 0xae: createSymbolObject("trunc_s/f32", "i64"),
26116 0xaf: createSymbolObject("trunc_u/f32", "i64"),
26117 0xb0: createSymbolObject("trunc_s/f64", "i64"),
26118 0xb1: createSymbolObject("trunc_u/f64", "i64"),
26119 0xb2: createSymbolObject("convert_s/i32", "f32"),
26120 0xb3: createSymbolObject("convert_u/i32", "f32"),
26121 0xb4: createSymbolObject("convert_s/i64", "f32"),
26122 0xb5: createSymbolObject("convert_u/i64", "f32"),
26123 0xb6: createSymbolObject("demote/f64", "f32"),
26124 0xb7: createSymbolObject("convert_s/i32", "f64"),
26125 0xb8: createSymbolObject("convert_u/i32", "f64"),
26126 0xb9: createSymbolObject("convert_s/i64", "f64"),
26127 0xba: createSymbolObject("convert_u/i64", "f64"),
26128 0xbb: createSymbolObject("promote/f32", "f64"),
26129 0xbc: createSymbolObject("reinterpret/f32", "i32"),
26130 0xbd: createSymbolObject("reinterpret/f64", "i64"),
26131 0xbe: createSymbolObject("reinterpret/i32", "f32"),
26132 0xbf: createSymbolObject("reinterpret/i64", "f64")
26133};
26134var symbolsByName = invertMap(symbolsByByte, function (obj) {
26135 if (typeof obj.object === "string") {
26136 return "".concat(obj.object, ".").concat(obj.name);
26137 }
26138
26139 return obj.name;
26140});
26141var _default = {
26142 symbolsByByte: symbolsByByte,
26143 sections: sections,
26144 magicModuleHeader: magicModuleHeader,
26145 moduleVersion: moduleVersion,
26146 types: types,
26147 valtypes: valtypes,
26148 exportTypes: exportTypes,
26149 blockTypes: blockTypes,
26150 tableTypes: tableTypes,
26151 globalTypes: globalTypes,
26152 importTypes: importTypes,
26153 valtypesByString: valtypesByString,
26154 globalTypesByString: globalTypesByString,
26155 exportTypesByName: exportTypesByName,
26156 symbolsByName: symbolsByName
26157};
26158exports.default = _default;
26159
26160/***/ }),
26161
26162/***/ 98933:
26163/***/ (function(__unused_webpack_module, exports) {
26164
26165"use strict";
26166
26167
26168Object.defineProperty(exports, "__esModule", ({
26169 value: true
26170}));
26171exports.getSectionForNode = getSectionForNode;
26172
26173function getSectionForNode(n) {
26174 switch (n.type) {
26175 case "ModuleImport":
26176 return "import";
26177
26178 case "CallInstruction":
26179 case "CallIndirectInstruction":
26180 case "Func":
26181 case "Instr":
26182 return "code";
26183
26184 case "ModuleExport":
26185 return "export";
26186
26187 case "Start":
26188 return "start";
26189
26190 case "TypeInstruction":
26191 return "type";
26192
26193 case "IndexInFuncSection":
26194 return "func";
26195
26196 case "Global":
26197 return "global";
26198 // No section
26199
26200 default:
26201 return;
26202 }
26203}
26204
26205/***/ }),
26206
26207/***/ 45378:
26208/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
26209
26210"use strict";
26211
26212
26213Object.defineProperty(exports, "__esModule", ({
26214 value: true
26215}));
26216exports.print = print;
26217
26218var _ast = __webpack_require__(37771);
26219
26220var _long = _interopRequireDefault(__webpack_require__(77960));
26221
26222function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26223
26224function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26225
26226function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
26227
26228function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
26229
26230var compact = false;
26231var space = " ";
26232
26233var quote = function quote(str) {
26234 return "\"".concat(str, "\"");
26235};
26236
26237function indent(nb) {
26238 return Array(nb).fill(space + space).join("");
26239} // TODO(sven): allow arbitrary ast nodes
26240
26241
26242function print(n) {
26243 if (n.type === "Program") {
26244 return printProgram(n, 0);
26245 } else {
26246 throw new Error("Unsupported node in print of type: " + String(n.type));
26247 }
26248}
26249
26250function printProgram(n, depth) {
26251 return n.body.reduce(function (acc, child) {
26252 if (child.type === "Module") {
26253 acc += printModule(child, depth + 1);
26254 }
26255
26256 if (child.type === "Func") {
26257 acc += printFunc(child, depth + 1);
26258 }
26259
26260 if (child.type === "BlockComment") {
26261 acc += printBlockComment(child);
26262 }
26263
26264 if (child.type === "LeadingComment") {
26265 acc += printLeadingComment(child);
26266 }
26267
26268 if (compact === false) {
26269 acc += "\n";
26270 }
26271
26272 return acc;
26273 }, "");
26274}
26275
26276function printTypeInstruction(n) {
26277 var out = "";
26278 out += "(";
26279 out += "type";
26280 out += space;
26281
26282 if (n.id != null) {
26283 out += printIndex(n.id);
26284 out += space;
26285 }
26286
26287 out += "(";
26288 out += "func";
26289 n.functype.params.forEach(function (param) {
26290 out += space;
26291 out += "(";
26292 out += "param";
26293 out += space;
26294 out += printFuncParam(param);
26295 out += ")";
26296 });
26297 n.functype.results.forEach(function (result) {
26298 out += space;
26299 out += "(";
26300 out += "result";
26301 out += space;
26302 out += result;
26303 out += ")";
26304 });
26305 out += ")"; // func
26306
26307 out += ")";
26308 return out;
26309}
26310
26311function printModule(n, depth) {
26312 var out = "(";
26313 out += "module";
26314
26315 if (typeof n.id === "string") {
26316 out += space;
26317 out += n.id;
26318 }
26319
26320 if (compact === false) {
26321 out += "\n";
26322 } else {
26323 out += space;
26324 }
26325
26326 n.fields.forEach(function (field) {
26327 if (compact === false) {
26328 out += indent(depth);
26329 }
26330
26331 switch (field.type) {
26332 case "Func":
26333 {
26334 out += printFunc(field, depth + 1);
26335 break;
26336 }
26337
26338 case "TypeInstruction":
26339 {
26340 out += printTypeInstruction(field);
26341 break;
26342 }
26343
26344 case "Table":
26345 {
26346 out += printTable(field);
26347 break;
26348 }
26349
26350 case "Global":
26351 {
26352 out += printGlobal(field, depth + 1);
26353 break;
26354 }
26355
26356 case "ModuleExport":
26357 {
26358 out += printModuleExport(field);
26359 break;
26360 }
26361
26362 case "ModuleImport":
26363 {
26364 out += printModuleImport(field);
26365 break;
26366 }
26367
26368 case "Memory":
26369 {
26370 out += printMemory(field);
26371 break;
26372 }
26373
26374 case "BlockComment":
26375 {
26376 out += printBlockComment(field);
26377 break;
26378 }
26379
26380 case "LeadingComment":
26381 {
26382 out += printLeadingComment(field);
26383 break;
26384 }
26385
26386 case "Start":
26387 {
26388 out += printStart(field);
26389 break;
26390 }
26391
26392 case "Elem":
26393 {
26394 out += printElem(field, depth);
26395 break;
26396 }
26397
26398 case "Data":
26399 {
26400 out += printData(field, depth);
26401 break;
26402 }
26403
26404 default:
26405 throw new Error("Unsupported node in printModule: " + String(field.type));
26406 }
26407
26408 if (compact === false) {
26409 out += "\n";
26410 }
26411 });
26412 out += ")";
26413 return out;
26414}
26415
26416function printData(n, depth) {
26417 var out = "";
26418 out += "(";
26419 out += "data";
26420 out += space;
26421 out += printIndex(n.memoryIndex);
26422 out += space;
26423 out += printInstruction(n.offset, depth);
26424 out += space;
26425 out += '"';
26426 n.init.values.forEach(function (byte) {
26427 // Avoid non-displayable characters
26428 if (byte <= 31 || byte == 34 || byte == 92 || byte >= 127) {
26429 out += "\\";
26430 out += ("00" + byte.toString(16)).substr(-2);
26431 } else if (byte > 255) {
26432 throw new Error("Unsupported byte in data segment: " + byte);
26433 } else {
26434 out += String.fromCharCode(byte);
26435 }
26436 });
26437 out += '"';
26438 out += ")";
26439 return out;
26440}
26441
26442function printElem(n, depth) {
26443 var out = "";
26444 out += "(";
26445 out += "elem";
26446 out += space;
26447 out += printIndex(n.table);
26448
26449 var _n$offset = _slicedToArray(n.offset, 1),
26450 firstOffset = _n$offset[0];
26451
26452 out += space;
26453 out += "(";
26454 out += "offset";
26455 out += space;
26456 out += printInstruction(firstOffset, depth);
26457 out += ")";
26458 n.funcs.forEach(function (func) {
26459 out += space;
26460 out += printIndex(func);
26461 });
26462 out += ")";
26463 return out;
26464}
26465
26466function printStart(n) {
26467 var out = "";
26468 out += "(";
26469 out += "start";
26470 out += space;
26471 out += printIndex(n.index);
26472 out += ")";
26473 return out;
26474}
26475
26476function printLeadingComment(n) {
26477 // Don't print leading comments in compact mode
26478 if (compact === true) {
26479 return "";
26480 }
26481
26482 var out = "";
26483 out += ";;";
26484 out += n.value;
26485 out += "\n";
26486 return out;
26487}
26488
26489function printBlockComment(n) {
26490 // Don't print block comments in compact mode
26491 if (compact === true) {
26492 return "";
26493 }
26494
26495 var out = "";
26496 out += "(;";
26497 out += n.value;
26498 out += ";)";
26499 out += "\n";
26500 return out;
26501}
26502
26503function printSignature(n) {
26504 var out = "";
26505 n.params.forEach(function (param) {
26506 out += space;
26507 out += "(";
26508 out += "param";
26509 out += space;
26510 out += printFuncParam(param);
26511 out += ")";
26512 });
26513 n.results.forEach(function (result) {
26514 out += space;
26515 out += "(";
26516 out += "result";
26517 out += space;
26518 out += result;
26519 out += ")";
26520 });
26521 return out;
26522}
26523
26524function printModuleImportDescr(n) {
26525 var out = "";
26526
26527 if (n.type === "FuncImportDescr") {
26528 out += "(";
26529 out += "func";
26530
26531 if ((0, _ast.isAnonymous)(n.id) === false) {
26532 out += space;
26533 out += printIdentifier(n.id);
26534 }
26535
26536 out += printSignature(n.signature);
26537 out += ")";
26538 }
26539
26540 if (n.type === "GlobalType") {
26541 out += "(";
26542 out += "global";
26543 out += space;
26544 out += printGlobalType(n);
26545 out += ")";
26546 }
26547
26548 if (n.type === "Table") {
26549 out += printTable(n);
26550 }
26551
26552 return out;
26553}
26554
26555function printModuleImport(n) {
26556 var out = "";
26557 out += "(";
26558 out += "import";
26559 out += space;
26560 out += quote(n.module);
26561 out += space;
26562 out += quote(n.name);
26563 out += space;
26564 out += printModuleImportDescr(n.descr);
26565 out += ")";
26566 return out;
26567}
26568
26569function printGlobalType(n) {
26570 var out = "";
26571
26572 if (n.mutability === "var") {
26573 out += "(";
26574 out += "mut";
26575 out += space;
26576 out += n.valtype;
26577 out += ")";
26578 } else {
26579 out += n.valtype;
26580 }
26581
26582 return out;
26583}
26584
26585function printGlobal(n, depth) {
26586 var out = "";
26587 out += "(";
26588 out += "global";
26589 out += space;
26590
26591 if (n.name != null && (0, _ast.isAnonymous)(n.name) === false) {
26592 out += printIdentifier(n.name);
26593 out += space;
26594 }
26595
26596 out += printGlobalType(n.globalType);
26597 out += space;
26598 n.init.forEach(function (i) {
26599 out += printInstruction(i, depth + 1);
26600 });
26601 out += ")";
26602 return out;
26603}
26604
26605function printTable(n) {
26606 var out = "";
26607 out += "(";
26608 out += "table";
26609 out += space;
26610
26611 if (n.name != null && (0, _ast.isAnonymous)(n.name) === false) {
26612 out += printIdentifier(n.name);
26613 out += space;
26614 }
26615
26616 out += printLimit(n.limits);
26617 out += space;
26618 out += n.elementType;
26619 out += ")";
26620 return out;
26621}
26622
26623function printFuncParam(n) {
26624 var out = "";
26625
26626 if (typeof n.id === "string") {
26627 out += "$" + n.id;
26628 out += space;
26629 }
26630
26631 out += n.valtype;
26632 return out;
26633}
26634
26635function printFunc(n, depth) {
26636 var out = "";
26637 out += "(";
26638 out += "func";
26639
26640 if (n.name != null) {
26641 if (n.name.type === "Identifier" && (0, _ast.isAnonymous)(n.name) === false) {
26642 out += space;
26643 out += printIdentifier(n.name);
26644 }
26645 }
26646
26647 if (n.signature.type === "Signature") {
26648 out += printSignature(n.signature);
26649 } else {
26650 var index = n.signature;
26651 out += space;
26652 out += "(";
26653 out += "type";
26654 out += space;
26655 out += printIndex(index);
26656 out += ")";
26657 }
26658
26659 if (n.body.length > 0) {
26660 // func is empty since we ignore the default end instruction
26661 if (n.body.length === 1 && n.body[0].id === "end") {
26662 out += ")";
26663 return out;
26664 }
26665
26666 if (compact === false) {
26667 out += "\n";
26668 }
26669
26670 n.body.forEach(function (i) {
26671 if (i.id !== "end") {
26672 out += indent(depth);
26673 out += printInstruction(i, depth);
26674
26675 if (compact === false) {
26676 out += "\n";
26677 }
26678 }
26679 });
26680 out += indent(depth - 1) + ")";
26681 } else {
26682 out += ")";
26683 }
26684
26685 return out;
26686}
26687
26688function printInstruction(n, depth) {
26689 switch (n.type) {
26690 case "Instr":
26691 // $FlowIgnore
26692 return printGenericInstruction(n, depth + 1);
26693
26694 case "BlockInstruction":
26695 // $FlowIgnore
26696 return printBlockInstruction(n, depth + 1);
26697
26698 case "IfInstruction":
26699 // $FlowIgnore
26700 return printIfInstruction(n, depth + 1);
26701
26702 case "CallInstruction":
26703 // $FlowIgnore
26704 return printCallInstruction(n, depth + 1);
26705
26706 case "CallIndirectInstruction":
26707 // $FlowIgnore
26708 return printCallIndirectIntruction(n, depth + 1);
26709
26710 case "LoopInstruction":
26711 // $FlowIgnore
26712 return printLoopInstruction(n, depth + 1);
26713
26714 default:
26715 throw new Error("Unsupported instruction: " + JSON.stringify(n.type));
26716 }
26717}
26718
26719function printCallIndirectIntruction(n, depth) {
26720 var out = "";
26721 out += "(";
26722 out += "call_indirect";
26723
26724 if (n.signature.type === "Signature") {
26725 out += printSignature(n.signature);
26726 } else if (n.signature.type === "Identifier") {
26727 out += space;
26728 out += "(";
26729 out += "type";
26730 out += space;
26731 out += printIdentifier(n.signature);
26732 out += ")";
26733 } else {
26734 throw new Error("CallIndirectInstruction: unsupported signature " + JSON.stringify(n.signature.type));
26735 }
26736
26737 out += space;
26738
26739 if (n.intrs != null) {
26740 // $FlowIgnore
26741 n.intrs.forEach(function (i, index) {
26742 // $FlowIgnore
26743 out += printInstruction(i, depth + 1); // $FlowIgnore
26744
26745 if (index !== n.intrs.length - 1) {
26746 out += space;
26747 }
26748 });
26749 }
26750
26751 out += ")";
26752 return out;
26753}
26754
26755function printLoopInstruction(n, depth) {
26756 var out = "";
26757 out += "(";
26758 out += "loop";
26759
26760 if (n.label != null && (0, _ast.isAnonymous)(n.label) === false) {
26761 out += space;
26762 out += printIdentifier(n.label);
26763 }
26764
26765 if (typeof n.resulttype === "string") {
26766 out += space;
26767 out += "(";
26768 out += "result";
26769 out += space;
26770 out += n.resulttype;
26771 out += ")";
26772 }
26773
26774 if (n.instr.length > 0) {
26775 n.instr.forEach(function (e) {
26776 if (compact === false) {
26777 out += "\n";
26778 }
26779
26780 out += indent(depth);
26781 out += printInstruction(e, depth + 1);
26782 });
26783
26784 if (compact === false) {
26785 out += "\n";
26786 out += indent(depth - 1);
26787 }
26788 }
26789
26790 out += ")";
26791 return out;
26792}
26793
26794function printCallInstruction(n, depth) {
26795 var out = "";
26796 out += "(";
26797 out += "call";
26798 out += space;
26799 out += printIndex(n.index);
26800
26801 if (_typeof(n.instrArgs) === "object") {
26802 // $FlowIgnore
26803 n.instrArgs.forEach(function (arg) {
26804 out += space;
26805 out += printFuncInstructionArg(arg, depth + 1);
26806 });
26807 }
26808
26809 out += ")";
26810 return out;
26811}
26812
26813function printIfInstruction(n, depth) {
26814 var out = "";
26815 out += "(";
26816 out += "if";
26817
26818 if (n.testLabel != null && (0, _ast.isAnonymous)(n.testLabel) === false) {
26819 out += space;
26820 out += printIdentifier(n.testLabel);
26821 }
26822
26823 if (typeof n.result === "string") {
26824 out += space;
26825 out += "(";
26826 out += "result";
26827 out += space;
26828 out += n.result;
26829 out += ")";
26830 }
26831
26832 if (n.test.length > 0) {
26833 out += space;
26834 n.test.forEach(function (i) {
26835 out += printInstruction(i, depth + 1);
26836 });
26837 }
26838
26839 if (n.consequent.length > 0) {
26840 if (compact === false) {
26841 out += "\n";
26842 }
26843
26844 out += indent(depth);
26845 out += "(";
26846 out += "then";
26847 depth++;
26848 n.consequent.forEach(function (i) {
26849 if (compact === false) {
26850 out += "\n";
26851 }
26852
26853 out += indent(depth);
26854 out += printInstruction(i, depth + 1);
26855 });
26856 depth--;
26857
26858 if (compact === false) {
26859 out += "\n";
26860 out += indent(depth);
26861 }
26862
26863 out += ")";
26864 } else {
26865 if (compact === false) {
26866 out += "\n";
26867 out += indent(depth);
26868 }
26869
26870 out += "(";
26871 out += "then";
26872 out += ")";
26873 }
26874
26875 if (n.alternate.length > 0) {
26876 if (compact === false) {
26877 out += "\n";
26878 }
26879
26880 out += indent(depth);
26881 out += "(";
26882 out += "else";
26883 depth++;
26884 n.alternate.forEach(function (i) {
26885 if (compact === false) {
26886 out += "\n";
26887 }
26888
26889 out += indent(depth);
26890 out += printInstruction(i, depth + 1);
26891 });
26892 depth--;
26893
26894 if (compact === false) {
26895 out += "\n";
26896 out += indent(depth);
26897 }
26898
26899 out += ")";
26900 } else {
26901 if (compact === false) {
26902 out += "\n";
26903 out += indent(depth);
26904 }
26905
26906 out += "(";
26907 out += "else";
26908 out += ")";
26909 }
26910
26911 if (compact === false) {
26912 out += "\n";
26913 out += indent(depth - 1);
26914 }
26915
26916 out += ")";
26917 return out;
26918}
26919
26920function printBlockInstruction(n, depth) {
26921 var out = "";
26922 out += "(";
26923 out += "block";
26924
26925 if (n.label != null && (0, _ast.isAnonymous)(n.label) === false) {
26926 out += space;
26927 out += printIdentifier(n.label);
26928 }
26929
26930 if (typeof n.result === "string") {
26931 out += space;
26932 out += "(";
26933 out += "result";
26934 out += space;
26935 out += n.result;
26936 out += ")";
26937 }
26938
26939 if (n.instr.length > 0) {
26940 n.instr.forEach(function (i) {
26941 if (compact === false) {
26942 out += "\n";
26943 }
26944
26945 out += indent(depth);
26946 out += printInstruction(i, depth + 1);
26947 });
26948
26949 if (compact === false) {
26950 out += "\n";
26951 }
26952
26953 out += indent(depth - 1);
26954 out += ")";
26955 } else {
26956 out += ")";
26957 }
26958
26959 return out;
26960}
26961
26962function printGenericInstruction(n, depth) {
26963 var out = "";
26964 out += "(";
26965
26966 if (typeof n.object === "string") {
26967 out += n.object;
26968 out += ".";
26969 }
26970
26971 out += n.id;
26972 n.args.forEach(function (arg) {
26973 out += space;
26974 out += printFuncInstructionArg(arg, depth + 1);
26975 });
26976 out += ")";
26977 return out;
26978}
26979
26980function printLongNumberLiteral(n) {
26981 if (typeof n.raw === "string") {
26982 return n.raw;
26983 }
26984
26985 var _n$value = n.value,
26986 low = _n$value.low,
26987 high = _n$value.high;
26988 var v = new _long.default(low, high);
26989 return v.toString();
26990}
26991
26992function printFloatLiteral(n) {
26993 if (typeof n.raw === "string") {
26994 return n.raw;
26995 }
26996
26997 return String(n.value);
26998}
26999
27000function printFuncInstructionArg(n, depth) {
27001 var out = "";
27002
27003 if (n.type === "NumberLiteral") {
27004 out += printNumberLiteral(n);
27005 }
27006
27007 if (n.type === "LongNumberLiteral") {
27008 out += printLongNumberLiteral(n);
27009 }
27010
27011 if (n.type === "Identifier" && (0, _ast.isAnonymous)(n) === false) {
27012 out += printIdentifier(n);
27013 }
27014
27015 if (n.type === "ValtypeLiteral") {
27016 out += n.name;
27017 }
27018
27019 if (n.type === "FloatLiteral") {
27020 out += printFloatLiteral(n);
27021 }
27022
27023 if ((0, _ast.isInstruction)(n)) {
27024 out += printInstruction(n, depth + 1);
27025 }
27026
27027 return out;
27028}
27029
27030function printNumberLiteral(n) {
27031 if (typeof n.raw === "string") {
27032 return n.raw;
27033 }
27034
27035 return String(n.value);
27036}
27037
27038function printModuleExport(n) {
27039 var out = "";
27040 out += "(";
27041 out += "export";
27042 out += space;
27043 out += quote(n.name);
27044
27045 if (n.descr.exportType === "Func") {
27046 out += space;
27047 out += "(";
27048 out += "func";
27049 out += space;
27050 out += printIndex(n.descr.id);
27051 out += ")";
27052 } else if (n.descr.exportType === "Global") {
27053 out += space;
27054 out += "(";
27055 out += "global";
27056 out += space;
27057 out += printIndex(n.descr.id);
27058 out += ")";
27059 } else if (n.descr.exportType === "Memory" || n.descr.exportType === "Mem") {
27060 out += space;
27061 out += "(";
27062 out += "memory";
27063 out += space;
27064 out += printIndex(n.descr.id);
27065 out += ")";
27066 } else if (n.descr.exportType === "Table") {
27067 out += space;
27068 out += "(";
27069 out += "table";
27070 out += space;
27071 out += printIndex(n.descr.id);
27072 out += ")";
27073 } else {
27074 throw new Error("printModuleExport: unknown type: " + n.descr.exportType);
27075 }
27076
27077 out += ")";
27078 return out;
27079}
27080
27081function printIdentifier(n) {
27082 return "$" + n.value;
27083}
27084
27085function printIndex(n) {
27086 if (n.type === "Identifier") {
27087 return printIdentifier(n);
27088 } else if (n.type === "NumberLiteral") {
27089 return printNumberLiteral(n);
27090 } else {
27091 throw new Error("Unsupported index: " + n.type);
27092 }
27093}
27094
27095function printMemory(n) {
27096 var out = "";
27097 out += "(";
27098 out += "memory";
27099
27100 if (n.id != null) {
27101 out += space;
27102 out += printIndex(n.id);
27103 out += space;
27104 }
27105
27106 out += printLimit(n.limits);
27107 out += ")";
27108 return out;
27109}
27110
27111function printLimit(n) {
27112 var out = "";
27113 out += n.min + "";
27114
27115 if (n.max != null) {
27116 out += space;
27117 out += String(n.max);
27118 }
27119
27120 return out;
27121}
27122
27123/***/ }),
27124
27125/***/ 21053:
27126/***/ (function(__unused_webpack_module, exports) {
27127
27128"use strict";
27129
27130
27131Object.defineProperty(exports, "__esModule", ({
27132 value: true
27133}));
27134exports.cloneNode = cloneNode;
27135
27136function cloneNode(n) {
27137 // $FlowIgnore
27138 var newObj = {};
27139
27140 for (var k in n) {
27141 newObj[k] = n[k];
27142 }
27143
27144 return newObj;
27145}
27146
27147/***/ }),
27148
27149/***/ 37771:
27150/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
27151
27152"use strict";
27153
27154
27155Object.defineProperty(exports, "__esModule", ({
27156 value: true
27157}));
27158var _exportNames = {
27159 numberLiteralFromRaw: true,
27160 withLoc: true,
27161 withRaw: true,
27162 funcParam: true,
27163 indexLiteral: true,
27164 memIndexLiteral: true,
27165 instruction: true,
27166 objectInstruction: true,
27167 traverse: true,
27168 signatures: true,
27169 cloneNode: true
27170};
27171Object.defineProperty(exports, "numberLiteralFromRaw", ({
27172 enumerable: true,
27173 get: function get() {
27174 return _nodeHelpers.numberLiteralFromRaw;
27175 }
27176}));
27177Object.defineProperty(exports, "withLoc", ({
27178 enumerable: true,
27179 get: function get() {
27180 return _nodeHelpers.withLoc;
27181 }
27182}));
27183Object.defineProperty(exports, "withRaw", ({
27184 enumerable: true,
27185 get: function get() {
27186 return _nodeHelpers.withRaw;
27187 }
27188}));
27189Object.defineProperty(exports, "funcParam", ({
27190 enumerable: true,
27191 get: function get() {
27192 return _nodeHelpers.funcParam;
27193 }
27194}));
27195Object.defineProperty(exports, "indexLiteral", ({
27196 enumerable: true,
27197 get: function get() {
27198 return _nodeHelpers.indexLiteral;
27199 }
27200}));
27201Object.defineProperty(exports, "memIndexLiteral", ({
27202 enumerable: true,
27203 get: function get() {
27204 return _nodeHelpers.memIndexLiteral;
27205 }
27206}));
27207Object.defineProperty(exports, "instruction", ({
27208 enumerable: true,
27209 get: function get() {
27210 return _nodeHelpers.instruction;
27211 }
27212}));
27213Object.defineProperty(exports, "objectInstruction", ({
27214 enumerable: true,
27215 get: function get() {
27216 return _nodeHelpers.objectInstruction;
27217 }
27218}));
27219Object.defineProperty(exports, "traverse", ({
27220 enumerable: true,
27221 get: function get() {
27222 return _traverse.traverse;
27223 }
27224}));
27225Object.defineProperty(exports, "signatures", ({
27226 enumerable: true,
27227 get: function get() {
27228 return _signatures.signatures;
27229 }
27230}));
27231Object.defineProperty(exports, "cloneNode", ({
27232 enumerable: true,
27233 get: function get() {
27234 return _clone.cloneNode;
27235 }
27236}));
27237
27238var _nodes = __webpack_require__(85701);
27239
27240Object.keys(_nodes).forEach(function (key) {
27241 if (key === "default" || key === "__esModule") return;
27242 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27243 Object.defineProperty(exports, key, {
27244 enumerable: true,
27245 get: function get() {
27246 return _nodes[key];
27247 }
27248 });
27249});
27250
27251var _nodeHelpers = __webpack_require__(23599);
27252
27253var _traverse = __webpack_require__(56694);
27254
27255var _signatures = __webpack_require__(74127);
27256
27257var _utils = __webpack_require__(41618);
27258
27259Object.keys(_utils).forEach(function (key) {
27260 if (key === "default" || key === "__esModule") return;
27261 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27262 Object.defineProperty(exports, key, {
27263 enumerable: true,
27264 get: function get() {
27265 return _utils[key];
27266 }
27267 });
27268});
27269
27270var _clone = __webpack_require__(21053);
27271
27272/***/ }),
27273
27274/***/ 23599:
27275/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
27276
27277"use strict";
27278
27279
27280Object.defineProperty(exports, "__esModule", ({
27281 value: true
27282}));
27283exports.numberLiteralFromRaw = numberLiteralFromRaw;
27284exports.instruction = instruction;
27285exports.objectInstruction = objectInstruction;
27286exports.withLoc = withLoc;
27287exports.withRaw = withRaw;
27288exports.funcParam = funcParam;
27289exports.indexLiteral = indexLiteral;
27290exports.memIndexLiteral = memIndexLiteral;
27291
27292var _wastParser = __webpack_require__(9016);
27293
27294var _nodes = __webpack_require__(85701);
27295
27296function numberLiteralFromRaw(rawValue) {
27297 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
27298 var original = rawValue; // Remove numeric separators _
27299
27300 if (typeof rawValue === "string") {
27301 rawValue = rawValue.replace(/_/g, "");
27302 }
27303
27304 if (typeof rawValue === "number") {
27305 return (0, _nodes.numberLiteral)(rawValue, String(original));
27306 } else {
27307 switch (instructionType) {
27308 case "i32":
27309 {
27310 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
27311 }
27312
27313 case "u32":
27314 {
27315 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
27316 }
27317
27318 case "i64":
27319 {
27320 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
27321 }
27322
27323 case "f32":
27324 {
27325 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
27326 }
27327 // f64
27328
27329 default:
27330 {
27331 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
27332 }
27333 }
27334 }
27335}
27336
27337function instruction(id) {
27338 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
27339 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27340 return (0, _nodes.instr)(id, undefined, args, namedArgs);
27341}
27342
27343function objectInstruction(id, object) {
27344 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
27345 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
27346 return (0, _nodes.instr)(id, object, args, namedArgs);
27347}
27348/**
27349 * Decorators
27350 */
27351
27352
27353function withLoc(n, end, start) {
27354 var loc = {
27355 start: start,
27356 end: end
27357 };
27358 n.loc = loc;
27359 return n;
27360}
27361
27362function withRaw(n, raw) {
27363 n.raw = raw;
27364 return n;
27365}
27366
27367function funcParam(valtype, id) {
27368 return {
27369 id: id,
27370 valtype: valtype
27371 };
27372}
27373
27374function indexLiteral(value) {
27375 // $FlowIgnore
27376 var x = numberLiteralFromRaw(value, "u32");
27377 return x;
27378}
27379
27380function memIndexLiteral(value) {
27381 // $FlowIgnore
27382 var x = numberLiteralFromRaw(value, "u32");
27383 return x;
27384}
27385
27386/***/ }),
27387
27388/***/ 43893:
27389/***/ (function(__unused_webpack_module, exports) {
27390
27391"use strict";
27392
27393
27394Object.defineProperty(exports, "__esModule", ({
27395 value: true
27396}));
27397exports.createPath = createPath;
27398
27399function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27400
27401function findParent(_ref, cb) {
27402 var parentPath = _ref.parentPath;
27403
27404 if (parentPath == null) {
27405 throw new Error("node is root");
27406 }
27407
27408 var currentPath = parentPath;
27409
27410 while (cb(currentPath) !== false) {
27411 // Hit the root node, stop
27412 // $FlowIgnore
27413 if (currentPath.parentPath == null) {
27414 return null;
27415 } // $FlowIgnore
27416
27417
27418 currentPath = currentPath.parentPath;
27419 }
27420
27421 return currentPath.node;
27422}
27423
27424function insertBefore(context, newNode) {
27425 return insert(context, newNode);
27426}
27427
27428function insertAfter(context, newNode) {
27429 return insert(context, newNode, 1);
27430}
27431
27432function insert(_ref2, newNode) {
27433 var node = _ref2.node,
27434 inList = _ref2.inList,
27435 parentPath = _ref2.parentPath,
27436 parentKey = _ref2.parentKey;
27437 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
27438
27439 if (!inList) {
27440 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
27441 }
27442
27443 if (!(parentPath != null)) {
27444 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
27445 }
27446
27447 // $FlowIgnore
27448 var parentList = parentPath.node[parentKey];
27449 var indexInList = parentList.findIndex(function (n) {
27450 return n === node;
27451 });
27452 parentList.splice(indexInList + indexOffset, 0, newNode);
27453}
27454
27455function remove(_ref3) {
27456 var node = _ref3.node,
27457 parentKey = _ref3.parentKey,
27458 parentPath = _ref3.parentPath;
27459
27460 if (!(parentPath != null)) {
27461 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
27462 }
27463
27464 // $FlowIgnore
27465 var parentNode = parentPath.node; // $FlowIgnore
27466
27467 var parentProperty = parentNode[parentKey];
27468
27469 if (Array.isArray(parentProperty)) {
27470 // $FlowIgnore
27471 parentNode[parentKey] = parentProperty.filter(function (n) {
27472 return n !== node;
27473 });
27474 } else {
27475 // $FlowIgnore
27476 delete parentNode[parentKey];
27477 }
27478
27479 node._deleted = true;
27480}
27481
27482function stop(context) {
27483 context.shouldStop = true;
27484}
27485
27486function replaceWith(context, newNode) {
27487 // $FlowIgnore
27488 var parentNode = context.parentPath.node; // $FlowIgnore
27489
27490 var parentProperty = parentNode[context.parentKey];
27491
27492 if (Array.isArray(parentProperty)) {
27493 var indexInList = parentProperty.findIndex(function (n) {
27494 return n === context.node;
27495 });
27496 parentProperty.splice(indexInList, 1, newNode);
27497 } else {
27498 // $FlowIgnore
27499 parentNode[context.parentKey] = newNode;
27500 }
27501
27502 context.node._deleted = true;
27503 context.node = newNode;
27504} // bind the context to the first argument of node operations
27505
27506
27507function bindNodeOperations(operations, context) {
27508 var keys = Object.keys(operations);
27509 var boundOperations = {};
27510 keys.forEach(function (key) {
27511 boundOperations[key] = operations[key].bind(null, context);
27512 });
27513 return boundOperations;
27514}
27515
27516function createPathOperations(context) {
27517 // $FlowIgnore
27518 return bindNodeOperations({
27519 findParent: findParent,
27520 replaceWith: replaceWith,
27521 remove: remove,
27522 insertBefore: insertBefore,
27523 insertAfter: insertAfter,
27524 stop: stop
27525 }, context);
27526}
27527
27528function createPath(context) {
27529 var path = _extends({}, context); // $FlowIgnore
27530
27531
27532 Object.assign(path, createPathOperations(path)); // $FlowIgnore
27533
27534 return path;
27535}
27536
27537/***/ }),
27538
27539/***/ 85701:
27540/***/ (function(__unused_webpack_module, exports) {
27541
27542"use strict";
27543
27544
27545Object.defineProperty(exports, "__esModule", ({
27546 value: true
27547}));
27548exports.module = _module;
27549exports.moduleMetadata = moduleMetadata;
27550exports.moduleNameMetadata = moduleNameMetadata;
27551exports.functionNameMetadata = functionNameMetadata;
27552exports.localNameMetadata = localNameMetadata;
27553exports.binaryModule = binaryModule;
27554exports.quoteModule = quoteModule;
27555exports.sectionMetadata = sectionMetadata;
27556exports.producersSectionMetadata = producersSectionMetadata;
27557exports.producerMetadata = producerMetadata;
27558exports.producerMetadataVersionedName = producerMetadataVersionedName;
27559exports.loopInstruction = loopInstruction;
27560exports.instr = instr;
27561exports.ifInstruction = ifInstruction;
27562exports.stringLiteral = stringLiteral;
27563exports.numberLiteral = numberLiteral;
27564exports.longNumberLiteral = longNumberLiteral;
27565exports.floatLiteral = floatLiteral;
27566exports.elem = elem;
27567exports.indexInFuncSection = indexInFuncSection;
27568exports.valtypeLiteral = valtypeLiteral;
27569exports.typeInstruction = typeInstruction;
27570exports.start = start;
27571exports.globalType = globalType;
27572exports.leadingComment = leadingComment;
27573exports.blockComment = blockComment;
27574exports.data = data;
27575exports.global = global;
27576exports.table = table;
27577exports.memory = memory;
27578exports.funcImportDescr = funcImportDescr;
27579exports.moduleImport = moduleImport;
27580exports.moduleExportDescr = moduleExportDescr;
27581exports.moduleExport = moduleExport;
27582exports.limit = limit;
27583exports.signature = signature;
27584exports.program = program;
27585exports.identifier = identifier;
27586exports.blockInstruction = blockInstruction;
27587exports.callInstruction = callInstruction;
27588exports.callIndirectInstruction = callIndirectInstruction;
27589exports.byteArray = byteArray;
27590exports.func = func;
27591exports.internalBrUnless = internalBrUnless;
27592exports.internalGoto = internalGoto;
27593exports.internalCallExtern = internalCallExtern;
27594exports.internalEndAndReturn = internalEndAndReturn;
27595exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
27596exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
27597
27598function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
27599
27600// THIS FILE IS AUTOGENERATED
27601// see scripts/generateNodeUtils.js
27602function isTypeOf(t) {
27603 return function (n) {
27604 return n.type === t;
27605 };
27606}
27607
27608function assertTypeOf(t) {
27609 return function (n) {
27610 return function () {
27611 if (!(n.type === t)) {
27612 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
27613 }
27614 }();
27615 };
27616}
27617
27618function _module(id, fields, metadata) {
27619 if (id !== null && id !== undefined) {
27620 if (!(typeof id === "string")) {
27621 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
27622 }
27623 }
27624
27625 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
27626 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
27627 }
27628
27629 var node = {
27630 type: "Module",
27631 id: id,
27632 fields: fields
27633 };
27634
27635 if (typeof metadata !== "undefined") {
27636 node.metadata = metadata;
27637 }
27638
27639 return node;
27640}
27641
27642function moduleMetadata(sections, functionNames, localNames, producers) {
27643 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
27644 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
27645 }
27646
27647 if (functionNames !== null && functionNames !== undefined) {
27648 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
27649 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
27650 }
27651 }
27652
27653 if (localNames !== null && localNames !== undefined) {
27654 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
27655 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
27656 }
27657 }
27658
27659 if (producers !== null && producers !== undefined) {
27660 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
27661 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
27662 }
27663 }
27664
27665 var node = {
27666 type: "ModuleMetadata",
27667 sections: sections
27668 };
27669
27670 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
27671 node.functionNames = functionNames;
27672 }
27673
27674 if (typeof localNames !== "undefined" && localNames.length > 0) {
27675 node.localNames = localNames;
27676 }
27677
27678 if (typeof producers !== "undefined" && producers.length > 0) {
27679 node.producers = producers;
27680 }
27681
27682 return node;
27683}
27684
27685function moduleNameMetadata(value) {
27686 if (!(typeof value === "string")) {
27687 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
27688 }
27689
27690 var node = {
27691 type: "ModuleNameMetadata",
27692 value: value
27693 };
27694 return node;
27695}
27696
27697function functionNameMetadata(value, index) {
27698 if (!(typeof value === "string")) {
27699 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
27700 }
27701
27702 if (!(typeof index === "number")) {
27703 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
27704 }
27705
27706 var node = {
27707 type: "FunctionNameMetadata",
27708 value: value,
27709 index: index
27710 };
27711 return node;
27712}
27713
27714function localNameMetadata(value, localIndex, functionIndex) {
27715 if (!(typeof value === "string")) {
27716 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
27717 }
27718
27719 if (!(typeof localIndex === "number")) {
27720 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
27721 }
27722
27723 if (!(typeof functionIndex === "number")) {
27724 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
27725 }
27726
27727 var node = {
27728 type: "LocalNameMetadata",
27729 value: value,
27730 localIndex: localIndex,
27731 functionIndex: functionIndex
27732 };
27733 return node;
27734}
27735
27736function binaryModule(id, blob) {
27737 if (id !== null && id !== undefined) {
27738 if (!(typeof id === "string")) {
27739 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
27740 }
27741 }
27742
27743 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
27744 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
27745 }
27746
27747 var node = {
27748 type: "BinaryModule",
27749 id: id,
27750 blob: blob
27751 };
27752 return node;
27753}
27754
27755function quoteModule(id, string) {
27756 if (id !== null && id !== undefined) {
27757 if (!(typeof id === "string")) {
27758 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
27759 }
27760 }
27761
27762 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
27763 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
27764 }
27765
27766 var node = {
27767 type: "QuoteModule",
27768 id: id,
27769 string: string
27770 };
27771 return node;
27772}
27773
27774function sectionMetadata(section, startOffset, size, vectorOfSize) {
27775 if (!(typeof startOffset === "number")) {
27776 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
27777 }
27778
27779 var node = {
27780 type: "SectionMetadata",
27781 section: section,
27782 startOffset: startOffset,
27783 size: size,
27784 vectorOfSize: vectorOfSize
27785 };
27786 return node;
27787}
27788
27789function producersSectionMetadata(producers) {
27790 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
27791 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
27792 }
27793
27794 var node = {
27795 type: "ProducersSectionMetadata",
27796 producers: producers
27797 };
27798 return node;
27799}
27800
27801function producerMetadata(language, processedBy, sdk) {
27802 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
27803 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
27804 }
27805
27806 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
27807 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
27808 }
27809
27810 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
27811 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
27812 }
27813
27814 var node = {
27815 type: "ProducerMetadata",
27816 language: language,
27817 processedBy: processedBy,
27818 sdk: sdk
27819 };
27820 return node;
27821}
27822
27823function producerMetadataVersionedName(name, version) {
27824 if (!(typeof name === "string")) {
27825 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
27826 }
27827
27828 if (!(typeof version === "string")) {
27829 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
27830 }
27831
27832 var node = {
27833 type: "ProducerMetadataVersionedName",
27834 name: name,
27835 version: version
27836 };
27837 return node;
27838}
27839
27840function loopInstruction(label, resulttype, instr) {
27841 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
27842 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
27843 }
27844
27845 var node = {
27846 type: "LoopInstruction",
27847 id: "loop",
27848 label: label,
27849 resulttype: resulttype,
27850 instr: instr
27851 };
27852 return node;
27853}
27854
27855function instr(id, object, args, namedArgs) {
27856 if (!(typeof id === "string")) {
27857 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
27858 }
27859
27860 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
27861 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
27862 }
27863
27864 var node = {
27865 type: "Instr",
27866 id: id,
27867 args: args
27868 };
27869
27870 if (typeof object !== "undefined") {
27871 node.object = object;
27872 }
27873
27874 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
27875 node.namedArgs = namedArgs;
27876 }
27877
27878 return node;
27879}
27880
27881function ifInstruction(testLabel, test, result, consequent, alternate) {
27882 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
27883 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
27884 }
27885
27886 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
27887 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
27888 }
27889
27890 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
27891 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
27892 }
27893
27894 var node = {
27895 type: "IfInstruction",
27896 id: "if",
27897 testLabel: testLabel,
27898 test: test,
27899 result: result,
27900 consequent: consequent,
27901 alternate: alternate
27902 };
27903 return node;
27904}
27905
27906function stringLiteral(value) {
27907 if (!(typeof value === "string")) {
27908 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
27909 }
27910
27911 var node = {
27912 type: "StringLiteral",
27913 value: value
27914 };
27915 return node;
27916}
27917
27918function numberLiteral(value, raw) {
27919 if (!(typeof value === "number")) {
27920 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
27921 }
27922
27923 if (!(typeof raw === "string")) {
27924 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
27925 }
27926
27927 var node = {
27928 type: "NumberLiteral",
27929 value: value,
27930 raw: raw
27931 };
27932 return node;
27933}
27934
27935function longNumberLiteral(value, raw) {
27936 if (!(typeof raw === "string")) {
27937 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
27938 }
27939
27940 var node = {
27941 type: "LongNumberLiteral",
27942 value: value,
27943 raw: raw
27944 };
27945 return node;
27946}
27947
27948function floatLiteral(value, nan, inf, raw) {
27949 if (!(typeof value === "number")) {
27950 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
27951 }
27952
27953 if (nan !== null && nan !== undefined) {
27954 if (!(typeof nan === "boolean")) {
27955 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
27956 }
27957 }
27958
27959 if (inf !== null && inf !== undefined) {
27960 if (!(typeof inf === "boolean")) {
27961 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
27962 }
27963 }
27964
27965 if (!(typeof raw === "string")) {
27966 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
27967 }
27968
27969 var node = {
27970 type: "FloatLiteral",
27971 value: value,
27972 raw: raw
27973 };
27974
27975 if (nan === true) {
27976 node.nan = true;
27977 }
27978
27979 if (inf === true) {
27980 node.inf = true;
27981 }
27982
27983 return node;
27984}
27985
27986function elem(table, offset, funcs) {
27987 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
27988 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
27989 }
27990
27991 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
27992 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
27993 }
27994
27995 var node = {
27996 type: "Elem",
27997 table: table,
27998 offset: offset,
27999 funcs: funcs
28000 };
28001 return node;
28002}
28003
28004function indexInFuncSection(index) {
28005 var node = {
28006 type: "IndexInFuncSection",
28007 index: index
28008 };
28009 return node;
28010}
28011
28012function valtypeLiteral(name) {
28013 var node = {
28014 type: "ValtypeLiteral",
28015 name: name
28016 };
28017 return node;
28018}
28019
28020function typeInstruction(id, functype) {
28021 var node = {
28022 type: "TypeInstruction",
28023 id: id,
28024 functype: functype
28025 };
28026 return node;
28027}
28028
28029function start(index) {
28030 var node = {
28031 type: "Start",
28032 index: index
28033 };
28034 return node;
28035}
28036
28037function globalType(valtype, mutability) {
28038 var node = {
28039 type: "GlobalType",
28040 valtype: valtype,
28041 mutability: mutability
28042 };
28043 return node;
28044}
28045
28046function leadingComment(value) {
28047 if (!(typeof value === "string")) {
28048 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
28049 }
28050
28051 var node = {
28052 type: "LeadingComment",
28053 value: value
28054 };
28055 return node;
28056}
28057
28058function blockComment(value) {
28059 if (!(typeof value === "string")) {
28060 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
28061 }
28062
28063 var node = {
28064 type: "BlockComment",
28065 value: value
28066 };
28067 return node;
28068}
28069
28070function data(memoryIndex, offset, init) {
28071 var node = {
28072 type: "Data",
28073 memoryIndex: memoryIndex,
28074 offset: offset,
28075 init: init
28076 };
28077 return node;
28078}
28079
28080function global(globalType, init, name) {
28081 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
28082 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
28083 }
28084
28085 var node = {
28086 type: "Global",
28087 globalType: globalType,
28088 init: init,
28089 name: name
28090 };
28091 return node;
28092}
28093
28094function table(elementType, limits, name, elements) {
28095 if (!(limits.type === "Limit")) {
28096 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
28097 }
28098
28099 if (elements !== null && elements !== undefined) {
28100 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
28101 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
28102 }
28103 }
28104
28105 var node = {
28106 type: "Table",
28107 elementType: elementType,
28108 limits: limits,
28109 name: name
28110 };
28111
28112 if (typeof elements !== "undefined" && elements.length > 0) {
28113 node.elements = elements;
28114 }
28115
28116 return node;
28117}
28118
28119function memory(limits, id) {
28120 var node = {
28121 type: "Memory",
28122 limits: limits,
28123 id: id
28124 };
28125 return node;
28126}
28127
28128function funcImportDescr(id, signature) {
28129 var node = {
28130 type: "FuncImportDescr",
28131 id: id,
28132 signature: signature
28133 };
28134 return node;
28135}
28136
28137function moduleImport(module, name, descr) {
28138 if (!(typeof module === "string")) {
28139 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
28140 }
28141
28142 if (!(typeof name === "string")) {
28143 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
28144 }
28145
28146 var node = {
28147 type: "ModuleImport",
28148 module: module,
28149 name: name,
28150 descr: descr
28151 };
28152 return node;
28153}
28154
28155function moduleExportDescr(exportType, id) {
28156 var node = {
28157 type: "ModuleExportDescr",
28158 exportType: exportType,
28159 id: id
28160 };
28161 return node;
28162}
28163
28164function moduleExport(name, descr) {
28165 if (!(typeof name === "string")) {
28166 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
28167 }
28168
28169 var node = {
28170 type: "ModuleExport",
28171 name: name,
28172 descr: descr
28173 };
28174 return node;
28175}
28176
28177function limit(min, max) {
28178 if (!(typeof min === "number")) {
28179 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
28180 }
28181
28182 if (max !== null && max !== undefined) {
28183 if (!(typeof max === "number")) {
28184 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
28185 }
28186 }
28187
28188 var node = {
28189 type: "Limit",
28190 min: min
28191 };
28192
28193 if (typeof max !== "undefined") {
28194 node.max = max;
28195 }
28196
28197 return node;
28198}
28199
28200function signature(params, results) {
28201 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
28202 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
28203 }
28204
28205 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
28206 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
28207 }
28208
28209 var node = {
28210 type: "Signature",
28211 params: params,
28212 results: results
28213 };
28214 return node;
28215}
28216
28217function program(body) {
28218 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
28219 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
28220 }
28221
28222 var node = {
28223 type: "Program",
28224 body: body
28225 };
28226 return node;
28227}
28228
28229function identifier(value, raw) {
28230 if (!(typeof value === "string")) {
28231 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
28232 }
28233
28234 if (raw !== null && raw !== undefined) {
28235 if (!(typeof raw === "string")) {
28236 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
28237 }
28238 }
28239
28240 var node = {
28241 type: "Identifier",
28242 value: value
28243 };
28244
28245 if (typeof raw !== "undefined") {
28246 node.raw = raw;
28247 }
28248
28249 return node;
28250}
28251
28252function blockInstruction(label, instr, result) {
28253 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
28254 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
28255 }
28256
28257 var node = {
28258 type: "BlockInstruction",
28259 id: "block",
28260 label: label,
28261 instr: instr,
28262 result: result
28263 };
28264 return node;
28265}
28266
28267function callInstruction(index, instrArgs, numeric) {
28268 if (instrArgs !== null && instrArgs !== undefined) {
28269 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
28270 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
28271 }
28272 }
28273
28274 var node = {
28275 type: "CallInstruction",
28276 id: "call",
28277 index: index
28278 };
28279
28280 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
28281 node.instrArgs = instrArgs;
28282 }
28283
28284 if (typeof numeric !== "undefined") {
28285 node.numeric = numeric;
28286 }
28287
28288 return node;
28289}
28290
28291function callIndirectInstruction(signature, intrs) {
28292 if (intrs !== null && intrs !== undefined) {
28293 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
28294 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
28295 }
28296 }
28297
28298 var node = {
28299 type: "CallIndirectInstruction",
28300 id: "call_indirect",
28301 signature: signature
28302 };
28303
28304 if (typeof intrs !== "undefined" && intrs.length > 0) {
28305 node.intrs = intrs;
28306 }
28307
28308 return node;
28309}
28310
28311function byteArray(values) {
28312 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
28313 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
28314 }
28315
28316 var node = {
28317 type: "ByteArray",
28318 values: values
28319 };
28320 return node;
28321}
28322
28323function func(name, signature, body, isExternal, metadata) {
28324 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
28325 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
28326 }
28327
28328 if (isExternal !== null && isExternal !== undefined) {
28329 if (!(typeof isExternal === "boolean")) {
28330 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
28331 }
28332 }
28333
28334 var node = {
28335 type: "Func",
28336 name: name,
28337 signature: signature,
28338 body: body
28339 };
28340
28341 if (isExternal === true) {
28342 node.isExternal = true;
28343 }
28344
28345 if (typeof metadata !== "undefined") {
28346 node.metadata = metadata;
28347 }
28348
28349 return node;
28350}
28351
28352function internalBrUnless(target) {
28353 if (!(typeof target === "number")) {
28354 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
28355 }
28356
28357 var node = {
28358 type: "InternalBrUnless",
28359 target: target
28360 };
28361 return node;
28362}
28363
28364function internalGoto(target) {
28365 if (!(typeof target === "number")) {
28366 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
28367 }
28368
28369 var node = {
28370 type: "InternalGoto",
28371 target: target
28372 };
28373 return node;
28374}
28375
28376function internalCallExtern(target) {
28377 if (!(typeof target === "number")) {
28378 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
28379 }
28380
28381 var node = {
28382 type: "InternalCallExtern",
28383 target: target
28384 };
28385 return node;
28386}
28387
28388function internalEndAndReturn() {
28389 var node = {
28390 type: "InternalEndAndReturn"
28391 };
28392 return node;
28393}
28394
28395var isModule = isTypeOf("Module");
28396exports.isModule = isModule;
28397var isModuleMetadata = isTypeOf("ModuleMetadata");
28398exports.isModuleMetadata = isModuleMetadata;
28399var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
28400exports.isModuleNameMetadata = isModuleNameMetadata;
28401var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
28402exports.isFunctionNameMetadata = isFunctionNameMetadata;
28403var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
28404exports.isLocalNameMetadata = isLocalNameMetadata;
28405var isBinaryModule = isTypeOf("BinaryModule");
28406exports.isBinaryModule = isBinaryModule;
28407var isQuoteModule = isTypeOf("QuoteModule");
28408exports.isQuoteModule = isQuoteModule;
28409var isSectionMetadata = isTypeOf("SectionMetadata");
28410exports.isSectionMetadata = isSectionMetadata;
28411var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
28412exports.isProducersSectionMetadata = isProducersSectionMetadata;
28413var isProducerMetadata = isTypeOf("ProducerMetadata");
28414exports.isProducerMetadata = isProducerMetadata;
28415var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
28416exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
28417var isLoopInstruction = isTypeOf("LoopInstruction");
28418exports.isLoopInstruction = isLoopInstruction;
28419var isInstr = isTypeOf("Instr");
28420exports.isInstr = isInstr;
28421var isIfInstruction = isTypeOf("IfInstruction");
28422exports.isIfInstruction = isIfInstruction;
28423var isStringLiteral = isTypeOf("StringLiteral");
28424exports.isStringLiteral = isStringLiteral;
28425var isNumberLiteral = isTypeOf("NumberLiteral");
28426exports.isNumberLiteral = isNumberLiteral;
28427var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
28428exports.isLongNumberLiteral = isLongNumberLiteral;
28429var isFloatLiteral = isTypeOf("FloatLiteral");
28430exports.isFloatLiteral = isFloatLiteral;
28431var isElem = isTypeOf("Elem");
28432exports.isElem = isElem;
28433var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
28434exports.isIndexInFuncSection = isIndexInFuncSection;
28435var isValtypeLiteral = isTypeOf("ValtypeLiteral");
28436exports.isValtypeLiteral = isValtypeLiteral;
28437var isTypeInstruction = isTypeOf("TypeInstruction");
28438exports.isTypeInstruction = isTypeInstruction;
28439var isStart = isTypeOf("Start");
28440exports.isStart = isStart;
28441var isGlobalType = isTypeOf("GlobalType");
28442exports.isGlobalType = isGlobalType;
28443var isLeadingComment = isTypeOf("LeadingComment");
28444exports.isLeadingComment = isLeadingComment;
28445var isBlockComment = isTypeOf("BlockComment");
28446exports.isBlockComment = isBlockComment;
28447var isData = isTypeOf("Data");
28448exports.isData = isData;
28449var isGlobal = isTypeOf("Global");
28450exports.isGlobal = isGlobal;
28451var isTable = isTypeOf("Table");
28452exports.isTable = isTable;
28453var isMemory = isTypeOf("Memory");
28454exports.isMemory = isMemory;
28455var isFuncImportDescr = isTypeOf("FuncImportDescr");
28456exports.isFuncImportDescr = isFuncImportDescr;
28457var isModuleImport = isTypeOf("ModuleImport");
28458exports.isModuleImport = isModuleImport;
28459var isModuleExportDescr = isTypeOf("ModuleExportDescr");
28460exports.isModuleExportDescr = isModuleExportDescr;
28461var isModuleExport = isTypeOf("ModuleExport");
28462exports.isModuleExport = isModuleExport;
28463var isLimit = isTypeOf("Limit");
28464exports.isLimit = isLimit;
28465var isSignature = isTypeOf("Signature");
28466exports.isSignature = isSignature;
28467var isProgram = isTypeOf("Program");
28468exports.isProgram = isProgram;
28469var isIdentifier = isTypeOf("Identifier");
28470exports.isIdentifier = isIdentifier;
28471var isBlockInstruction = isTypeOf("BlockInstruction");
28472exports.isBlockInstruction = isBlockInstruction;
28473var isCallInstruction = isTypeOf("CallInstruction");
28474exports.isCallInstruction = isCallInstruction;
28475var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
28476exports.isCallIndirectInstruction = isCallIndirectInstruction;
28477var isByteArray = isTypeOf("ByteArray");
28478exports.isByteArray = isByteArray;
28479var isFunc = isTypeOf("Func");
28480exports.isFunc = isFunc;
28481var isInternalBrUnless = isTypeOf("InternalBrUnless");
28482exports.isInternalBrUnless = isInternalBrUnless;
28483var isInternalGoto = isTypeOf("InternalGoto");
28484exports.isInternalGoto = isInternalGoto;
28485var isInternalCallExtern = isTypeOf("InternalCallExtern");
28486exports.isInternalCallExtern = isInternalCallExtern;
28487var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
28488exports.isInternalEndAndReturn = isInternalEndAndReturn;
28489
28490var isNode = function isNode(node) {
28491 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
28492};
28493
28494exports.isNode = isNode;
28495
28496var isBlock = function isBlock(node) {
28497 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
28498};
28499
28500exports.isBlock = isBlock;
28501
28502var isInstruction = function isInstruction(node) {
28503 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
28504};
28505
28506exports.isInstruction = isInstruction;
28507
28508var isExpression = function isExpression(node) {
28509 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
28510};
28511
28512exports.isExpression = isExpression;
28513
28514var isNumericLiteral = function isNumericLiteral(node) {
28515 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
28516};
28517
28518exports.isNumericLiteral = isNumericLiteral;
28519
28520var isImportDescr = function isImportDescr(node) {
28521 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
28522};
28523
28524exports.isImportDescr = isImportDescr;
28525
28526var isIntrinsic = function isIntrinsic(node) {
28527 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
28528};
28529
28530exports.isIntrinsic = isIntrinsic;
28531var assertModule = assertTypeOf("Module");
28532exports.assertModule = assertModule;
28533var assertModuleMetadata = assertTypeOf("ModuleMetadata");
28534exports.assertModuleMetadata = assertModuleMetadata;
28535var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
28536exports.assertModuleNameMetadata = assertModuleNameMetadata;
28537var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
28538exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
28539var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
28540exports.assertLocalNameMetadata = assertLocalNameMetadata;
28541var assertBinaryModule = assertTypeOf("BinaryModule");
28542exports.assertBinaryModule = assertBinaryModule;
28543var assertQuoteModule = assertTypeOf("QuoteModule");
28544exports.assertQuoteModule = assertQuoteModule;
28545var assertSectionMetadata = assertTypeOf("SectionMetadata");
28546exports.assertSectionMetadata = assertSectionMetadata;
28547var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
28548exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
28549var assertProducerMetadata = assertTypeOf("ProducerMetadata");
28550exports.assertProducerMetadata = assertProducerMetadata;
28551var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
28552exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
28553var assertLoopInstruction = assertTypeOf("LoopInstruction");
28554exports.assertLoopInstruction = assertLoopInstruction;
28555var assertInstr = assertTypeOf("Instr");
28556exports.assertInstr = assertInstr;
28557var assertIfInstruction = assertTypeOf("IfInstruction");
28558exports.assertIfInstruction = assertIfInstruction;
28559var assertStringLiteral = assertTypeOf("StringLiteral");
28560exports.assertStringLiteral = assertStringLiteral;
28561var assertNumberLiteral = assertTypeOf("NumberLiteral");
28562exports.assertNumberLiteral = assertNumberLiteral;
28563var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
28564exports.assertLongNumberLiteral = assertLongNumberLiteral;
28565var assertFloatLiteral = assertTypeOf("FloatLiteral");
28566exports.assertFloatLiteral = assertFloatLiteral;
28567var assertElem = assertTypeOf("Elem");
28568exports.assertElem = assertElem;
28569var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
28570exports.assertIndexInFuncSection = assertIndexInFuncSection;
28571var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
28572exports.assertValtypeLiteral = assertValtypeLiteral;
28573var assertTypeInstruction = assertTypeOf("TypeInstruction");
28574exports.assertTypeInstruction = assertTypeInstruction;
28575var assertStart = assertTypeOf("Start");
28576exports.assertStart = assertStart;
28577var assertGlobalType = assertTypeOf("GlobalType");
28578exports.assertGlobalType = assertGlobalType;
28579var assertLeadingComment = assertTypeOf("LeadingComment");
28580exports.assertLeadingComment = assertLeadingComment;
28581var assertBlockComment = assertTypeOf("BlockComment");
28582exports.assertBlockComment = assertBlockComment;
28583var assertData = assertTypeOf("Data");
28584exports.assertData = assertData;
28585var assertGlobal = assertTypeOf("Global");
28586exports.assertGlobal = assertGlobal;
28587var assertTable = assertTypeOf("Table");
28588exports.assertTable = assertTable;
28589var assertMemory = assertTypeOf("Memory");
28590exports.assertMemory = assertMemory;
28591var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
28592exports.assertFuncImportDescr = assertFuncImportDescr;
28593var assertModuleImport = assertTypeOf("ModuleImport");
28594exports.assertModuleImport = assertModuleImport;
28595var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
28596exports.assertModuleExportDescr = assertModuleExportDescr;
28597var assertModuleExport = assertTypeOf("ModuleExport");
28598exports.assertModuleExport = assertModuleExport;
28599var assertLimit = assertTypeOf("Limit");
28600exports.assertLimit = assertLimit;
28601var assertSignature = assertTypeOf("Signature");
28602exports.assertSignature = assertSignature;
28603var assertProgram = assertTypeOf("Program");
28604exports.assertProgram = assertProgram;
28605var assertIdentifier = assertTypeOf("Identifier");
28606exports.assertIdentifier = assertIdentifier;
28607var assertBlockInstruction = assertTypeOf("BlockInstruction");
28608exports.assertBlockInstruction = assertBlockInstruction;
28609var assertCallInstruction = assertTypeOf("CallInstruction");
28610exports.assertCallInstruction = assertCallInstruction;
28611var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
28612exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
28613var assertByteArray = assertTypeOf("ByteArray");
28614exports.assertByteArray = assertByteArray;
28615var assertFunc = assertTypeOf("Func");
28616exports.assertFunc = assertFunc;
28617var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
28618exports.assertInternalBrUnless = assertInternalBrUnless;
28619var assertInternalGoto = assertTypeOf("InternalGoto");
28620exports.assertInternalGoto = assertInternalGoto;
28621var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
28622exports.assertInternalCallExtern = assertInternalCallExtern;
28623var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
28624exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
28625var unionTypesMap = {
28626 Module: ["Node"],
28627 ModuleMetadata: ["Node"],
28628 ModuleNameMetadata: ["Node"],
28629 FunctionNameMetadata: ["Node"],
28630 LocalNameMetadata: ["Node"],
28631 BinaryModule: ["Node"],
28632 QuoteModule: ["Node"],
28633 SectionMetadata: ["Node"],
28634 ProducersSectionMetadata: ["Node"],
28635 ProducerMetadata: ["Node"],
28636 ProducerMetadataVersionedName: ["Node"],
28637 LoopInstruction: ["Node", "Block", "Instruction"],
28638 Instr: ["Node", "Expression", "Instruction"],
28639 IfInstruction: ["Node", "Instruction"],
28640 StringLiteral: ["Node", "Expression"],
28641 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
28642 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
28643 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
28644 Elem: ["Node"],
28645 IndexInFuncSection: ["Node"],
28646 ValtypeLiteral: ["Node", "Expression"],
28647 TypeInstruction: ["Node", "Instruction"],
28648 Start: ["Node"],
28649 GlobalType: ["Node", "ImportDescr"],
28650 LeadingComment: ["Node"],
28651 BlockComment: ["Node"],
28652 Data: ["Node"],
28653 Global: ["Node"],
28654 Table: ["Node", "ImportDescr"],
28655 Memory: ["Node", "ImportDescr"],
28656 FuncImportDescr: ["Node", "ImportDescr"],
28657 ModuleImport: ["Node"],
28658 ModuleExportDescr: ["Node"],
28659 ModuleExport: ["Node"],
28660 Limit: ["Node"],
28661 Signature: ["Node"],
28662 Program: ["Node"],
28663 Identifier: ["Node", "Expression"],
28664 BlockInstruction: ["Node", "Block", "Instruction"],
28665 CallInstruction: ["Node", "Instruction"],
28666 CallIndirectInstruction: ["Node", "Instruction"],
28667 ByteArray: ["Node"],
28668 Func: ["Node", "Block"],
28669 InternalBrUnless: ["Node", "Intrinsic"],
28670 InternalGoto: ["Node", "Intrinsic"],
28671 InternalCallExtern: ["Node", "Intrinsic"],
28672 InternalEndAndReturn: ["Node", "Intrinsic"]
28673};
28674exports.unionTypesMap = unionTypesMap;
28675var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
28676exports.nodeAndUnionTypes = nodeAndUnionTypes;
28677
28678/***/ }),
28679
28680/***/ 74127:
28681/***/ (function(__unused_webpack_module, exports) {
28682
28683"use strict";
28684
28685
28686Object.defineProperty(exports, "__esModule", ({
28687 value: true
28688}));
28689exports.signatures = void 0;
28690
28691function sign(input, output) {
28692 return [input, output];
28693}
28694
28695var u32 = "u32";
28696var i32 = "i32";
28697var i64 = "i64";
28698var f32 = "f32";
28699var f64 = "f64";
28700
28701var vector = function vector(t) {
28702 var vecType = [t]; // $FlowIgnore
28703
28704 vecType.vector = true;
28705 return vecType;
28706};
28707
28708var controlInstructions = {
28709 unreachable: sign([], []),
28710 nop: sign([], []),
28711 // block ?
28712 // loop ?
28713 // if ?
28714 // if else ?
28715 br: sign([u32], []),
28716 br_if: sign([u32], []),
28717 br_table: sign(vector(u32), []),
28718 return: sign([], []),
28719 call: sign([u32], []),
28720 call_indirect: sign([u32], [])
28721};
28722var parametricInstructions = {
28723 drop: sign([], []),
28724 select: sign([], [])
28725};
28726var variableInstructions = {
28727 get_local: sign([u32], []),
28728 set_local: sign([u32], []),
28729 tee_local: sign([u32], []),
28730 get_global: sign([u32], []),
28731 set_global: sign([u32], [])
28732};
28733var memoryInstructions = {
28734 "i32.load": sign([u32, u32], [i32]),
28735 "i64.load": sign([u32, u32], []),
28736 "f32.load": sign([u32, u32], []),
28737 "f64.load": sign([u32, u32], []),
28738 "i32.load8_s": sign([u32, u32], [i32]),
28739 "i32.load8_u": sign([u32, u32], [i32]),
28740 "i32.load16_s": sign([u32, u32], [i32]),
28741 "i32.load16_u": sign([u32, u32], [i32]),
28742 "i64.load8_s": sign([u32, u32], [i64]),
28743 "i64.load8_u": sign([u32, u32], [i64]),
28744 "i64.load16_s": sign([u32, u32], [i64]),
28745 "i64.load16_u": sign([u32, u32], [i64]),
28746 "i64.load32_s": sign([u32, u32], [i64]),
28747 "i64.load32_u": sign([u32, u32], [i64]),
28748 "i32.store": sign([u32, u32], []),
28749 "i64.store": sign([u32, u32], []),
28750 "f32.store": sign([u32, u32], []),
28751 "f64.store": sign([u32, u32], []),
28752 "i32.store8": sign([u32, u32], []),
28753 "i32.store16": sign([u32, u32], []),
28754 "i64.store8": sign([u32, u32], []),
28755 "i64.store16": sign([u32, u32], []),
28756 "i64.store32": sign([u32, u32], []),
28757 current_memory: sign([], []),
28758 grow_memory: sign([], [])
28759};
28760var numericInstructions = {
28761 "i32.const": sign([i32], [i32]),
28762 "i64.const": sign([i64], [i64]),
28763 "f32.const": sign([f32], [f32]),
28764 "f64.const": sign([f64], [f64]),
28765 "i32.eqz": sign([i32], [i32]),
28766 "i32.eq": sign([i32, i32], [i32]),
28767 "i32.ne": sign([i32, i32], [i32]),
28768 "i32.lt_s": sign([i32, i32], [i32]),
28769 "i32.lt_u": sign([i32, i32], [i32]),
28770 "i32.gt_s": sign([i32, i32], [i32]),
28771 "i32.gt_u": sign([i32, i32], [i32]),
28772 "i32.le_s": sign([i32, i32], [i32]),
28773 "i32.le_u": sign([i32, i32], [i32]),
28774 "i32.ge_s": sign([i32, i32], [i32]),
28775 "i32.ge_u": sign([i32, i32], [i32]),
28776 "i64.eqz": sign([i64], [i64]),
28777 "i64.eq": sign([i64, i64], [i32]),
28778 "i64.ne": sign([i64, i64], [i32]),
28779 "i64.lt_s": sign([i64, i64], [i32]),
28780 "i64.lt_u": sign([i64, i64], [i32]),
28781 "i64.gt_s": sign([i64, i64], [i32]),
28782 "i64.gt_u": sign([i64, i64], [i32]),
28783 "i64.le_s": sign([i64, i64], [i32]),
28784 "i64.le_u": sign([i64, i64], [i32]),
28785 "i64.ge_s": sign([i64, i64], [i32]),
28786 "i64.ge_u": sign([i64, i64], [i32]),
28787 "f32.eq": sign([f32, f32], [i32]),
28788 "f32.ne": sign([f32, f32], [i32]),
28789 "f32.lt": sign([f32, f32], [i32]),
28790 "f32.gt": sign([f32, f32], [i32]),
28791 "f32.le": sign([f32, f32], [i32]),
28792 "f32.ge": sign([f32, f32], [i32]),
28793 "f64.eq": sign([f64, f64], [i32]),
28794 "f64.ne": sign([f64, f64], [i32]),
28795 "f64.lt": sign([f64, f64], [i32]),
28796 "f64.gt": sign([f64, f64], [i32]),
28797 "f64.le": sign([f64, f64], [i32]),
28798 "f64.ge": sign([f64, f64], [i32]),
28799 "i32.clz": sign([i32], [i32]),
28800 "i32.ctz": sign([i32], [i32]),
28801 "i32.popcnt": sign([i32], [i32]),
28802 "i32.add": sign([i32, i32], [i32]),
28803 "i32.sub": sign([i32, i32], [i32]),
28804 "i32.mul": sign([i32, i32], [i32]),
28805 "i32.div_s": sign([i32, i32], [i32]),
28806 "i32.div_u": sign([i32, i32], [i32]),
28807 "i32.rem_s": sign([i32, i32], [i32]),
28808 "i32.rem_u": sign([i32, i32], [i32]),
28809 "i32.and": sign([i32, i32], [i32]),
28810 "i32.or": sign([i32, i32], [i32]),
28811 "i32.xor": sign([i32, i32], [i32]),
28812 "i32.shl": sign([i32, i32], [i32]),
28813 "i32.shr_s": sign([i32, i32], [i32]),
28814 "i32.shr_u": sign([i32, i32], [i32]),
28815 "i32.rotl": sign([i32, i32], [i32]),
28816 "i32.rotr": sign([i32, i32], [i32]),
28817 "i64.clz": sign([i64], [i64]),
28818 "i64.ctz": sign([i64], [i64]),
28819 "i64.popcnt": sign([i64], [i64]),
28820 "i64.add": sign([i64, i64], [i64]),
28821 "i64.sub": sign([i64, i64], [i64]),
28822 "i64.mul": sign([i64, i64], [i64]),
28823 "i64.div_s": sign([i64, i64], [i64]),
28824 "i64.div_u": sign([i64, i64], [i64]),
28825 "i64.rem_s": sign([i64, i64], [i64]),
28826 "i64.rem_u": sign([i64, i64], [i64]),
28827 "i64.and": sign([i64, i64], [i64]),
28828 "i64.or": sign([i64, i64], [i64]),
28829 "i64.xor": sign([i64, i64], [i64]),
28830 "i64.shl": sign([i64, i64], [i64]),
28831 "i64.shr_s": sign([i64, i64], [i64]),
28832 "i64.shr_u": sign([i64, i64], [i64]),
28833 "i64.rotl": sign([i64, i64], [i64]),
28834 "i64.rotr": sign([i64, i64], [i64]),
28835 "f32.abs": sign([f32], [f32]),
28836 "f32.neg": sign([f32], [f32]),
28837 "f32.ceil": sign([f32], [f32]),
28838 "f32.floor": sign([f32], [f32]),
28839 "f32.trunc": sign([f32], [f32]),
28840 "f32.nearest": sign([f32], [f32]),
28841 "f32.sqrt": sign([f32], [f32]),
28842 "f32.add": sign([f32, f32], [f32]),
28843 "f32.sub": sign([f32, f32], [f32]),
28844 "f32.mul": sign([f32, f32], [f32]),
28845 "f32.div": sign([f32, f32], [f32]),
28846 "f32.min": sign([f32, f32], [f32]),
28847 "f32.max": sign([f32, f32], [f32]),
28848 "f32.copysign": sign([f32, f32], [f32]),
28849 "f64.abs": sign([f64], [f64]),
28850 "f64.neg": sign([f64], [f64]),
28851 "f64.ceil": sign([f64], [f64]),
28852 "f64.floor": sign([f64], [f64]),
28853 "f64.trunc": sign([f64], [f64]),
28854 "f64.nearest": sign([f64], [f64]),
28855 "f64.sqrt": sign([f64], [f64]),
28856 "f64.add": sign([f64, f64], [f64]),
28857 "f64.sub": sign([f64, f64], [f64]),
28858 "f64.mul": sign([f64, f64], [f64]),
28859 "f64.div": sign([f64, f64], [f64]),
28860 "f64.min": sign([f64, f64], [f64]),
28861 "f64.max": sign([f64, f64], [f64]),
28862 "f64.copysign": sign([f64, f64], [f64]),
28863 "i32.wrap/i64": sign([i64], [i32]),
28864 "i32.trunc_s/f32": sign([f32], [i32]),
28865 "i32.trunc_u/f32": sign([f32], [i32]),
28866 "i32.trunc_s/f64": sign([f32], [i32]),
28867 "i32.trunc_u/f64": sign([f64], [i32]),
28868 "i64.extend_s/i32": sign([i32], [i64]),
28869 "i64.extend_u/i32": sign([i32], [i64]),
28870 "i64.trunc_s/f32": sign([f32], [i64]),
28871 "i64.trunc_u/f32": sign([f32], [i64]),
28872 "i64.trunc_s/f64": sign([f64], [i64]),
28873 "i64.trunc_u/f64": sign([f64], [i64]),
28874 "f32.convert_s/i32": sign([i32], [f32]),
28875 "f32.convert_u/i32": sign([i32], [f32]),
28876 "f32.convert_s/i64": sign([i64], [f32]),
28877 "f32.convert_u/i64": sign([i64], [f32]),
28878 "f32.demote/f64": sign([f64], [f32]),
28879 "f64.convert_s/i32": sign([i32], [f64]),
28880 "f64.convert_u/i32": sign([i32], [f64]),
28881 "f64.convert_s/i64": sign([i64], [f64]),
28882 "f64.convert_u/i64": sign([i64], [f64]),
28883 "f64.promote/f32": sign([f32], [f64]),
28884 "i32.reinterpret/f32": sign([f32], [i32]),
28885 "i64.reinterpret/f64": sign([f64], [i64]),
28886 "f32.reinterpret/i32": sign([i32], [f32]),
28887 "f64.reinterpret/i64": sign([i64], [f64])
28888};
28889var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
28890exports.signatures = signatures;
28891
28892/***/ }),
28893
28894/***/ 56694:
28895/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
28896
28897"use strict";
28898
28899
28900Object.defineProperty(exports, "__esModule", ({
28901 value: true
28902}));
28903exports.traverse = traverse;
28904
28905var _nodePath = __webpack_require__(43893);
28906
28907var _nodes = __webpack_require__(85701);
28908
28909// recursively walks the AST starting at the given node. The callback is invoked for
28910// and object that has a 'type' property.
28911function walk(context, callback) {
28912 var stop = false;
28913
28914 function innerWalk(context, callback) {
28915 if (stop) {
28916 return;
28917 }
28918
28919 var node = context.node;
28920
28921 if (node === undefined) {
28922 console.warn("traversing with an empty context");
28923 return;
28924 }
28925
28926 if (node._deleted === true) {
28927 return;
28928 }
28929
28930 var path = (0, _nodePath.createPath)(context);
28931 callback(node.type, path);
28932
28933 if (path.shouldStop) {
28934 stop = true;
28935 return;
28936 }
28937
28938 Object.keys(node).forEach(function (prop) {
28939 var value = node[prop];
28940
28941 if (value === null || value === undefined) {
28942 return;
28943 }
28944
28945 var valueAsArray = Array.isArray(value) ? value : [value];
28946 valueAsArray.forEach(function (childNode) {
28947 if (typeof childNode.type === "string") {
28948 var childContext = {
28949 node: childNode,
28950 parentKey: prop,
28951 parentPath: path,
28952 shouldStop: false,
28953 inList: Array.isArray(value)
28954 };
28955 innerWalk(childContext, callback);
28956 }
28957 });
28958 });
28959 }
28960
28961 innerWalk(context, callback);
28962}
28963
28964var noop = function noop() {};
28965
28966function traverse(node, visitors) {
28967 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
28968 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
28969 Object.keys(visitors).forEach(function (visitor) {
28970 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
28971 throw new Error("Unexpected visitor ".concat(visitor));
28972 }
28973 });
28974 var context = {
28975 node: node,
28976 inList: false,
28977 shouldStop: false,
28978 parentPath: null,
28979 parentKey: null
28980 };
28981 walk(context, function (type, path) {
28982 if (typeof visitors[type] === "function") {
28983 before(type, path);
28984 visitors[type](path);
28985 after(type, path);
28986 }
28987
28988 var unionTypes = _nodes.unionTypesMap[type];
28989
28990 if (!unionTypes) {
28991 throw new Error("Unexpected node type ".concat(type));
28992 }
28993
28994 unionTypes.forEach(function (unionType) {
28995 if (typeof visitors[unionType] === "function") {
28996 before(unionType, path);
28997 visitors[unionType](path);
28998 after(unionType, path);
28999 }
29000 });
29001 });
29002}
29003
29004/***/ }),
29005
29006/***/ 41618:
29007/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
29008
29009"use strict";
29010
29011
29012Object.defineProperty(exports, "__esModule", ({
29013 value: true
29014}));
29015exports.isAnonymous = isAnonymous;
29016exports.getSectionMetadata = getSectionMetadata;
29017exports.getSectionMetadatas = getSectionMetadatas;
29018exports.sortSectionMetadata = sortSectionMetadata;
29019exports.orderedInsertNode = orderedInsertNode;
29020exports.assertHasLoc = assertHasLoc;
29021exports.getEndOfSection = getEndOfSection;
29022exports.shiftLoc = shiftLoc;
29023exports.shiftSection = shiftSection;
29024exports.signatureForOpcode = signatureForOpcode;
29025exports.getUniqueNameGenerator = getUniqueNameGenerator;
29026exports.getStartByteOffset = getStartByteOffset;
29027exports.getEndByteOffset = getEndByteOffset;
29028exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
29029exports.getEndBlockByteOffset = getEndBlockByteOffset;
29030exports.getStartBlockByteOffset = getStartBlockByteOffset;
29031
29032var _signatures = __webpack_require__(74127);
29033
29034var _traverse = __webpack_require__(56694);
29035
29036var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(24616));
29037
29038function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
29039
29040function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29041
29042function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
29043
29044function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
29045
29046function isAnonymous(ident) {
29047 return ident.raw === "";
29048}
29049
29050function getSectionMetadata(ast, name) {
29051 var section;
29052 (0, _traverse.traverse)(ast, {
29053 SectionMetadata: function (_SectionMetadata) {
29054 function SectionMetadata(_x) {
29055 return _SectionMetadata.apply(this, arguments);
29056 }
29057
29058 SectionMetadata.toString = function () {
29059 return _SectionMetadata.toString();
29060 };
29061
29062 return SectionMetadata;
29063 }(function (_ref) {
29064 var node = _ref.node;
29065
29066 if (node.section === name) {
29067 section = node;
29068 }
29069 })
29070 });
29071 return section;
29072}
29073
29074function getSectionMetadatas(ast, name) {
29075 var sections = [];
29076 (0, _traverse.traverse)(ast, {
29077 SectionMetadata: function (_SectionMetadata2) {
29078 function SectionMetadata(_x2) {
29079 return _SectionMetadata2.apply(this, arguments);
29080 }
29081
29082 SectionMetadata.toString = function () {
29083 return _SectionMetadata2.toString();
29084 };
29085
29086 return SectionMetadata;
29087 }(function (_ref2) {
29088 var node = _ref2.node;
29089
29090 if (node.section === name) {
29091 sections.push(node);
29092 }
29093 })
29094 });
29095 return sections;
29096}
29097
29098function sortSectionMetadata(m) {
29099 if (m.metadata == null) {
29100 console.warn("sortSectionMetadata: no metadata to sort");
29101 return;
29102 } // $FlowIgnore
29103
29104
29105 m.metadata.sections.sort(function (a, b) {
29106 var aId = _helperWasmBytecode.default.sections[a.section];
29107 var bId = _helperWasmBytecode.default.sections[b.section];
29108
29109 if (typeof aId !== "number" || typeof bId !== "number") {
29110 throw new Error("Section id not found");
29111 }
29112
29113 return aId - bId;
29114 });
29115}
29116
29117function orderedInsertNode(m, n) {
29118 assertHasLoc(n);
29119 var didInsert = false;
29120
29121 if (n.type === "ModuleExport") {
29122 m.fields.push(n);
29123 return;
29124 }
29125
29126 m.fields = m.fields.reduce(function (acc, field) {
29127 var fieldEndCol = Infinity;
29128
29129 if (field.loc != null) {
29130 // $FlowIgnore
29131 fieldEndCol = field.loc.end.column;
29132 } // $FlowIgnore: assertHasLoc ensures that
29133
29134
29135 if (didInsert === false && n.loc.start.column < fieldEndCol) {
29136 didInsert = true;
29137 acc.push(n);
29138 }
29139
29140 acc.push(field);
29141 return acc;
29142 }, []); // Handles empty modules or n is the last element
29143
29144 if (didInsert === false) {
29145 m.fields.push(n);
29146 }
29147}
29148
29149function assertHasLoc(n) {
29150 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
29151 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
29152 }
29153}
29154
29155function getEndOfSection(s) {
29156 assertHasLoc(s.size);
29157 return s.startOffset + s.size.value + ( // $FlowIgnore
29158 s.size.loc.end.column - s.size.loc.start.column);
29159}
29160
29161function shiftLoc(node, delta) {
29162 // $FlowIgnore
29163 node.loc.start.column += delta; // $FlowIgnore
29164
29165 node.loc.end.column += delta;
29166}
29167
29168function shiftSection(ast, node, delta) {
29169 if (node.type !== "SectionMetadata") {
29170 throw new Error("Can not shift node " + JSON.stringify(node.type));
29171 }
29172
29173 node.startOffset += delta;
29174
29175 if (_typeof(node.size.loc) === "object") {
29176 shiftLoc(node.size, delta);
29177 } // Custom sections doesn't have vectorOfSize
29178
29179
29180 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
29181 shiftLoc(node.vectorOfSize, delta);
29182 }
29183
29184 var sectionName = node.section; // shift node locations within that section
29185
29186 (0, _traverse.traverse)(ast, {
29187 Node: function Node(_ref3) {
29188 var node = _ref3.node;
29189 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
29190
29191 if (section === sectionName && _typeof(node.loc) === "object") {
29192 shiftLoc(node, delta);
29193 }
29194 }
29195 });
29196}
29197
29198function signatureForOpcode(object, name) {
29199 var opcodeName = name;
29200
29201 if (object !== undefined && object !== "") {
29202 opcodeName = object + "." + name;
29203 }
29204
29205 var sign = _signatures.signatures[opcodeName];
29206
29207 if (sign == undefined) {
29208 // TODO: Uncomment this when br_table and others has been done
29209 //throw new Error("Invalid opcode: "+opcodeName);
29210 return [object, object];
29211 }
29212
29213 return sign[0];
29214}
29215
29216function getUniqueNameGenerator() {
29217 var inc = {};
29218 return function () {
29219 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
29220
29221 if (!(prefix in inc)) {
29222 inc[prefix] = 0;
29223 } else {
29224 inc[prefix] = inc[prefix] + 1;
29225 }
29226
29227 return prefix + "_" + inc[prefix];
29228 };
29229}
29230
29231function getStartByteOffset(n) {
29232 // $FlowIgnore
29233 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
29234 throw new Error( // $FlowIgnore
29235 "Can not get byte offset without loc informations, node: " + String(n.id));
29236 }
29237
29238 return n.loc.start.column;
29239}
29240
29241function getEndByteOffset(n) {
29242 // $FlowIgnore
29243 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
29244 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
29245 }
29246
29247 return n.loc.end.column;
29248}
29249
29250function getFunctionBeginingByteOffset(n) {
29251 if (!(n.body.length > 0)) {
29252 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
29253 }
29254
29255 var _n$body = _slicedToArray(n.body, 1),
29256 firstInstruction = _n$body[0];
29257
29258 return getStartByteOffset(firstInstruction);
29259}
29260
29261function getEndBlockByteOffset(n) {
29262 // $FlowIgnore
29263 if (!(n.instr.length > 0 || n.body.length > 0)) {
29264 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
29265 }
29266
29267 var lastInstruction;
29268
29269 if (n.instr) {
29270 // $FlowIgnore
29271 lastInstruction = n.instr[n.instr.length - 1];
29272 }
29273
29274 if (n.body) {
29275 // $FlowIgnore
29276 lastInstruction = n.body[n.body.length - 1];
29277 }
29278
29279 if (!(_typeof(lastInstruction) === "object")) {
29280 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
29281 }
29282
29283 // $FlowIgnore
29284 return getStartByteOffset(lastInstruction);
29285}
29286
29287function getStartBlockByteOffset(n) {
29288 // $FlowIgnore
29289 if (!(n.instr.length > 0 || n.body.length > 0)) {
29290 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
29291 }
29292
29293 var fistInstruction;
29294
29295 if (n.instr) {
29296 // $FlowIgnore
29297 var _n$instr = _slicedToArray(n.instr, 1);
29298
29299 fistInstruction = _n$instr[0];
29300 }
29301
29302 if (n.body) {
29303 // $FlowIgnore
29304 var _n$body2 = _slicedToArray(n.body, 1);
29305
29306 fistInstruction = _n$body2[0];
29307 }
29308
29309 if (!(_typeof(fistInstruction) === "object")) {
29310 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
29311 }
29312
29313 // $FlowIgnore
29314 return getStartByteOffset(fistInstruction);
29315}
29316
29317/***/ }),
29318
29319/***/ 24616:
29320/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
29321
29322"use strict";
29323
29324
29325Object.defineProperty(exports, "__esModule", ({
29326 value: true
29327}));
29328Object.defineProperty(exports, "getSectionForNode", ({
29329 enumerable: true,
29330 get: function get() {
29331 return _section.getSectionForNode;
29332 }
29333}));
29334exports.default = void 0;
29335
29336var _section = __webpack_require__(37154);
29337
29338var illegalop = "illegal";
29339var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
29340var moduleVersion = [0x01, 0x00, 0x00, 0x00];
29341
29342function invertMap(obj) {
29343 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
29344 return k;
29345 };
29346 var result = {};
29347 var keys = Object.keys(obj);
29348
29349 for (var i = 0, length = keys.length; i < length; i++) {
29350 result[keyModifierFn(obj[keys[i]])] = keys[i];
29351 }
29352
29353 return result;
29354}
29355
29356function createSymbolObject(name
29357/*: string */
29358, object
29359/*: string */
29360)
29361/*: Symbol*/
29362{
29363 var numberOfArgs
29364 /*: number*/
29365 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
29366 return {
29367 name: name,
29368 object: object,
29369 numberOfArgs: numberOfArgs
29370 };
29371}
29372
29373function createSymbol(name
29374/*: string */
29375)
29376/*: Symbol*/
29377{
29378 var numberOfArgs
29379 /*: number*/
29380 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
29381 return {
29382 name: name,
29383 numberOfArgs: numberOfArgs
29384 };
29385}
29386
29387var types = {
29388 func: 0x60,
29389 result: 0x40
29390};
29391var exportTypes = {
29392 0x00: "Func",
29393 0x01: "Table",
29394 0x02: "Mem",
29395 0x03: "Global"
29396};
29397var exportTypesByName = invertMap(exportTypes);
29398var valtypes = {
29399 0x7f: "i32",
29400 0x7e: "i64",
29401 0x7d: "f32",
29402 0x7c: "f64",
29403 0x7b: "v128"
29404};
29405var valtypesByString = invertMap(valtypes);
29406var tableTypes = {
29407 0x70: "anyfunc"
29408};
29409var blockTypes = Object.assign({}, valtypes, {
29410 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
29411 0x40: null,
29412 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
29413 0x7f: "i32",
29414 0x7e: "i64",
29415 0x7d: "f32",
29416 0x7c: "f64"
29417});
29418var globalTypes = {
29419 0x00: "const",
29420 0x01: "var"
29421};
29422var globalTypesByString = invertMap(globalTypes);
29423var importTypes = {
29424 0x00: "func",
29425 0x01: "table",
29426 0x02: "mem",
29427 0x03: "global"
29428};
29429var sections = {
29430 custom: 0,
29431 type: 1,
29432 import: 2,
29433 func: 3,
29434 table: 4,
29435 memory: 5,
29436 global: 6,
29437 export: 7,
29438 start: 8,
29439 element: 9,
29440 code: 10,
29441 data: 11
29442};
29443var symbolsByByte = {
29444 0x00: createSymbol("unreachable"),
29445 0x01: createSymbol("nop"),
29446 0x02: createSymbol("block"),
29447 0x03: createSymbol("loop"),
29448 0x04: createSymbol("if"),
29449 0x05: createSymbol("else"),
29450 0x06: illegalop,
29451 0x07: illegalop,
29452 0x08: illegalop,
29453 0x09: illegalop,
29454 0x0a: illegalop,
29455 0x0b: createSymbol("end"),
29456 0x0c: createSymbol("br", 1),
29457 0x0d: createSymbol("br_if", 1),
29458 0x0e: createSymbol("br_table"),
29459 0x0f: createSymbol("return"),
29460 0x10: createSymbol("call", 1),
29461 0x11: createSymbol("call_indirect", 2),
29462 0x12: illegalop,
29463 0x13: illegalop,
29464 0x14: illegalop,
29465 0x15: illegalop,
29466 0x16: illegalop,
29467 0x17: illegalop,
29468 0x18: illegalop,
29469 0x19: illegalop,
29470 0x1a: createSymbol("drop"),
29471 0x1b: createSymbol("select"),
29472 0x1c: illegalop,
29473 0x1d: illegalop,
29474 0x1e: illegalop,
29475 0x1f: illegalop,
29476 0x20: createSymbol("get_local", 1),
29477 0x21: createSymbol("set_local", 1),
29478 0x22: createSymbol("tee_local", 1),
29479 0x23: createSymbol("get_global", 1),
29480 0x24: createSymbol("set_global", 1),
29481 0x25: illegalop,
29482 0x26: illegalop,
29483 0x27: illegalop,
29484 0x28: createSymbolObject("load", "u32", 1),
29485 0x29: createSymbolObject("load", "u64", 1),
29486 0x2a: createSymbolObject("load", "f32", 1),
29487 0x2b: createSymbolObject("load", "f64", 1),
29488 0x2c: createSymbolObject("load8_s", "u32", 1),
29489 0x2d: createSymbolObject("load8_u", "u32", 1),
29490 0x2e: createSymbolObject("load16_s", "u32", 1),
29491 0x2f: createSymbolObject("load16_u", "u32", 1),
29492 0x30: createSymbolObject("load8_s", "u64", 1),
29493 0x31: createSymbolObject("load8_u", "u64", 1),
29494 0x32: createSymbolObject("load16_s", "u64", 1),
29495 0x33: createSymbolObject("load16_u", "u64", 1),
29496 0x34: createSymbolObject("load32_s", "u64", 1),
29497 0x35: createSymbolObject("load32_u", "u64", 1),
29498 0x36: createSymbolObject("store", "u32", 1),
29499 0x37: createSymbolObject("store", "u64", 1),
29500 0x38: createSymbolObject("store", "f32", 1),
29501 0x39: createSymbolObject("store", "f64", 1),
29502 0x3a: createSymbolObject("store8", "u32", 1),
29503 0x3b: createSymbolObject("store16", "u32", 1),
29504 0x3c: createSymbolObject("store8", "u64", 1),
29505 0x3d: createSymbolObject("store16", "u64", 1),
29506 0x3e: createSymbolObject("store32", "u64", 1),
29507 0x3f: createSymbolObject("current_memory"),
29508 0x40: createSymbolObject("grow_memory"),
29509 0x41: createSymbolObject("const", "i32", 1),
29510 0x42: createSymbolObject("const", "i64", 1),
29511 0x43: createSymbolObject("const", "f32", 1),
29512 0x44: createSymbolObject("const", "f64", 1),
29513 0x45: createSymbolObject("eqz", "i32"),
29514 0x46: createSymbolObject("eq", "i32"),
29515 0x47: createSymbolObject("ne", "i32"),
29516 0x48: createSymbolObject("lt_s", "i32"),
29517 0x49: createSymbolObject("lt_u", "i32"),
29518 0x4a: createSymbolObject("gt_s", "i32"),
29519 0x4b: createSymbolObject("gt_u", "i32"),
29520 0x4c: createSymbolObject("le_s", "i32"),
29521 0x4d: createSymbolObject("le_u", "i32"),
29522 0x4e: createSymbolObject("ge_s", "i32"),
29523 0x4f: createSymbolObject("ge_u", "i32"),
29524 0x50: createSymbolObject("eqz", "i64"),
29525 0x51: createSymbolObject("eq", "i64"),
29526 0x52: createSymbolObject("ne", "i64"),
29527 0x53: createSymbolObject("lt_s", "i64"),
29528 0x54: createSymbolObject("lt_u", "i64"),
29529 0x55: createSymbolObject("gt_s", "i64"),
29530 0x56: createSymbolObject("gt_u", "i64"),
29531 0x57: createSymbolObject("le_s", "i64"),
29532 0x58: createSymbolObject("le_u", "i64"),
29533 0x59: createSymbolObject("ge_s", "i64"),
29534 0x5a: createSymbolObject("ge_u", "i64"),
29535 0x5b: createSymbolObject("eq", "f32"),
29536 0x5c: createSymbolObject("ne", "f32"),
29537 0x5d: createSymbolObject("lt", "f32"),
29538 0x5e: createSymbolObject("gt", "f32"),
29539 0x5f: createSymbolObject("le", "f32"),
29540 0x60: createSymbolObject("ge", "f32"),
29541 0x61: createSymbolObject("eq", "f64"),
29542 0x62: createSymbolObject("ne", "f64"),
29543 0x63: createSymbolObject("lt", "f64"),
29544 0x64: createSymbolObject("gt", "f64"),
29545 0x65: createSymbolObject("le", "f64"),
29546 0x66: createSymbolObject("ge", "f64"),
29547 0x67: createSymbolObject("clz", "i32"),
29548 0x68: createSymbolObject("ctz", "i32"),
29549 0x69: createSymbolObject("popcnt", "i32"),
29550 0x6a: createSymbolObject("add", "i32"),
29551 0x6b: createSymbolObject("sub", "i32"),
29552 0x6c: createSymbolObject("mul", "i32"),
29553 0x6d: createSymbolObject("div_s", "i32"),
29554 0x6e: createSymbolObject("div_u", "i32"),
29555 0x6f: createSymbolObject("rem_s", "i32"),
29556 0x70: createSymbolObject("rem_u", "i32"),
29557 0x71: createSymbolObject("and", "i32"),
29558 0x72: createSymbolObject("or", "i32"),
29559 0x73: createSymbolObject("xor", "i32"),
29560 0x74: createSymbolObject("shl", "i32"),
29561 0x75: createSymbolObject("shr_s", "i32"),
29562 0x76: createSymbolObject("shr_u", "i32"),
29563 0x77: createSymbolObject("rotl", "i32"),
29564 0x78: createSymbolObject("rotr", "i32"),
29565 0x79: createSymbolObject("clz", "i64"),
29566 0x7a: createSymbolObject("ctz", "i64"),
29567 0x7b: createSymbolObject("popcnt", "i64"),
29568 0x7c: createSymbolObject("add", "i64"),
29569 0x7d: createSymbolObject("sub", "i64"),
29570 0x7e: createSymbolObject("mul", "i64"),
29571 0x7f: createSymbolObject("div_s", "i64"),
29572 0x80: createSymbolObject("div_u", "i64"),
29573 0x81: createSymbolObject("rem_s", "i64"),
29574 0x82: createSymbolObject("rem_u", "i64"),
29575 0x83: createSymbolObject("and", "i64"),
29576 0x84: createSymbolObject("or", "i64"),
29577 0x85: createSymbolObject("xor", "i64"),
29578 0x86: createSymbolObject("shl", "i64"),
29579 0x87: createSymbolObject("shr_s", "i64"),
29580 0x88: createSymbolObject("shr_u", "i64"),
29581 0x89: createSymbolObject("rotl", "i64"),
29582 0x8a: createSymbolObject("rotr", "i64"),
29583 0x8b: createSymbolObject("abs", "f32"),
29584 0x8c: createSymbolObject("neg", "f32"),
29585 0x8d: createSymbolObject("ceil", "f32"),
29586 0x8e: createSymbolObject("floor", "f32"),
29587 0x8f: createSymbolObject("trunc", "f32"),
29588 0x90: createSymbolObject("nearest", "f32"),
29589 0x91: createSymbolObject("sqrt", "f32"),
29590 0x92: createSymbolObject("add", "f32"),
29591 0x93: createSymbolObject("sub", "f32"),
29592 0x94: createSymbolObject("mul", "f32"),
29593 0x95: createSymbolObject("div", "f32"),
29594 0x96: createSymbolObject("min", "f32"),
29595 0x97: createSymbolObject("max", "f32"),
29596 0x98: createSymbolObject("copysign", "f32"),
29597 0x99: createSymbolObject("abs", "f64"),
29598 0x9a: createSymbolObject("neg", "f64"),
29599 0x9b: createSymbolObject("ceil", "f64"),
29600 0x9c: createSymbolObject("floor", "f64"),
29601 0x9d: createSymbolObject("trunc", "f64"),
29602 0x9e: createSymbolObject("nearest", "f64"),
29603 0x9f: createSymbolObject("sqrt", "f64"),
29604 0xa0: createSymbolObject("add", "f64"),
29605 0xa1: createSymbolObject("sub", "f64"),
29606 0xa2: createSymbolObject("mul", "f64"),
29607 0xa3: createSymbolObject("div", "f64"),
29608 0xa4: createSymbolObject("min", "f64"),
29609 0xa5: createSymbolObject("max", "f64"),
29610 0xa6: createSymbolObject("copysign", "f64"),
29611 0xa7: createSymbolObject("wrap/i64", "i32"),
29612 0xa8: createSymbolObject("trunc_s/f32", "i32"),
29613 0xa9: createSymbolObject("trunc_u/f32", "i32"),
29614 0xaa: createSymbolObject("trunc_s/f64", "i32"),
29615 0xab: createSymbolObject("trunc_u/f64", "i32"),
29616 0xac: createSymbolObject("extend_s/i32", "i64"),
29617 0xad: createSymbolObject("extend_u/i32", "i64"),
29618 0xae: createSymbolObject("trunc_s/f32", "i64"),
29619 0xaf: createSymbolObject("trunc_u/f32", "i64"),
29620 0xb0: createSymbolObject("trunc_s/f64", "i64"),
29621 0xb1: createSymbolObject("trunc_u/f64", "i64"),
29622 0xb2: createSymbolObject("convert_s/i32", "f32"),
29623 0xb3: createSymbolObject("convert_u/i32", "f32"),
29624 0xb4: createSymbolObject("convert_s/i64", "f32"),
29625 0xb5: createSymbolObject("convert_u/i64", "f32"),
29626 0xb6: createSymbolObject("demote/f64", "f32"),
29627 0xb7: createSymbolObject("convert_s/i32", "f64"),
29628 0xb8: createSymbolObject("convert_u/i32", "f64"),
29629 0xb9: createSymbolObject("convert_s/i64", "f64"),
29630 0xba: createSymbolObject("convert_u/i64", "f64"),
29631 0xbb: createSymbolObject("promote/f32", "f64"),
29632 0xbc: createSymbolObject("reinterpret/f32", "i32"),
29633 0xbd: createSymbolObject("reinterpret/f64", "i64"),
29634 0xbe: createSymbolObject("reinterpret/i32", "f32"),
29635 0xbf: createSymbolObject("reinterpret/i64", "f64")
29636};
29637var symbolsByName = invertMap(symbolsByByte, function (obj) {
29638 if (typeof obj.object === "string") {
29639 return "".concat(obj.object, ".").concat(obj.name);
29640 }
29641
29642 return obj.name;
29643});
29644var _default = {
29645 symbolsByByte: symbolsByByte,
29646 sections: sections,
29647 magicModuleHeader: magicModuleHeader,
29648 moduleVersion: moduleVersion,
29649 types: types,
29650 valtypes: valtypes,
29651 exportTypes: exportTypes,
29652 blockTypes: blockTypes,
29653 tableTypes: tableTypes,
29654 globalTypes: globalTypes,
29655 importTypes: importTypes,
29656 valtypesByString: valtypesByString,
29657 globalTypesByString: globalTypesByString,
29658 exportTypesByName: exportTypesByName,
29659 symbolsByName: symbolsByName
29660};
29661exports.default = _default;
29662
29663/***/ }),
29664
29665/***/ 37154:
29666/***/ (function(__unused_webpack_module, exports) {
29667
29668"use strict";
29669
29670
29671Object.defineProperty(exports, "__esModule", ({
29672 value: true
29673}));
29674exports.getSectionForNode = getSectionForNode;
29675
29676function getSectionForNode(n) {
29677 switch (n.type) {
29678 case "ModuleImport":
29679 return "import";
29680
29681 case "CallInstruction":
29682 case "CallIndirectInstruction":
29683 case "Func":
29684 case "Instr":
29685 return "code";
29686
29687 case "ModuleExport":
29688 return "export";
29689
29690 case "Start":
29691 return "start";
29692
29693 case "TypeInstruction":
29694 return "type";
29695
29696 case "IndexInFuncSection":
29697 return "func";
29698
29699 case "Global":
29700 return "global";
29701 // No section
29702
29703 default:
29704 return;
29705 }
29706}
29707
29708/***/ }),
29709
29710/***/ 30848:
29711/***/ (function(__unused_webpack_module, exports) {
29712
29713"use strict";
29714
29715
29716Object.defineProperty(exports, "__esModule", ({
29717 value: true
29718}));
29719exports.read = read;
29720exports.write = write;
29721
29722function read(buffer, offset, isLE, mLen, nBytes) {
29723 var e, m;
29724 var eLen = nBytes * 8 - mLen - 1;
29725 var eMax = (1 << eLen) - 1;
29726 var eBias = eMax >> 1;
29727 var nBits = -7;
29728 var i = isLE ? nBytes - 1 : 0;
29729 var d = isLE ? -1 : 1;
29730 var s = buffer[offset + i];
29731 i += d;
29732 e = s & (1 << -nBits) - 1;
29733 s >>= -nBits;
29734 nBits += eLen;
29735
29736 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
29737
29738 m = e & (1 << -nBits) - 1;
29739 e >>= -nBits;
29740 nBits += mLen;
29741
29742 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
29743
29744 if (e === 0) {
29745 e = 1 - eBias;
29746 } else if (e === eMax) {
29747 return m ? NaN : (s ? -1 : 1) * Infinity;
29748 } else {
29749 m = m + Math.pow(2, mLen);
29750 e = e - eBias;
29751 }
29752
29753 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
29754}
29755
29756function write(buffer, value, offset, isLE, mLen, nBytes) {
29757 var e, m, c;
29758 var eLen = nBytes * 8 - mLen - 1;
29759 var eMax = (1 << eLen) - 1;
29760 var eBias = eMax >> 1;
29761 var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
29762 var i = isLE ? 0 : nBytes - 1;
29763 var d = isLE ? 1 : -1;
29764 var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
29765 value = Math.abs(value);
29766
29767 if (isNaN(value) || value === Infinity) {
29768 m = isNaN(value) ? 1 : 0;
29769 e = eMax;
29770 } else {
29771 e = Math.floor(Math.log(value) / Math.LN2);
29772
29773 if (value * (c = Math.pow(2, -e)) < 1) {
29774 e--;
29775 c *= 2;
29776 }
29777
29778 if (e + eBias >= 1) {
29779 value += rt / c;
29780 } else {
29781 value += rt * Math.pow(2, 1 - eBias);
29782 }
29783
29784 if (value * c >= 2) {
29785 e++;
29786 c /= 2;
29787 }
29788
29789 if (e + eBias >= eMax) {
29790 m = 0;
29791 e = eMax;
29792 } else if (e + eBias >= 1) {
29793 m = (value * c - 1) * Math.pow(2, mLen);
29794 e = e + eBias;
29795 } else {
29796 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
29797 e = 0;
29798 }
29799 }
29800
29801 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
29802
29803 e = e << mLen | m;
29804 eLen += mLen;
29805
29806 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
29807
29808 buffer[offset + i - d] |= s * 128;
29809}
29810
29811
29812/***/ }),
29813
29814/***/ 77960:
29815/***/ (function(module) {
29816
29817module.exports = Long;
29818
29819/**
29820 * wasm optimizations, to do native i64 multiplication and divide
29821 */
29822var wasm = null;
29823
29824try {
29825 wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
29826 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11
29827 ])), {}).exports;
29828} catch (e) {
29829 // no wasm support :(
29830}
29831
29832/**
29833 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
29834 * See the from* functions below for more convenient ways of constructing Longs.
29835 * @exports Long
29836 * @class A Long class for representing a 64 bit two's-complement integer value.
29837 * @param {number} low The low (signed) 32 bits of the long
29838 * @param {number} high The high (signed) 32 bits of the long
29839 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
29840 * @constructor
29841 */
29842function Long(low, high, unsigned) {
29843
29844 /**
29845 * The low 32 bits as a signed value.
29846 * @type {number}
29847 */
29848 this.low = low | 0;
29849
29850 /**
29851 * The high 32 bits as a signed value.
29852 * @type {number}
29853 */
29854 this.high = high | 0;
29855
29856 /**
29857 * Whether unsigned or not.
29858 * @type {boolean}
29859 */
29860 this.unsigned = !!unsigned;
29861}
29862
29863// The internal representation of a long is the two given signed, 32-bit values.
29864// We use 32-bit pieces because these are the size of integers on which
29865// Javascript performs bit-operations. For operations like addition and
29866// multiplication, we split each number into 16 bit pieces, which can easily be
29867// multiplied within Javascript's floating-point representation without overflow
29868// or change in sign.
29869//
29870// In the algorithms below, we frequently reduce the negative case to the
29871// positive case by negating the input(s) and then post-processing the result.
29872// Note that we must ALWAYS check specially whether those values are MIN_VALUE
29873// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
29874// a positive number, it overflows back into a negative). Not handling this
29875// case would often result in infinite recursion.
29876//
29877// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
29878// methods on which they depend.
29879
29880/**
29881 * An indicator used to reliably determine if an object is a Long or not.
29882 * @type {boolean}
29883 * @const
29884 * @private
29885 */
29886Long.prototype.__isLong__;
29887
29888Object.defineProperty(Long.prototype, "__isLong__", { value: true });
29889
29890/**
29891 * @function
29892 * @param {*} obj Object
29893 * @returns {boolean}
29894 * @inner
29895 */
29896function isLong(obj) {
29897 return (obj && obj["__isLong__"]) === true;
29898}
29899
29900/**
29901 * Tests if the specified object is a Long.
29902 * @function
29903 * @param {*} obj Object
29904 * @returns {boolean}
29905 */
29906Long.isLong = isLong;
29907
29908/**
29909 * A cache of the Long representations of small integer values.
29910 * @type {!Object}
29911 * @inner
29912 */
29913var INT_CACHE = {};
29914
29915/**
29916 * A cache of the Long representations of small unsigned integer values.
29917 * @type {!Object}
29918 * @inner
29919 */
29920var UINT_CACHE = {};
29921
29922/**
29923 * @param {number} value
29924 * @param {boolean=} unsigned
29925 * @returns {!Long}
29926 * @inner
29927 */
29928function fromInt(value, unsigned) {
29929 var obj, cachedObj, cache;
29930 if (unsigned) {
29931 value >>>= 0;
29932 if (cache = (0 <= value && value < 256)) {
29933 cachedObj = UINT_CACHE[value];
29934 if (cachedObj)
29935 return cachedObj;
29936 }
29937 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
29938 if (cache)
29939 UINT_CACHE[value] = obj;
29940 return obj;
29941 } else {
29942 value |= 0;
29943 if (cache = (-128 <= value && value < 128)) {
29944 cachedObj = INT_CACHE[value];
29945 if (cachedObj)
29946 return cachedObj;
29947 }
29948 obj = fromBits(value, value < 0 ? -1 : 0, false);
29949 if (cache)
29950 INT_CACHE[value] = obj;
29951 return obj;
29952 }
29953}
29954
29955/**
29956 * Returns a Long representing the given 32 bit integer value.
29957 * @function
29958 * @param {number} value The 32 bit integer in question
29959 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
29960 * @returns {!Long} The corresponding Long value
29961 */
29962Long.fromInt = fromInt;
29963
29964/**
29965 * @param {number} value
29966 * @param {boolean=} unsigned
29967 * @returns {!Long}
29968 * @inner
29969 */
29970function fromNumber(value, unsigned) {
29971 if (isNaN(value))
29972 return unsigned ? UZERO : ZERO;
29973 if (unsigned) {
29974 if (value < 0)
29975 return UZERO;
29976 if (value >= TWO_PWR_64_DBL)
29977 return MAX_UNSIGNED_VALUE;
29978 } else {
29979 if (value <= -TWO_PWR_63_DBL)
29980 return MIN_VALUE;
29981 if (value + 1 >= TWO_PWR_63_DBL)
29982 return MAX_VALUE;
29983 }
29984 if (value < 0)
29985 return fromNumber(-value, unsigned).neg();
29986 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
29987}
29988
29989/**
29990 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
29991 * @function
29992 * @param {number} value The number in question
29993 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
29994 * @returns {!Long} The corresponding Long value
29995 */
29996Long.fromNumber = fromNumber;
29997
29998/**
29999 * @param {number} lowBits
30000 * @param {number} highBits
30001 * @param {boolean=} unsigned
30002 * @returns {!Long}
30003 * @inner
30004 */
30005function fromBits(lowBits, highBits, unsigned) {
30006 return new Long(lowBits, highBits, unsigned);
30007}
30008
30009/**
30010 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
30011 * assumed to use 32 bits.
30012 * @function
30013 * @param {number} lowBits The low 32 bits
30014 * @param {number} highBits The high 32 bits
30015 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
30016 * @returns {!Long} The corresponding Long value
30017 */
30018Long.fromBits = fromBits;
30019
30020/**
30021 * @function
30022 * @param {number} base
30023 * @param {number} exponent
30024 * @returns {number}
30025 * @inner
30026 */
30027var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
30028
30029/**
30030 * @param {string} str
30031 * @param {(boolean|number)=} unsigned
30032 * @param {number=} radix
30033 * @returns {!Long}
30034 * @inner
30035 */
30036function fromString(str, unsigned, radix) {
30037 if (str.length === 0)
30038 throw Error('empty string');
30039 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
30040 return ZERO;
30041 if (typeof unsigned === 'number') {
30042 // For goog.math.long compatibility
30043 radix = unsigned,
30044 unsigned = false;
30045 } else {
30046 unsigned = !! unsigned;
30047 }
30048 radix = radix || 10;
30049 if (radix < 2 || 36 < radix)
30050 throw RangeError('radix');
30051
30052 var p;
30053 if ((p = str.indexOf('-')) > 0)
30054 throw Error('interior hyphen');
30055 else if (p === 0) {
30056 return fromString(str.substring(1), unsigned, radix).neg();
30057 }
30058
30059 // Do several (8) digits each time through the loop, so as to
30060 // minimize the calls to the very expensive emulated div.
30061 var radixToPower = fromNumber(pow_dbl(radix, 8));
30062
30063 var result = ZERO;
30064 for (var i = 0; i < str.length; i += 8) {
30065 var size = Math.min(8, str.length - i),
30066 value = parseInt(str.substring(i, i + size), radix);
30067 if (size < 8) {
30068 var power = fromNumber(pow_dbl(radix, size));
30069 result = result.mul(power).add(fromNumber(value));
30070 } else {
30071 result = result.mul(radixToPower);
30072 result = result.add(fromNumber(value));
30073 }
30074 }
30075 result.unsigned = unsigned;
30076 return result;
30077}
30078
30079/**
30080 * Returns a Long representation of the given string, written using the specified radix.
30081 * @function
30082 * @param {string} str The textual representation of the Long
30083 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
30084 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
30085 * @returns {!Long} The corresponding Long value
30086 */
30087Long.fromString = fromString;
30088
30089/**
30090 * @function
30091 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
30092 * @param {boolean=} unsigned
30093 * @returns {!Long}
30094 * @inner
30095 */
30096function fromValue(val, unsigned) {
30097 if (typeof val === 'number')
30098 return fromNumber(val, unsigned);
30099 if (typeof val === 'string')
30100 return fromString(val, unsigned);
30101 // Throws for non-objects, converts non-instanceof Long:
30102 return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
30103}
30104
30105/**
30106 * Converts the specified value to a Long using the appropriate from* function for its type.
30107 * @function
30108 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
30109 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
30110 * @returns {!Long}
30111 */
30112Long.fromValue = fromValue;
30113
30114// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
30115// no runtime penalty for these.
30116
30117/**
30118 * @type {number}
30119 * @const
30120 * @inner
30121 */
30122var TWO_PWR_16_DBL = 1 << 16;
30123
30124/**
30125 * @type {number}
30126 * @const
30127 * @inner
30128 */
30129var TWO_PWR_24_DBL = 1 << 24;
30130
30131/**
30132 * @type {number}
30133 * @const
30134 * @inner
30135 */
30136var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
30137
30138/**
30139 * @type {number}
30140 * @const
30141 * @inner
30142 */
30143var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
30144
30145/**
30146 * @type {number}
30147 * @const
30148 * @inner
30149 */
30150var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
30151
30152/**
30153 * @type {!Long}
30154 * @const
30155 * @inner
30156 */
30157var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
30158
30159/**
30160 * @type {!Long}
30161 * @inner
30162 */
30163var ZERO = fromInt(0);
30164
30165/**
30166 * Signed zero.
30167 * @type {!Long}
30168 */
30169Long.ZERO = ZERO;
30170
30171/**
30172 * @type {!Long}
30173 * @inner
30174 */
30175var UZERO = fromInt(0, true);
30176
30177/**
30178 * Unsigned zero.
30179 * @type {!Long}
30180 */
30181Long.UZERO = UZERO;
30182
30183/**
30184 * @type {!Long}
30185 * @inner
30186 */
30187var ONE = fromInt(1);
30188
30189/**
30190 * Signed one.
30191 * @type {!Long}
30192 */
30193Long.ONE = ONE;
30194
30195/**
30196 * @type {!Long}
30197 * @inner
30198 */
30199var UONE = fromInt(1, true);
30200
30201/**
30202 * Unsigned one.
30203 * @type {!Long}
30204 */
30205Long.UONE = UONE;
30206
30207/**
30208 * @type {!Long}
30209 * @inner
30210 */
30211var NEG_ONE = fromInt(-1);
30212
30213/**
30214 * Signed negative one.
30215 * @type {!Long}
30216 */
30217Long.NEG_ONE = NEG_ONE;
30218
30219/**
30220 * @type {!Long}
30221 * @inner
30222 */
30223var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
30224
30225/**
30226 * Maximum signed value.
30227 * @type {!Long}
30228 */
30229Long.MAX_VALUE = MAX_VALUE;
30230
30231/**
30232 * @type {!Long}
30233 * @inner
30234 */
30235var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
30236
30237/**
30238 * Maximum unsigned value.
30239 * @type {!Long}
30240 */
30241Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
30242
30243/**
30244 * @type {!Long}
30245 * @inner
30246 */
30247var MIN_VALUE = fromBits(0, 0x80000000|0, false);
30248
30249/**
30250 * Minimum signed value.
30251 * @type {!Long}
30252 */
30253Long.MIN_VALUE = MIN_VALUE;
30254
30255/**
30256 * @alias Long.prototype
30257 * @inner
30258 */
30259var LongPrototype = Long.prototype;
30260
30261/**
30262 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
30263 * @this {!Long}
30264 * @returns {number}
30265 */
30266LongPrototype.toInt = function toInt() {
30267 return this.unsigned ? this.low >>> 0 : this.low;
30268};
30269
30270/**
30271 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
30272 * @this {!Long}
30273 * @returns {number}
30274 */
30275LongPrototype.toNumber = function toNumber() {
30276 if (this.unsigned)
30277 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
30278 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
30279};
30280
30281/**
30282 * Converts the Long to a string written in the specified radix.
30283 * @this {!Long}
30284 * @param {number=} radix Radix (2-36), defaults to 10
30285 * @returns {string}
30286 * @override
30287 * @throws {RangeError} If `radix` is out of range
30288 */
30289LongPrototype.toString = function toString(radix) {
30290 radix = radix || 10;
30291 if (radix < 2 || 36 < radix)
30292 throw RangeError('radix');
30293 if (this.isZero())
30294 return '0';
30295 if (this.isNegative()) { // Unsigned Longs are never negative
30296 if (this.eq(MIN_VALUE)) {
30297 // We need to change the Long value before it can be negated, so we remove
30298 // the bottom-most digit in this base and then recurse to do the rest.
30299 var radixLong = fromNumber(radix),
30300 div = this.div(radixLong),
30301 rem1 = div.mul(radixLong).sub(this);
30302 return div.toString(radix) + rem1.toInt().toString(radix);
30303 } else
30304 return '-' + this.neg().toString(radix);
30305 }
30306
30307 // Do several (6) digits each time through the loop, so as to
30308 // minimize the calls to the very expensive emulated div.
30309 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
30310 rem = this;
30311 var result = '';
30312 while (true) {
30313 var remDiv = rem.div(radixToPower),
30314 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
30315 digits = intval.toString(radix);
30316 rem = remDiv;
30317 if (rem.isZero())
30318 return digits + result;
30319 else {
30320 while (digits.length < 6)
30321 digits = '0' + digits;
30322 result = '' + digits + result;
30323 }
30324 }
30325};
30326
30327/**
30328 * Gets the high 32 bits as a signed integer.
30329 * @this {!Long}
30330 * @returns {number} Signed high bits
30331 */
30332LongPrototype.getHighBits = function getHighBits() {
30333 return this.high;
30334};
30335
30336/**
30337 * Gets the high 32 bits as an unsigned integer.
30338 * @this {!Long}
30339 * @returns {number} Unsigned high bits
30340 */
30341LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
30342 return this.high >>> 0;
30343};
30344
30345/**
30346 * Gets the low 32 bits as a signed integer.
30347 * @this {!Long}
30348 * @returns {number} Signed low bits
30349 */
30350LongPrototype.getLowBits = function getLowBits() {
30351 return this.low;
30352};
30353
30354/**
30355 * Gets the low 32 bits as an unsigned integer.
30356 * @this {!Long}
30357 * @returns {number} Unsigned low bits
30358 */
30359LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
30360 return this.low >>> 0;
30361};
30362
30363/**
30364 * Gets the number of bits needed to represent the absolute value of this Long.
30365 * @this {!Long}
30366 * @returns {number}
30367 */
30368LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
30369 if (this.isNegative()) // Unsigned Longs are never negative
30370 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
30371 var val = this.high != 0 ? this.high : this.low;
30372 for (var bit = 31; bit > 0; bit--)
30373 if ((val & (1 << bit)) != 0)
30374 break;
30375 return this.high != 0 ? bit + 33 : bit + 1;
30376};
30377
30378/**
30379 * Tests if this Long's value equals zero.
30380 * @this {!Long}
30381 * @returns {boolean}
30382 */
30383LongPrototype.isZero = function isZero() {
30384 return this.high === 0 && this.low === 0;
30385};
30386
30387/**
30388 * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
30389 * @returns {boolean}
30390 */
30391LongPrototype.eqz = LongPrototype.isZero;
30392
30393/**
30394 * Tests if this Long's value is negative.
30395 * @this {!Long}
30396 * @returns {boolean}
30397 */
30398LongPrototype.isNegative = function isNegative() {
30399 return !this.unsigned && this.high < 0;
30400};
30401
30402/**
30403 * Tests if this Long's value is positive.
30404 * @this {!Long}
30405 * @returns {boolean}
30406 */
30407LongPrototype.isPositive = function isPositive() {
30408 return this.unsigned || this.high >= 0;
30409};
30410
30411/**
30412 * Tests if this Long's value is odd.
30413 * @this {!Long}
30414 * @returns {boolean}
30415 */
30416LongPrototype.isOdd = function isOdd() {
30417 return (this.low & 1) === 1;
30418};
30419
30420/**
30421 * Tests if this Long's value is even.
30422 * @this {!Long}
30423 * @returns {boolean}
30424 */
30425LongPrototype.isEven = function isEven() {
30426 return (this.low & 1) === 0;
30427};
30428
30429/**
30430 * Tests if this Long's value equals the specified's.
30431 * @this {!Long}
30432 * @param {!Long|number|string} other Other value
30433 * @returns {boolean}
30434 */
30435LongPrototype.equals = function equals(other) {
30436 if (!isLong(other))
30437 other = fromValue(other);
30438 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
30439 return false;
30440 return this.high === other.high && this.low === other.low;
30441};
30442
30443/**
30444 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
30445 * @function
30446 * @param {!Long|number|string} other Other value
30447 * @returns {boolean}
30448 */
30449LongPrototype.eq = LongPrototype.equals;
30450
30451/**
30452 * Tests if this Long's value differs from the specified's.
30453 * @this {!Long}
30454 * @param {!Long|number|string} other Other value
30455 * @returns {boolean}
30456 */
30457LongPrototype.notEquals = function notEquals(other) {
30458 return !this.eq(/* validates */ other);
30459};
30460
30461/**
30462 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
30463 * @function
30464 * @param {!Long|number|string} other Other value
30465 * @returns {boolean}
30466 */
30467LongPrototype.neq = LongPrototype.notEquals;
30468
30469/**
30470 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
30471 * @function
30472 * @param {!Long|number|string} other Other value
30473 * @returns {boolean}
30474 */
30475LongPrototype.ne = LongPrototype.notEquals;
30476
30477/**
30478 * Tests if this Long's value is less than the specified's.
30479 * @this {!Long}
30480 * @param {!Long|number|string} other Other value
30481 * @returns {boolean}
30482 */
30483LongPrototype.lessThan = function lessThan(other) {
30484 return this.comp(/* validates */ other) < 0;
30485};
30486
30487/**
30488 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
30489 * @function
30490 * @param {!Long|number|string} other Other value
30491 * @returns {boolean}
30492 */
30493LongPrototype.lt = LongPrototype.lessThan;
30494
30495/**
30496 * Tests if this Long's value is less than or equal the specified's.
30497 * @this {!Long}
30498 * @param {!Long|number|string} other Other value
30499 * @returns {boolean}
30500 */
30501LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
30502 return this.comp(/* validates */ other) <= 0;
30503};
30504
30505/**
30506 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
30507 * @function
30508 * @param {!Long|number|string} other Other value
30509 * @returns {boolean}
30510 */
30511LongPrototype.lte = LongPrototype.lessThanOrEqual;
30512
30513/**
30514 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
30515 * @function
30516 * @param {!Long|number|string} other Other value
30517 * @returns {boolean}
30518 */
30519LongPrototype.le = LongPrototype.lessThanOrEqual;
30520
30521/**
30522 * Tests if this Long's value is greater than the specified's.
30523 * @this {!Long}
30524 * @param {!Long|number|string} other Other value
30525 * @returns {boolean}
30526 */
30527LongPrototype.greaterThan = function greaterThan(other) {
30528 return this.comp(/* validates */ other) > 0;
30529};
30530
30531/**
30532 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
30533 * @function
30534 * @param {!Long|number|string} other Other value
30535 * @returns {boolean}
30536 */
30537LongPrototype.gt = LongPrototype.greaterThan;
30538
30539/**
30540 * Tests if this Long's value is greater than or equal the specified's.
30541 * @this {!Long}
30542 * @param {!Long|number|string} other Other value
30543 * @returns {boolean}
30544 */
30545LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
30546 return this.comp(/* validates */ other) >= 0;
30547};
30548
30549/**
30550 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
30551 * @function
30552 * @param {!Long|number|string} other Other value
30553 * @returns {boolean}
30554 */
30555LongPrototype.gte = LongPrototype.greaterThanOrEqual;
30556
30557/**
30558 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
30559 * @function
30560 * @param {!Long|number|string} other Other value
30561 * @returns {boolean}
30562 */
30563LongPrototype.ge = LongPrototype.greaterThanOrEqual;
30564
30565/**
30566 * Compares this Long's value with the specified's.
30567 * @this {!Long}
30568 * @param {!Long|number|string} other Other value
30569 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
30570 * if the given one is greater
30571 */
30572LongPrototype.compare = function compare(other) {
30573 if (!isLong(other))
30574 other = fromValue(other);
30575 if (this.eq(other))
30576 return 0;
30577 var thisNeg = this.isNegative(),
30578 otherNeg = other.isNegative();
30579 if (thisNeg && !otherNeg)
30580 return -1;
30581 if (!thisNeg && otherNeg)
30582 return 1;
30583 // At this point the sign bits are the same
30584 if (!this.unsigned)
30585 return this.sub(other).isNegative() ? -1 : 1;
30586 // Both are positive if at least one is unsigned
30587 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
30588};
30589
30590/**
30591 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
30592 * @function
30593 * @param {!Long|number|string} other Other value
30594 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
30595 * if the given one is greater
30596 */
30597LongPrototype.comp = LongPrototype.compare;
30598
30599/**
30600 * Negates this Long's value.
30601 * @this {!Long}
30602 * @returns {!Long} Negated Long
30603 */
30604LongPrototype.negate = function negate() {
30605 if (!this.unsigned && this.eq(MIN_VALUE))
30606 return MIN_VALUE;
30607 return this.not().add(ONE);
30608};
30609
30610/**
30611 * Negates this Long's value. This is an alias of {@link Long#negate}.
30612 * @function
30613 * @returns {!Long} Negated Long
30614 */
30615LongPrototype.neg = LongPrototype.negate;
30616
30617/**
30618 * Returns the sum of this and the specified Long.
30619 * @this {!Long}
30620 * @param {!Long|number|string} addend Addend
30621 * @returns {!Long} Sum
30622 */
30623LongPrototype.add = function add(addend) {
30624 if (!isLong(addend))
30625 addend = fromValue(addend);
30626
30627 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
30628
30629 var a48 = this.high >>> 16;
30630 var a32 = this.high & 0xFFFF;
30631 var a16 = this.low >>> 16;
30632 var a00 = this.low & 0xFFFF;
30633
30634 var b48 = addend.high >>> 16;
30635 var b32 = addend.high & 0xFFFF;
30636 var b16 = addend.low >>> 16;
30637 var b00 = addend.low & 0xFFFF;
30638
30639 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
30640 c00 += a00 + b00;
30641 c16 += c00 >>> 16;
30642 c00 &= 0xFFFF;
30643 c16 += a16 + b16;
30644 c32 += c16 >>> 16;
30645 c16 &= 0xFFFF;
30646 c32 += a32 + b32;
30647 c48 += c32 >>> 16;
30648 c32 &= 0xFFFF;
30649 c48 += a48 + b48;
30650 c48 &= 0xFFFF;
30651 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
30652};
30653
30654/**
30655 * Returns the difference of this and the specified Long.
30656 * @this {!Long}
30657 * @param {!Long|number|string} subtrahend Subtrahend
30658 * @returns {!Long} Difference
30659 */
30660LongPrototype.subtract = function subtract(subtrahend) {
30661 if (!isLong(subtrahend))
30662 subtrahend = fromValue(subtrahend);
30663 return this.add(subtrahend.neg());
30664};
30665
30666/**
30667 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
30668 * @function
30669 * @param {!Long|number|string} subtrahend Subtrahend
30670 * @returns {!Long} Difference
30671 */
30672LongPrototype.sub = LongPrototype.subtract;
30673
30674/**
30675 * Returns the product of this and the specified Long.
30676 * @this {!Long}
30677 * @param {!Long|number|string} multiplier Multiplier
30678 * @returns {!Long} Product
30679 */
30680LongPrototype.multiply = function multiply(multiplier) {
30681 if (this.isZero())
30682 return ZERO;
30683 if (!isLong(multiplier))
30684 multiplier = fromValue(multiplier);
30685
30686 // use wasm support if present
30687 if (wasm) {
30688 var low = wasm["mul"](this.low,
30689 this.high,
30690 multiplier.low,
30691 multiplier.high);
30692 return fromBits(low, wasm["get_high"](), this.unsigned);
30693 }
30694
30695 if (multiplier.isZero())
30696 return ZERO;
30697 if (this.eq(MIN_VALUE))
30698 return multiplier.isOdd() ? MIN_VALUE : ZERO;
30699 if (multiplier.eq(MIN_VALUE))
30700 return this.isOdd() ? MIN_VALUE : ZERO;
30701
30702 if (this.isNegative()) {
30703 if (multiplier.isNegative())
30704 return this.neg().mul(multiplier.neg());
30705 else
30706 return this.neg().mul(multiplier).neg();
30707 } else if (multiplier.isNegative())
30708 return this.mul(multiplier.neg()).neg();
30709
30710 // If both longs are small, use float multiplication
30711 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
30712 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
30713
30714 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
30715 // We can skip products that would overflow.
30716
30717 var a48 = this.high >>> 16;
30718 var a32 = this.high & 0xFFFF;
30719 var a16 = this.low >>> 16;
30720 var a00 = this.low & 0xFFFF;
30721
30722 var b48 = multiplier.high >>> 16;
30723 var b32 = multiplier.high & 0xFFFF;
30724 var b16 = multiplier.low >>> 16;
30725 var b00 = multiplier.low & 0xFFFF;
30726
30727 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
30728 c00 += a00 * b00;
30729 c16 += c00 >>> 16;
30730 c00 &= 0xFFFF;
30731 c16 += a16 * b00;
30732 c32 += c16 >>> 16;
30733 c16 &= 0xFFFF;
30734 c16 += a00 * b16;
30735 c32 += c16 >>> 16;
30736 c16 &= 0xFFFF;
30737 c32 += a32 * b00;
30738 c48 += c32 >>> 16;
30739 c32 &= 0xFFFF;
30740 c32 += a16 * b16;
30741 c48 += c32 >>> 16;
30742 c32 &= 0xFFFF;
30743 c32 += a00 * b32;
30744 c48 += c32 >>> 16;
30745 c32 &= 0xFFFF;
30746 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
30747 c48 &= 0xFFFF;
30748 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
30749};
30750
30751/**
30752 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
30753 * @function
30754 * @param {!Long|number|string} multiplier Multiplier
30755 * @returns {!Long} Product
30756 */
30757LongPrototype.mul = LongPrototype.multiply;
30758
30759/**
30760 * Returns this Long divided by the specified. The result is signed if this Long is signed or
30761 * unsigned if this Long is unsigned.
30762 * @this {!Long}
30763 * @param {!Long|number|string} divisor Divisor
30764 * @returns {!Long} Quotient
30765 */
30766LongPrototype.divide = function divide(divisor) {
30767 if (!isLong(divisor))
30768 divisor = fromValue(divisor);
30769 if (divisor.isZero())
30770 throw Error('division by zero');
30771
30772 // use wasm support if present
30773 if (wasm) {
30774 // guard against signed division overflow: the largest
30775 // negative number / -1 would be 1 larger than the largest
30776 // positive number, due to two's complement.
30777 if (!this.unsigned &&
30778 this.high === -0x80000000 &&
30779 divisor.low === -1 && divisor.high === -1) {
30780 // be consistent with non-wasm code path
30781 return this;
30782 }
30783 var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
30784 this.low,
30785 this.high,
30786 divisor.low,
30787 divisor.high
30788 );
30789 return fromBits(low, wasm["get_high"](), this.unsigned);
30790 }
30791
30792 if (this.isZero())
30793 return this.unsigned ? UZERO : ZERO;
30794 var approx, rem, res;
30795 if (!this.unsigned) {
30796 // This section is only relevant for signed longs and is derived from the
30797 // closure library as a whole.
30798 if (this.eq(MIN_VALUE)) {
30799 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
30800 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
30801 else if (divisor.eq(MIN_VALUE))
30802 return ONE;
30803 else {
30804 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
30805 var halfThis = this.shr(1);
30806 approx = halfThis.div(divisor).shl(1);
30807 if (approx.eq(ZERO)) {
30808 return divisor.isNegative() ? ONE : NEG_ONE;
30809 } else {
30810 rem = this.sub(divisor.mul(approx));
30811 res = approx.add(rem.div(divisor));
30812 return res;
30813 }
30814 }
30815 } else if (divisor.eq(MIN_VALUE))
30816 return this.unsigned ? UZERO : ZERO;
30817 if (this.isNegative()) {
30818 if (divisor.isNegative())
30819 return this.neg().div(divisor.neg());
30820 return this.neg().div(divisor).neg();
30821 } else if (divisor.isNegative())
30822 return this.div(divisor.neg()).neg();
30823 res = ZERO;
30824 } else {
30825 // The algorithm below has not been made for unsigned longs. It's therefore
30826 // required to take special care of the MSB prior to running it.
30827 if (!divisor.unsigned)
30828 divisor = divisor.toUnsigned();
30829 if (divisor.gt(this))
30830 return UZERO;
30831 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
30832 return UONE;
30833 res = UZERO;
30834 }
30835
30836 // Repeat the following until the remainder is less than other: find a
30837 // floating-point that approximates remainder / other *from below*, add this
30838 // into the result, and subtract it from the remainder. It is critical that
30839 // the approximate value is less than or equal to the real value so that the
30840 // remainder never becomes negative.
30841 rem = this;
30842 while (rem.gte(divisor)) {
30843 // Approximate the result of division. This may be a little greater or
30844 // smaller than the actual value.
30845 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
30846
30847 // We will tweak the approximate result by changing it in the 48-th digit or
30848 // the smallest non-fractional digit, whichever is larger.
30849 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
30850 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
30851
30852 // Decrease the approximation until it is smaller than the remainder. Note
30853 // that if it is too large, the product overflows and is negative.
30854 approxRes = fromNumber(approx),
30855 approxRem = approxRes.mul(divisor);
30856 while (approxRem.isNegative() || approxRem.gt(rem)) {
30857 approx -= delta;
30858 approxRes = fromNumber(approx, this.unsigned);
30859 approxRem = approxRes.mul(divisor);
30860 }
30861
30862 // We know the answer can't be zero... and actually, zero would cause
30863 // infinite recursion since we would make no progress.
30864 if (approxRes.isZero())
30865 approxRes = ONE;
30866
30867 res = res.add(approxRes);
30868 rem = rem.sub(approxRem);
30869 }
30870 return res;
30871};
30872
30873/**
30874 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
30875 * @function
30876 * @param {!Long|number|string} divisor Divisor
30877 * @returns {!Long} Quotient
30878 */
30879LongPrototype.div = LongPrototype.divide;
30880
30881/**
30882 * Returns this Long modulo the specified.
30883 * @this {!Long}
30884 * @param {!Long|number|string} divisor Divisor
30885 * @returns {!Long} Remainder
30886 */
30887LongPrototype.modulo = function modulo(divisor) {
30888 if (!isLong(divisor))
30889 divisor = fromValue(divisor);
30890
30891 // use wasm support if present
30892 if (wasm) {
30893 var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
30894 this.low,
30895 this.high,
30896 divisor.low,
30897 divisor.high
30898 );
30899 return fromBits(low, wasm["get_high"](), this.unsigned);
30900 }
30901
30902 return this.sub(this.div(divisor).mul(divisor));
30903};
30904
30905/**
30906 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
30907 * @function
30908 * @param {!Long|number|string} divisor Divisor
30909 * @returns {!Long} Remainder
30910 */
30911LongPrototype.mod = LongPrototype.modulo;
30912
30913/**
30914 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
30915 * @function
30916 * @param {!Long|number|string} divisor Divisor
30917 * @returns {!Long} Remainder
30918 */
30919LongPrototype.rem = LongPrototype.modulo;
30920
30921/**
30922 * Returns the bitwise NOT of this Long.
30923 * @this {!Long}
30924 * @returns {!Long}
30925 */
30926LongPrototype.not = function not() {
30927 return fromBits(~this.low, ~this.high, this.unsigned);
30928};
30929
30930/**
30931 * Returns the bitwise AND of this Long and the specified.
30932 * @this {!Long}
30933 * @param {!Long|number|string} other Other Long
30934 * @returns {!Long}
30935 */
30936LongPrototype.and = function and(other) {
30937 if (!isLong(other))
30938 other = fromValue(other);
30939 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
30940};
30941
30942/**
30943 * Returns the bitwise OR of this Long and the specified.
30944 * @this {!Long}
30945 * @param {!Long|number|string} other Other Long
30946 * @returns {!Long}
30947 */
30948LongPrototype.or = function or(other) {
30949 if (!isLong(other))
30950 other = fromValue(other);
30951 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
30952};
30953
30954/**
30955 * Returns the bitwise XOR of this Long and the given one.
30956 * @this {!Long}
30957 * @param {!Long|number|string} other Other Long
30958 * @returns {!Long}
30959 */
30960LongPrototype.xor = function xor(other) {
30961 if (!isLong(other))
30962 other = fromValue(other);
30963 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
30964};
30965
30966/**
30967 * Returns this Long with bits shifted to the left by the given amount.
30968 * @this {!Long}
30969 * @param {number|!Long} numBits Number of bits
30970 * @returns {!Long} Shifted Long
30971 */
30972LongPrototype.shiftLeft = function shiftLeft(numBits) {
30973 if (isLong(numBits))
30974 numBits = numBits.toInt();
30975 if ((numBits &= 63) === 0)
30976 return this;
30977 else if (numBits < 32)
30978 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
30979 else
30980 return fromBits(0, this.low << (numBits - 32), this.unsigned);
30981};
30982
30983/**
30984 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
30985 * @function
30986 * @param {number|!Long} numBits Number of bits
30987 * @returns {!Long} Shifted Long
30988 */
30989LongPrototype.shl = LongPrototype.shiftLeft;
30990
30991/**
30992 * Returns this Long with bits arithmetically shifted to the right by the given amount.
30993 * @this {!Long}
30994 * @param {number|!Long} numBits Number of bits
30995 * @returns {!Long} Shifted Long
30996 */
30997LongPrototype.shiftRight = function shiftRight(numBits) {
30998 if (isLong(numBits))
30999 numBits = numBits.toInt();
31000 if ((numBits &= 63) === 0)
31001 return this;
31002 else if (numBits < 32)
31003 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
31004 else
31005 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
31006};
31007
31008/**
31009 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
31010 * @function
31011 * @param {number|!Long} numBits Number of bits
31012 * @returns {!Long} Shifted Long
31013 */
31014LongPrototype.shr = LongPrototype.shiftRight;
31015
31016/**
31017 * Returns this Long with bits logically shifted to the right by the given amount.
31018 * @this {!Long}
31019 * @param {number|!Long} numBits Number of bits
31020 * @returns {!Long} Shifted Long
31021 */
31022LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
31023 if (isLong(numBits)) numBits = numBits.toInt();
31024 if ((numBits &= 63) === 0) return this;
31025 if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned);
31026 if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
31027 return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);
31028};
31029
31030/**
31031 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
31032 * @function
31033 * @param {number|!Long} numBits Number of bits
31034 * @returns {!Long} Shifted Long
31035 */
31036LongPrototype.shru = LongPrototype.shiftRightUnsigned;
31037
31038/**
31039 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
31040 * @function
31041 * @param {number|!Long} numBits Number of bits
31042 * @returns {!Long} Shifted Long
31043 */
31044LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
31045
31046/**
31047 * Returns this Long with bits rotated to the left by the given amount.
31048 * @this {!Long}
31049 * @param {number|!Long} numBits Number of bits
31050 * @returns {!Long} Rotated Long
31051 */
31052LongPrototype.rotateLeft = function rotateLeft(numBits) {
31053 var b;
31054 if (isLong(numBits)) numBits = numBits.toInt();
31055 if ((numBits &= 63) === 0) return this;
31056 if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
31057 if (numBits < 32) {
31058 b = (32 - numBits);
31059 return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned);
31060 }
31061 numBits -= 32;
31062 b = (32 - numBits);
31063 return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned);
31064}
31065/**
31066 * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
31067 * @function
31068 * @param {number|!Long} numBits Number of bits
31069 * @returns {!Long} Rotated Long
31070 */
31071LongPrototype.rotl = LongPrototype.rotateLeft;
31072
31073/**
31074 * Returns this Long with bits rotated to the right by the given amount.
31075 * @this {!Long}
31076 * @param {number|!Long} numBits Number of bits
31077 * @returns {!Long} Rotated Long
31078 */
31079LongPrototype.rotateRight = function rotateRight(numBits) {
31080 var b;
31081 if (isLong(numBits)) numBits = numBits.toInt();
31082 if ((numBits &= 63) === 0) return this;
31083 if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
31084 if (numBits < 32) {
31085 b = (32 - numBits);
31086 return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned);
31087 }
31088 numBits -= 32;
31089 b = (32 - numBits);
31090 return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned);
31091}
31092/**
31093 * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
31094 * @function
31095 * @param {number|!Long} numBits Number of bits
31096 * @returns {!Long} Rotated Long
31097 */
31098LongPrototype.rotr = LongPrototype.rotateRight;
31099
31100/**
31101 * Converts this Long to signed.
31102 * @this {!Long}
31103 * @returns {!Long} Signed long
31104 */
31105LongPrototype.toSigned = function toSigned() {
31106 if (!this.unsigned)
31107 return this;
31108 return fromBits(this.low, this.high, false);
31109};
31110
31111/**
31112 * Converts this Long to unsigned.
31113 * @this {!Long}
31114 * @returns {!Long} Unsigned long
31115 */
31116LongPrototype.toUnsigned = function toUnsigned() {
31117 if (this.unsigned)
31118 return this;
31119 return fromBits(this.low, this.high, true);
31120};
31121
31122/**
31123 * Converts this Long to its byte representation.
31124 * @param {boolean=} le Whether little or big endian, defaults to big endian
31125 * @this {!Long}
31126 * @returns {!Array.<number>} Byte representation
31127 */
31128LongPrototype.toBytes = function toBytes(le) {
31129 return le ? this.toBytesLE() : this.toBytesBE();
31130};
31131
31132/**
31133 * Converts this Long to its little endian byte representation.
31134 * @this {!Long}
31135 * @returns {!Array.<number>} Little endian byte representation
31136 */
31137LongPrototype.toBytesLE = function toBytesLE() {
31138 var hi = this.high,
31139 lo = this.low;
31140 return [
31141 lo & 0xff,
31142 lo >>> 8 & 0xff,
31143 lo >>> 16 & 0xff,
31144 lo >>> 24 ,
31145 hi & 0xff,
31146 hi >>> 8 & 0xff,
31147 hi >>> 16 & 0xff,
31148 hi >>> 24
31149 ];
31150};
31151
31152/**
31153 * Converts this Long to its big endian byte representation.
31154 * @this {!Long}
31155 * @returns {!Array.<number>} Big endian byte representation
31156 */
31157LongPrototype.toBytesBE = function toBytesBE() {
31158 var hi = this.high,
31159 lo = this.low;
31160 return [
31161 hi >>> 24 ,
31162 hi >>> 16 & 0xff,
31163 hi >>> 8 & 0xff,
31164 hi & 0xff,
31165 lo >>> 24 ,
31166 lo >>> 16 & 0xff,
31167 lo >>> 8 & 0xff,
31168 lo & 0xff
31169 ];
31170};
31171
31172/**
31173 * Creates a Long from its byte representation.
31174 * @param {!Array.<number>} bytes Byte representation
31175 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
31176 * @param {boolean=} le Whether little or big endian, defaults to big endian
31177 * @returns {Long} The corresponding Long value
31178 */
31179Long.fromBytes = function fromBytes(bytes, unsigned, le) {
31180 return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
31181};
31182
31183/**
31184 * Creates a Long from its little endian byte representation.
31185 * @param {!Array.<number>} bytes Little endian byte representation
31186 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
31187 * @returns {Long} The corresponding Long value
31188 */
31189Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
31190 return new Long(
31191 bytes[0] |
31192 bytes[1] << 8 |
31193 bytes[2] << 16 |
31194 bytes[3] << 24,
31195 bytes[4] |
31196 bytes[5] << 8 |
31197 bytes[6] << 16 |
31198 bytes[7] << 24,
31199 unsigned
31200 );
31201};
31202
31203/**
31204 * Creates a Long from its big endian byte representation.
31205 * @param {!Array.<number>} bytes Big endian byte representation
31206 * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
31207 * @returns {Long} The corresponding Long value
31208 */
31209Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
31210 return new Long(
31211 bytes[4] << 24 |
31212 bytes[5] << 16 |
31213 bytes[6] << 8 |
31214 bytes[7],
31215 bytes[0] << 24 |
31216 bytes[1] << 16 |
31217 bytes[2] << 8 |
31218 bytes[3],
31219 unsigned
31220 );
31221};
31222
31223
31224/***/ }),
31225
31226/***/ 82133:
31227/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
31228
31229"use strict";
31230
31231
31232var KEYWORDS = __webpack_require__(72670);
31233
31234module.exports = defineKeywords;
31235
31236
31237/**
31238 * Defines one or several keywords in ajv instance
31239 * @param {Ajv} ajv validator instance
31240 * @param {String|Array<String>|undefined} keyword keyword(s) to define
31241 * @return {Ajv} ajv instance (for chaining)
31242 */
31243function defineKeywords(ajv, keyword) {
31244 if (Array.isArray(keyword)) {
31245 for (var i=0; i<keyword.length; i++)
31246 get(keyword[i])(ajv);
31247 return ajv;
31248 }
31249 if (keyword) {
31250 get(keyword)(ajv);
31251 return ajv;
31252 }
31253 for (keyword in KEYWORDS) get(keyword)(ajv);
31254 return ajv;
31255}
31256
31257
31258defineKeywords.get = get;
31259
31260function get(keyword) {
31261 var defFunc = KEYWORDS[keyword];
31262 if (!defFunc) throw new Error('Unknown keyword ' + keyword);
31263 return defFunc;
31264}
31265
31266
31267/***/ }),
31268
31269/***/ 92784:
31270/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
31271
31272"use strict";
31273
31274
31275var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
31276var DATE_TIME_SEPARATOR = /t|\s/i;
31277
31278var COMPARE_FORMATS = {
31279 date: compareDate,
31280 time: compareTime,
31281 'date-time': compareDateTime
31282};
31283
31284var $dataMetaSchema = {
31285 type: 'object',
31286 required: [ '$data' ],
31287 properties: {
31288 $data: {
31289 type: 'string',
31290 anyOf: [
31291 { format: 'relative-json-pointer' },
31292 { format: 'json-pointer' }
31293 ]
31294 }
31295 },
31296 additionalProperties: false
31297};
31298
31299module.exports = function (minMax) {
31300 var keyword = 'format' + minMax;
31301 return function defFunc(ajv) {
31302 defFunc.definition = {
31303 type: 'string',
31304 inline: __webpack_require__(67194),
31305 statements: true,
31306 errors: 'full',
31307 dependencies: ['format'],
31308 metaSchema: {
31309 anyOf: [
31310 {type: 'string'},
31311 $dataMetaSchema
31312 ]
31313 }
31314 };
31315
31316 ajv.addKeyword(keyword, defFunc.definition);
31317 ajv.addKeyword('formatExclusive' + minMax, {
31318 dependencies: ['format' + minMax],
31319 metaSchema: {
31320 anyOf: [
31321 {type: 'boolean'},
31322 $dataMetaSchema
31323 ]
31324 }
31325 });
31326 extendFormats(ajv);
31327 return ajv;
31328 };
31329};
31330
31331
31332function extendFormats(ajv) {
31333 var formats = ajv._formats;
31334 for (var name in COMPARE_FORMATS) {
31335 var format = formats[name];
31336 // the last condition is needed if it's RegExp from another window
31337 if (typeof format != 'object' || format instanceof RegExp || !format.validate)
31338 format = formats[name] = { validate: format };
31339 if (!format.compare)
31340 format.compare = COMPARE_FORMATS[name];
31341 }
31342}
31343
31344
31345function compareDate(d1, d2) {
31346 if (!(d1 && d2)) return;
31347 if (d1 > d2) return 1;
31348 if (d1 < d2) return -1;
31349 if (d1 === d2) return 0;
31350}
31351
31352
31353function compareTime(t1, t2) {
31354 if (!(t1 && t2)) return;
31355 t1 = t1.match(TIME);
31356 t2 = t2.match(TIME);
31357 if (!(t1 && t2)) return;
31358 t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
31359 t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
31360 if (t1 > t2) return 1;
31361 if (t1 < t2) return -1;
31362 if (t1 === t2) return 0;
31363}
31364
31365
31366function compareDateTime(dt1, dt2) {
31367 if (!(dt1 && dt2)) return;
31368 dt1 = dt1.split(DATE_TIME_SEPARATOR);
31369 dt2 = dt2.split(DATE_TIME_SEPARATOR);
31370 var res = compareDate(dt1[0], dt2[0]);
31371 if (res === undefined) return;
31372 return res || compareTime(dt1[1], dt2[1]);
31373}
31374
31375
31376/***/ }),
31377
31378/***/ 33733:
31379/***/ (function(module) {
31380
31381"use strict";
31382
31383
31384module.exports = {
31385 metaSchemaRef: metaSchemaRef
31386};
31387
31388var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
31389
31390function metaSchemaRef(ajv) {
31391 var defaultMeta = ajv._opts.defaultMeta;
31392 if (typeof defaultMeta == 'string') return { $ref: defaultMeta };
31393 if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID };
31394 console.warn('meta schema not defined');
31395 return {};
31396}
31397
31398
31399/***/ }),
31400
31401/***/ 25541:
31402/***/ (function(module) {
31403
31404"use strict";
31405
31406
31407module.exports = function defFunc(ajv) {
31408 defFunc.definition = {
31409 type: 'object',
31410 macro: function (schema, parentSchema) {
31411 if (!schema) return true;
31412 var properties = Object.keys(parentSchema.properties);
31413 if (properties.length == 0) return true;
31414 return {required: properties};
31415 },
31416 metaSchema: {type: 'boolean'},
31417 dependencies: ['properties']
31418 };
31419
31420 ajv.addKeyword('allRequired', defFunc.definition);
31421 return ajv;
31422};
31423
31424
31425/***/ }),
31426
31427/***/ 97039:
31428/***/ (function(module) {
31429
31430"use strict";
31431
31432
31433module.exports = function defFunc(ajv) {
31434 defFunc.definition = {
31435 type: 'object',
31436 macro: function (schema) {
31437 if (schema.length == 0) return true;
31438 if (schema.length == 1) return {required: schema};
31439 var schemas = schema.map(function (prop) {
31440 return {required: [prop]};
31441 });
31442 return {anyOf: schemas};
31443 },
31444 metaSchema: {
31445 type: 'array',
31446 items: {
31447 type: 'string'
31448 }
31449 }
31450 };
31451
31452 ajv.addKeyword('anyRequired', defFunc.definition);
31453 return ajv;
31454};
31455
31456
31457/***/ }),
31458
31459/***/ 51673:
31460/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
31461
31462"use strict";
31463
31464
31465var util = __webpack_require__(33733);
31466
31467module.exports = function defFunc(ajv) {
31468 defFunc.definition = {
31469 type: 'object',
31470 macro: function (schema) {
31471 var schemas = [];
31472 for (var pointer in schema)
31473 schemas.push(getSchema(pointer, schema[pointer]));
31474 return {'allOf': schemas};
31475 },
31476 metaSchema: {
31477 type: 'object',
31478 propertyNames: {
31479 type: 'string',
31480 format: 'json-pointer'
31481 },
31482 additionalProperties: util.metaSchemaRef(ajv)
31483 }
31484 };
31485
31486 ajv.addKeyword('deepProperties', defFunc.definition);
31487 return ajv;
31488};
31489
31490
31491function getSchema(jsonPointer, schema) {
31492 var segments = jsonPointer.split('/');
31493 var rootSchema = {};
31494 var pointerSchema = rootSchema;
31495 for (var i=1; i<segments.length; i++) {
31496 var segment = segments[i];
31497 var isLast = i == segments.length - 1;
31498 segment = unescapeJsonPointer(segment);
31499 var properties = pointerSchema.properties = {};
31500 var items = undefined;
31501 if (/[0-9]+/.test(segment)) {
31502 var count = +segment;
31503 items = pointerSchema.items = [];
31504 while (count--) items.push({});
31505 }
31506 pointerSchema = isLast ? schema : {};
31507 properties[segment] = pointerSchema;
31508 if (items) items.push(pointerSchema);
31509 }
31510 return rootSchema;
31511}
31512
31513
31514function unescapeJsonPointer(str) {
31515 return str.replace(/~1/g, '/').replace(/~0/g, '~');
31516}
31517
31518
31519/***/ }),
31520
31521/***/ 12541:
31522/***/ (function(module) {
31523
31524"use strict";
31525
31526
31527module.exports = function defFunc(ajv) {
31528 defFunc.definition = {
31529 type: 'object',
31530 inline: function (it, keyword, schema) {
31531 var expr = '';
31532 for (var i=0; i<schema.length; i++) {
31533 if (i) expr += ' && ';
31534 expr += '(' + getData(schema[i], it.dataLevel) + ' !== undefined)';
31535 }
31536 return expr;
31537 },
31538 metaSchema: {
31539 type: 'array',
31540 items: {
31541 type: 'string',
31542 format: 'json-pointer'
31543 }
31544 }
31545 };
31546
31547 ajv.addKeyword('deepRequired', defFunc.definition);
31548 return ajv;
31549};
31550
31551
31552function getData(jsonPointer, lvl) {
31553 var data = 'data' + (lvl || '');
31554 if (!jsonPointer) return data;
31555
31556 var expr = data;
31557 var segments = jsonPointer.split('/');
31558 for (var i=1; i<segments.length; i++) {
31559 var segment = segments[i];
31560 data += getProperty(unescapeJsonPointer(segment));
31561 expr += ' && ' + data;
31562 }
31563 return expr;
31564}
31565
31566
31567var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
31568var INTEGER = /^[0-9]+$/;
31569var SINGLE_QUOTE = /'|\\/g;
31570function getProperty(key) {
31571 return INTEGER.test(key)
31572 ? '[' + key + ']'
31573 : IDENTIFIER.test(key)
31574 ? '.' + key
31575 : "['" + key.replace(SINGLE_QUOTE, '\\$&') + "']";
31576}
31577
31578
31579function unescapeJsonPointer(str) {
31580 return str.replace(/~1/g, '/').replace(/~0/g, '~');
31581}
31582
31583
31584/***/ }),
31585
31586/***/ 67194:
31587/***/ (function(module) {
31588
31589"use strict";
31590
31591module.exports = function generate__formatLimit(it, $keyword, $ruleType) {
31592 var out = ' ';
31593 var $lvl = it.level;
31594 var $dataLvl = it.dataLevel;
31595 var $schema = it.schema[$keyword];
31596 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
31597 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
31598 var $breakOnError = !it.opts.allErrors;
31599 var $errorKeyword;
31600 var $data = 'data' + ($dataLvl || '');
31601 var $valid = 'valid' + $lvl;
31602 out += 'var ' + ($valid) + ' = undefined;';
31603 if (it.opts.format === false) {
31604 out += ' ' + ($valid) + ' = true; ';
31605 return out;
31606 }
31607 var $schemaFormat = it.schema.format,
31608 $isDataFormat = it.opts.$data && $schemaFormat.$data,
31609 $closingBraces = '';
31610 if ($isDataFormat) {
31611 var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr),
31612 $format = 'format' + $lvl,
31613 $compare = 'compare' + $lvl;
31614 out += ' var ' + ($format) + ' = formats[' + ($schemaValueFormat) + '] , ' + ($compare) + ' = ' + ($format) + ' && ' + ($format) + '.compare;';
31615 } else {
31616 var $format = it.formats[$schemaFormat];
31617 if (!($format && $format.compare)) {
31618 out += ' ' + ($valid) + ' = true; ';
31619 return out;
31620 }
31621 var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare';
31622 }
31623 var $isMax = $keyword == 'formatMaximum',
31624 $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum'),
31625 $schemaExcl = it.schema[$exclusiveKeyword],
31626 $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
31627 $op = $isMax ? '<' : '>',
31628 $result = 'result' + $lvl;
31629 var $isData = it.opts.$data && $schema && $schema.$data,
31630 $schemaValue;
31631 if ($isData) {
31632 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
31633 $schemaValue = 'schema' + $lvl;
31634 } else {
31635 $schemaValue = $schema;
31636 }
31637 if ($isDataExcl) {
31638 var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
31639 $exclusive = 'exclusive' + $lvl,
31640 $opExpr = 'op' + $lvl,
31641 $opStr = '\' + ' + $opExpr + ' + \'';
31642 out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
31643 $schemaValueExcl = 'schemaExcl' + $lvl;
31644 out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; ';
31645 var $errorKeyword = $exclusiveKeyword;
31646 var $$outStack = $$outStack || [];
31647 $$outStack.push(out);
31648 out = ''; /* istanbul ignore else */
31649 if (it.createErrors !== false) {
31650 out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
31651 if (it.opts.messages !== false) {
31652 out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
31653 }
31654 if (it.opts.verbose) {
31655 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
31656 }
31657 out += ' } ';
31658 } else {
31659 out += ' {} ';
31660 }
31661 var __err = out;
31662 out = $$outStack.pop();
31663 if (!it.compositeRule && $breakOnError) {
31664 /* istanbul ignore if */
31665 if (it.async) {
31666 out += ' throw new ValidationError([' + (__err) + ']); ';
31667 } else {
31668 out += ' validate.errors = [' + (__err) + ']; return false; ';
31669 }
31670 } else {
31671 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
31672 }
31673 out += ' } ';
31674 if ($breakOnError) {
31675 $closingBraces += '}';
31676 out += ' else { ';
31677 }
31678 if ($isData) {
31679 out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
31680 $closingBraces += '}';
31681 }
31682 if ($isDataFormat) {
31683 out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
31684 $closingBraces += '}';
31685 }
31686 out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
31687 if ($isData) {
31688 out += '' + ($schemaValue);
31689 } else {
31690 out += '' + (it.util.toQuotedString($schema));
31691 }
31692 out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
31693 } else {
31694 var $exclusive = $schemaExcl === true,
31695 $opStr = $op;
31696 if (!$exclusive) $opStr += '=';
31697 var $opExpr = '\'' + $opStr + '\'';
31698 if ($isData) {
31699 out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
31700 $closingBraces += '}';
31701 }
31702 if ($isDataFormat) {
31703 out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
31704 $closingBraces += '}';
31705 }
31706 out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
31707 if ($isData) {
31708 out += '' + ($schemaValue);
31709 } else {
31710 out += '' + (it.util.toQuotedString($schema));
31711 }
31712 out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op);
31713 if (!$exclusive) {
31714 out += '=';
31715 }
31716 out += ' 0;';
31717 }
31718 out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
31719 var $errorKeyword = $keyword;
31720 var $$outStack = $$outStack || [];
31721 $$outStack.push(out);
31722 out = ''; /* istanbul ignore else */
31723 if (it.createErrors !== false) {
31724 out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ';
31725 if ($isData) {
31726 out += '' + ($schemaValue);
31727 } else {
31728 out += '' + (it.util.toQuotedString($schema));
31729 }
31730 out += ' , exclusive: ' + ($exclusive) + ' } ';
31731 if (it.opts.messages !== false) {
31732 out += ' , message: \'should be ' + ($opStr) + ' "';
31733 if ($isData) {
31734 out += '\' + ' + ($schemaValue) + ' + \'';
31735 } else {
31736 out += '' + (it.util.escapeQuotes($schema));
31737 }
31738 out += '"\' ';
31739 }
31740 if (it.opts.verbose) {
31741 out += ' , schema: ';
31742 if ($isData) {
31743 out += 'validate.schema' + ($schemaPath);
31744 } else {
31745 out += '' + (it.util.toQuotedString($schema));
31746 }
31747 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
31748 }
31749 out += ' } ';
31750 } else {
31751 out += ' {} ';
31752 }
31753 var __err = out;
31754 out = $$outStack.pop();
31755 if (!it.compositeRule && $breakOnError) {
31756 /* istanbul ignore if */
31757 if (it.async) {
31758 out += ' throw new ValidationError([' + (__err) + ']); ';
31759 } else {
31760 out += ' validate.errors = [' + (__err) + ']; return false; ';
31761 }
31762 } else {
31763 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
31764 }
31765 out += '}';
31766 return out;
31767}
31768
31769
31770/***/ }),
31771
31772/***/ 83724:
31773/***/ (function(module) {
31774
31775"use strict";
31776
31777module.exports = function generate_patternRequired(it, $keyword, $ruleType) {
31778 var out = ' ';
31779 var $lvl = it.level;
31780 var $dataLvl = it.dataLevel;
31781 var $schema = it.schema[$keyword];
31782 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
31783 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
31784 var $breakOnError = !it.opts.allErrors;
31785 var $data = 'data' + ($dataLvl || '');
31786 var $valid = 'valid' + $lvl;
31787 var $key = 'key' + $lvl,
31788 $idx = 'idx' + $lvl,
31789 $matched = 'patternMatched' + $lvl,
31790 $dataProperties = 'dataProperties' + $lvl,
31791 $closingBraces = '',
31792 $ownProperties = it.opts.ownProperties;
31793 out += 'var ' + ($valid) + ' = true;';
31794 if ($ownProperties) {
31795 out += ' var ' + ($dataProperties) + ' = undefined;';
31796 }
31797 var arr1 = $schema;
31798 if (arr1) {
31799 var $pProperty, i1 = -1,
31800 l1 = arr1.length - 1;
31801 while (i1 < l1) {
31802 $pProperty = arr1[i1 += 1];
31803 out += ' var ' + ($matched) + ' = false; ';
31804 if ($ownProperties) {
31805 out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
31806 } else {
31807 out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
31808 }
31809 out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } ';
31810 var $missingPattern = it.util.escapeQuotes($pProperty);
31811 out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */
31812 if (it.createErrors !== false) {
31813 out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } ';
31814 if (it.opts.messages !== false) {
31815 out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' ';
31816 }
31817 if (it.opts.verbose) {
31818 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
31819 }
31820 out += ' } ';
31821 } else {
31822 out += ' {} ';
31823 }
31824 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
31825 if ($breakOnError) {
31826 $closingBraces += '}';
31827 out += ' else { ';
31828 }
31829 }
31830 }
31831 out += '' + ($closingBraces);
31832 return out;
31833}
31834
31835
31836/***/ }),
31837
31838/***/ 20608:
31839/***/ (function(module) {
31840
31841"use strict";
31842
31843module.exports = function generate_switch(it, $keyword, $ruleType) {
31844 var out = ' ';
31845 var $lvl = it.level;
31846 var $dataLvl = it.dataLevel;
31847 var $schema = it.schema[$keyword];
31848 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
31849 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
31850 var $breakOnError = !it.opts.allErrors;
31851 var $data = 'data' + ($dataLvl || '');
31852 var $valid = 'valid' + $lvl;
31853 var $errs = 'errs__' + $lvl;
31854 var $it = it.util.copy(it);
31855 var $closingBraces = '';
31856 $it.level++;
31857 var $nextValid = 'valid' + $it.level;
31858 var $ifPassed = 'ifPassed' + it.level,
31859 $currentBaseId = $it.baseId,
31860 $shouldContinue;
31861 out += 'var ' + ($ifPassed) + ';';
31862 var arr1 = $schema;
31863 if (arr1) {
31864 var $sch, $caseIndex = -1,
31865 l1 = arr1.length - 1;
31866 while ($caseIndex < l1) {
31867 $sch = arr1[$caseIndex += 1];
31868 if ($caseIndex && !$shouldContinue) {
31869 out += ' if (!' + ($ifPassed) + ') { ';
31870 $closingBraces += '}';
31871 }
31872 if ($sch.if && (it.opts.strictKeywords ? typeof $sch.if == 'object' && Object.keys($sch.if).length > 0 : it.util.schemaHasRules($sch.if, it.RULES.all))) {
31873 out += ' var ' + ($errs) + ' = errors; ';
31874 var $wasComposite = it.compositeRule;
31875 it.compositeRule = $it.compositeRule = true;
31876 $it.createErrors = false;
31877 $it.schema = $sch.if;
31878 $it.schemaPath = $schemaPath + '[' + $caseIndex + '].if';
31879 $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if';
31880 out += ' ' + (it.validate($it)) + ' ';
31881 $it.baseId = $currentBaseId;
31882 $it.createErrors = true;
31883 it.compositeRule = $it.compositeRule = $wasComposite;
31884 out += ' ' + ($ifPassed) + ' = ' + ($nextValid) + '; if (' + ($ifPassed) + ') { ';
31885 if (typeof $sch.then == 'boolean') {
31886 if ($sch.then === false) {
31887 var $$outStack = $$outStack || [];
31888 $$outStack.push(out);
31889 out = ''; /* istanbul ignore else */
31890 if (it.createErrors !== false) {
31891 out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
31892 if (it.opts.messages !== false) {
31893 out += ' , message: \'should pass "switch" keyword validation\' ';
31894 }
31895 if (it.opts.verbose) {
31896 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
31897 }
31898 out += ' } ';
31899 } else {
31900 out += ' {} ';
31901 }
31902 var __err = out;
31903 out = $$outStack.pop();
31904 if (!it.compositeRule && $breakOnError) {
31905 /* istanbul ignore if */
31906 if (it.async) {
31907 out += ' throw new ValidationError([' + (__err) + ']); ';
31908 } else {
31909 out += ' validate.errors = [' + (__err) + ']; return false; ';
31910 }
31911 } else {
31912 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
31913 }
31914 }
31915 out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
31916 } else {
31917 $it.schema = $sch.then;
31918 $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
31919 $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
31920 out += ' ' + (it.validate($it)) + ' ';
31921 $it.baseId = $currentBaseId;
31922 }
31923 out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } ';
31924 } else {
31925 out += ' ' + ($ifPassed) + ' = true; ';
31926 if (typeof $sch.then == 'boolean') {
31927 if ($sch.then === false) {
31928 var $$outStack = $$outStack || [];
31929 $$outStack.push(out);
31930 out = ''; /* istanbul ignore else */
31931 if (it.createErrors !== false) {
31932 out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
31933 if (it.opts.messages !== false) {
31934 out += ' , message: \'should pass "switch" keyword validation\' ';
31935 }
31936 if (it.opts.verbose) {
31937 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
31938 }
31939 out += ' } ';
31940 } else {
31941 out += ' {} ';
31942 }
31943 var __err = out;
31944 out = $$outStack.pop();
31945 if (!it.compositeRule && $breakOnError) {
31946 /* istanbul ignore if */
31947 if (it.async) {
31948 out += ' throw new ValidationError([' + (__err) + ']); ';
31949 } else {
31950 out += ' validate.errors = [' + (__err) + ']; return false; ';
31951 }
31952 } else {
31953 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
31954 }
31955 }
31956 out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
31957 } else {
31958 $it.schema = $sch.then;
31959 $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
31960 $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
31961 out += ' ' + (it.validate($it)) + ' ';
31962 $it.baseId = $currentBaseId;
31963 }
31964 }
31965 $shouldContinue = $sch.continue
31966 }
31967 }
31968 out += '' + ($closingBraces) + 'var ' + ($valid) + ' = ' + ($nextValid) + ';';
31969 return out;
31970}
31971
31972
31973/***/ }),
31974
31975/***/ 32107:
31976/***/ (function(module) {
31977
31978"use strict";
31979
31980
31981var sequences = {};
31982
31983var DEFAULTS = {
31984 timestamp: function() { return Date.now(); },
31985 datetime: function() { return (new Date).toISOString(); },
31986 date: function() { return (new Date).toISOString().slice(0, 10); },
31987 time: function() { return (new Date).toISOString().slice(11); },
31988 random: function() { return Math.random(); },
31989 randomint: function (args) {
31990 var limit = args && args.max || 2;
31991 return function() { return Math.floor(Math.random() * limit); };
31992 },
31993 seq: function (args) {
31994 var name = args && args.name || '';
31995 sequences[name] = sequences[name] || 0;
31996 return function() { return sequences[name]++; };
31997 }
31998};
31999
32000module.exports = function defFunc(ajv) {
32001 defFunc.definition = {
32002 compile: function (schema, parentSchema, it) {
32003 var funcs = {};
32004
32005 for (var key in schema) {
32006 var d = schema[key];
32007 var func = getDefault(typeof d == 'string' ? d : d.func);
32008 funcs[key] = func.length ? func(d.args) : func;
32009 }
32010
32011 return it.opts.useDefaults && !it.compositeRule
32012 ? assignDefaults
32013 : noop;
32014
32015 function assignDefaults(data) {
32016 for (var prop in schema){
32017 if (data[prop] === undefined
32018 || (it.opts.useDefaults == 'empty'
32019 && (data[prop] === null || data[prop] === '')))
32020 data[prop] = funcs[prop]();
32021 }
32022 return true;
32023 }
32024
32025 function noop() { return true; }
32026 },
32027 DEFAULTS: DEFAULTS,
32028 metaSchema: {
32029 type: 'object',
32030 additionalProperties: {
32031 type: ['string', 'object'],
32032 additionalProperties: false,
32033 required: ['func', 'args'],
32034 properties: {
32035 func: { type: 'string' },
32036 args: { type: 'object' }
32037 }
32038 }
32039 }
32040 };
32041
32042 ajv.addKeyword('dynamicDefaults', defFunc.definition);
32043 return ajv;
32044
32045 function getDefault(d) {
32046 var def = DEFAULTS[d];
32047 if (def) return def;
32048 throw new Error('invalid "dynamicDefaults" keyword property value: ' + d);
32049 }
32050};
32051
32052
32053/***/ }),
32054
32055/***/ 46153:
32056/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32057
32058"use strict";
32059
32060
32061module.exports = __webpack_require__(92784)('Maximum');
32062
32063
32064/***/ }),
32065
32066/***/ 54409:
32067/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32068
32069"use strict";
32070
32071
32072module.exports = __webpack_require__(92784)('Minimum');
32073
32074
32075/***/ }),
32076
32077/***/ 72670:
32078/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32079
32080"use strict";
32081
32082
32083module.exports = {
32084 'instanceof': __webpack_require__(62479),
32085 range: __webpack_require__(79159),
32086 regexp: __webpack_require__(23284),
32087 'typeof': __webpack_require__(22608),
32088 dynamicDefaults: __webpack_require__(32107),
32089 allRequired: __webpack_require__(25541),
32090 anyRequired: __webpack_require__(97039),
32091 oneRequired: __webpack_require__(12135),
32092 prohibited: __webpack_require__(63115),
32093 uniqueItemProperties: __webpack_require__(43786),
32094 deepProperties: __webpack_require__(51673),
32095 deepRequired: __webpack_require__(12541),
32096 formatMinimum: __webpack_require__(54409),
32097 formatMaximum: __webpack_require__(46153),
32098 patternRequired: __webpack_require__(5844),
32099 'switch': __webpack_require__(682),
32100 select: __webpack_require__(22308),
32101 transform: __webpack_require__(40159)
32102};
32103
32104
32105/***/ }),
32106
32107/***/ 62479:
32108/***/ (function(module) {
32109
32110"use strict";
32111
32112
32113var CONSTRUCTORS = {
32114 Object: Object,
32115 Array: Array,
32116 Function: Function,
32117 Number: Number,
32118 String: String,
32119 Date: Date,
32120 RegExp: RegExp
32121};
32122
32123module.exports = function defFunc(ajv) {
32124 /* istanbul ignore else */
32125 if (typeof Buffer != 'undefined')
32126 CONSTRUCTORS.Buffer = Buffer;
32127
32128 /* istanbul ignore else */
32129 if (typeof Promise != 'undefined')
32130 CONSTRUCTORS.Promise = Promise;
32131
32132 defFunc.definition = {
32133 compile: function (schema) {
32134 if (typeof schema == 'string') {
32135 var Constructor = getConstructor(schema);
32136 return function (data) {
32137 return data instanceof Constructor;
32138 };
32139 }
32140
32141 var constructors = schema.map(getConstructor);
32142 return function (data) {
32143 for (var i=0; i<constructors.length; i++)
32144 if (data instanceof constructors[i]) return true;
32145 return false;
32146 };
32147 },
32148 CONSTRUCTORS: CONSTRUCTORS,
32149 metaSchema: {
32150 anyOf: [
32151 { type: 'string' },
32152 {
32153 type: 'array',
32154 items: { type: 'string' }
32155 }
32156 ]
32157 }
32158 };
32159
32160 ajv.addKeyword('instanceof', defFunc.definition);
32161 return ajv;
32162
32163 function getConstructor(c) {
32164 var Constructor = CONSTRUCTORS[c];
32165 if (Constructor) return Constructor;
32166 throw new Error('invalid "instanceof" keyword value ' + c);
32167 }
32168};
32169
32170
32171/***/ }),
32172
32173/***/ 12135:
32174/***/ (function(module) {
32175
32176"use strict";
32177
32178
32179module.exports = function defFunc(ajv) {
32180 defFunc.definition = {
32181 type: 'object',
32182 macro: function (schema) {
32183 if (schema.length == 0) return true;
32184 if (schema.length == 1) return {required: schema};
32185 var schemas = schema.map(function (prop) {
32186 return {required: [prop]};
32187 });
32188 return {oneOf: schemas};
32189 },
32190 metaSchema: {
32191 type: 'array',
32192 items: {
32193 type: 'string'
32194 }
32195 }
32196 };
32197
32198 ajv.addKeyword('oneRequired', defFunc.definition);
32199 return ajv;
32200};
32201
32202
32203/***/ }),
32204
32205/***/ 5844:
32206/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32207
32208"use strict";
32209
32210
32211module.exports = function defFunc(ajv) {
32212 defFunc.definition = {
32213 type: 'object',
32214 inline: __webpack_require__(83724),
32215 statements: true,
32216 errors: 'full',
32217 metaSchema: {
32218 type: 'array',
32219 items: {
32220 type: 'string',
32221 format: 'regex'
32222 },
32223 uniqueItems: true
32224 }
32225 };
32226
32227 ajv.addKeyword('patternRequired', defFunc.definition);
32228 return ajv;
32229};
32230
32231
32232/***/ }),
32233
32234/***/ 63115:
32235/***/ (function(module) {
32236
32237"use strict";
32238
32239
32240module.exports = function defFunc(ajv) {
32241 defFunc.definition = {
32242 type: 'object',
32243 macro: function (schema) {
32244 if (schema.length == 0) return true;
32245 if (schema.length == 1) return {not: {required: schema}};
32246 var schemas = schema.map(function (prop) {
32247 return {required: [prop]};
32248 });
32249 return {not: {anyOf: schemas}};
32250 },
32251 metaSchema: {
32252 type: 'array',
32253 items: {
32254 type: 'string'
32255 }
32256 }
32257 };
32258
32259 ajv.addKeyword('prohibited', defFunc.definition);
32260 return ajv;
32261};
32262
32263
32264/***/ }),
32265
32266/***/ 79159:
32267/***/ (function(module) {
32268
32269"use strict";
32270
32271
32272module.exports = function defFunc(ajv) {
32273 defFunc.definition = {
32274 type: 'number',
32275 macro: function (schema, parentSchema) {
32276 var min = schema[0]
32277 , max = schema[1]
32278 , exclusive = parentSchema.exclusiveRange;
32279
32280 validateRangeSchema(min, max, exclusive);
32281
32282 return exclusive === true
32283 ? {exclusiveMinimum: min, exclusiveMaximum: max}
32284 : {minimum: min, maximum: max};
32285 },
32286 metaSchema: {
32287 type: 'array',
32288 minItems: 2,
32289 maxItems: 2,
32290 items: { type: 'number' }
32291 }
32292 };
32293
32294 ajv.addKeyword('range', defFunc.definition);
32295 ajv.addKeyword('exclusiveRange');
32296 return ajv;
32297
32298 function validateRangeSchema(min, max, exclusive) {
32299 if (exclusive !== undefined && typeof exclusive != 'boolean')
32300 throw new Error('Invalid schema for exclusiveRange keyword, should be boolean');
32301
32302 if (min > max || (exclusive && min == max))
32303 throw new Error('There are no numbers in range');
32304 }
32305};
32306
32307
32308/***/ }),
32309
32310/***/ 23284:
32311/***/ (function(module) {
32312
32313"use strict";
32314
32315
32316module.exports = function defFunc(ajv) {
32317 defFunc.definition = {
32318 type: 'string',
32319 inline: function (it, keyword, schema) {
32320 return getRegExp() + '.test(data' + (it.dataLevel || '') + ')';
32321
32322 function getRegExp() {
32323 try {
32324 if (typeof schema == 'object')
32325 return new RegExp(schema.pattern, schema.flags);
32326
32327 var rx = schema.match(/^\/(.*)\/([gimuy]*)$/);
32328 if (rx) return new RegExp(rx[1], rx[2]);
32329 throw new Error('cannot parse string into RegExp');
32330 } catch(e) {
32331 console.error('regular expression', schema, 'is invalid');
32332 throw e;
32333 }
32334 }
32335 },
32336 metaSchema: {
32337 type: ['string', 'object'],
32338 properties: {
32339 pattern: { type: 'string' },
32340 flags: { type: 'string' }
32341 },
32342 required: ['pattern'],
32343 additionalProperties: false
32344 }
32345 };
32346
32347 ajv.addKeyword('regexp', defFunc.definition);
32348 return ajv;
32349};
32350
32351
32352/***/ }),
32353
32354/***/ 22308:
32355/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32356
32357"use strict";
32358
32359
32360var util = __webpack_require__(33733);
32361
32362module.exports = function defFunc(ajv) {
32363 if (!ajv._opts.$data) {
32364 console.warn('keyword select requires $data option');
32365 return ajv;
32366 }
32367 var metaSchemaRef = util.metaSchemaRef(ajv);
32368 var compiledCaseSchemas = [];
32369
32370 defFunc.definition = {
32371 validate: function v(schema, data, parentSchema) {
32372 if (parentSchema.selectCases === undefined)
32373 throw new Error('keyword "selectCases" is absent');
32374 var compiled = getCompiledSchemas(parentSchema, false);
32375 var validate = compiled.cases[schema];
32376 if (validate === undefined) validate = compiled.default;
32377 if (typeof validate == 'boolean') return validate;
32378 var valid = validate(data);
32379 if (!valid) v.errors = validate.errors;
32380 return valid;
32381 },
32382 $data: true,
32383 metaSchema: { type: ['string', 'number', 'boolean', 'null'] }
32384 };
32385
32386 ajv.addKeyword('select', defFunc.definition);
32387 ajv.addKeyword('selectCases', {
32388 compile: function (schemas, parentSchema) {
32389 var compiled = getCompiledSchemas(parentSchema);
32390 for (var value in schemas)
32391 compiled.cases[value] = compileOrBoolean(schemas[value]);
32392 return function() { return true; };
32393 },
32394 valid: true,
32395 metaSchema: {
32396 type: 'object',
32397 additionalProperties: metaSchemaRef
32398 }
32399 });
32400 ajv.addKeyword('selectDefault', {
32401 compile: function (schema, parentSchema) {
32402 var compiled = getCompiledSchemas(parentSchema);
32403 compiled.default = compileOrBoolean(schema);
32404 return function() { return true; };
32405 },
32406 valid: true,
32407 metaSchema: metaSchemaRef
32408 });
32409 return ajv;
32410
32411
32412 function getCompiledSchemas(parentSchema, create) {
32413 var compiled;
32414 compiledCaseSchemas.some(function (c) {
32415 if (c.parentSchema === parentSchema) {
32416 compiled = c;
32417 return true;
32418 }
32419 });
32420 if (!compiled && create !== false) {
32421 compiled = {
32422 parentSchema: parentSchema,
32423 cases: {},
32424 default: true
32425 };
32426 compiledCaseSchemas.push(compiled);
32427 }
32428 return compiled;
32429 }
32430
32431 function compileOrBoolean(schema) {
32432 return typeof schema == 'boolean'
32433 ? schema
32434 : ajv.compile(schema);
32435 }
32436};
32437
32438
32439/***/ }),
32440
32441/***/ 682:
32442/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32443
32444"use strict";
32445
32446
32447var util = __webpack_require__(33733);
32448
32449module.exports = function defFunc(ajv) {
32450 if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
32451
32452 var metaSchemaRef = util.metaSchemaRef(ajv);
32453
32454 defFunc.definition = {
32455 inline: __webpack_require__(20608),
32456 statements: true,
32457 errors: 'full',
32458 metaSchema: {
32459 type: 'array',
32460 items: {
32461 required: [ 'then' ],
32462 properties: {
32463 'if': metaSchemaRef,
32464 'then': {
32465 anyOf: [
32466 { type: 'boolean' },
32467 metaSchemaRef
32468 ]
32469 },
32470 'continue': { type: 'boolean' }
32471 },
32472 additionalProperties: false,
32473 dependencies: {
32474 'continue': [ 'if' ]
32475 }
32476 }
32477 }
32478 };
32479
32480 ajv.addKeyword('switch', defFunc.definition);
32481 return ajv;
32482};
32483
32484
32485/***/ }),
32486
32487/***/ 40159:
32488/***/ (function(module) {
32489
32490"use strict";
32491
32492
32493module.exports = function defFunc (ajv) {
32494 var transform = {
32495 trimLeft: function (value) {
32496 return value.replace(/^[\s]+/, '');
32497 },
32498 trimRight: function (value) {
32499 return value.replace(/[\s]+$/, '');
32500 },
32501 trim: function (value) {
32502 return value.trim();
32503 },
32504 toLowerCase: function (value) {
32505 return value.toLowerCase();
32506 },
32507 toUpperCase: function (value) {
32508 return value.toUpperCase();
32509 },
32510 toEnumCase: function (value, cfg) {
32511 return cfg.hash[makeHashTableKey(value)] || value;
32512 }
32513 };
32514
32515 defFunc.definition = {
32516 type: 'string',
32517 errors: false,
32518 modifying: true,
32519 valid: true,
32520 compile: function (schema, parentSchema) {
32521 var cfg;
32522
32523 if (schema.indexOf('toEnumCase') !== -1) {
32524 // build hash table to enum values
32525 cfg = {hash: {}};
32526
32527 // requires `enum` in schema
32528 if (!parentSchema.enum)
32529 throw new Error('Missing enum. To use `transform:["toEnumCase"]`, `enum:[...]` is required.');
32530 for (var i = parentSchema.enum.length; i--; i) {
32531 var v = parentSchema.enum[i];
32532 if (typeof v !== 'string') continue;
32533 var k = makeHashTableKey(v);
32534 // requires all `enum` values have unique keys
32535 if (cfg.hash[k])
32536 throw new Error('Invalid enum uniqueness. To use `transform:["toEnumCase"]`, all values must be unique when case insensitive.');
32537 cfg.hash[k] = v;
32538 }
32539 }
32540
32541 return function (data, dataPath, object, key) {
32542 // skip if value only
32543 if (!object) return;
32544
32545 // apply transform in order provided
32546 for (var j = 0, l = schema.length; j < l; j++)
32547 data = transform[schema[j]](data, cfg);
32548
32549 object[key] = data;
32550 };
32551 },
32552 metaSchema: {
32553 type: 'array',
32554 items: {
32555 type: 'string',
32556 enum: [
32557 'trimLeft', 'trimRight', 'trim',
32558 'toLowerCase', 'toUpperCase', 'toEnumCase'
32559 ]
32560 }
32561 }
32562 };
32563
32564 ajv.addKeyword('transform', defFunc.definition);
32565 return ajv;
32566
32567 function makeHashTableKey (value) {
32568 return value.toLowerCase();
32569 }
32570};
32571
32572
32573/***/ }),
32574
32575/***/ 22608:
32576/***/ (function(module) {
32577
32578"use strict";
32579
32580
32581var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol'];
32582
32583module.exports = function defFunc(ajv) {
32584 defFunc.definition = {
32585 inline: function (it, keyword, schema) {
32586 var data = 'data' + (it.dataLevel || '');
32587 if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"';
32588 schema = 'validate.schema' + it.schemaPath + '.' + keyword;
32589 return schema + '.indexOf(typeof ' + data + ') >= 0';
32590 },
32591 metaSchema: {
32592 anyOf: [
32593 {
32594 type: 'string',
32595 enum: KNOWN_TYPES
32596 },
32597 {
32598 type: 'array',
32599 items: {
32600 type: 'string',
32601 enum: KNOWN_TYPES
32602 }
32603 }
32604 ]
32605 }
32606 };
32607
32608 ajv.addKeyword('typeof', defFunc.definition);
32609 return ajv;
32610};
32611
32612
32613/***/ }),
32614
32615/***/ 43786:
32616/***/ (function(module) {
32617
32618"use strict";
32619
32620
32621var SCALAR_TYPES = ['number', 'integer', 'string', 'boolean', 'null'];
32622
32623module.exports = function defFunc(ajv) {
32624 defFunc.definition = {
32625 type: 'array',
32626 compile: function(keys, parentSchema, it) {
32627 var equal = it.util.equal;
32628 var scalar = getScalarKeys(keys, parentSchema);
32629
32630 return function(data) {
32631 if (data.length > 1) {
32632 for (var k=0; k < keys.length; k++) {
32633 var i, key = keys[k];
32634 if (scalar[k]) {
32635 var hash = {};
32636 for (i = data.length; i--;) {
32637 if (!data[i] || typeof data[i] != 'object') continue;
32638 var prop = data[i][key];
32639 if (prop && typeof prop == 'object') continue;
32640 if (typeof prop == 'string') prop = '"' + prop;
32641 if (hash[prop]) return false;
32642 hash[prop] = true;
32643 }
32644 } else {
32645 for (i = data.length; i--;) {
32646 if (!data[i] || typeof data[i] != 'object') continue;
32647 for (var j = i; j--;) {
32648 if (data[j] && typeof data[j] == 'object' && equal(data[i][key], data[j][key]))
32649 return false;
32650 }
32651 }
32652 }
32653 }
32654 }
32655 return true;
32656 };
32657 },
32658 metaSchema: {
32659 type: 'array',
32660 items: {type: 'string'}
32661 }
32662 };
32663
32664 ajv.addKeyword('uniqueItemProperties', defFunc.definition);
32665 return ajv;
32666};
32667
32668
32669function getScalarKeys(keys, schema) {
32670 return keys.map(function(key) {
32671 var properties = schema.items && schema.items.properties;
32672 var propType = properties && properties[key] && properties[key].type;
32673 return Array.isArray(propType)
32674 ? propType.indexOf('object') < 0 && propType.indexOf('array') < 0
32675 : SCALAR_TYPES.indexOf(propType) >= 0;
32676 });
32677}
32678
32679
32680/***/ }),
32681
32682/***/ 21414:
32683/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
32684
32685"use strict";
32686
32687
32688var compileSchema = __webpack_require__(51645)
32689 , resolve = __webpack_require__(62630)
32690 , Cache = __webpack_require__(67246)
32691 , SchemaObject = __webpack_require__(27837)
32692 , stableStringify = __webpack_require__(73600)
32693 , formats = __webpack_require__(49290)
32694 , rules = __webpack_require__(91665)
32695 , $dataMetaSchema = __webpack_require__(56989)
32696 , util = __webpack_require__(16057);
32697
32698module.exports = Ajv;
32699
32700Ajv.prototype.validate = validate;
32701Ajv.prototype.compile = compile;
32702Ajv.prototype.addSchema = addSchema;
32703Ajv.prototype.addMetaSchema = addMetaSchema;
32704Ajv.prototype.validateSchema = validateSchema;
32705Ajv.prototype.getSchema = getSchema;
32706Ajv.prototype.removeSchema = removeSchema;
32707Ajv.prototype.addFormat = addFormat;
32708Ajv.prototype.errorsText = errorsText;
32709
32710Ajv.prototype._addSchema = _addSchema;
32711Ajv.prototype._compile = _compile;
32712
32713Ajv.prototype.compileAsync = __webpack_require__(40075);
32714var customKeyword = __webpack_require__(58093);
32715Ajv.prototype.addKeyword = customKeyword.add;
32716Ajv.prototype.getKeyword = customKeyword.get;
32717Ajv.prototype.removeKeyword = customKeyword.remove;
32718Ajv.prototype.validateKeyword = customKeyword.validate;
32719
32720var errorClasses = __webpack_require__(42718);
32721Ajv.ValidationError = errorClasses.Validation;
32722Ajv.MissingRefError = errorClasses.MissingRef;
32723Ajv.$dataMetaSchema = $dataMetaSchema;
32724
32725var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
32726
32727var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
32728var META_SUPPORT_DATA = ['/properties'];
32729
32730/**
32731 * Creates validator instance.
32732 * Usage: `Ajv(opts)`
32733 * @param {Object} opts optional options
32734 * @return {Object} ajv instance
32735 */
32736function Ajv(opts) {
32737 if (!(this instanceof Ajv)) return new Ajv(opts);
32738 opts = this._opts = util.copy(opts) || {};
32739 setLogger(this);
32740 this._schemas = {};
32741 this._refs = {};
32742 this._fragments = {};
32743 this._formats = formats(opts.format);
32744
32745 this._cache = opts.cache || new Cache;
32746 this._loadingSchemas = {};
32747 this._compilations = [];
32748 this.RULES = rules();
32749 this._getId = chooseGetId(opts);
32750
32751 opts.loopRequired = opts.loopRequired || Infinity;
32752 if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
32753 if (opts.serialize === undefined) opts.serialize = stableStringify;
32754 this._metaOpts = getMetaSchemaOptions(this);
32755
32756 if (opts.formats) addInitialFormats(this);
32757 if (opts.keywords) addInitialKeywords(this);
32758 addDefaultMetaSchema(this);
32759 if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
32760 if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
32761 addInitialSchemas(this);
32762}
32763
32764
32765
32766/**
32767 * Validate data using schema
32768 * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
32769 * @this Ajv
32770 * @param {String|Object} schemaKeyRef key, ref or schema object
32771 * @param {Any} data to be validated
32772 * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
32773 */
32774function validate(schemaKeyRef, data) {
32775 var v;
32776 if (typeof schemaKeyRef == 'string') {
32777 v = this.getSchema(schemaKeyRef);
32778 if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
32779 } else {
32780 var schemaObj = this._addSchema(schemaKeyRef);
32781 v = schemaObj.validate || this._compile(schemaObj);
32782 }
32783
32784 var valid = v(data);
32785 if (v.$async !== true) this.errors = v.errors;
32786 return valid;
32787}
32788
32789
32790/**
32791 * Create validating function for passed schema.
32792 * @this Ajv
32793 * @param {Object} schema schema object
32794 * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
32795 * @return {Function} validating function
32796 */
32797function compile(schema, _meta) {
32798 var schemaObj = this._addSchema(schema, undefined, _meta);
32799 return schemaObj.validate || this._compile(schemaObj);
32800}
32801
32802
32803/**
32804 * Adds schema to the instance.
32805 * @this Ajv
32806 * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
32807 * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
32808 * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
32809 * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
32810 * @return {Ajv} this for method chaining
32811 */
32812function addSchema(schema, key, _skipValidation, _meta) {
32813 if (Array.isArray(schema)){
32814 for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
32815 return this;
32816 }
32817 var id = this._getId(schema);
32818 if (id !== undefined && typeof id != 'string')
32819 throw new Error('schema id must be string');
32820 key = resolve.normalizeId(key || id);
32821 checkUnique(this, key);
32822 this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
32823 return this;
32824}
32825
32826
32827/**
32828 * Add schema that will be used to validate other schemas
32829 * options in META_IGNORE_OPTIONS are alway set to false
32830 * @this Ajv
32831 * @param {Object} schema schema object
32832 * @param {String} key optional schema key
32833 * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
32834 * @return {Ajv} this for method chaining
32835 */
32836function addMetaSchema(schema, key, skipValidation) {
32837 this.addSchema(schema, key, skipValidation, true);
32838 return this;
32839}
32840
32841
32842/**
32843 * Validate schema
32844 * @this Ajv
32845 * @param {Object} schema schema to validate
32846 * @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
32847 * @return {Boolean} true if schema is valid
32848 */
32849function validateSchema(schema, throwOrLogError) {
32850 var $schema = schema.$schema;
32851 if ($schema !== undefined && typeof $schema != 'string')
32852 throw new Error('$schema must be a string');
32853 $schema = $schema || this._opts.defaultMeta || defaultMeta(this);
32854 if (!$schema) {
32855 this.logger.warn('meta-schema not available');
32856 this.errors = null;
32857 return true;
32858 }
32859 var valid = this.validate($schema, schema);
32860 if (!valid && throwOrLogError) {
32861 var message = 'schema is invalid: ' + this.errorsText();
32862 if (this._opts.validateSchema == 'log') this.logger.error(message);
32863 else throw new Error(message);
32864 }
32865 return valid;
32866}
32867
32868
32869function defaultMeta(self) {
32870 var meta = self._opts.meta;
32871 self._opts.defaultMeta = typeof meta == 'object'
32872 ? self._getId(meta) || meta
32873 : self.getSchema(META_SCHEMA_ID)
32874 ? META_SCHEMA_ID
32875 : undefined;
32876 return self._opts.defaultMeta;
32877}
32878
32879
32880/**
32881 * Get compiled schema from the instance by `key` or `ref`.
32882 * @this Ajv
32883 * @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
32884 * @return {Function} schema validating function (with property `schema`).
32885 */
32886function getSchema(keyRef) {
32887 var schemaObj = _getSchemaObj(this, keyRef);
32888 switch (typeof schemaObj) {
32889 case 'object': return schemaObj.validate || this._compile(schemaObj);
32890 case 'string': return this.getSchema(schemaObj);
32891 case 'undefined': return _getSchemaFragment(this, keyRef);
32892 }
32893}
32894
32895
32896function _getSchemaFragment(self, ref) {
32897 var res = resolve.schema.call(self, { schema: {} }, ref);
32898 if (res) {
32899 var schema = res.schema
32900 , root = res.root
32901 , baseId = res.baseId;
32902 var v = compileSchema.call(self, schema, root, undefined, baseId);
32903 self._fragments[ref] = new SchemaObject({
32904 ref: ref,
32905 fragment: true,
32906 schema: schema,
32907 root: root,
32908 baseId: baseId,
32909 validate: v
32910 });
32911 return v;
32912 }
32913}
32914
32915
32916function _getSchemaObj(self, keyRef) {
32917 keyRef = resolve.normalizeId(keyRef);
32918 return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
32919}
32920
32921
32922/**
32923 * Remove cached schema(s).
32924 * If no parameter is passed all schemas but meta-schemas are removed.
32925 * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
32926 * Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
32927 * @this Ajv
32928 * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
32929 * @return {Ajv} this for method chaining
32930 */
32931function removeSchema(schemaKeyRef) {
32932 if (schemaKeyRef instanceof RegExp) {
32933 _removeAllSchemas(this, this._schemas, schemaKeyRef);
32934 _removeAllSchemas(this, this._refs, schemaKeyRef);
32935 return this;
32936 }
32937 switch (typeof schemaKeyRef) {
32938 case 'undefined':
32939 _removeAllSchemas(this, this._schemas);
32940 _removeAllSchemas(this, this._refs);
32941 this._cache.clear();
32942 return this;
32943 case 'string':
32944 var schemaObj = _getSchemaObj(this, schemaKeyRef);
32945 if (schemaObj) this._cache.del(schemaObj.cacheKey);
32946 delete this._schemas[schemaKeyRef];
32947 delete this._refs[schemaKeyRef];
32948 return this;
32949 case 'object':
32950 var serialize = this._opts.serialize;
32951 var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
32952 this._cache.del(cacheKey);
32953 var id = this._getId(schemaKeyRef);
32954 if (id) {
32955 id = resolve.normalizeId(id);
32956 delete this._schemas[id];
32957 delete this._refs[id];
32958 }
32959 }
32960 return this;
32961}
32962
32963
32964function _removeAllSchemas(self, schemas, regex) {
32965 for (var keyRef in schemas) {
32966 var schemaObj = schemas[keyRef];
32967 if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
32968 self._cache.del(schemaObj.cacheKey);
32969 delete schemas[keyRef];
32970 }
32971 }
32972}
32973
32974
32975/* @this Ajv */
32976function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
32977 if (typeof schema != 'object' && typeof schema != 'boolean')
32978 throw new Error('schema should be object or boolean');
32979 var serialize = this._opts.serialize;
32980 var cacheKey = serialize ? serialize(schema) : schema;
32981 var cached = this._cache.get(cacheKey);
32982 if (cached) return cached;
32983
32984 shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
32985
32986 var id = resolve.normalizeId(this._getId(schema));
32987 if (id && shouldAddSchema) checkUnique(this, id);
32988
32989 var willValidate = this._opts.validateSchema !== false && !skipValidation;
32990 var recursiveMeta;
32991 if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
32992 this.validateSchema(schema, true);
32993
32994 var localRefs = resolve.ids.call(this, schema);
32995
32996 var schemaObj = new SchemaObject({
32997 id: id,
32998 schema: schema,
32999 localRefs: localRefs,
33000 cacheKey: cacheKey,
33001 meta: meta
33002 });
33003
33004 if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
33005 this._cache.put(cacheKey, schemaObj);
33006
33007 if (willValidate && recursiveMeta) this.validateSchema(schema, true);
33008
33009 return schemaObj;
33010}
33011
33012
33013/* @this Ajv */
33014function _compile(schemaObj, root) {
33015 if (schemaObj.compiling) {
33016 schemaObj.validate = callValidate;
33017 callValidate.schema = schemaObj.schema;
33018 callValidate.errors = null;
33019 callValidate.root = root ? root : callValidate;
33020 if (schemaObj.schema.$async === true)
33021 callValidate.$async = true;
33022 return callValidate;
33023 }
33024 schemaObj.compiling = true;
33025
33026 var currentOpts;
33027 if (schemaObj.meta) {
33028 currentOpts = this._opts;
33029 this._opts = this._metaOpts;
33030 }
33031
33032 var v;
33033 try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
33034 catch(e) {
33035 delete schemaObj.validate;
33036 throw e;
33037 }
33038 finally {
33039 schemaObj.compiling = false;
33040 if (schemaObj.meta) this._opts = currentOpts;
33041 }
33042
33043 schemaObj.validate = v;
33044 schemaObj.refs = v.refs;
33045 schemaObj.refVal = v.refVal;
33046 schemaObj.root = v.root;
33047 return v;
33048
33049
33050 /* @this {*} - custom context, see passContext option */
33051 function callValidate() {
33052 /* jshint validthis: true */
33053 var _validate = schemaObj.validate;
33054 var result = _validate.apply(this, arguments);
33055 callValidate.errors = _validate.errors;
33056 return result;
33057 }
33058}
33059
33060
33061function chooseGetId(opts) {
33062 switch (opts.schemaId) {
33063 case 'auto': return _get$IdOrId;
33064 case 'id': return _getId;
33065 default: return _get$Id;
33066 }
33067}
33068
33069/* @this Ajv */
33070function _getId(schema) {
33071 if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
33072 return schema.id;
33073}
33074
33075/* @this Ajv */
33076function _get$Id(schema) {
33077 if (schema.id) this.logger.warn('schema id ignored', schema.id);
33078 return schema.$id;
33079}
33080
33081
33082function _get$IdOrId(schema) {
33083 if (schema.$id && schema.id && schema.$id != schema.id)
33084 throw new Error('schema $id is different from id');
33085 return schema.$id || schema.id;
33086}
33087
33088
33089/**
33090 * Convert array of error message objects to string
33091 * @this Ajv
33092 * @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
33093 * @param {Object} options optional options with properties `separator` and `dataVar`.
33094 * @return {String} human readable string with all errors descriptions
33095 */
33096function errorsText(errors, options) {
33097 errors = errors || this.errors;
33098 if (!errors) return 'No errors';
33099 options = options || {};
33100 var separator = options.separator === undefined ? ', ' : options.separator;
33101 var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
33102
33103 var text = '';
33104 for (var i=0; i<errors.length; i++) {
33105 var e = errors[i];
33106 if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
33107 }
33108 return text.slice(0, -separator.length);
33109}
33110
33111
33112/**
33113 * Add custom format
33114 * @this Ajv
33115 * @param {String} name format name
33116 * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
33117 * @return {Ajv} this for method chaining
33118 */
33119function addFormat(name, format) {
33120 if (typeof format == 'string') format = new RegExp(format);
33121 this._formats[name] = format;
33122 return this;
33123}
33124
33125
33126function addDefaultMetaSchema(self) {
33127 var $dataSchema;
33128 if (self._opts.$data) {
33129 $dataSchema = __webpack_require__(90601);
33130 self.addMetaSchema($dataSchema, $dataSchema.$id, true);
33131 }
33132 if (self._opts.meta === false) return;
33133 var metaSchema = __webpack_require__(98938);
33134 if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
33135 self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
33136 self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
33137}
33138
33139
33140function addInitialSchemas(self) {
33141 var optsSchemas = self._opts.schemas;
33142 if (!optsSchemas) return;
33143 if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
33144 else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
33145}
33146
33147
33148function addInitialFormats(self) {
33149 for (var name in self._opts.formats) {
33150 var format = self._opts.formats[name];
33151 self.addFormat(name, format);
33152 }
33153}
33154
33155
33156function addInitialKeywords(self) {
33157 for (var name in self._opts.keywords) {
33158 var keyword = self._opts.keywords[name];
33159 self.addKeyword(name, keyword);
33160 }
33161}
33162
33163
33164function checkUnique(self, id) {
33165 if (self._schemas[id] || self._refs[id])
33166 throw new Error('schema with key or id "' + id + '" already exists');
33167}
33168
33169
33170function getMetaSchemaOptions(self) {
33171 var metaOpts = util.copy(self._opts);
33172 for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
33173 delete metaOpts[META_IGNORE_OPTIONS[i]];
33174 return metaOpts;
33175}
33176
33177
33178function setLogger(self) {
33179 var logger = self._opts.logger;
33180 if (logger === false) {
33181 self.logger = {log: noop, warn: noop, error: noop};
33182 } else {
33183 if (logger === undefined) logger = console;
33184 if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
33185 throw new Error('logger must implement log, warn and error methods');
33186 self.logger = logger;
33187 }
33188}
33189
33190
33191function noop() {}
33192
33193
33194/***/ }),
33195
33196/***/ 67246:
33197/***/ (function(module) {
33198
33199"use strict";
33200
33201
33202
33203var Cache = module.exports = function Cache() {
33204 this._cache = {};
33205};
33206
33207
33208Cache.prototype.put = function Cache_put(key, value) {
33209 this._cache[key] = value;
33210};
33211
33212
33213Cache.prototype.get = function Cache_get(key) {
33214 return this._cache[key];
33215};
33216
33217
33218Cache.prototype.del = function Cache_del(key) {
33219 delete this._cache[key];
33220};
33221
33222
33223Cache.prototype.clear = function Cache_clear() {
33224 this._cache = {};
33225};
33226
33227
33228/***/ }),
33229
33230/***/ 40075:
33231/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
33232
33233"use strict";
33234
33235
33236var MissingRefError = __webpack_require__(42718).MissingRef;
33237
33238module.exports = compileAsync;
33239
33240
33241/**
33242 * Creates validating function for passed schema with asynchronous loading of missing schemas.
33243 * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
33244 * @this Ajv
33245 * @param {Object} schema schema object
33246 * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
33247 * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
33248 * @return {Promise} promise that resolves with a validating function.
33249 */
33250function compileAsync(schema, meta, callback) {
33251 /* eslint no-shadow: 0 */
33252 /* global Promise */
33253 /* jshint validthis: true */
33254 var self = this;
33255 if (typeof this._opts.loadSchema != 'function')
33256 throw new Error('options.loadSchema should be a function');
33257
33258 if (typeof meta == 'function') {
33259 callback = meta;
33260 meta = undefined;
33261 }
33262
33263 var p = loadMetaSchemaOf(schema).then(function () {
33264 var schemaObj = self._addSchema(schema, undefined, meta);
33265 return schemaObj.validate || _compileAsync(schemaObj);
33266 });
33267
33268 if (callback) {
33269 p.then(
33270 function(v) { callback(null, v); },
33271 callback
33272 );
33273 }
33274
33275 return p;
33276
33277
33278 function loadMetaSchemaOf(sch) {
33279 var $schema = sch.$schema;
33280 return $schema && !self.getSchema($schema)
33281 ? compileAsync.call(self, { $ref: $schema }, true)
33282 : Promise.resolve();
33283 }
33284
33285
33286 function _compileAsync(schemaObj) {
33287 try { return self._compile(schemaObj); }
33288 catch(e) {
33289 if (e instanceof MissingRefError) return loadMissingSchema(e);
33290 throw e;
33291 }
33292
33293
33294 function loadMissingSchema(e) {
33295 var ref = e.missingSchema;
33296 if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
33297
33298 var schemaPromise = self._loadingSchemas[ref];
33299 if (!schemaPromise) {
33300 schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
33301 schemaPromise.then(removePromise, removePromise);
33302 }
33303
33304 return schemaPromise.then(function (sch) {
33305 if (!added(ref)) {
33306 return loadMetaSchemaOf(sch).then(function () {
33307 if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
33308 });
33309 }
33310 }).then(function() {
33311 return _compileAsync(schemaObj);
33312 });
33313
33314 function removePromise() {
33315 delete self._loadingSchemas[ref];
33316 }
33317
33318 function added(ref) {
33319 return self._refs[ref] || self._schemas[ref];
33320 }
33321 }
33322 }
33323}
33324
33325
33326/***/ }),
33327
33328/***/ 42718:
33329/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
33330
33331"use strict";
33332
33333
33334var resolve = __webpack_require__(62630);
33335
33336module.exports = {
33337 Validation: errorSubclass(ValidationError),
33338 MissingRef: errorSubclass(MissingRefError)
33339};
33340
33341
33342function ValidationError(errors) {
33343 this.message = 'validation failed';
33344 this.errors = errors;
33345 this.ajv = this.validation = true;
33346}
33347
33348
33349MissingRefError.message = function (baseId, ref) {
33350 return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
33351};
33352
33353
33354function MissingRefError(baseId, ref, message) {
33355 this.message = message || MissingRefError.message(baseId, ref);
33356 this.missingRef = resolve.url(baseId, ref);
33357 this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
33358}
33359
33360
33361function errorSubclass(Subclass) {
33362 Subclass.prototype = Object.create(Error.prototype);
33363 Subclass.prototype.constructor = Subclass;
33364 return Subclass;
33365}
33366
33367
33368/***/ }),
33369
33370/***/ 49290:
33371/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
33372
33373"use strict";
33374
33375
33376var util = __webpack_require__(16057);
33377
33378var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
33379var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
33380var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
33381var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
33382var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
33383var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
33384// uri-template: https://tools.ietf.org/html/rfc6570
33385var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
33386// For the source: https://gist.github.com/dperini/729294
33387// For test cases: https://mathiasbynens.be/demo/url-regex
33388// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
33389// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
33390var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
33391var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
33392var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
33393var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
33394var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
33395
33396
33397module.exports = formats;
33398
33399function formats(mode) {
33400 mode = mode == 'full' ? 'full' : 'fast';
33401 return util.copy(formats[mode]);
33402}
33403
33404
33405formats.fast = {
33406 // date: http://tools.ietf.org/html/rfc3339#section-5.6
33407 date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
33408 // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
33409 time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
33410 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
33411 // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
33412 uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
33413 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
33414 'uri-template': URITEMPLATE,
33415 url: URL,
33416 // email (sources from jsen validator):
33417 // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
33418 // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
33419 email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
33420 hostname: HOSTNAME,
33421 // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
33422 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
33423 // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
33424 ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
33425 regex: regex,
33426 // uuid: http://tools.ietf.org/html/rfc4122
33427 uuid: UUID,
33428 // JSON-pointer: https://tools.ietf.org/html/rfc6901
33429 // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
33430 'json-pointer': JSON_POINTER,
33431 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
33432 // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
33433 'relative-json-pointer': RELATIVE_JSON_POINTER
33434};
33435
33436
33437formats.full = {
33438 date: date,
33439 time: time,
33440 'date-time': date_time,
33441 uri: uri,
33442 'uri-reference': URIREF,
33443 'uri-template': URITEMPLATE,
33444 url: URL,
33445 email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
33446 hostname: HOSTNAME,
33447 ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
33448 ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
33449 regex: regex,
33450 uuid: UUID,
33451 'json-pointer': JSON_POINTER,
33452 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
33453 'relative-json-pointer': RELATIVE_JSON_POINTER
33454};
33455
33456
33457function isLeapYear(year) {
33458 // https://tools.ietf.org/html/rfc3339#appendix-C
33459 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
33460}
33461
33462
33463function date(str) {
33464 // full-date from http://tools.ietf.org/html/rfc3339#section-5.6
33465 var matches = str.match(DATE);
33466 if (!matches) return false;
33467
33468 var year = +matches[1];
33469 var month = +matches[2];
33470 var day = +matches[3];
33471
33472 return month >= 1 && month <= 12 && day >= 1 &&
33473 day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
33474}
33475
33476
33477function time(str, full) {
33478 var matches = str.match(TIME);
33479 if (!matches) return false;
33480
33481 var hour = matches[1];
33482 var minute = matches[2];
33483 var second = matches[3];
33484 var timeZone = matches[5];
33485 return ((hour <= 23 && minute <= 59 && second <= 59) ||
33486 (hour == 23 && minute == 59 && second == 60)) &&
33487 (!full || timeZone);
33488}
33489
33490
33491var DATE_TIME_SEPARATOR = /t|\s/i;
33492function date_time(str) {
33493 // http://tools.ietf.org/html/rfc3339#section-5.6
33494 var dateTime = str.split(DATE_TIME_SEPARATOR);
33495 return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
33496}
33497
33498
33499var NOT_URI_FRAGMENT = /\/|:/;
33500function uri(str) {
33501 // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
33502 return NOT_URI_FRAGMENT.test(str) && URI.test(str);
33503}
33504
33505
33506var Z_ANCHOR = /[^\\]\\Z/;
33507function regex(str) {
33508 if (Z_ANCHOR.test(str)) return false;
33509 try {
33510 new RegExp(str);
33511 return true;
33512 } catch(e) {
33513 return false;
33514 }
33515}
33516
33517
33518/***/ }),
33519
33520/***/ 51645:
33521/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
33522
33523"use strict";
33524
33525
33526var resolve = __webpack_require__(62630)
33527 , util = __webpack_require__(16057)
33528 , errorClasses = __webpack_require__(42718)
33529 , stableStringify = __webpack_require__(73600);
33530
33531var validateGenerator = __webpack_require__(26131);
33532
33533/**
33534 * Functions below are used inside compiled validations function
33535 */
33536
33537var ucs2length = util.ucs2length;
33538var equal = __webpack_require__(63933);
33539
33540// this error is thrown by async schemas to return validation errors via exception
33541var ValidationError = errorClasses.Validation;
33542
33543module.exports = compile;
33544
33545
33546/**
33547 * Compiles schema to validation function
33548 * @this Ajv
33549 * @param {Object} schema schema object
33550 * @param {Object} root object with information about the root schema for this schema
33551 * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
33552 * @param {String} baseId base ID for IDs in the schema
33553 * @return {Function} validation function
33554 */
33555function compile(schema, root, localRefs, baseId) {
33556 /* jshint validthis: true, evil: true */
33557 /* eslint no-shadow: 0 */
33558 var self = this
33559 , opts = this._opts
33560 , refVal = [ undefined ]
33561 , refs = {}
33562 , patterns = []
33563 , patternsHash = {}
33564 , defaults = []
33565 , defaultsHash = {}
33566 , customRules = [];
33567
33568 root = root || { schema: schema, refVal: refVal, refs: refs };
33569
33570 var c = checkCompiling.call(this, schema, root, baseId);
33571 var compilation = this._compilations[c.index];
33572 if (c.compiling) return (compilation.callValidate = callValidate);
33573
33574 var formats = this._formats;
33575 var RULES = this.RULES;
33576
33577 try {
33578 var v = localCompile(schema, root, localRefs, baseId);
33579 compilation.validate = v;
33580 var cv = compilation.callValidate;
33581 if (cv) {
33582 cv.schema = v.schema;
33583 cv.errors = null;
33584 cv.refs = v.refs;
33585 cv.refVal = v.refVal;
33586 cv.root = v.root;
33587 cv.$async = v.$async;
33588 if (opts.sourceCode) cv.source = v.source;
33589 }
33590 return v;
33591 } finally {
33592 endCompiling.call(this, schema, root, baseId);
33593 }
33594
33595 /* @this {*} - custom context, see passContext option */
33596 function callValidate() {
33597 /* jshint validthis: true */
33598 var validate = compilation.validate;
33599 var result = validate.apply(this, arguments);
33600 callValidate.errors = validate.errors;
33601 return result;
33602 }
33603
33604 function localCompile(_schema, _root, localRefs, baseId) {
33605 var isRoot = !_root || (_root && _root.schema == _schema);
33606 if (_root.schema != root.schema)
33607 return compile.call(self, _schema, _root, localRefs, baseId);
33608
33609 var $async = _schema.$async === true;
33610
33611 var sourceCode = validateGenerator({
33612 isTop: true,
33613 schema: _schema,
33614 isRoot: isRoot,
33615 baseId: baseId,
33616 root: _root,
33617 schemaPath: '',
33618 errSchemaPath: '#',
33619 errorPath: '""',
33620 MissingRefError: errorClasses.MissingRef,
33621 RULES: RULES,
33622 validate: validateGenerator,
33623 util: util,
33624 resolve: resolve,
33625 resolveRef: resolveRef,
33626 usePattern: usePattern,
33627 useDefault: useDefault,
33628 useCustomRule: useCustomRule,
33629 opts: opts,
33630 formats: formats,
33631 logger: self.logger,
33632 self: self
33633 });
33634
33635 sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
33636 + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
33637 + sourceCode;
33638
33639 if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
33640 // console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
33641 var validate;
33642 try {
33643 var makeValidate = new Function(
33644 'self',
33645 'RULES',
33646 'formats',
33647 'root',
33648 'refVal',
33649 'defaults',
33650 'customRules',
33651 'equal',
33652 'ucs2length',
33653 'ValidationError',
33654 sourceCode
33655 );
33656
33657 validate = makeValidate(
33658 self,
33659 RULES,
33660 formats,
33661 root,
33662 refVal,
33663 defaults,
33664 customRules,
33665 equal,
33666 ucs2length,
33667 ValidationError
33668 );
33669
33670 refVal[0] = validate;
33671 } catch(e) {
33672 self.logger.error('Error compiling schema, function code:', sourceCode);
33673 throw e;
33674 }
33675
33676 validate.schema = _schema;
33677 validate.errors = null;
33678 validate.refs = refs;
33679 validate.refVal = refVal;
33680 validate.root = isRoot ? validate : _root;
33681 if ($async) validate.$async = true;
33682 if (opts.sourceCode === true) {
33683 validate.source = {
33684 code: sourceCode,
33685 patterns: patterns,
33686 defaults: defaults
33687 };
33688 }
33689
33690 return validate;
33691 }
33692
33693 function resolveRef(baseId, ref, isRoot) {
33694 ref = resolve.url(baseId, ref);
33695 var refIndex = refs[ref];
33696 var _refVal, refCode;
33697 if (refIndex !== undefined) {
33698 _refVal = refVal[refIndex];
33699 refCode = 'refVal[' + refIndex + ']';
33700 return resolvedRef(_refVal, refCode);
33701 }
33702 if (!isRoot && root.refs) {
33703 var rootRefId = root.refs[ref];
33704 if (rootRefId !== undefined) {
33705 _refVal = root.refVal[rootRefId];
33706 refCode = addLocalRef(ref, _refVal);
33707 return resolvedRef(_refVal, refCode);
33708 }
33709 }
33710
33711 refCode = addLocalRef(ref);
33712 var v = resolve.call(self, localCompile, root, ref);
33713 if (v === undefined) {
33714 var localSchema = localRefs && localRefs[ref];
33715 if (localSchema) {
33716 v = resolve.inlineRef(localSchema, opts.inlineRefs)
33717 ? localSchema
33718 : compile.call(self, localSchema, root, localRefs, baseId);
33719 }
33720 }
33721
33722 if (v === undefined) {
33723 removeLocalRef(ref);
33724 } else {
33725 replaceLocalRef(ref, v);
33726 return resolvedRef(v, refCode);
33727 }
33728 }
33729
33730 function addLocalRef(ref, v) {
33731 var refId = refVal.length;
33732 refVal[refId] = v;
33733 refs[ref] = refId;
33734 return 'refVal' + refId;
33735 }
33736
33737 function removeLocalRef(ref) {
33738 delete refs[ref];
33739 }
33740
33741 function replaceLocalRef(ref, v) {
33742 var refId = refs[ref];
33743 refVal[refId] = v;
33744 }
33745
33746 function resolvedRef(refVal, code) {
33747 return typeof refVal == 'object' || typeof refVal == 'boolean'
33748 ? { code: code, schema: refVal, inline: true }
33749 : { code: code, $async: refVal && !!refVal.$async };
33750 }
33751
33752 function usePattern(regexStr) {
33753 var index = patternsHash[regexStr];
33754 if (index === undefined) {
33755 index = patternsHash[regexStr] = patterns.length;
33756 patterns[index] = regexStr;
33757 }
33758 return 'pattern' + index;
33759 }
33760
33761 function useDefault(value) {
33762 switch (typeof value) {
33763 case 'boolean':
33764 case 'number':
33765 return '' + value;
33766 case 'string':
33767 return util.toQuotedString(value);
33768 case 'object':
33769 if (value === null) return 'null';
33770 var valueStr = stableStringify(value);
33771 var index = defaultsHash[valueStr];
33772 if (index === undefined) {
33773 index = defaultsHash[valueStr] = defaults.length;
33774 defaults[index] = value;
33775 }
33776 return 'default' + index;
33777 }
33778 }
33779
33780 function useCustomRule(rule, schema, parentSchema, it) {
33781 if (self._opts.validateSchema !== false) {
33782 var deps = rule.definition.dependencies;
33783 if (deps && !deps.every(function(keyword) {
33784 return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
33785 }))
33786 throw new Error('parent schema must have all required keywords: ' + deps.join(','));
33787
33788 var validateSchema = rule.definition.validateSchema;
33789 if (validateSchema) {
33790 var valid = validateSchema(schema);
33791 if (!valid) {
33792 var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
33793 if (self._opts.validateSchema == 'log') self.logger.error(message);
33794 else throw new Error(message);
33795 }
33796 }
33797 }
33798
33799 var compile = rule.definition.compile
33800 , inline = rule.definition.inline
33801 , macro = rule.definition.macro;
33802
33803 var validate;
33804 if (compile) {
33805 validate = compile.call(self, schema, parentSchema, it);
33806 } else if (macro) {
33807 validate = macro.call(self, schema, parentSchema, it);
33808 if (opts.validateSchema !== false) self.validateSchema(validate, true);
33809 } else if (inline) {
33810 validate = inline.call(self, it, rule.keyword, schema, parentSchema);
33811 } else {
33812 validate = rule.definition.validate;
33813 if (!validate) return;
33814 }
33815
33816 if (validate === undefined)
33817 throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
33818
33819 var index = customRules.length;
33820 customRules[index] = validate;
33821
33822 return {
33823 code: 'customRule' + index,
33824 validate: validate
33825 };
33826 }
33827}
33828
33829
33830/**
33831 * Checks if the schema is currently compiled
33832 * @this Ajv
33833 * @param {Object} schema schema to compile
33834 * @param {Object} root root object
33835 * @param {String} baseId base schema ID
33836 * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
33837 */
33838function checkCompiling(schema, root, baseId) {
33839 /* jshint validthis: true */
33840 var index = compIndex.call(this, schema, root, baseId);
33841 if (index >= 0) return { index: index, compiling: true };
33842 index = this._compilations.length;
33843 this._compilations[index] = {
33844 schema: schema,
33845 root: root,
33846 baseId: baseId
33847 };
33848 return { index: index, compiling: false };
33849}
33850
33851
33852/**
33853 * Removes the schema from the currently compiled list
33854 * @this Ajv
33855 * @param {Object} schema schema to compile
33856 * @param {Object} root root object
33857 * @param {String} baseId base schema ID
33858 */
33859function endCompiling(schema, root, baseId) {
33860 /* jshint validthis: true */
33861 var i = compIndex.call(this, schema, root, baseId);
33862 if (i >= 0) this._compilations.splice(i, 1);
33863}
33864
33865
33866/**
33867 * Index of schema compilation in the currently compiled list
33868 * @this Ajv
33869 * @param {Object} schema schema to compile
33870 * @param {Object} root root object
33871 * @param {String} baseId base schema ID
33872 * @return {Integer} compilation index
33873 */
33874function compIndex(schema, root, baseId) {
33875 /* jshint validthis: true */
33876 for (var i=0; i<this._compilations.length; i++) {
33877 var c = this._compilations[i];
33878 if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
33879 }
33880 return -1;
33881}
33882
33883
33884function patternCode(i, patterns) {
33885 return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
33886}
33887
33888
33889function defaultCode(i) {
33890 return 'var default' + i + ' = defaults[' + i + '];';
33891}
33892
33893
33894function refValCode(i, refVal) {
33895 return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
33896}
33897
33898
33899function customRuleCode(i) {
33900 return 'var customRule' + i + ' = customRules[' + i + '];';
33901}
33902
33903
33904function vars(arr, statement) {
33905 if (!arr.length) return '';
33906 var code = '';
33907 for (var i=0; i<arr.length; i++)
33908 code += statement(i, arr);
33909 return code;
33910}
33911
33912
33913/***/ }),
33914
33915/***/ 62630:
33916/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
33917
33918"use strict";
33919
33920
33921var URI = __webpack_require__(94007)
33922 , equal = __webpack_require__(63933)
33923 , util = __webpack_require__(16057)
33924 , SchemaObject = __webpack_require__(27837)
33925 , traverse = __webpack_require__(62437);
33926
33927module.exports = resolve;
33928
33929resolve.normalizeId = normalizeId;
33930resolve.fullPath = getFullPath;
33931resolve.url = resolveUrl;
33932resolve.ids = resolveIds;
33933resolve.inlineRef = inlineRef;
33934resolve.schema = resolveSchema;
33935
33936/**
33937 * [resolve and compile the references ($ref)]
33938 * @this Ajv
33939 * @param {Function} compile reference to schema compilation funciton (localCompile)
33940 * @param {Object} root object with information about the root schema for the current schema
33941 * @param {String} ref reference to resolve
33942 * @return {Object|Function} schema object (if the schema can be inlined) or validation function
33943 */
33944function resolve(compile, root, ref) {
33945 /* jshint validthis: true */
33946 var refVal = this._refs[ref];
33947 if (typeof refVal == 'string') {
33948 if (this._refs[refVal]) refVal = this._refs[refVal];
33949 else return resolve.call(this, compile, root, refVal);
33950 }
33951
33952 refVal = refVal || this._schemas[ref];
33953 if (refVal instanceof SchemaObject) {
33954 return inlineRef(refVal.schema, this._opts.inlineRefs)
33955 ? refVal.schema
33956 : refVal.validate || this._compile(refVal);
33957 }
33958
33959 var res = resolveSchema.call(this, root, ref);
33960 var schema, v, baseId;
33961 if (res) {
33962 schema = res.schema;
33963 root = res.root;
33964 baseId = res.baseId;
33965 }
33966
33967 if (schema instanceof SchemaObject) {
33968 v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
33969 } else if (schema !== undefined) {
33970 v = inlineRef(schema, this._opts.inlineRefs)
33971 ? schema
33972 : compile.call(this, schema, root, undefined, baseId);
33973 }
33974
33975 return v;
33976}
33977
33978
33979/**
33980 * Resolve schema, its root and baseId
33981 * @this Ajv
33982 * @param {Object} root root object with properties schema, refVal, refs
33983 * @param {String} ref reference to resolve
33984 * @return {Object} object with properties schema, root, baseId
33985 */
33986function resolveSchema(root, ref) {
33987 /* jshint validthis: true */
33988 var p = URI.parse(ref)
33989 , refPath = _getFullPath(p)
33990 , baseId = getFullPath(this._getId(root.schema));
33991 if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
33992 var id = normalizeId(refPath);
33993 var refVal = this._refs[id];
33994 if (typeof refVal == 'string') {
33995 return resolveRecursive.call(this, root, refVal, p);
33996 } else if (refVal instanceof SchemaObject) {
33997 if (!refVal.validate) this._compile(refVal);
33998 root = refVal;
33999 } else {
34000 refVal = this._schemas[id];
34001 if (refVal instanceof SchemaObject) {
34002 if (!refVal.validate) this._compile(refVal);
34003 if (id == normalizeId(ref))
34004 return { schema: refVal, root: root, baseId: baseId };
34005 root = refVal;
34006 } else {
34007 return;
34008 }
34009 }
34010 if (!root.schema) return;
34011 baseId = getFullPath(this._getId(root.schema));
34012 }
34013 return getJsonPointer.call(this, p, baseId, root.schema, root);
34014}
34015
34016
34017/* @this Ajv */
34018function resolveRecursive(root, ref, parsedRef) {
34019 /* jshint validthis: true */
34020 var res = resolveSchema.call(this, root, ref);
34021 if (res) {
34022 var schema = res.schema;
34023 var baseId = res.baseId;
34024 root = res.root;
34025 var id = this._getId(schema);
34026 if (id) baseId = resolveUrl(baseId, id);
34027 return getJsonPointer.call(this, parsedRef, baseId, schema, root);
34028 }
34029}
34030
34031
34032var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
34033/* @this Ajv */
34034function getJsonPointer(parsedRef, baseId, schema, root) {
34035 /* jshint validthis: true */
34036 parsedRef.fragment = parsedRef.fragment || '';
34037 if (parsedRef.fragment.slice(0,1) != '/') return;
34038 var parts = parsedRef.fragment.split('/');
34039
34040 for (var i = 1; i < parts.length; i++) {
34041 var part = parts[i];
34042 if (part) {
34043 part = util.unescapeFragment(part);
34044 schema = schema[part];
34045 if (schema === undefined) break;
34046 var id;
34047 if (!PREVENT_SCOPE_CHANGE[part]) {
34048 id = this._getId(schema);
34049 if (id) baseId = resolveUrl(baseId, id);
34050 if (schema.$ref) {
34051 var $ref = resolveUrl(baseId, schema.$ref);
34052 var res = resolveSchema.call(this, root, $ref);
34053 if (res) {
34054 schema = res.schema;
34055 root = res.root;
34056 baseId = res.baseId;
34057 }
34058 }
34059 }
34060 }
34061 }
34062 if (schema !== undefined && schema !== root.schema)
34063 return { schema: schema, root: root, baseId: baseId };
34064}
34065
34066
34067var SIMPLE_INLINED = util.toHash([
34068 'type', 'format', 'pattern',
34069 'maxLength', 'minLength',
34070 'maxProperties', 'minProperties',
34071 'maxItems', 'minItems',
34072 'maximum', 'minimum',
34073 'uniqueItems', 'multipleOf',
34074 'required', 'enum'
34075]);
34076function inlineRef(schema, limit) {
34077 if (limit === false) return false;
34078 if (limit === undefined || limit === true) return checkNoRef(schema);
34079 else if (limit) return countKeys(schema) <= limit;
34080}
34081
34082
34083function checkNoRef(schema) {
34084 var item;
34085 if (Array.isArray(schema)) {
34086 for (var i=0; i<schema.length; i++) {
34087 item = schema[i];
34088 if (typeof item == 'object' && !checkNoRef(item)) return false;
34089 }
34090 } else {
34091 for (var key in schema) {
34092 if (key == '$ref') return false;
34093 item = schema[key];
34094 if (typeof item == 'object' && !checkNoRef(item)) return false;
34095 }
34096 }
34097 return true;
34098}
34099
34100
34101function countKeys(schema) {
34102 var count = 0, item;
34103 if (Array.isArray(schema)) {
34104 for (var i=0; i<schema.length; i++) {
34105 item = schema[i];
34106 if (typeof item == 'object') count += countKeys(item);
34107 if (count == Infinity) return Infinity;
34108 }
34109 } else {
34110 for (var key in schema) {
34111 if (key == '$ref') return Infinity;
34112 if (SIMPLE_INLINED[key]) {
34113 count++;
34114 } else {
34115 item = schema[key];
34116 if (typeof item == 'object') count += countKeys(item) + 1;
34117 if (count == Infinity) return Infinity;
34118 }
34119 }
34120 }
34121 return count;
34122}
34123
34124
34125function getFullPath(id, normalize) {
34126 if (normalize !== false) id = normalizeId(id);
34127 var p = URI.parse(id);
34128 return _getFullPath(p);
34129}
34130
34131
34132function _getFullPath(p) {
34133 return URI.serialize(p).split('#')[0] + '#';
34134}
34135
34136
34137var TRAILING_SLASH_HASH = /#\/?$/;
34138function normalizeId(id) {
34139 return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
34140}
34141
34142
34143function resolveUrl(baseId, id) {
34144 id = normalizeId(id);
34145 return URI.resolve(baseId, id);
34146}
34147
34148
34149/* @this Ajv */
34150function resolveIds(schema) {
34151 var schemaId = normalizeId(this._getId(schema));
34152 var baseIds = {'': schemaId};
34153 var fullPaths = {'': getFullPath(schemaId, false)};
34154 var localRefs = {};
34155 var self = this;
34156
34157 traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
34158 if (jsonPtr === '') return;
34159 var id = self._getId(sch);
34160 var baseId = baseIds[parentJsonPtr];
34161 var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
34162 if (keyIndex !== undefined)
34163 fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
34164
34165 if (typeof id == 'string') {
34166 id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
34167
34168 var refVal = self._refs[id];
34169 if (typeof refVal == 'string') refVal = self._refs[refVal];
34170 if (refVal && refVal.schema) {
34171 if (!equal(sch, refVal.schema))
34172 throw new Error('id "' + id + '" resolves to more than one schema');
34173 } else if (id != normalizeId(fullPath)) {
34174 if (id[0] == '#') {
34175 if (localRefs[id] && !equal(sch, localRefs[id]))
34176 throw new Error('id "' + id + '" resolves to more than one schema');
34177 localRefs[id] = sch;
34178 } else {
34179 self._refs[id] = fullPath;
34180 }
34181 }
34182 }
34183 baseIds[jsonPtr] = baseId;
34184 fullPaths[jsonPtr] = fullPath;
34185 });
34186
34187 return localRefs;
34188}
34189
34190
34191/***/ }),
34192
34193/***/ 91665:
34194/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
34195
34196"use strict";
34197
34198
34199var ruleModules = __webpack_require__(24124)
34200 , toHash = __webpack_require__(16057).toHash;
34201
34202module.exports = function rules() {
34203 var RULES = [
34204 { type: 'number',
34205 rules: [ { 'maximum': ['exclusiveMaximum'] },
34206 { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
34207 { type: 'string',
34208 rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
34209 { type: 'array',
34210 rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
34211 { type: 'object',
34212 rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
34213 { 'properties': ['additionalProperties', 'patternProperties'] } ] },
34214 { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
34215 ];
34216
34217 var ALL = [ 'type', '$comment' ];
34218 var KEYWORDS = [
34219 '$schema', '$id', 'id', '$data', '$async', 'title',
34220 'description', 'default', 'definitions',
34221 'examples', 'readOnly', 'writeOnly',
34222 'contentMediaType', 'contentEncoding',
34223 'additionalItems', 'then', 'else'
34224 ];
34225 var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
34226 RULES.all = toHash(ALL);
34227 RULES.types = toHash(TYPES);
34228
34229 RULES.forEach(function (group) {
34230 group.rules = group.rules.map(function (keyword) {
34231 var implKeywords;
34232 if (typeof keyword == 'object') {
34233 var key = Object.keys(keyword)[0];
34234 implKeywords = keyword[key];
34235 keyword = key;
34236 implKeywords.forEach(function (k) {
34237 ALL.push(k);
34238 RULES.all[k] = true;
34239 });
34240 }
34241 ALL.push(keyword);
34242 var rule = RULES.all[keyword] = {
34243 keyword: keyword,
34244 code: ruleModules[keyword],
34245 implements: implKeywords
34246 };
34247 return rule;
34248 });
34249
34250 RULES.all.$comment = {
34251 keyword: '$comment',
34252 code: ruleModules.$comment
34253 };
34254
34255 if (group.type) RULES.types[group.type] = group;
34256 });
34257
34258 RULES.keywords = toHash(ALL.concat(KEYWORDS));
34259 RULES.custom = {};
34260
34261 return RULES;
34262};
34263
34264
34265/***/ }),
34266
34267/***/ 27837:
34268/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
34269
34270"use strict";
34271
34272
34273var util = __webpack_require__(16057);
34274
34275module.exports = SchemaObject;
34276
34277function SchemaObject(obj) {
34278 util.copy(obj, this);
34279}
34280
34281
34282/***/ }),
34283
34284/***/ 19652:
34285/***/ (function(module) {
34286
34287"use strict";
34288
34289
34290// https://mathiasbynens.be/notes/javascript-encoding
34291// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
34292module.exports = function ucs2length(str) {
34293 var length = 0
34294 , len = str.length
34295 , pos = 0
34296 , value;
34297 while (pos < len) {
34298 length++;
34299 value = str.charCodeAt(pos++);
34300 if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
34301 // high surrogate, and there is a next character
34302 value = str.charCodeAt(pos);
34303 if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
34304 }
34305 }
34306 return length;
34307};
34308
34309
34310/***/ }),
34311
34312/***/ 16057:
34313/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
34314
34315"use strict";
34316
34317
34318
34319module.exports = {
34320 copy: copy,
34321 checkDataType: checkDataType,
34322 checkDataTypes: checkDataTypes,
34323 coerceToTypes: coerceToTypes,
34324 toHash: toHash,
34325 getProperty: getProperty,
34326 escapeQuotes: escapeQuotes,
34327 equal: __webpack_require__(63933),
34328 ucs2length: __webpack_require__(19652),
34329 varOccurences: varOccurences,
34330 varReplace: varReplace,
34331 schemaHasRules: schemaHasRules,
34332 schemaHasRulesExcept: schemaHasRulesExcept,
34333 schemaUnknownRules: schemaUnknownRules,
34334 toQuotedString: toQuotedString,
34335 getPathExpr: getPathExpr,
34336 getPath: getPath,
34337 getData: getData,
34338 unescapeFragment: unescapeFragment,
34339 unescapeJsonPointer: unescapeJsonPointer,
34340 escapeFragment: escapeFragment,
34341 escapeJsonPointer: escapeJsonPointer
34342};
34343
34344
34345function copy(o, to) {
34346 to = to || {};
34347 for (var key in o) to[key] = o[key];
34348 return to;
34349}
34350
34351
34352function checkDataType(dataType, data, strictNumbers, negate) {
34353 var EQUAL = negate ? ' !== ' : ' === '
34354 , AND = negate ? ' || ' : ' && '
34355 , OK = negate ? '!' : ''
34356 , NOT = negate ? '' : '!';
34357 switch (dataType) {
34358 case 'null': return data + EQUAL + 'null';
34359 case 'array': return OK + 'Array.isArray(' + data + ')';
34360 case 'object': return '(' + OK + data + AND +
34361 'typeof ' + data + EQUAL + '"object"' + AND +
34362 NOT + 'Array.isArray(' + data + '))';
34363 case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
34364 NOT + '(' + data + ' % 1)' +
34365 AND + data + EQUAL + data +
34366 (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
34367 case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
34368 (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
34369 default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
34370 }
34371}
34372
34373
34374function checkDataTypes(dataTypes, data, strictNumbers) {
34375 switch (dataTypes.length) {
34376 case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
34377 default:
34378 var code = '';
34379 var types = toHash(dataTypes);
34380 if (types.array && types.object) {
34381 code = types.null ? '(': '(!' + data + ' || ';
34382 code += 'typeof ' + data + ' !== "object")';
34383 delete types.null;
34384 delete types.array;
34385 delete types.object;
34386 }
34387 if (types.number) delete types.integer;
34388 for (var t in types)
34389 code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
34390
34391 return code;
34392 }
34393}
34394
34395
34396var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
34397function coerceToTypes(optionCoerceTypes, dataTypes) {
34398 if (Array.isArray(dataTypes)) {
34399 var types = [];
34400 for (var i=0; i<dataTypes.length; i++) {
34401 var t = dataTypes[i];
34402 if (COERCE_TO_TYPES[t]) types[types.length] = t;
34403 else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
34404 }
34405 if (types.length) return types;
34406 } else if (COERCE_TO_TYPES[dataTypes]) {
34407 return [dataTypes];
34408 } else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
34409 return ['array'];
34410 }
34411}
34412
34413
34414function toHash(arr) {
34415 var hash = {};
34416 for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
34417 return hash;
34418}
34419
34420
34421var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
34422var SINGLE_QUOTE = /'|\\/g;
34423function getProperty(key) {
34424 return typeof key == 'number'
34425 ? '[' + key + ']'
34426 : IDENTIFIER.test(key)
34427 ? '.' + key
34428 : "['" + escapeQuotes(key) + "']";
34429}
34430
34431
34432function escapeQuotes(str) {
34433 return str.replace(SINGLE_QUOTE, '\\$&')
34434 .replace(/\n/g, '\\n')
34435 .replace(/\r/g, '\\r')
34436 .replace(/\f/g, '\\f')
34437 .replace(/\t/g, '\\t');
34438}
34439
34440
34441function varOccurences(str, dataVar) {
34442 dataVar += '[^0-9]';
34443 var matches = str.match(new RegExp(dataVar, 'g'));
34444 return matches ? matches.length : 0;
34445}
34446
34447
34448function varReplace(str, dataVar, expr) {
34449 dataVar += '([^0-9])';
34450 expr = expr.replace(/\$/g, '$$$$');
34451 return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
34452}
34453
34454
34455function schemaHasRules(schema, rules) {
34456 if (typeof schema == 'boolean') return !schema;
34457 for (var key in schema) if (rules[key]) return true;
34458}
34459
34460
34461function schemaHasRulesExcept(schema, rules, exceptKeyword) {
34462 if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
34463 for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
34464}
34465
34466
34467function schemaUnknownRules(schema, rules) {
34468 if (typeof schema == 'boolean') return;
34469 for (var key in schema) if (!rules[key]) return key;
34470}
34471
34472
34473function toQuotedString(str) {
34474 return '\'' + escapeQuotes(str) + '\'';
34475}
34476
34477
34478function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
34479 var path = jsonPointers // false by default
34480 ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
34481 : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
34482 return joinPaths(currentPath, path);
34483}
34484
34485
34486function getPath(currentPath, prop, jsonPointers) {
34487 var path = jsonPointers // false by default
34488 ? toQuotedString('/' + escapeJsonPointer(prop))
34489 : toQuotedString(getProperty(prop));
34490 return joinPaths(currentPath, path);
34491}
34492
34493
34494var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
34495var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
34496function getData($data, lvl, paths) {
34497 var up, jsonPointer, data, matches;
34498 if ($data === '') return 'rootData';
34499 if ($data[0] == '/') {
34500 if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
34501 jsonPointer = $data;
34502 data = 'rootData';
34503 } else {
34504 matches = $data.match(RELATIVE_JSON_POINTER);
34505 if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
34506 up = +matches[1];
34507 jsonPointer = matches[2];
34508 if (jsonPointer == '#') {
34509 if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
34510 return paths[lvl - up];
34511 }
34512
34513 if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
34514 data = 'data' + ((lvl - up) || '');
34515 if (!jsonPointer) return data;
34516 }
34517
34518 var expr = data;
34519 var segments = jsonPointer.split('/');
34520 for (var i=0; i<segments.length; i++) {
34521 var segment = segments[i];
34522 if (segment) {
34523 data += getProperty(unescapeJsonPointer(segment));
34524 expr += ' && ' + data;
34525 }
34526 }
34527 return expr;
34528}
34529
34530
34531function joinPaths (a, b) {
34532 if (a == '""') return b;
34533 return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
34534}
34535
34536
34537function unescapeFragment(str) {
34538 return unescapeJsonPointer(decodeURIComponent(str));
34539}
34540
34541
34542function escapeFragment(str) {
34543 return encodeURIComponent(escapeJsonPointer(str));
34544}
34545
34546
34547function escapeJsonPointer(str) {
34548 return str.replace(/~/g, '~0').replace(/\//g, '~1');
34549}
34550
34551
34552function unescapeJsonPointer(str) {
34553 return str.replace(/~1/g, '/').replace(/~0/g, '~');
34554}
34555
34556
34557/***/ }),
34558
34559/***/ 56989:
34560/***/ (function(module) {
34561
34562"use strict";
34563
34564
34565var KEYWORDS = [
34566 'multipleOf',
34567 'maximum',
34568 'exclusiveMaximum',
34569 'minimum',
34570 'exclusiveMinimum',
34571 'maxLength',
34572 'minLength',
34573 'pattern',
34574 'additionalItems',
34575 'maxItems',
34576 'minItems',
34577 'uniqueItems',
34578 'maxProperties',
34579 'minProperties',
34580 'required',
34581 'additionalProperties',
34582 'enum',
34583 'format',
34584 'const'
34585];
34586
34587module.exports = function (metaSchema, keywordsJsonPointers) {
34588 for (var i=0; i<keywordsJsonPointers.length; i++) {
34589 metaSchema = JSON.parse(JSON.stringify(metaSchema));
34590 var segments = keywordsJsonPointers[i].split('/');
34591 var keywords = metaSchema;
34592 var j;
34593 for (j=1; j<segments.length; j++)
34594 keywords = keywords[segments[j]];
34595
34596 for (j=0; j<KEYWORDS.length; j++) {
34597 var key = KEYWORDS[j];
34598 var schema = keywords[key];
34599 if (schema) {
34600 keywords[key] = {
34601 anyOf: [
34602 schema,
34603 { $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
34604 ]
34605 };
34606 }
34607 }
34608 }
34609
34610 return metaSchema;
34611};
34612
34613
34614/***/ }),
34615
34616/***/ 55533:
34617/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
34618
34619"use strict";
34620
34621
34622var metaSchema = __webpack_require__(98938);
34623
34624module.exports = {
34625 $id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
34626 definitions: {
34627 simpleTypes: metaSchema.definitions.simpleTypes
34628 },
34629 type: 'object',
34630 dependencies: {
34631 schema: ['validate'],
34632 $data: ['validate'],
34633 statements: ['inline'],
34634 valid: {not: {required: ['macro']}}
34635 },
34636 properties: {
34637 type: metaSchema.properties.type,
34638 schema: {type: 'boolean'},
34639 statements: {type: 'boolean'},
34640 dependencies: {
34641 type: 'array',
34642 items: {type: 'string'}
34643 },
34644 metaSchema: {type: 'object'},
34645 modifying: {type: 'boolean'},
34646 valid: {type: 'boolean'},
34647 $data: {type: 'boolean'},
34648 async: {type: 'boolean'},
34649 errors: {
34650 anyOf: [
34651 {type: 'boolean'},
34652 {const: 'full'}
34653 ]
34654 }
34655 }
34656};
34657
34658
34659/***/ }),
34660
34661/***/ 93711:
34662/***/ (function(module) {
34663
34664"use strict";
34665
34666module.exports = function generate__limit(it, $keyword, $ruleType) {
34667 var out = ' ';
34668 var $lvl = it.level;
34669 var $dataLvl = it.dataLevel;
34670 var $schema = it.schema[$keyword];
34671 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
34672 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
34673 var $breakOnError = !it.opts.allErrors;
34674 var $errorKeyword;
34675 var $data = 'data' + ($dataLvl || '');
34676 var $isData = it.opts.$data && $schema && $schema.$data,
34677 $schemaValue;
34678 if ($isData) {
34679 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
34680 $schemaValue = 'schema' + $lvl;
34681 } else {
34682 $schemaValue = $schema;
34683 }
34684 var $isMax = $keyword == 'maximum',
34685 $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
34686 $schemaExcl = it.schema[$exclusiveKeyword],
34687 $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
34688 $op = $isMax ? '<' : '>',
34689 $notOp = $isMax ? '>' : '<',
34690 $errorKeyword = undefined;
34691 if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
34692 throw new Error($keyword + ' must be number');
34693 }
34694 if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
34695 throw new Error($exclusiveKeyword + ' must be number or boolean');
34696 }
34697 if ($isDataExcl) {
34698 var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
34699 $exclusive = 'exclusive' + $lvl,
34700 $exclType = 'exclType' + $lvl,
34701 $exclIsNumber = 'exclIsNumber' + $lvl,
34702 $opExpr = 'op' + $lvl,
34703 $opStr = '\' + ' + $opExpr + ' + \'';
34704 out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
34705 $schemaValueExcl = 'schemaExcl' + $lvl;
34706 out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';
34707 var $errorKeyword = $exclusiveKeyword;
34708 var $$outStack = $$outStack || [];
34709 $$outStack.push(out);
34710 out = ''; /* istanbul ignore else */
34711 if (it.createErrors !== false) {
34712 out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
34713 if (it.opts.messages !== false) {
34714 out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
34715 }
34716 if (it.opts.verbose) {
34717 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
34718 }
34719 out += ' } ';
34720 } else {
34721 out += ' {} ';
34722 }
34723 var __err = out;
34724 out = $$outStack.pop();
34725 if (!it.compositeRule && $breakOnError) {
34726 /* istanbul ignore if */
34727 if (it.async) {
34728 out += ' throw new ValidationError([' + (__err) + ']); ';
34729 } else {
34730 out += ' validate.errors = [' + (__err) + ']; return false; ';
34731 }
34732 } else {
34733 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
34734 }
34735 out += ' } else if ( ';
34736 if ($isData) {
34737 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
34738 }
34739 out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';
34740 if ($schema === undefined) {
34741 $errorKeyword = $exclusiveKeyword;
34742 $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
34743 $schemaValue = $schemaValueExcl;
34744 $isData = $isDataExcl;
34745 }
34746 } else {
34747 var $exclIsNumber = typeof $schemaExcl == 'number',
34748 $opStr = $op;
34749 if ($exclIsNumber && $isData) {
34750 var $opExpr = '\'' + $opStr + '\'';
34751 out += ' if ( ';
34752 if ($isData) {
34753 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
34754 }
34755 out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';
34756 } else {
34757 if ($exclIsNumber && $schema === undefined) {
34758 $exclusive = true;
34759 $errorKeyword = $exclusiveKeyword;
34760 $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
34761 $schemaValue = $schemaExcl;
34762 $notOp += '=';
34763 } else {
34764 if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
34765 if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
34766 $exclusive = true;
34767 $errorKeyword = $exclusiveKeyword;
34768 $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
34769 $notOp += '=';
34770 } else {
34771 $exclusive = false;
34772 $opStr += '=';
34773 }
34774 }
34775 var $opExpr = '\'' + $opStr + '\'';
34776 out += ' if ( ';
34777 if ($isData) {
34778 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
34779 }
34780 out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';
34781 }
34782 }
34783 $errorKeyword = $errorKeyword || $keyword;
34784 var $$outStack = $$outStack || [];
34785 $$outStack.push(out);
34786 out = ''; /* istanbul ignore else */
34787 if (it.createErrors !== false) {
34788 out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
34789 if (it.opts.messages !== false) {
34790 out += ' , message: \'should be ' + ($opStr) + ' ';
34791 if ($isData) {
34792 out += '\' + ' + ($schemaValue);
34793 } else {
34794 out += '' + ($schemaValue) + '\'';
34795 }
34796 }
34797 if (it.opts.verbose) {
34798 out += ' , schema: ';
34799 if ($isData) {
34800 out += 'validate.schema' + ($schemaPath);
34801 } else {
34802 out += '' + ($schema);
34803 }
34804 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
34805 }
34806 out += ' } ';
34807 } else {
34808 out += ' {} ';
34809 }
34810 var __err = out;
34811 out = $$outStack.pop();
34812 if (!it.compositeRule && $breakOnError) {
34813 /* istanbul ignore if */
34814 if (it.async) {
34815 out += ' throw new ValidationError([' + (__err) + ']); ';
34816 } else {
34817 out += ' validate.errors = [' + (__err) + ']; return false; ';
34818 }
34819 } else {
34820 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
34821 }
34822 out += ' } ';
34823 if ($breakOnError) {
34824 out += ' else { ';
34825 }
34826 return out;
34827}
34828
34829
34830/***/ }),
34831
34832/***/ 45675:
34833/***/ (function(module) {
34834
34835"use strict";
34836
34837module.exports = function generate__limitItems(it, $keyword, $ruleType) {
34838 var out = ' ';
34839 var $lvl = it.level;
34840 var $dataLvl = it.dataLevel;
34841 var $schema = it.schema[$keyword];
34842 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
34843 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
34844 var $breakOnError = !it.opts.allErrors;
34845 var $errorKeyword;
34846 var $data = 'data' + ($dataLvl || '');
34847 var $isData = it.opts.$data && $schema && $schema.$data,
34848 $schemaValue;
34849 if ($isData) {
34850 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
34851 $schemaValue = 'schema' + $lvl;
34852 } else {
34853 $schemaValue = $schema;
34854 }
34855 if (!($isData || typeof $schema == 'number')) {
34856 throw new Error($keyword + ' must be number');
34857 }
34858 var $op = $keyword == 'maxItems' ? '>' : '<';
34859 out += 'if ( ';
34860 if ($isData) {
34861 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
34862 }
34863 out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
34864 var $errorKeyword = $keyword;
34865 var $$outStack = $$outStack || [];
34866 $$outStack.push(out);
34867 out = ''; /* istanbul ignore else */
34868 if (it.createErrors !== false) {
34869 out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
34870 if (it.opts.messages !== false) {
34871 out += ' , message: \'should NOT have ';
34872 if ($keyword == 'maxItems') {
34873 out += 'more';
34874 } else {
34875 out += 'fewer';
34876 }
34877 out += ' than ';
34878 if ($isData) {
34879 out += '\' + ' + ($schemaValue) + ' + \'';
34880 } else {
34881 out += '' + ($schema);
34882 }
34883 out += ' items\' ';
34884 }
34885 if (it.opts.verbose) {
34886 out += ' , schema: ';
34887 if ($isData) {
34888 out += 'validate.schema' + ($schemaPath);
34889 } else {
34890 out += '' + ($schema);
34891 }
34892 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
34893 }
34894 out += ' } ';
34895 } else {
34896 out += ' {} ';
34897 }
34898 var __err = out;
34899 out = $$outStack.pop();
34900 if (!it.compositeRule && $breakOnError) {
34901 /* istanbul ignore if */
34902 if (it.async) {
34903 out += ' throw new ValidationError([' + (__err) + ']); ';
34904 } else {
34905 out += ' validate.errors = [' + (__err) + ']; return false; ';
34906 }
34907 } else {
34908 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
34909 }
34910 out += '} ';
34911 if ($breakOnError) {
34912 out += ' else { ';
34913 }
34914 return out;
34915}
34916
34917
34918/***/ }),
34919
34920/***/ 6051:
34921/***/ (function(module) {
34922
34923"use strict";
34924
34925module.exports = function generate__limitLength(it, $keyword, $ruleType) {
34926 var out = ' ';
34927 var $lvl = it.level;
34928 var $dataLvl = it.dataLevel;
34929 var $schema = it.schema[$keyword];
34930 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
34931 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
34932 var $breakOnError = !it.opts.allErrors;
34933 var $errorKeyword;
34934 var $data = 'data' + ($dataLvl || '');
34935 var $isData = it.opts.$data && $schema && $schema.$data,
34936 $schemaValue;
34937 if ($isData) {
34938 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
34939 $schemaValue = 'schema' + $lvl;
34940 } else {
34941 $schemaValue = $schema;
34942 }
34943 if (!($isData || typeof $schema == 'number')) {
34944 throw new Error($keyword + ' must be number');
34945 }
34946 var $op = $keyword == 'maxLength' ? '>' : '<';
34947 out += 'if ( ';
34948 if ($isData) {
34949 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
34950 }
34951 if (it.opts.unicode === false) {
34952 out += ' ' + ($data) + '.length ';
34953 } else {
34954 out += ' ucs2length(' + ($data) + ') ';
34955 }
34956 out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
34957 var $errorKeyword = $keyword;
34958 var $$outStack = $$outStack || [];
34959 $$outStack.push(out);
34960 out = ''; /* istanbul ignore else */
34961 if (it.createErrors !== false) {
34962 out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
34963 if (it.opts.messages !== false) {
34964 out += ' , message: \'should NOT be ';
34965 if ($keyword == 'maxLength') {
34966 out += 'longer';
34967 } else {
34968 out += 'shorter';
34969 }
34970 out += ' than ';
34971 if ($isData) {
34972 out += '\' + ' + ($schemaValue) + ' + \'';
34973 } else {
34974 out += '' + ($schema);
34975 }
34976 out += ' characters\' ';
34977 }
34978 if (it.opts.verbose) {
34979 out += ' , schema: ';
34980 if ($isData) {
34981 out += 'validate.schema' + ($schemaPath);
34982 } else {
34983 out += '' + ($schema);
34984 }
34985 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
34986 }
34987 out += ' } ';
34988 } else {
34989 out += ' {} ';
34990 }
34991 var __err = out;
34992 out = $$outStack.pop();
34993 if (!it.compositeRule && $breakOnError) {
34994 /* istanbul ignore if */
34995 if (it.async) {
34996 out += ' throw new ValidationError([' + (__err) + ']); ';
34997 } else {
34998 out += ' validate.errors = [' + (__err) + ']; return false; ';
34999 }
35000 } else {
35001 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35002 }
35003 out += '} ';
35004 if ($breakOnError) {
35005 out += ' else { ';
35006 }
35007 return out;
35008}
35009
35010
35011/***/ }),
35012
35013/***/ 17043:
35014/***/ (function(module) {
35015
35016"use strict";
35017
35018module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
35019 var out = ' ';
35020 var $lvl = it.level;
35021 var $dataLvl = it.dataLevel;
35022 var $schema = it.schema[$keyword];
35023 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35024 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35025 var $breakOnError = !it.opts.allErrors;
35026 var $errorKeyword;
35027 var $data = 'data' + ($dataLvl || '');
35028 var $isData = it.opts.$data && $schema && $schema.$data,
35029 $schemaValue;
35030 if ($isData) {
35031 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
35032 $schemaValue = 'schema' + $lvl;
35033 } else {
35034 $schemaValue = $schema;
35035 }
35036 if (!($isData || typeof $schema == 'number')) {
35037 throw new Error($keyword + ' must be number');
35038 }
35039 var $op = $keyword == 'maxProperties' ? '>' : '<';
35040 out += 'if ( ';
35041 if ($isData) {
35042 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
35043 }
35044 out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
35045 var $errorKeyword = $keyword;
35046 var $$outStack = $$outStack || [];
35047 $$outStack.push(out);
35048 out = ''; /* istanbul ignore else */
35049 if (it.createErrors !== false) {
35050 out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
35051 if (it.opts.messages !== false) {
35052 out += ' , message: \'should NOT have ';
35053 if ($keyword == 'maxProperties') {
35054 out += 'more';
35055 } else {
35056 out += 'fewer';
35057 }
35058 out += ' than ';
35059 if ($isData) {
35060 out += '\' + ' + ($schemaValue) + ' + \'';
35061 } else {
35062 out += '' + ($schema);
35063 }
35064 out += ' properties\' ';
35065 }
35066 if (it.opts.verbose) {
35067 out += ' , schema: ';
35068 if ($isData) {
35069 out += 'validate.schema' + ($schemaPath);
35070 } else {
35071 out += '' + ($schema);
35072 }
35073 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35074 }
35075 out += ' } ';
35076 } else {
35077 out += ' {} ';
35078 }
35079 var __err = out;
35080 out = $$outStack.pop();
35081 if (!it.compositeRule && $breakOnError) {
35082 /* istanbul ignore if */
35083 if (it.async) {
35084 out += ' throw new ValidationError([' + (__err) + ']); ';
35085 } else {
35086 out += ' validate.errors = [' + (__err) + ']; return false; ';
35087 }
35088 } else {
35089 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35090 }
35091 out += '} ';
35092 if ($breakOnError) {
35093 out += ' else { ';
35094 }
35095 return out;
35096}
35097
35098
35099/***/ }),
35100
35101/***/ 73639:
35102/***/ (function(module) {
35103
35104"use strict";
35105
35106module.exports = function generate_allOf(it, $keyword, $ruleType) {
35107 var out = ' ';
35108 var $schema = it.schema[$keyword];
35109 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35110 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35111 var $breakOnError = !it.opts.allErrors;
35112 var $it = it.util.copy(it);
35113 var $closingBraces = '';
35114 $it.level++;
35115 var $nextValid = 'valid' + $it.level;
35116 var $currentBaseId = $it.baseId,
35117 $allSchemasEmpty = true;
35118 var arr1 = $schema;
35119 if (arr1) {
35120 var $sch, $i = -1,
35121 l1 = arr1.length - 1;
35122 while ($i < l1) {
35123 $sch = arr1[$i += 1];
35124 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
35125 $allSchemasEmpty = false;
35126 $it.schema = $sch;
35127 $it.schemaPath = $schemaPath + '[' + $i + ']';
35128 $it.errSchemaPath = $errSchemaPath + '/' + $i;
35129 out += ' ' + (it.validate($it)) + ' ';
35130 $it.baseId = $currentBaseId;
35131 if ($breakOnError) {
35132 out += ' if (' + ($nextValid) + ') { ';
35133 $closingBraces += '}';
35134 }
35135 }
35136 }
35137 }
35138 if ($breakOnError) {
35139 if ($allSchemasEmpty) {
35140 out += ' if (true) { ';
35141 } else {
35142 out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
35143 }
35144 }
35145 return out;
35146}
35147
35148
35149/***/ }),
35150
35151/***/ 71256:
35152/***/ (function(module) {
35153
35154"use strict";
35155
35156module.exports = function generate_anyOf(it, $keyword, $ruleType) {
35157 var out = ' ';
35158 var $lvl = it.level;
35159 var $dataLvl = it.dataLevel;
35160 var $schema = it.schema[$keyword];
35161 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35162 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35163 var $breakOnError = !it.opts.allErrors;
35164 var $data = 'data' + ($dataLvl || '');
35165 var $valid = 'valid' + $lvl;
35166 var $errs = 'errs__' + $lvl;
35167 var $it = it.util.copy(it);
35168 var $closingBraces = '';
35169 $it.level++;
35170 var $nextValid = 'valid' + $it.level;
35171 var $noEmptySchema = $schema.every(function($sch) {
35172 return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
35173 });
35174 if ($noEmptySchema) {
35175 var $currentBaseId = $it.baseId;
35176 out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';
35177 var $wasComposite = it.compositeRule;
35178 it.compositeRule = $it.compositeRule = true;
35179 var arr1 = $schema;
35180 if (arr1) {
35181 var $sch, $i = -1,
35182 l1 = arr1.length - 1;
35183 while ($i < l1) {
35184 $sch = arr1[$i += 1];
35185 $it.schema = $sch;
35186 $it.schemaPath = $schemaPath + '[' + $i + ']';
35187 $it.errSchemaPath = $errSchemaPath + '/' + $i;
35188 out += ' ' + (it.validate($it)) + ' ';
35189 $it.baseId = $currentBaseId;
35190 out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';
35191 $closingBraces += '}';
35192 }
35193 }
35194 it.compositeRule = $it.compositeRule = $wasComposite;
35195 out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
35196 if (it.createErrors !== false) {
35197 out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
35198 if (it.opts.messages !== false) {
35199 out += ' , message: \'should match some schema in anyOf\' ';
35200 }
35201 if (it.opts.verbose) {
35202 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35203 }
35204 out += ' } ';
35205 } else {
35206 out += ' {} ';
35207 }
35208 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35209 if (!it.compositeRule && $breakOnError) {
35210 /* istanbul ignore if */
35211 if (it.async) {
35212 out += ' throw new ValidationError(vErrors); ';
35213 } else {
35214 out += ' validate.errors = vErrors; return false; ';
35215 }
35216 }
35217 out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
35218 if (it.opts.allErrors) {
35219 out += ' } ';
35220 }
35221 } else {
35222 if ($breakOnError) {
35223 out += ' if (true) { ';
35224 }
35225 }
35226 return out;
35227}
35228
35229
35230/***/ }),
35231
35232/***/ 12660:
35233/***/ (function(module) {
35234
35235"use strict";
35236
35237module.exports = function generate_comment(it, $keyword, $ruleType) {
35238 var out = ' ';
35239 var $schema = it.schema[$keyword];
35240 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35241 var $breakOnError = !it.opts.allErrors;
35242 var $comment = it.util.toQuotedString($schema);
35243 if (it.opts.$comment === true) {
35244 out += ' console.log(' + ($comment) + ');';
35245 } else if (typeof it.opts.$comment == 'function') {
35246 out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';
35247 }
35248 return out;
35249}
35250
35251
35252/***/ }),
35253
35254/***/ 10184:
35255/***/ (function(module) {
35256
35257"use strict";
35258
35259module.exports = function generate_const(it, $keyword, $ruleType) {
35260 var out = ' ';
35261 var $lvl = it.level;
35262 var $dataLvl = it.dataLevel;
35263 var $schema = it.schema[$keyword];
35264 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35265 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35266 var $breakOnError = !it.opts.allErrors;
35267 var $data = 'data' + ($dataLvl || '');
35268 var $valid = 'valid' + $lvl;
35269 var $isData = it.opts.$data && $schema && $schema.$data,
35270 $schemaValue;
35271 if ($isData) {
35272 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
35273 $schemaValue = 'schema' + $lvl;
35274 } else {
35275 $schemaValue = $schema;
35276 }
35277 if (!$isData) {
35278 out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';
35279 }
35280 out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';
35281 var $$outStack = $$outStack || [];
35282 $$outStack.push(out);
35283 out = ''; /* istanbul ignore else */
35284 if (it.createErrors !== false) {
35285 out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';
35286 if (it.opts.messages !== false) {
35287 out += ' , message: \'should be equal to constant\' ';
35288 }
35289 if (it.opts.verbose) {
35290 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35291 }
35292 out += ' } ';
35293 } else {
35294 out += ' {} ';
35295 }
35296 var __err = out;
35297 out = $$outStack.pop();
35298 if (!it.compositeRule && $breakOnError) {
35299 /* istanbul ignore if */
35300 if (it.async) {
35301 out += ' throw new ValidationError([' + (__err) + ']); ';
35302 } else {
35303 out += ' validate.errors = [' + (__err) + ']; return false; ';
35304 }
35305 } else {
35306 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35307 }
35308 out += ' }';
35309 if ($breakOnError) {
35310 out += ' else { ';
35311 }
35312 return out;
35313}
35314
35315
35316/***/ }),
35317
35318/***/ 27419:
35319/***/ (function(module) {
35320
35321"use strict";
35322
35323module.exports = function generate_contains(it, $keyword, $ruleType) {
35324 var out = ' ';
35325 var $lvl = it.level;
35326 var $dataLvl = it.dataLevel;
35327 var $schema = it.schema[$keyword];
35328 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35329 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35330 var $breakOnError = !it.opts.allErrors;
35331 var $data = 'data' + ($dataLvl || '');
35332 var $valid = 'valid' + $lvl;
35333 var $errs = 'errs__' + $lvl;
35334 var $it = it.util.copy(it);
35335 var $closingBraces = '';
35336 $it.level++;
35337 var $nextValid = 'valid' + $it.level;
35338 var $idx = 'i' + $lvl,
35339 $dataNxt = $it.dataLevel = it.dataLevel + 1,
35340 $nextData = 'data' + $dataNxt,
35341 $currentBaseId = it.baseId,
35342 $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
35343 out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
35344 if ($nonEmptySchema) {
35345 var $wasComposite = it.compositeRule;
35346 it.compositeRule = $it.compositeRule = true;
35347 $it.schema = $schema;
35348 $it.schemaPath = $schemaPath;
35349 $it.errSchemaPath = $errSchemaPath;
35350 out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
35351 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
35352 var $passData = $data + '[' + $idx + ']';
35353 $it.dataPathArr[$dataNxt] = $idx;
35354 var $code = it.validate($it);
35355 $it.baseId = $currentBaseId;
35356 if (it.util.varOccurences($code, $nextData) < 2) {
35357 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
35358 } else {
35359 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
35360 }
35361 out += ' if (' + ($nextValid) + ') break; } ';
35362 it.compositeRule = $it.compositeRule = $wasComposite;
35363 out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';
35364 } else {
35365 out += ' if (' + ($data) + '.length == 0) {';
35366 }
35367 var $$outStack = $$outStack || [];
35368 $$outStack.push(out);
35369 out = ''; /* istanbul ignore else */
35370 if (it.createErrors !== false) {
35371 out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
35372 if (it.opts.messages !== false) {
35373 out += ' , message: \'should contain a valid item\' ';
35374 }
35375 if (it.opts.verbose) {
35376 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35377 }
35378 out += ' } ';
35379 } else {
35380 out += ' {} ';
35381 }
35382 var __err = out;
35383 out = $$outStack.pop();
35384 if (!it.compositeRule && $breakOnError) {
35385 /* istanbul ignore if */
35386 if (it.async) {
35387 out += ' throw new ValidationError([' + (__err) + ']); ';
35388 } else {
35389 out += ' validate.errors = [' + (__err) + ']; return false; ';
35390 }
35391 } else {
35392 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35393 }
35394 out += ' } else { ';
35395 if ($nonEmptySchema) {
35396 out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
35397 }
35398 if (it.opts.allErrors) {
35399 out += ' } ';
35400 }
35401 return out;
35402}
35403
35404
35405/***/ }),
35406
35407/***/ 87921:
35408/***/ (function(module) {
35409
35410"use strict";
35411
35412module.exports = function generate_custom(it, $keyword, $ruleType) {
35413 var out = ' ';
35414 var $lvl = it.level;
35415 var $dataLvl = it.dataLevel;
35416 var $schema = it.schema[$keyword];
35417 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35418 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35419 var $breakOnError = !it.opts.allErrors;
35420 var $errorKeyword;
35421 var $data = 'data' + ($dataLvl || '');
35422 var $valid = 'valid' + $lvl;
35423 var $errs = 'errs__' + $lvl;
35424 var $isData = it.opts.$data && $schema && $schema.$data,
35425 $schemaValue;
35426 if ($isData) {
35427 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
35428 $schemaValue = 'schema' + $lvl;
35429 } else {
35430 $schemaValue = $schema;
35431 }
35432 var $rule = this,
35433 $definition = 'definition' + $lvl,
35434 $rDef = $rule.definition,
35435 $closingBraces = '';
35436 var $compile, $inline, $macro, $ruleValidate, $validateCode;
35437 if ($isData && $rDef.$data) {
35438 $validateCode = 'keywordValidate' + $lvl;
35439 var $validateSchema = $rDef.validateSchema;
35440 out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';
35441 } else {
35442 $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
35443 if (!$ruleValidate) return;
35444 $schemaValue = 'validate.schema' + $schemaPath;
35445 $validateCode = $ruleValidate.code;
35446 $compile = $rDef.compile;
35447 $inline = $rDef.inline;
35448 $macro = $rDef.macro;
35449 }
35450 var $ruleErrs = $validateCode + '.errors',
35451 $i = 'i' + $lvl,
35452 $ruleErr = 'ruleErr' + $lvl,
35453 $asyncKeyword = $rDef.async;
35454 if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');
35455 if (!($inline || $macro)) {
35456 out += '' + ($ruleErrs) + ' = null;';
35457 }
35458 out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
35459 if ($isData && $rDef.$data) {
35460 $closingBraces += '}';
35461 out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { ';
35462 if ($validateSchema) {
35463 $closingBraces += '}';
35464 out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { ';
35465 }
35466 }
35467 if ($inline) {
35468 if ($rDef.statements) {
35469 out += ' ' + ($ruleValidate.validate) + ' ';
35470 } else {
35471 out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';
35472 }
35473 } else if ($macro) {
35474 var $it = it.util.copy(it);
35475 var $closingBraces = '';
35476 $it.level++;
35477 var $nextValid = 'valid' + $it.level;
35478 $it.schema = $ruleValidate.validate;
35479 $it.schemaPath = '';
35480 var $wasComposite = it.compositeRule;
35481 it.compositeRule = $it.compositeRule = true;
35482 var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
35483 it.compositeRule = $it.compositeRule = $wasComposite;
35484 out += ' ' + ($code);
35485 } else {
35486 var $$outStack = $$outStack || [];
35487 $$outStack.push(out);
35488 out = '';
35489 out += ' ' + ($validateCode) + '.call( ';
35490 if (it.opts.passContext) {
35491 out += 'this';
35492 } else {
35493 out += 'self';
35494 }
35495 if ($compile || $rDef.schema === false) {
35496 out += ' , ' + ($data) + ' ';
35497 } else {
35498 out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';
35499 }
35500 out += ' , (dataPath || \'\')';
35501 if (it.errorPath != '""') {
35502 out += ' + ' + (it.errorPath);
35503 }
35504 var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
35505 $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
35506 out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';
35507 var def_callRuleValidate = out;
35508 out = $$outStack.pop();
35509 if ($rDef.errors === false) {
35510 out += ' ' + ($valid) + ' = ';
35511 if ($asyncKeyword) {
35512 out += 'await ';
35513 }
35514 out += '' + (def_callRuleValidate) + '; ';
35515 } else {
35516 if ($asyncKeyword) {
35517 $ruleErrs = 'customErrors' + $lvl;
35518 out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
35519 } else {
35520 out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
35521 }
35522 }
35523 }
35524 if ($rDef.modifying) {
35525 out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';
35526 }
35527 out += '' + ($closingBraces);
35528 if ($rDef.valid) {
35529 if ($breakOnError) {
35530 out += ' if (true) { ';
35531 }
35532 } else {
35533 out += ' if ( ';
35534 if ($rDef.valid === undefined) {
35535 out += ' !';
35536 if ($macro) {
35537 out += '' + ($nextValid);
35538 } else {
35539 out += '' + ($valid);
35540 }
35541 } else {
35542 out += ' ' + (!$rDef.valid) + ' ';
35543 }
35544 out += ') { ';
35545 $errorKeyword = $rule.keyword;
35546 var $$outStack = $$outStack || [];
35547 $$outStack.push(out);
35548 out = '';
35549 var $$outStack = $$outStack || [];
35550 $$outStack.push(out);
35551 out = ''; /* istanbul ignore else */
35552 if (it.createErrors !== false) {
35553 out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
35554 if (it.opts.messages !== false) {
35555 out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
35556 }
35557 if (it.opts.verbose) {
35558 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35559 }
35560 out += ' } ';
35561 } else {
35562 out += ' {} ';
35563 }
35564 var __err = out;
35565 out = $$outStack.pop();
35566 if (!it.compositeRule && $breakOnError) {
35567 /* istanbul ignore if */
35568 if (it.async) {
35569 out += ' throw new ValidationError([' + (__err) + ']); ';
35570 } else {
35571 out += ' validate.errors = [' + (__err) + ']; return false; ';
35572 }
35573 } else {
35574 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35575 }
35576 var def_customError = out;
35577 out = $$outStack.pop();
35578 if ($inline) {
35579 if ($rDef.errors) {
35580 if ($rDef.errors != 'full') {
35581 out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
35582 if (it.opts.verbose) {
35583 out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
35584 }
35585 out += ' } ';
35586 }
35587 } else {
35588 if ($rDef.errors === false) {
35589 out += ' ' + (def_customError) + ' ';
35590 } else {
35591 out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
35592 if (it.opts.verbose) {
35593 out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
35594 }
35595 out += ' } } ';
35596 }
35597 }
35598 } else if ($macro) {
35599 out += ' var err = '; /* istanbul ignore else */
35600 if (it.createErrors !== false) {
35601 out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
35602 if (it.opts.messages !== false) {
35603 out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
35604 }
35605 if (it.opts.verbose) {
35606 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35607 }
35608 out += ' } ';
35609 } else {
35610 out += ' {} ';
35611 }
35612 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35613 if (!it.compositeRule && $breakOnError) {
35614 /* istanbul ignore if */
35615 if (it.async) {
35616 out += ' throw new ValidationError(vErrors); ';
35617 } else {
35618 out += ' validate.errors = vErrors; return false; ';
35619 }
35620 }
35621 } else {
35622 if ($rDef.errors === false) {
35623 out += ' ' + (def_customError) + ' ';
35624 } else {
35625 out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; ';
35626 if (it.opts.verbose) {
35627 out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
35628 }
35629 out += ' } } else { ' + (def_customError) + ' } ';
35630 }
35631 }
35632 out += ' } ';
35633 if ($breakOnError) {
35634 out += ' else { ';
35635 }
35636 }
35637 return out;
35638}
35639
35640
35641/***/ }),
35642
35643/***/ 77299:
35644/***/ (function(module) {
35645
35646"use strict";
35647
35648module.exports = function generate_dependencies(it, $keyword, $ruleType) {
35649 var out = ' ';
35650 var $lvl = it.level;
35651 var $dataLvl = it.dataLevel;
35652 var $schema = it.schema[$keyword];
35653 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35654 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35655 var $breakOnError = !it.opts.allErrors;
35656 var $data = 'data' + ($dataLvl || '');
35657 var $errs = 'errs__' + $lvl;
35658 var $it = it.util.copy(it);
35659 var $closingBraces = '';
35660 $it.level++;
35661 var $nextValid = 'valid' + $it.level;
35662 var $schemaDeps = {},
35663 $propertyDeps = {},
35664 $ownProperties = it.opts.ownProperties;
35665 for ($property in $schema) {
35666 if ($property == '__proto__') continue;
35667 var $sch = $schema[$property];
35668 var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
35669 $deps[$property] = $sch;
35670 }
35671 out += 'var ' + ($errs) + ' = errors;';
35672 var $currentErrorPath = it.errorPath;
35673 out += 'var missing' + ($lvl) + ';';
35674 for (var $property in $propertyDeps) {
35675 $deps = $propertyDeps[$property];
35676 if ($deps.length) {
35677 out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
35678 if ($ownProperties) {
35679 out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
35680 }
35681 if ($breakOnError) {
35682 out += ' && ( ';
35683 var arr1 = $deps;
35684 if (arr1) {
35685 var $propertyKey, $i = -1,
35686 l1 = arr1.length - 1;
35687 while ($i < l1) {
35688 $propertyKey = arr1[$i += 1];
35689 if ($i) {
35690 out += ' || ';
35691 }
35692 var $prop = it.util.getProperty($propertyKey),
35693 $useData = $data + $prop;
35694 out += ' ( ( ' + ($useData) + ' === undefined ';
35695 if ($ownProperties) {
35696 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
35697 }
35698 out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
35699 }
35700 }
35701 out += ')) { ';
35702 var $propertyPath = 'missing' + $lvl,
35703 $missingProperty = '\' + ' + $propertyPath + ' + \'';
35704 if (it.opts._errorDataPathProperty) {
35705 it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
35706 }
35707 var $$outStack = $$outStack || [];
35708 $$outStack.push(out);
35709 out = ''; /* istanbul ignore else */
35710 if (it.createErrors !== false) {
35711 out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
35712 if (it.opts.messages !== false) {
35713 out += ' , message: \'should have ';
35714 if ($deps.length == 1) {
35715 out += 'property ' + (it.util.escapeQuotes($deps[0]));
35716 } else {
35717 out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
35718 }
35719 out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
35720 }
35721 if (it.opts.verbose) {
35722 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35723 }
35724 out += ' } ';
35725 } else {
35726 out += ' {} ';
35727 }
35728 var __err = out;
35729 out = $$outStack.pop();
35730 if (!it.compositeRule && $breakOnError) {
35731 /* istanbul ignore if */
35732 if (it.async) {
35733 out += ' throw new ValidationError([' + (__err) + ']); ';
35734 } else {
35735 out += ' validate.errors = [' + (__err) + ']; return false; ';
35736 }
35737 } else {
35738 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35739 }
35740 } else {
35741 out += ' ) { ';
35742 var arr2 = $deps;
35743 if (arr2) {
35744 var $propertyKey, i2 = -1,
35745 l2 = arr2.length - 1;
35746 while (i2 < l2) {
35747 $propertyKey = arr2[i2 += 1];
35748 var $prop = it.util.getProperty($propertyKey),
35749 $missingProperty = it.util.escapeQuotes($propertyKey),
35750 $useData = $data + $prop;
35751 if (it.opts._errorDataPathProperty) {
35752 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
35753 }
35754 out += ' if ( ' + ($useData) + ' === undefined ';
35755 if ($ownProperties) {
35756 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
35757 }
35758 out += ') { var err = '; /* istanbul ignore else */
35759 if (it.createErrors !== false) {
35760 out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
35761 if (it.opts.messages !== false) {
35762 out += ' , message: \'should have ';
35763 if ($deps.length == 1) {
35764 out += 'property ' + (it.util.escapeQuotes($deps[0]));
35765 } else {
35766 out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
35767 }
35768 out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
35769 }
35770 if (it.opts.verbose) {
35771 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35772 }
35773 out += ' } ';
35774 } else {
35775 out += ' {} ';
35776 }
35777 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
35778 }
35779 }
35780 }
35781 out += ' } ';
35782 if ($breakOnError) {
35783 $closingBraces += '}';
35784 out += ' else { ';
35785 }
35786 }
35787 }
35788 it.errorPath = $currentErrorPath;
35789 var $currentBaseId = $it.baseId;
35790 for (var $property in $schemaDeps) {
35791 var $sch = $schemaDeps[$property];
35792 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
35793 out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
35794 if ($ownProperties) {
35795 out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
35796 }
35797 out += ') { ';
35798 $it.schema = $sch;
35799 $it.schemaPath = $schemaPath + it.util.getProperty($property);
35800 $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
35801 out += ' ' + (it.validate($it)) + ' ';
35802 $it.baseId = $currentBaseId;
35803 out += ' } ';
35804 if ($breakOnError) {
35805 out += ' if (' + ($nextValid) + ') { ';
35806 $closingBraces += '}';
35807 }
35808 }
35809 }
35810 if ($breakOnError) {
35811 out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
35812 }
35813 return out;
35814}
35815
35816
35817/***/ }),
35818
35819/***/ 89795:
35820/***/ (function(module) {
35821
35822"use strict";
35823
35824module.exports = function generate_enum(it, $keyword, $ruleType) {
35825 var out = ' ';
35826 var $lvl = it.level;
35827 var $dataLvl = it.dataLevel;
35828 var $schema = it.schema[$keyword];
35829 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35830 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35831 var $breakOnError = !it.opts.allErrors;
35832 var $data = 'data' + ($dataLvl || '');
35833 var $valid = 'valid' + $lvl;
35834 var $isData = it.opts.$data && $schema && $schema.$data,
35835 $schemaValue;
35836 if ($isData) {
35837 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
35838 $schemaValue = 'schema' + $lvl;
35839 } else {
35840 $schemaValue = $schema;
35841 }
35842 var $i = 'i' + $lvl,
35843 $vSchema = 'schema' + $lvl;
35844 if (!$isData) {
35845 out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';
35846 }
35847 out += 'var ' + ($valid) + ';';
35848 if ($isData) {
35849 out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
35850 }
35851 out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';
35852 if ($isData) {
35853 out += ' } ';
35854 }
35855 out += ' if (!' + ($valid) + ') { ';
35856 var $$outStack = $$outStack || [];
35857 $$outStack.push(out);
35858 out = ''; /* istanbul ignore else */
35859 if (it.createErrors !== false) {
35860 out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';
35861 if (it.opts.messages !== false) {
35862 out += ' , message: \'should be equal to one of the allowed values\' ';
35863 }
35864 if (it.opts.verbose) {
35865 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
35866 }
35867 out += ' } ';
35868 } else {
35869 out += ' {} ';
35870 }
35871 var __err = out;
35872 out = $$outStack.pop();
35873 if (!it.compositeRule && $breakOnError) {
35874 /* istanbul ignore if */
35875 if (it.async) {
35876 out += ' throw new ValidationError([' + (__err) + ']); ';
35877 } else {
35878 out += ' validate.errors = [' + (__err) + ']; return false; ';
35879 }
35880 } else {
35881 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
35882 }
35883 out += ' }';
35884 if ($breakOnError) {
35885 out += ' else { ';
35886 }
35887 return out;
35888}
35889
35890
35891/***/ }),
35892
35893/***/ 85801:
35894/***/ (function(module) {
35895
35896"use strict";
35897
35898module.exports = function generate_format(it, $keyword, $ruleType) {
35899 var out = ' ';
35900 var $lvl = it.level;
35901 var $dataLvl = it.dataLevel;
35902 var $schema = it.schema[$keyword];
35903 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
35904 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
35905 var $breakOnError = !it.opts.allErrors;
35906 var $data = 'data' + ($dataLvl || '');
35907 if (it.opts.format === false) {
35908 if ($breakOnError) {
35909 out += ' if (true) { ';
35910 }
35911 return out;
35912 }
35913 var $isData = it.opts.$data && $schema && $schema.$data,
35914 $schemaValue;
35915 if ($isData) {
35916 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
35917 $schemaValue = 'schema' + $lvl;
35918 } else {
35919 $schemaValue = $schema;
35920 }
35921 var $unknownFormats = it.opts.unknownFormats,
35922 $allowUnknown = Array.isArray($unknownFormats);
35923 if ($isData) {
35924 var $format = 'format' + $lvl,
35925 $isObject = 'isObject' + $lvl,
35926 $formatType = 'formatType' + $lvl;
35927 out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { ';
35928 if (it.async) {
35929 out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';
35930 }
35931 out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';
35932 if ($isData) {
35933 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
35934 }
35935 out += ' (';
35936 if ($unknownFormats != 'ignore') {
35937 out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';
35938 if ($allowUnknown) {
35939 out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';
35940 }
35941 out += ') || ';
35942 }
35943 out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? ';
35944 if (it.async) {
35945 out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
35946 } else {
35947 out += ' ' + ($format) + '(' + ($data) + ') ';
35948 }
35949 out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';
35950 } else {
35951 var $format = it.formats[$schema];
35952 if (!$format) {
35953 if ($unknownFormats == 'ignore') {
35954 it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
35955 if ($breakOnError) {
35956 out += ' if (true) { ';
35957 }
35958 return out;
35959 } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {
35960 if ($breakOnError) {
35961 out += ' if (true) { ';
35962 }
35963 return out;
35964 } else {
35965 throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');
35966 }
35967 }
35968 var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;
35969 var $formatType = $isObject && $format.type || 'string';
35970 if ($isObject) {
35971 var $async = $format.async === true;
35972 $format = $format.validate;
35973 }
35974 if ($formatType != $ruleType) {
35975 if ($breakOnError) {
35976 out += ' if (true) { ';
35977 }
35978 return out;
35979 }
35980 if ($async) {
35981 if (!it.async) throw new Error('async format in sync schema');
35982 var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
35983 out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';
35984 } else {
35985 out += ' if (! ';
35986 var $formatRef = 'formats' + it.util.getProperty($schema);
35987 if ($isObject) $formatRef += '.validate';
35988 if (typeof $format == 'function') {
35989 out += ' ' + ($formatRef) + '(' + ($data) + ') ';
35990 } else {
35991 out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';
35992 }
35993 out += ') { ';
35994 }
35995 }
35996 var $$outStack = $$outStack || [];
35997 $$outStack.push(out);
35998 out = ''; /* istanbul ignore else */
35999 if (it.createErrors !== false) {
36000 out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';
36001 if ($isData) {
36002 out += '' + ($schemaValue);
36003 } else {
36004 out += '' + (it.util.toQuotedString($schema));
36005 }
36006 out += ' } ';
36007 if (it.opts.messages !== false) {
36008 out += ' , message: \'should match format "';
36009 if ($isData) {
36010 out += '\' + ' + ($schemaValue) + ' + \'';
36011 } else {
36012 out += '' + (it.util.escapeQuotes($schema));
36013 }
36014 out += '"\' ';
36015 }
36016 if (it.opts.verbose) {
36017 out += ' , schema: ';
36018 if ($isData) {
36019 out += 'validate.schema' + ($schemaPath);
36020 } else {
36021 out += '' + (it.util.toQuotedString($schema));
36022 }
36023 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36024 }
36025 out += ' } ';
36026 } else {
36027 out += ' {} ';
36028 }
36029 var __err = out;
36030 out = $$outStack.pop();
36031 if (!it.compositeRule && $breakOnError) {
36032 /* istanbul ignore if */
36033 if (it.async) {
36034 out += ' throw new ValidationError([' + (__err) + ']); ';
36035 } else {
36036 out += ' validate.errors = [' + (__err) + ']; return false; ';
36037 }
36038 } else {
36039 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36040 }
36041 out += ' } ';
36042 if ($breakOnError) {
36043 out += ' else { ';
36044 }
36045 return out;
36046}
36047
36048
36049/***/ }),
36050
36051/***/ 64962:
36052/***/ (function(module) {
36053
36054"use strict";
36055
36056module.exports = function generate_if(it, $keyword, $ruleType) {
36057 var out = ' ';
36058 var $lvl = it.level;
36059 var $dataLvl = it.dataLevel;
36060 var $schema = it.schema[$keyword];
36061 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36062 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36063 var $breakOnError = !it.opts.allErrors;
36064 var $data = 'data' + ($dataLvl || '');
36065 var $valid = 'valid' + $lvl;
36066 var $errs = 'errs__' + $lvl;
36067 var $it = it.util.copy(it);
36068 $it.level++;
36069 var $nextValid = 'valid' + $it.level;
36070 var $thenSch = it.schema['then'],
36071 $elseSch = it.schema['else'],
36072 $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
36073 $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
36074 $currentBaseId = $it.baseId;
36075 if ($thenPresent || $elsePresent) {
36076 var $ifClause;
36077 $it.createErrors = false;
36078 $it.schema = $schema;
36079 $it.schemaPath = $schemaPath;
36080 $it.errSchemaPath = $errSchemaPath;
36081 out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';
36082 var $wasComposite = it.compositeRule;
36083 it.compositeRule = $it.compositeRule = true;
36084 out += ' ' + (it.validate($it)) + ' ';
36085 $it.baseId = $currentBaseId;
36086 $it.createErrors = true;
36087 out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
36088 it.compositeRule = $it.compositeRule = $wasComposite;
36089 if ($thenPresent) {
36090 out += ' if (' + ($nextValid) + ') { ';
36091 $it.schema = it.schema['then'];
36092 $it.schemaPath = it.schemaPath + '.then';
36093 $it.errSchemaPath = it.errSchemaPath + '/then';
36094 out += ' ' + (it.validate($it)) + ' ';
36095 $it.baseId = $currentBaseId;
36096 out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
36097 if ($thenPresent && $elsePresent) {
36098 $ifClause = 'ifClause' + $lvl;
36099 out += ' var ' + ($ifClause) + ' = \'then\'; ';
36100 } else {
36101 $ifClause = '\'then\'';
36102 }
36103 out += ' } ';
36104 if ($elsePresent) {
36105 out += ' else { ';
36106 }
36107 } else {
36108 out += ' if (!' + ($nextValid) + ') { ';
36109 }
36110 if ($elsePresent) {
36111 $it.schema = it.schema['else'];
36112 $it.schemaPath = it.schemaPath + '.else';
36113 $it.errSchemaPath = it.errSchemaPath + '/else';
36114 out += ' ' + (it.validate($it)) + ' ';
36115 $it.baseId = $currentBaseId;
36116 out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
36117 if ($thenPresent && $elsePresent) {
36118 $ifClause = 'ifClause' + $lvl;
36119 out += ' var ' + ($ifClause) + ' = \'else\'; ';
36120 } else {
36121 $ifClause = '\'else\'';
36122 }
36123 out += ' } ';
36124 }
36125 out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
36126 if (it.createErrors !== false) {
36127 out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';
36128 if (it.opts.messages !== false) {
36129 out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';
36130 }
36131 if (it.opts.verbose) {
36132 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36133 }
36134 out += ' } ';
36135 } else {
36136 out += ' {} ';
36137 }
36138 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36139 if (!it.compositeRule && $breakOnError) {
36140 /* istanbul ignore if */
36141 if (it.async) {
36142 out += ' throw new ValidationError(vErrors); ';
36143 } else {
36144 out += ' validate.errors = vErrors; return false; ';
36145 }
36146 }
36147 out += ' } ';
36148 if ($breakOnError) {
36149 out += ' else { ';
36150 }
36151 } else {
36152 if ($breakOnError) {
36153 out += ' if (true) { ';
36154 }
36155 }
36156 return out;
36157}
36158
36159
36160/***/ }),
36161
36162/***/ 24124:
36163/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
36164
36165"use strict";
36166
36167
36168//all requires must be explicit because browserify won't work with dynamic requires
36169module.exports = {
36170 '$ref': __webpack_require__(95746),
36171 allOf: __webpack_require__(73639),
36172 anyOf: __webpack_require__(71256),
36173 '$comment': __webpack_require__(12660),
36174 const: __webpack_require__(10184),
36175 contains: __webpack_require__(27419),
36176 dependencies: __webpack_require__(77299),
36177 'enum': __webpack_require__(89795),
36178 format: __webpack_require__(85801),
36179 'if': __webpack_require__(64962),
36180 items: __webpack_require__(49623),
36181 maximum: __webpack_require__(93711),
36182 minimum: __webpack_require__(93711),
36183 maxItems: __webpack_require__(45675),
36184 minItems: __webpack_require__(45675),
36185 maxLength: __webpack_require__(6051),
36186 minLength: __webpack_require__(6051),
36187 maxProperties: __webpack_require__(17043),
36188 minProperties: __webpack_require__(17043),
36189 multipleOf: __webpack_require__(99251),
36190 not: __webpack_require__(67739),
36191 oneOf: __webpack_require__(26857),
36192 pattern: __webpack_require__(28099),
36193 properties: __webpack_require__(59438),
36194 propertyNames: __webpack_require__(53466),
36195 required: __webpack_require__(88430),
36196 uniqueItems: __webpack_require__(12207),
36197 validate: __webpack_require__(26131)
36198};
36199
36200
36201/***/ }),
36202
36203/***/ 49623:
36204/***/ (function(module) {
36205
36206"use strict";
36207
36208module.exports = function generate_items(it, $keyword, $ruleType) {
36209 var out = ' ';
36210 var $lvl = it.level;
36211 var $dataLvl = it.dataLevel;
36212 var $schema = it.schema[$keyword];
36213 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36214 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36215 var $breakOnError = !it.opts.allErrors;
36216 var $data = 'data' + ($dataLvl || '');
36217 var $valid = 'valid' + $lvl;
36218 var $errs = 'errs__' + $lvl;
36219 var $it = it.util.copy(it);
36220 var $closingBraces = '';
36221 $it.level++;
36222 var $nextValid = 'valid' + $it.level;
36223 var $idx = 'i' + $lvl,
36224 $dataNxt = $it.dataLevel = it.dataLevel + 1,
36225 $nextData = 'data' + $dataNxt,
36226 $currentBaseId = it.baseId;
36227 out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
36228 if (Array.isArray($schema)) {
36229 var $additionalItems = it.schema.additionalItems;
36230 if ($additionalItems === false) {
36231 out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';
36232 var $currErrSchemaPath = $errSchemaPath;
36233 $errSchemaPath = it.errSchemaPath + '/additionalItems';
36234 out += ' if (!' + ($valid) + ') { ';
36235 var $$outStack = $$outStack || [];
36236 $$outStack.push(out);
36237 out = ''; /* istanbul ignore else */
36238 if (it.createErrors !== false) {
36239 out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';
36240 if (it.opts.messages !== false) {
36241 out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' ';
36242 }
36243 if (it.opts.verbose) {
36244 out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36245 }
36246 out += ' } ';
36247 } else {
36248 out += ' {} ';
36249 }
36250 var __err = out;
36251 out = $$outStack.pop();
36252 if (!it.compositeRule && $breakOnError) {
36253 /* istanbul ignore if */
36254 if (it.async) {
36255 out += ' throw new ValidationError([' + (__err) + ']); ';
36256 } else {
36257 out += ' validate.errors = [' + (__err) + ']; return false; ';
36258 }
36259 } else {
36260 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36261 }
36262 out += ' } ';
36263 $errSchemaPath = $currErrSchemaPath;
36264 if ($breakOnError) {
36265 $closingBraces += '}';
36266 out += ' else { ';
36267 }
36268 }
36269 var arr1 = $schema;
36270 if (arr1) {
36271 var $sch, $i = -1,
36272 l1 = arr1.length - 1;
36273 while ($i < l1) {
36274 $sch = arr1[$i += 1];
36275 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
36276 out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
36277 var $passData = $data + '[' + $i + ']';
36278 $it.schema = $sch;
36279 $it.schemaPath = $schemaPath + '[' + $i + ']';
36280 $it.errSchemaPath = $errSchemaPath + '/' + $i;
36281 $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
36282 $it.dataPathArr[$dataNxt] = $i;
36283 var $code = it.validate($it);
36284 $it.baseId = $currentBaseId;
36285 if (it.util.varOccurences($code, $nextData) < 2) {
36286 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
36287 } else {
36288 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
36289 }
36290 out += ' } ';
36291 if ($breakOnError) {
36292 out += ' if (' + ($nextValid) + ') { ';
36293 $closingBraces += '}';
36294 }
36295 }
36296 }
36297 }
36298 if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
36299 $it.schema = $additionalItems;
36300 $it.schemaPath = it.schemaPath + '.additionalItems';
36301 $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
36302 out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
36303 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
36304 var $passData = $data + '[' + $idx + ']';
36305 $it.dataPathArr[$dataNxt] = $idx;
36306 var $code = it.validate($it);
36307 $it.baseId = $currentBaseId;
36308 if (it.util.varOccurences($code, $nextData) < 2) {
36309 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
36310 } else {
36311 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
36312 }
36313 if ($breakOnError) {
36314 out += ' if (!' + ($nextValid) + ') break; ';
36315 }
36316 out += ' } } ';
36317 if ($breakOnError) {
36318 out += ' if (' + ($nextValid) + ') { ';
36319 $closingBraces += '}';
36320 }
36321 }
36322 } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
36323 $it.schema = $schema;
36324 $it.schemaPath = $schemaPath;
36325 $it.errSchemaPath = $errSchemaPath;
36326 out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
36327 $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
36328 var $passData = $data + '[' + $idx + ']';
36329 $it.dataPathArr[$dataNxt] = $idx;
36330 var $code = it.validate($it);
36331 $it.baseId = $currentBaseId;
36332 if (it.util.varOccurences($code, $nextData) < 2) {
36333 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
36334 } else {
36335 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
36336 }
36337 if ($breakOnError) {
36338 out += ' if (!' + ($nextValid) + ') break; ';
36339 }
36340 out += ' }';
36341 }
36342 if ($breakOnError) {
36343 out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
36344 }
36345 return out;
36346}
36347
36348
36349/***/ }),
36350
36351/***/ 99251:
36352/***/ (function(module) {
36353
36354"use strict";
36355
36356module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
36357 var out = ' ';
36358 var $lvl = it.level;
36359 var $dataLvl = it.dataLevel;
36360 var $schema = it.schema[$keyword];
36361 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36362 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36363 var $breakOnError = !it.opts.allErrors;
36364 var $data = 'data' + ($dataLvl || '');
36365 var $isData = it.opts.$data && $schema && $schema.$data,
36366 $schemaValue;
36367 if ($isData) {
36368 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
36369 $schemaValue = 'schema' + $lvl;
36370 } else {
36371 $schemaValue = $schema;
36372 }
36373 if (!($isData || typeof $schema == 'number')) {
36374 throw new Error($keyword + ' must be number');
36375 }
36376 out += 'var division' + ($lvl) + ';if (';
36377 if ($isData) {
36378 out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
36379 }
36380 out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
36381 if (it.opts.multipleOfPrecision) {
36382 out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
36383 } else {
36384 out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
36385 }
36386 out += ' ) ';
36387 if ($isData) {
36388 out += ' ) ';
36389 }
36390 out += ' ) { ';
36391 var $$outStack = $$outStack || [];
36392 $$outStack.push(out);
36393 out = ''; /* istanbul ignore else */
36394 if (it.createErrors !== false) {
36395 out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
36396 if (it.opts.messages !== false) {
36397 out += ' , message: \'should be multiple of ';
36398 if ($isData) {
36399 out += '\' + ' + ($schemaValue);
36400 } else {
36401 out += '' + ($schemaValue) + '\'';
36402 }
36403 }
36404 if (it.opts.verbose) {
36405 out += ' , schema: ';
36406 if ($isData) {
36407 out += 'validate.schema' + ($schemaPath);
36408 } else {
36409 out += '' + ($schema);
36410 }
36411 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36412 }
36413 out += ' } ';
36414 } else {
36415 out += ' {} ';
36416 }
36417 var __err = out;
36418 out = $$outStack.pop();
36419 if (!it.compositeRule && $breakOnError) {
36420 /* istanbul ignore if */
36421 if (it.async) {
36422 out += ' throw new ValidationError([' + (__err) + ']); ';
36423 } else {
36424 out += ' validate.errors = [' + (__err) + ']; return false; ';
36425 }
36426 } else {
36427 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36428 }
36429 out += '} ';
36430 if ($breakOnError) {
36431 out += ' else { ';
36432 }
36433 return out;
36434}
36435
36436
36437/***/ }),
36438
36439/***/ 67739:
36440/***/ (function(module) {
36441
36442"use strict";
36443
36444module.exports = function generate_not(it, $keyword, $ruleType) {
36445 var out = ' ';
36446 var $lvl = it.level;
36447 var $dataLvl = it.dataLevel;
36448 var $schema = it.schema[$keyword];
36449 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36450 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36451 var $breakOnError = !it.opts.allErrors;
36452 var $data = 'data' + ($dataLvl || '');
36453 var $errs = 'errs__' + $lvl;
36454 var $it = it.util.copy(it);
36455 $it.level++;
36456 var $nextValid = 'valid' + $it.level;
36457 if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
36458 $it.schema = $schema;
36459 $it.schemaPath = $schemaPath;
36460 $it.errSchemaPath = $errSchemaPath;
36461 out += ' var ' + ($errs) + ' = errors; ';
36462 var $wasComposite = it.compositeRule;
36463 it.compositeRule = $it.compositeRule = true;
36464 $it.createErrors = false;
36465 var $allErrorsOption;
36466 if ($it.opts.allErrors) {
36467 $allErrorsOption = $it.opts.allErrors;
36468 $it.opts.allErrors = false;
36469 }
36470 out += ' ' + (it.validate($it)) + ' ';
36471 $it.createErrors = true;
36472 if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
36473 it.compositeRule = $it.compositeRule = $wasComposite;
36474 out += ' if (' + ($nextValid) + ') { ';
36475 var $$outStack = $$outStack || [];
36476 $$outStack.push(out);
36477 out = ''; /* istanbul ignore else */
36478 if (it.createErrors !== false) {
36479 out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
36480 if (it.opts.messages !== false) {
36481 out += ' , message: \'should NOT be valid\' ';
36482 }
36483 if (it.opts.verbose) {
36484 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36485 }
36486 out += ' } ';
36487 } else {
36488 out += ' {} ';
36489 }
36490 var __err = out;
36491 out = $$outStack.pop();
36492 if (!it.compositeRule && $breakOnError) {
36493 /* istanbul ignore if */
36494 if (it.async) {
36495 out += ' throw new ValidationError([' + (__err) + ']); ';
36496 } else {
36497 out += ' validate.errors = [' + (__err) + ']; return false; ';
36498 }
36499 } else {
36500 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36501 }
36502 out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
36503 if (it.opts.allErrors) {
36504 out += ' } ';
36505 }
36506 } else {
36507 out += ' var err = '; /* istanbul ignore else */
36508 if (it.createErrors !== false) {
36509 out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
36510 if (it.opts.messages !== false) {
36511 out += ' , message: \'should NOT be valid\' ';
36512 }
36513 if (it.opts.verbose) {
36514 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36515 }
36516 out += ' } ';
36517 } else {
36518 out += ' {} ';
36519 }
36520 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36521 if ($breakOnError) {
36522 out += ' if (false) { ';
36523 }
36524 }
36525 return out;
36526}
36527
36528
36529/***/ }),
36530
36531/***/ 26857:
36532/***/ (function(module) {
36533
36534"use strict";
36535
36536module.exports = function generate_oneOf(it, $keyword, $ruleType) {
36537 var out = ' ';
36538 var $lvl = it.level;
36539 var $dataLvl = it.dataLevel;
36540 var $schema = it.schema[$keyword];
36541 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36542 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36543 var $breakOnError = !it.opts.allErrors;
36544 var $data = 'data' + ($dataLvl || '');
36545 var $valid = 'valid' + $lvl;
36546 var $errs = 'errs__' + $lvl;
36547 var $it = it.util.copy(it);
36548 var $closingBraces = '';
36549 $it.level++;
36550 var $nextValid = 'valid' + $it.level;
36551 var $currentBaseId = $it.baseId,
36552 $prevValid = 'prevValid' + $lvl,
36553 $passingSchemas = 'passingSchemas' + $lvl;
36554 out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';
36555 var $wasComposite = it.compositeRule;
36556 it.compositeRule = $it.compositeRule = true;
36557 var arr1 = $schema;
36558 if (arr1) {
36559 var $sch, $i = -1,
36560 l1 = arr1.length - 1;
36561 while ($i < l1) {
36562 $sch = arr1[$i += 1];
36563 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
36564 $it.schema = $sch;
36565 $it.schemaPath = $schemaPath + '[' + $i + ']';
36566 $it.errSchemaPath = $errSchemaPath + '/' + $i;
36567 out += ' ' + (it.validate($it)) + ' ';
36568 $it.baseId = $currentBaseId;
36569 } else {
36570 out += ' var ' + ($nextValid) + ' = true; ';
36571 }
36572 if ($i) {
36573 out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';
36574 $closingBraces += '}';
36575 }
36576 out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';
36577 }
36578 }
36579 it.compositeRule = $it.compositeRule = $wasComposite;
36580 out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
36581 if (it.createErrors !== false) {
36582 out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';
36583 if (it.opts.messages !== false) {
36584 out += ' , message: \'should match exactly one schema in oneOf\' ';
36585 }
36586 if (it.opts.verbose) {
36587 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36588 }
36589 out += ' } ';
36590 } else {
36591 out += ' {} ';
36592 }
36593 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36594 if (!it.compositeRule && $breakOnError) {
36595 /* istanbul ignore if */
36596 if (it.async) {
36597 out += ' throw new ValidationError(vErrors); ';
36598 } else {
36599 out += ' validate.errors = vErrors; return false; ';
36600 }
36601 }
36602 out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';
36603 if (it.opts.allErrors) {
36604 out += ' } ';
36605 }
36606 return out;
36607}
36608
36609
36610/***/ }),
36611
36612/***/ 28099:
36613/***/ (function(module) {
36614
36615"use strict";
36616
36617module.exports = function generate_pattern(it, $keyword, $ruleType) {
36618 var out = ' ';
36619 var $lvl = it.level;
36620 var $dataLvl = it.dataLevel;
36621 var $schema = it.schema[$keyword];
36622 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36623 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36624 var $breakOnError = !it.opts.allErrors;
36625 var $data = 'data' + ($dataLvl || '');
36626 var $isData = it.opts.$data && $schema && $schema.$data,
36627 $schemaValue;
36628 if ($isData) {
36629 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
36630 $schemaValue = 'schema' + $lvl;
36631 } else {
36632 $schemaValue = $schema;
36633 }
36634 var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
36635 out += 'if ( ';
36636 if ($isData) {
36637 out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
36638 }
36639 out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
36640 var $$outStack = $$outStack || [];
36641 $$outStack.push(out);
36642 out = ''; /* istanbul ignore else */
36643 if (it.createErrors !== false) {
36644 out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';
36645 if ($isData) {
36646 out += '' + ($schemaValue);
36647 } else {
36648 out += '' + (it.util.toQuotedString($schema));
36649 }
36650 out += ' } ';
36651 if (it.opts.messages !== false) {
36652 out += ' , message: \'should match pattern "';
36653 if ($isData) {
36654 out += '\' + ' + ($schemaValue) + ' + \'';
36655 } else {
36656 out += '' + (it.util.escapeQuotes($schema));
36657 }
36658 out += '"\' ';
36659 }
36660 if (it.opts.verbose) {
36661 out += ' , schema: ';
36662 if ($isData) {
36663 out += 'validate.schema' + ($schemaPath);
36664 } else {
36665 out += '' + (it.util.toQuotedString($schema));
36666 }
36667 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36668 }
36669 out += ' } ';
36670 } else {
36671 out += ' {} ';
36672 }
36673 var __err = out;
36674 out = $$outStack.pop();
36675 if (!it.compositeRule && $breakOnError) {
36676 /* istanbul ignore if */
36677 if (it.async) {
36678 out += ' throw new ValidationError([' + (__err) + ']); ';
36679 } else {
36680 out += ' validate.errors = [' + (__err) + ']; return false; ';
36681 }
36682 } else {
36683 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36684 }
36685 out += '} ';
36686 if ($breakOnError) {
36687 out += ' else { ';
36688 }
36689 return out;
36690}
36691
36692
36693/***/ }),
36694
36695/***/ 59438:
36696/***/ (function(module) {
36697
36698"use strict";
36699
36700module.exports = function generate_properties(it, $keyword, $ruleType) {
36701 var out = ' ';
36702 var $lvl = it.level;
36703 var $dataLvl = it.dataLevel;
36704 var $schema = it.schema[$keyword];
36705 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
36706 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
36707 var $breakOnError = !it.opts.allErrors;
36708 var $data = 'data' + ($dataLvl || '');
36709 var $errs = 'errs__' + $lvl;
36710 var $it = it.util.copy(it);
36711 var $closingBraces = '';
36712 $it.level++;
36713 var $nextValid = 'valid' + $it.level;
36714 var $key = 'key' + $lvl,
36715 $idx = 'idx' + $lvl,
36716 $dataNxt = $it.dataLevel = it.dataLevel + 1,
36717 $nextData = 'data' + $dataNxt,
36718 $dataProperties = 'dataProperties' + $lvl;
36719 var $schemaKeys = Object.keys($schema || {}).filter(notProto),
36720 $pProperties = it.schema.patternProperties || {},
36721 $pPropertyKeys = Object.keys($pProperties).filter(notProto),
36722 $aProperties = it.schema.additionalProperties,
36723 $someProperties = $schemaKeys.length || $pPropertyKeys.length,
36724 $noAdditional = $aProperties === false,
36725 $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,
36726 $removeAdditional = it.opts.removeAdditional,
36727 $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,
36728 $ownProperties = it.opts.ownProperties,
36729 $currentBaseId = it.baseId;
36730 var $required = it.schema.required;
36731 if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
36732 var $requiredHash = it.util.toHash($required);
36733 }
36734
36735 function notProto(p) {
36736 return p !== '__proto__';
36737 }
36738 out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
36739 if ($ownProperties) {
36740 out += ' var ' + ($dataProperties) + ' = undefined;';
36741 }
36742 if ($checkAdditional) {
36743 if ($ownProperties) {
36744 out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
36745 } else {
36746 out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
36747 }
36748 if ($someProperties) {
36749 out += ' var isAdditional' + ($lvl) + ' = !(false ';
36750 if ($schemaKeys.length) {
36751 if ($schemaKeys.length > 8) {
36752 out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';
36753 } else {
36754 var arr1 = $schemaKeys;
36755 if (arr1) {
36756 var $propertyKey, i1 = -1,
36757 l1 = arr1.length - 1;
36758 while (i1 < l1) {
36759 $propertyKey = arr1[i1 += 1];
36760 out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';
36761 }
36762 }
36763 }
36764 }
36765 if ($pPropertyKeys.length) {
36766 var arr2 = $pPropertyKeys;
36767 if (arr2) {
36768 var $pProperty, $i = -1,
36769 l2 = arr2.length - 1;
36770 while ($i < l2) {
36771 $pProperty = arr2[$i += 1];
36772 out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';
36773 }
36774 }
36775 }
36776 out += ' ); if (isAdditional' + ($lvl) + ') { ';
36777 }
36778 if ($removeAdditional == 'all') {
36779 out += ' delete ' + ($data) + '[' + ($key) + ']; ';
36780 } else {
36781 var $currentErrorPath = it.errorPath;
36782 var $additionalProperty = '\' + ' + $key + ' + \'';
36783 if (it.opts._errorDataPathProperty) {
36784 it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
36785 }
36786 if ($noAdditional) {
36787 if ($removeAdditional) {
36788 out += ' delete ' + ($data) + '[' + ($key) + ']; ';
36789 } else {
36790 out += ' ' + ($nextValid) + ' = false; ';
36791 var $currErrSchemaPath = $errSchemaPath;
36792 $errSchemaPath = it.errSchemaPath + '/additionalProperties';
36793 var $$outStack = $$outStack || [];
36794 $$outStack.push(out);
36795 out = ''; /* istanbul ignore else */
36796 if (it.createErrors !== false) {
36797 out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
36798 if (it.opts.messages !== false) {
36799 out += ' , message: \'';
36800 if (it.opts._errorDataPathProperty) {
36801 out += 'is an invalid additional property';
36802 } else {
36803 out += 'should NOT have additional properties';
36804 }
36805 out += '\' ';
36806 }
36807 if (it.opts.verbose) {
36808 out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36809 }
36810 out += ' } ';
36811 } else {
36812 out += ' {} ';
36813 }
36814 var __err = out;
36815 out = $$outStack.pop();
36816 if (!it.compositeRule && $breakOnError) {
36817 /* istanbul ignore if */
36818 if (it.async) {
36819 out += ' throw new ValidationError([' + (__err) + ']); ';
36820 } else {
36821 out += ' validate.errors = [' + (__err) + ']; return false; ';
36822 }
36823 } else {
36824 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36825 }
36826 $errSchemaPath = $currErrSchemaPath;
36827 if ($breakOnError) {
36828 out += ' break; ';
36829 }
36830 }
36831 } else if ($additionalIsSchema) {
36832 if ($removeAdditional == 'failing') {
36833 out += ' var ' + ($errs) + ' = errors; ';
36834 var $wasComposite = it.compositeRule;
36835 it.compositeRule = $it.compositeRule = true;
36836 $it.schema = $aProperties;
36837 $it.schemaPath = it.schemaPath + '.additionalProperties';
36838 $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
36839 $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
36840 var $passData = $data + '[' + $key + ']';
36841 $it.dataPathArr[$dataNxt] = $key;
36842 var $code = it.validate($it);
36843 $it.baseId = $currentBaseId;
36844 if (it.util.varOccurences($code, $nextData) < 2) {
36845 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
36846 } else {
36847 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
36848 }
36849 out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';
36850 it.compositeRule = $it.compositeRule = $wasComposite;
36851 } else {
36852 $it.schema = $aProperties;
36853 $it.schemaPath = it.schemaPath + '.additionalProperties';
36854 $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
36855 $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
36856 var $passData = $data + '[' + $key + ']';
36857 $it.dataPathArr[$dataNxt] = $key;
36858 var $code = it.validate($it);
36859 $it.baseId = $currentBaseId;
36860 if (it.util.varOccurences($code, $nextData) < 2) {
36861 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
36862 } else {
36863 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
36864 }
36865 if ($breakOnError) {
36866 out += ' if (!' + ($nextValid) + ') break; ';
36867 }
36868 }
36869 }
36870 it.errorPath = $currentErrorPath;
36871 }
36872 if ($someProperties) {
36873 out += ' } ';
36874 }
36875 out += ' } ';
36876 if ($breakOnError) {
36877 out += ' if (' + ($nextValid) + ') { ';
36878 $closingBraces += '}';
36879 }
36880 }
36881 var $useDefaults = it.opts.useDefaults && !it.compositeRule;
36882 if ($schemaKeys.length) {
36883 var arr3 = $schemaKeys;
36884 if (arr3) {
36885 var $propertyKey, i3 = -1,
36886 l3 = arr3.length - 1;
36887 while (i3 < l3) {
36888 $propertyKey = arr3[i3 += 1];
36889 var $sch = $schema[$propertyKey];
36890 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
36891 var $prop = it.util.getProperty($propertyKey),
36892 $passData = $data + $prop,
36893 $hasDefault = $useDefaults && $sch.default !== undefined;
36894 $it.schema = $sch;
36895 $it.schemaPath = $schemaPath + $prop;
36896 $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
36897 $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
36898 $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
36899 var $code = it.validate($it);
36900 $it.baseId = $currentBaseId;
36901 if (it.util.varOccurences($code, $nextData) < 2) {
36902 $code = it.util.varReplace($code, $nextData, $passData);
36903 var $useData = $passData;
36904 } else {
36905 var $useData = $nextData;
36906 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';
36907 }
36908 if ($hasDefault) {
36909 out += ' ' + ($code) + ' ';
36910 } else {
36911 if ($requiredHash && $requiredHash[$propertyKey]) {
36912 out += ' if ( ' + ($useData) + ' === undefined ';
36913 if ($ownProperties) {
36914 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
36915 }
36916 out += ') { ' + ($nextValid) + ' = false; ';
36917 var $currentErrorPath = it.errorPath,
36918 $currErrSchemaPath = $errSchemaPath,
36919 $missingProperty = it.util.escapeQuotes($propertyKey);
36920 if (it.opts._errorDataPathProperty) {
36921 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
36922 }
36923 $errSchemaPath = it.errSchemaPath + '/required';
36924 var $$outStack = $$outStack || [];
36925 $$outStack.push(out);
36926 out = ''; /* istanbul ignore else */
36927 if (it.createErrors !== false) {
36928 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
36929 if (it.opts.messages !== false) {
36930 out += ' , message: \'';
36931 if (it.opts._errorDataPathProperty) {
36932 out += 'is a required property';
36933 } else {
36934 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
36935 }
36936 out += '\' ';
36937 }
36938 if (it.opts.verbose) {
36939 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36940 }
36941 out += ' } ';
36942 } else {
36943 out += ' {} ';
36944 }
36945 var __err = out;
36946 out = $$outStack.pop();
36947 if (!it.compositeRule && $breakOnError) {
36948 /* istanbul ignore if */
36949 if (it.async) {
36950 out += ' throw new ValidationError([' + (__err) + ']); ';
36951 } else {
36952 out += ' validate.errors = [' + (__err) + ']; return false; ';
36953 }
36954 } else {
36955 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
36956 }
36957 $errSchemaPath = $currErrSchemaPath;
36958 it.errorPath = $currentErrorPath;
36959 out += ' } else { ';
36960 } else {
36961 if ($breakOnError) {
36962 out += ' if ( ' + ($useData) + ' === undefined ';
36963 if ($ownProperties) {
36964 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
36965 }
36966 out += ') { ' + ($nextValid) + ' = true; } else { ';
36967 } else {
36968 out += ' if (' + ($useData) + ' !== undefined ';
36969 if ($ownProperties) {
36970 out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
36971 }
36972 out += ' ) { ';
36973 }
36974 }
36975 out += ' ' + ($code) + ' } ';
36976 }
36977 }
36978 if ($breakOnError) {
36979 out += ' if (' + ($nextValid) + ') { ';
36980 $closingBraces += '}';
36981 }
36982 }
36983 }
36984 }
36985 if ($pPropertyKeys.length) {
36986 var arr4 = $pPropertyKeys;
36987 if (arr4) {
36988 var $pProperty, i4 = -1,
36989 l4 = arr4.length - 1;
36990 while (i4 < l4) {
36991 $pProperty = arr4[i4 += 1];
36992 var $sch = $pProperties[$pProperty];
36993 if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
36994 $it.schema = $sch;
36995 $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
36996 $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
36997 if ($ownProperties) {
36998 out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
36999 } else {
37000 out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
37001 }
37002 out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';
37003 $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
37004 var $passData = $data + '[' + $key + ']';
37005 $it.dataPathArr[$dataNxt] = $key;
37006 var $code = it.validate($it);
37007 $it.baseId = $currentBaseId;
37008 if (it.util.varOccurences($code, $nextData) < 2) {
37009 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
37010 } else {
37011 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
37012 }
37013 if ($breakOnError) {
37014 out += ' if (!' + ($nextValid) + ') break; ';
37015 }
37016 out += ' } ';
37017 if ($breakOnError) {
37018 out += ' else ' + ($nextValid) + ' = true; ';
37019 }
37020 out += ' } ';
37021 if ($breakOnError) {
37022 out += ' if (' + ($nextValid) + ') { ';
37023 $closingBraces += '}';
37024 }
37025 }
37026 }
37027 }
37028 }
37029 if ($breakOnError) {
37030 out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
37031 }
37032 return out;
37033}
37034
37035
37036/***/ }),
37037
37038/***/ 53466:
37039/***/ (function(module) {
37040
37041"use strict";
37042
37043module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
37044 var out = ' ';
37045 var $lvl = it.level;
37046 var $dataLvl = it.dataLevel;
37047 var $schema = it.schema[$keyword];
37048 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
37049 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
37050 var $breakOnError = !it.opts.allErrors;
37051 var $data = 'data' + ($dataLvl || '');
37052 var $errs = 'errs__' + $lvl;
37053 var $it = it.util.copy(it);
37054 var $closingBraces = '';
37055 $it.level++;
37056 var $nextValid = 'valid' + $it.level;
37057 out += 'var ' + ($errs) + ' = errors;';
37058 if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
37059 $it.schema = $schema;
37060 $it.schemaPath = $schemaPath;
37061 $it.errSchemaPath = $errSchemaPath;
37062 var $key = 'key' + $lvl,
37063 $idx = 'idx' + $lvl,
37064 $i = 'i' + $lvl,
37065 $invalidName = '\' + ' + $key + ' + \'',
37066 $dataNxt = $it.dataLevel = it.dataLevel + 1,
37067 $nextData = 'data' + $dataNxt,
37068 $dataProperties = 'dataProperties' + $lvl,
37069 $ownProperties = it.opts.ownProperties,
37070 $currentBaseId = it.baseId;
37071 if ($ownProperties) {
37072 out += ' var ' + ($dataProperties) + ' = undefined; ';
37073 }
37074 if ($ownProperties) {
37075 out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
37076 } else {
37077 out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
37078 }
37079 out += ' var startErrs' + ($lvl) + ' = errors; ';
37080 var $passData = $key;
37081 var $wasComposite = it.compositeRule;
37082 it.compositeRule = $it.compositeRule = true;
37083 var $code = it.validate($it);
37084 $it.baseId = $currentBaseId;
37085 if (it.util.varOccurences($code, $nextData) < 2) {
37086 out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
37087 } else {
37088 out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
37089 }
37090 it.compositeRule = $it.compositeRule = $wasComposite;
37091 out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; } var err = '; /* istanbul ignore else */
37092 if (it.createErrors !== false) {
37093 out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } ';
37094 if (it.opts.messages !== false) {
37095 out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' ';
37096 }
37097 if (it.opts.verbose) {
37098 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37099 }
37100 out += ' } ';
37101 } else {
37102 out += ' {} ';
37103 }
37104 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37105 if (!it.compositeRule && $breakOnError) {
37106 /* istanbul ignore if */
37107 if (it.async) {
37108 out += ' throw new ValidationError(vErrors); ';
37109 } else {
37110 out += ' validate.errors = vErrors; return false; ';
37111 }
37112 }
37113 if ($breakOnError) {
37114 out += ' break; ';
37115 }
37116 out += ' } }';
37117 }
37118 if ($breakOnError) {
37119 out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
37120 }
37121 return out;
37122}
37123
37124
37125/***/ }),
37126
37127/***/ 95746:
37128/***/ (function(module) {
37129
37130"use strict";
37131
37132module.exports = function generate_ref(it, $keyword, $ruleType) {
37133 var out = ' ';
37134 var $lvl = it.level;
37135 var $dataLvl = it.dataLevel;
37136 var $schema = it.schema[$keyword];
37137 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
37138 var $breakOnError = !it.opts.allErrors;
37139 var $data = 'data' + ($dataLvl || '');
37140 var $valid = 'valid' + $lvl;
37141 var $async, $refCode;
37142 if ($schema == '#' || $schema == '#/') {
37143 if (it.isRoot) {
37144 $async = it.async;
37145 $refCode = 'validate';
37146 } else {
37147 $async = it.root.schema.$async === true;
37148 $refCode = 'root.refVal[0]';
37149 }
37150 } else {
37151 var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
37152 if ($refVal === undefined) {
37153 var $message = it.MissingRefError.message(it.baseId, $schema);
37154 if (it.opts.missingRefs == 'fail') {
37155 it.logger.error($message);
37156 var $$outStack = $$outStack || [];
37157 $$outStack.push(out);
37158 out = ''; /* istanbul ignore else */
37159 if (it.createErrors !== false) {
37160 out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';
37161 if (it.opts.messages !== false) {
37162 out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
37163 }
37164 if (it.opts.verbose) {
37165 out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37166 }
37167 out += ' } ';
37168 } else {
37169 out += ' {} ';
37170 }
37171 var __err = out;
37172 out = $$outStack.pop();
37173 if (!it.compositeRule && $breakOnError) {
37174 /* istanbul ignore if */
37175 if (it.async) {
37176 out += ' throw new ValidationError([' + (__err) + ']); ';
37177 } else {
37178 out += ' validate.errors = [' + (__err) + ']; return false; ';
37179 }
37180 } else {
37181 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37182 }
37183 if ($breakOnError) {
37184 out += ' if (false) { ';
37185 }
37186 } else if (it.opts.missingRefs == 'ignore') {
37187 it.logger.warn($message);
37188 if ($breakOnError) {
37189 out += ' if (true) { ';
37190 }
37191 } else {
37192 throw new it.MissingRefError(it.baseId, $schema, $message);
37193 }
37194 } else if ($refVal.inline) {
37195 var $it = it.util.copy(it);
37196 $it.level++;
37197 var $nextValid = 'valid' + $it.level;
37198 $it.schema = $refVal.schema;
37199 $it.schemaPath = '';
37200 $it.errSchemaPath = $schema;
37201 var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
37202 out += ' ' + ($code) + ' ';
37203 if ($breakOnError) {
37204 out += ' if (' + ($nextValid) + ') { ';
37205 }
37206 } else {
37207 $async = $refVal.$async === true || (it.async && $refVal.$async !== false);
37208 $refCode = $refVal.code;
37209 }
37210 }
37211 if ($refCode) {
37212 var $$outStack = $$outStack || [];
37213 $$outStack.push(out);
37214 out = '';
37215 if (it.opts.passContext) {
37216 out += ' ' + ($refCode) + '.call(this, ';
37217 } else {
37218 out += ' ' + ($refCode) + '( ';
37219 }
37220 out += ' ' + ($data) + ', (dataPath || \'\')';
37221 if (it.errorPath != '""') {
37222 out += ' + ' + (it.errorPath);
37223 }
37224 var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
37225 $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
37226 out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';
37227 var __callValidate = out;
37228 out = $$outStack.pop();
37229 if ($async) {
37230 if (!it.async) throw new Error('async schema referenced by sync schema');
37231 if ($breakOnError) {
37232 out += ' var ' + ($valid) + '; ';
37233 }
37234 out += ' try { await ' + (__callValidate) + '; ';
37235 if ($breakOnError) {
37236 out += ' ' + ($valid) + ' = true; ';
37237 }
37238 out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';
37239 if ($breakOnError) {
37240 out += ' ' + ($valid) + ' = false; ';
37241 }
37242 out += ' } ';
37243 if ($breakOnError) {
37244 out += ' if (' + ($valid) + ') { ';
37245 }
37246 } else {
37247 out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';
37248 if ($breakOnError) {
37249 out += ' else { ';
37250 }
37251 }
37252 }
37253 return out;
37254}
37255
37256
37257/***/ }),
37258
37259/***/ 88430:
37260/***/ (function(module) {
37261
37262"use strict";
37263
37264module.exports = function generate_required(it, $keyword, $ruleType) {
37265 var out = ' ';
37266 var $lvl = it.level;
37267 var $dataLvl = it.dataLevel;
37268 var $schema = it.schema[$keyword];
37269 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
37270 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
37271 var $breakOnError = !it.opts.allErrors;
37272 var $data = 'data' + ($dataLvl || '');
37273 var $valid = 'valid' + $lvl;
37274 var $isData = it.opts.$data && $schema && $schema.$data,
37275 $schemaValue;
37276 if ($isData) {
37277 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
37278 $schemaValue = 'schema' + $lvl;
37279 } else {
37280 $schemaValue = $schema;
37281 }
37282 var $vSchema = 'schema' + $lvl;
37283 if (!$isData) {
37284 if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
37285 var $required = [];
37286 var arr1 = $schema;
37287 if (arr1) {
37288 var $property, i1 = -1,
37289 l1 = arr1.length - 1;
37290 while (i1 < l1) {
37291 $property = arr1[i1 += 1];
37292 var $propertySch = it.schema.properties[$property];
37293 if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
37294 $required[$required.length] = $property;
37295 }
37296 }
37297 }
37298 } else {
37299 var $required = $schema;
37300 }
37301 }
37302 if ($isData || $required.length) {
37303 var $currentErrorPath = it.errorPath,
37304 $loopRequired = $isData || $required.length >= it.opts.loopRequired,
37305 $ownProperties = it.opts.ownProperties;
37306 if ($breakOnError) {
37307 out += ' var missing' + ($lvl) + '; ';
37308 if ($loopRequired) {
37309 if (!$isData) {
37310 out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
37311 }
37312 var $i = 'i' + $lvl,
37313 $propertyPath = 'schema' + $lvl + '[' + $i + ']',
37314 $missingProperty = '\' + ' + $propertyPath + ' + \'';
37315 if (it.opts._errorDataPathProperty) {
37316 it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
37317 }
37318 out += ' var ' + ($valid) + ' = true; ';
37319 if ($isData) {
37320 out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
37321 }
37322 out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';
37323 if ($ownProperties) {
37324 out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
37325 }
37326 out += '; if (!' + ($valid) + ') break; } ';
37327 if ($isData) {
37328 out += ' } ';
37329 }
37330 out += ' if (!' + ($valid) + ') { ';
37331 var $$outStack = $$outStack || [];
37332 $$outStack.push(out);
37333 out = ''; /* istanbul ignore else */
37334 if (it.createErrors !== false) {
37335 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
37336 if (it.opts.messages !== false) {
37337 out += ' , message: \'';
37338 if (it.opts._errorDataPathProperty) {
37339 out += 'is a required property';
37340 } else {
37341 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
37342 }
37343 out += '\' ';
37344 }
37345 if (it.opts.verbose) {
37346 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37347 }
37348 out += ' } ';
37349 } else {
37350 out += ' {} ';
37351 }
37352 var __err = out;
37353 out = $$outStack.pop();
37354 if (!it.compositeRule && $breakOnError) {
37355 /* istanbul ignore if */
37356 if (it.async) {
37357 out += ' throw new ValidationError([' + (__err) + ']); ';
37358 } else {
37359 out += ' validate.errors = [' + (__err) + ']; return false; ';
37360 }
37361 } else {
37362 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37363 }
37364 out += ' } else { ';
37365 } else {
37366 out += ' if ( ';
37367 var arr2 = $required;
37368 if (arr2) {
37369 var $propertyKey, $i = -1,
37370 l2 = arr2.length - 1;
37371 while ($i < l2) {
37372 $propertyKey = arr2[$i += 1];
37373 if ($i) {
37374 out += ' || ';
37375 }
37376 var $prop = it.util.getProperty($propertyKey),
37377 $useData = $data + $prop;
37378 out += ' ( ( ' + ($useData) + ' === undefined ';
37379 if ($ownProperties) {
37380 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
37381 }
37382 out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
37383 }
37384 }
37385 out += ') { ';
37386 var $propertyPath = 'missing' + $lvl,
37387 $missingProperty = '\' + ' + $propertyPath + ' + \'';
37388 if (it.opts._errorDataPathProperty) {
37389 it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
37390 }
37391 var $$outStack = $$outStack || [];
37392 $$outStack.push(out);
37393 out = ''; /* istanbul ignore else */
37394 if (it.createErrors !== false) {
37395 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
37396 if (it.opts.messages !== false) {
37397 out += ' , message: \'';
37398 if (it.opts._errorDataPathProperty) {
37399 out += 'is a required property';
37400 } else {
37401 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
37402 }
37403 out += '\' ';
37404 }
37405 if (it.opts.verbose) {
37406 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37407 }
37408 out += ' } ';
37409 } else {
37410 out += ' {} ';
37411 }
37412 var __err = out;
37413 out = $$outStack.pop();
37414 if (!it.compositeRule && $breakOnError) {
37415 /* istanbul ignore if */
37416 if (it.async) {
37417 out += ' throw new ValidationError([' + (__err) + ']); ';
37418 } else {
37419 out += ' validate.errors = [' + (__err) + ']; return false; ';
37420 }
37421 } else {
37422 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37423 }
37424 out += ' } else { ';
37425 }
37426 } else {
37427 if ($loopRequired) {
37428 if (!$isData) {
37429 out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
37430 }
37431 var $i = 'i' + $lvl,
37432 $propertyPath = 'schema' + $lvl + '[' + $i + ']',
37433 $missingProperty = '\' + ' + $propertyPath + ' + \'';
37434 if (it.opts._errorDataPathProperty) {
37435 it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
37436 }
37437 if ($isData) {
37438 out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */
37439 if (it.createErrors !== false) {
37440 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
37441 if (it.opts.messages !== false) {
37442 out += ' , message: \'';
37443 if (it.opts._errorDataPathProperty) {
37444 out += 'is a required property';
37445 } else {
37446 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
37447 }
37448 out += '\' ';
37449 }
37450 if (it.opts.verbose) {
37451 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37452 }
37453 out += ' } ';
37454 } else {
37455 out += ' {} ';
37456 }
37457 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
37458 }
37459 out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';
37460 if ($ownProperties) {
37461 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
37462 }
37463 out += ') { var err = '; /* istanbul ignore else */
37464 if (it.createErrors !== false) {
37465 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
37466 if (it.opts.messages !== false) {
37467 out += ' , message: \'';
37468 if (it.opts._errorDataPathProperty) {
37469 out += 'is a required property';
37470 } else {
37471 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
37472 }
37473 out += '\' ';
37474 }
37475 if (it.opts.verbose) {
37476 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37477 }
37478 out += ' } ';
37479 } else {
37480 out += ' {} ';
37481 }
37482 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
37483 if ($isData) {
37484 out += ' } ';
37485 }
37486 } else {
37487 var arr3 = $required;
37488 if (arr3) {
37489 var $propertyKey, i3 = -1,
37490 l3 = arr3.length - 1;
37491 while (i3 < l3) {
37492 $propertyKey = arr3[i3 += 1];
37493 var $prop = it.util.getProperty($propertyKey),
37494 $missingProperty = it.util.escapeQuotes($propertyKey),
37495 $useData = $data + $prop;
37496 if (it.opts._errorDataPathProperty) {
37497 it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
37498 }
37499 out += ' if ( ' + ($useData) + ' === undefined ';
37500 if ($ownProperties) {
37501 out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
37502 }
37503 out += ') { var err = '; /* istanbul ignore else */
37504 if (it.createErrors !== false) {
37505 out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
37506 if (it.opts.messages !== false) {
37507 out += ' , message: \'';
37508 if (it.opts._errorDataPathProperty) {
37509 out += 'is a required property';
37510 } else {
37511 out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
37512 }
37513 out += '\' ';
37514 }
37515 if (it.opts.verbose) {
37516 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37517 }
37518 out += ' } ';
37519 } else {
37520 out += ' {} ';
37521 }
37522 out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
37523 }
37524 }
37525 }
37526 }
37527 it.errorPath = $currentErrorPath;
37528 } else if ($breakOnError) {
37529 out += ' if (true) {';
37530 }
37531 return out;
37532}
37533
37534
37535/***/ }),
37536
37537/***/ 12207:
37538/***/ (function(module) {
37539
37540"use strict";
37541
37542module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
37543 var out = ' ';
37544 var $lvl = it.level;
37545 var $dataLvl = it.dataLevel;
37546 var $schema = it.schema[$keyword];
37547 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
37548 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
37549 var $breakOnError = !it.opts.allErrors;
37550 var $data = 'data' + ($dataLvl || '');
37551 var $valid = 'valid' + $lvl;
37552 var $isData = it.opts.$data && $schema && $schema.$data,
37553 $schemaValue;
37554 if ($isData) {
37555 out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
37556 $schemaValue = 'schema' + $lvl;
37557 } else {
37558 $schemaValue = $schema;
37559 }
37560 if (($schema || $isData) && it.opts.uniqueItems !== false) {
37561 if ($isData) {
37562 out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';
37563 }
37564 out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';
37565 var $itemType = it.schema.items && it.schema.items.type,
37566 $typeIsArray = Array.isArray($itemType);
37567 if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {
37568 out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';
37569 } else {
37570 out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
37571 var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
37572 out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
37573 if ($typeIsArray) {
37574 out += ' if (typeof item == \'string\') item = \'"\' + item; ';
37575 }
37576 out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';
37577 }
37578 out += ' } ';
37579 if ($isData) {
37580 out += ' } ';
37581 }
37582 out += ' if (!' + ($valid) + ') { ';
37583 var $$outStack = $$outStack || [];
37584 $$outStack.push(out);
37585 out = ''; /* istanbul ignore else */
37586 if (it.createErrors !== false) {
37587 out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';
37588 if (it.opts.messages !== false) {
37589 out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' ';
37590 }
37591 if (it.opts.verbose) {
37592 out += ' , schema: ';
37593 if ($isData) {
37594 out += 'validate.schema' + ($schemaPath);
37595 } else {
37596 out += '' + ($schema);
37597 }
37598 out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37599 }
37600 out += ' } ';
37601 } else {
37602 out += ' {} ';
37603 }
37604 var __err = out;
37605 out = $$outStack.pop();
37606 if (!it.compositeRule && $breakOnError) {
37607 /* istanbul ignore if */
37608 if (it.async) {
37609 out += ' throw new ValidationError([' + (__err) + ']); ';
37610 } else {
37611 out += ' validate.errors = [' + (__err) + ']; return false; ';
37612 }
37613 } else {
37614 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37615 }
37616 out += ' } ';
37617 if ($breakOnError) {
37618 out += ' else { ';
37619 }
37620 } else {
37621 if ($breakOnError) {
37622 out += ' if (true) { ';
37623 }
37624 }
37625 return out;
37626}
37627
37628
37629/***/ }),
37630
37631/***/ 26131:
37632/***/ (function(module) {
37633
37634"use strict";
37635
37636module.exports = function generate_validate(it, $keyword, $ruleType) {
37637 var out = '';
37638 var $async = it.schema.$async === true,
37639 $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
37640 $id = it.self._getId(it.schema);
37641 if (it.opts.strictKeywords) {
37642 var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
37643 if ($unknownKwd) {
37644 var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
37645 if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
37646 else throw new Error($keywordsMsg);
37647 }
37648 }
37649 if (it.isTop) {
37650 out += ' var validate = ';
37651 if ($async) {
37652 it.async = true;
37653 out += 'async ';
37654 }
37655 out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
37656 if ($id && (it.opts.sourceCode || it.opts.processCode)) {
37657 out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' ';
37658 }
37659 }
37660 if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) {
37661 var $keyword = 'false schema';
37662 var $lvl = it.level;
37663 var $dataLvl = it.dataLevel;
37664 var $schema = it.schema[$keyword];
37665 var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
37666 var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
37667 var $breakOnError = !it.opts.allErrors;
37668 var $errorKeyword;
37669 var $data = 'data' + ($dataLvl || '');
37670 var $valid = 'valid' + $lvl;
37671 if (it.schema === false) {
37672 if (it.isTop) {
37673 $breakOnError = true;
37674 } else {
37675 out += ' var ' + ($valid) + ' = false; ';
37676 }
37677 var $$outStack = $$outStack || [];
37678 $$outStack.push(out);
37679 out = ''; /* istanbul ignore else */
37680 if (it.createErrors !== false) {
37681 out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
37682 if (it.opts.messages !== false) {
37683 out += ' , message: \'boolean schema is false\' ';
37684 }
37685 if (it.opts.verbose) {
37686 out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37687 }
37688 out += ' } ';
37689 } else {
37690 out += ' {} ';
37691 }
37692 var __err = out;
37693 out = $$outStack.pop();
37694 if (!it.compositeRule && $breakOnError) {
37695 /* istanbul ignore if */
37696 if (it.async) {
37697 out += ' throw new ValidationError([' + (__err) + ']); ';
37698 } else {
37699 out += ' validate.errors = [' + (__err) + ']; return false; ';
37700 }
37701 } else {
37702 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37703 }
37704 } else {
37705 if (it.isTop) {
37706 if ($async) {
37707 out += ' return data; ';
37708 } else {
37709 out += ' validate.errors = null; return true; ';
37710 }
37711 } else {
37712 out += ' var ' + ($valid) + ' = true; ';
37713 }
37714 }
37715 if (it.isTop) {
37716 out += ' }; return validate; ';
37717 }
37718 return out;
37719 }
37720 if (it.isTop) {
37721 var $top = it.isTop,
37722 $lvl = it.level = 0,
37723 $dataLvl = it.dataLevel = 0,
37724 $data = 'data';
37725 it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
37726 it.baseId = it.baseId || it.rootId;
37727 delete it.isTop;
37728 it.dataPathArr = [""];
37729 if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
37730 var $defaultMsg = 'default is ignored in the schema root';
37731 if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
37732 else throw new Error($defaultMsg);
37733 }
37734 out += ' var vErrors = null; ';
37735 out += ' var errors = 0; ';
37736 out += ' if (rootData === undefined) rootData = data; ';
37737 } else {
37738 var $lvl = it.level,
37739 $dataLvl = it.dataLevel,
37740 $data = 'data' + ($dataLvl || '');
37741 if ($id) it.baseId = it.resolve.url(it.baseId, $id);
37742 if ($async && !it.async) throw new Error('async schema in sync schema');
37743 out += ' var errs_' + ($lvl) + ' = errors;';
37744 }
37745 var $valid = 'valid' + $lvl,
37746 $breakOnError = !it.opts.allErrors,
37747 $closingBraces1 = '',
37748 $closingBraces2 = '';
37749 var $errorKeyword;
37750 var $typeSchema = it.schema.type,
37751 $typeIsArray = Array.isArray($typeSchema);
37752 if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
37753 if ($typeIsArray) {
37754 if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null');
37755 } else if ($typeSchema != 'null') {
37756 $typeSchema = [$typeSchema, 'null'];
37757 $typeIsArray = true;
37758 }
37759 }
37760 if ($typeIsArray && $typeSchema.length == 1) {
37761 $typeSchema = $typeSchema[0];
37762 $typeIsArray = false;
37763 }
37764 if (it.schema.$ref && $refKeywords) {
37765 if (it.opts.extendRefs == 'fail') {
37766 throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');
37767 } else if (it.opts.extendRefs !== true) {
37768 $refKeywords = false;
37769 it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
37770 }
37771 }
37772 if (it.schema.$comment && it.opts.$comment) {
37773 out += ' ' + (it.RULES.all.$comment.code(it, '$comment'));
37774 }
37775 if ($typeSchema) {
37776 if (it.opts.coerceTypes) {
37777 var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
37778 }
37779 var $rulesGroup = it.RULES.types[$typeSchema];
37780 if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) {
37781 var $schemaPath = it.schemaPath + '.type',
37782 $errSchemaPath = it.errSchemaPath + '/type';
37783 var $schemaPath = it.schemaPath + '.type',
37784 $errSchemaPath = it.errSchemaPath + '/type',
37785 $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
37786 out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
37787 if ($coerceToTypes) {
37788 var $dataType = 'dataType' + $lvl,
37789 $coerced = 'coerced' + $lvl;
37790 out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
37791 if (it.opts.coerceTypes == 'array') {
37792 out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
37793 }
37794 out += ' if (' + ($coerced) + ' !== undefined) ; ';
37795 var arr1 = $coerceToTypes;
37796 if (arr1) {
37797 var $type, $i = -1,
37798 l1 = arr1.length - 1;
37799 while ($i < l1) {
37800 $type = arr1[$i += 1];
37801 if ($type == 'string') {
37802 out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
37803 } else if ($type == 'number' || $type == 'integer') {
37804 out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
37805 if ($type == 'integer') {
37806 out += ' && !(' + ($data) + ' % 1)';
37807 }
37808 out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
37809 } else if ($type == 'boolean') {
37810 out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
37811 } else if ($type == 'null') {
37812 out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
37813 } else if (it.opts.coerceTypes == 'array' && $type == 'array') {
37814 out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
37815 }
37816 }
37817 }
37818 out += ' else { ';
37819 var $$outStack = $$outStack || [];
37820 $$outStack.push(out);
37821 out = ''; /* istanbul ignore else */
37822 if (it.createErrors !== false) {
37823 out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
37824 if ($typeIsArray) {
37825 out += '' + ($typeSchema.join(","));
37826 } else {
37827 out += '' + ($typeSchema);
37828 }
37829 out += '\' } ';
37830 if (it.opts.messages !== false) {
37831 out += ' , message: \'should be ';
37832 if ($typeIsArray) {
37833 out += '' + ($typeSchema.join(","));
37834 } else {
37835 out += '' + ($typeSchema);
37836 }
37837 out += '\' ';
37838 }
37839 if (it.opts.verbose) {
37840 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37841 }
37842 out += ' } ';
37843 } else {
37844 out += ' {} ';
37845 }
37846 var __err = out;
37847 out = $$outStack.pop();
37848 if (!it.compositeRule && $breakOnError) {
37849 /* istanbul ignore if */
37850 if (it.async) {
37851 out += ' throw new ValidationError([' + (__err) + ']); ';
37852 } else {
37853 out += ' validate.errors = [' + (__err) + ']; return false; ';
37854 }
37855 } else {
37856 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37857 }
37858 out += ' } if (' + ($coerced) + ' !== undefined) { ';
37859 var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
37860 $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
37861 out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
37862 if (!$dataLvl) {
37863 out += 'if (' + ($parentData) + ' !== undefined)';
37864 }
37865 out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } ';
37866 } else {
37867 var $$outStack = $$outStack || [];
37868 $$outStack.push(out);
37869 out = ''; /* istanbul ignore else */
37870 if (it.createErrors !== false) {
37871 out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
37872 if ($typeIsArray) {
37873 out += '' + ($typeSchema.join(","));
37874 } else {
37875 out += '' + ($typeSchema);
37876 }
37877 out += '\' } ';
37878 if (it.opts.messages !== false) {
37879 out += ' , message: \'should be ';
37880 if ($typeIsArray) {
37881 out += '' + ($typeSchema.join(","));
37882 } else {
37883 out += '' + ($typeSchema);
37884 }
37885 out += '\' ';
37886 }
37887 if (it.opts.verbose) {
37888 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
37889 }
37890 out += ' } ';
37891 } else {
37892 out += ' {} ';
37893 }
37894 var __err = out;
37895 out = $$outStack.pop();
37896 if (!it.compositeRule && $breakOnError) {
37897 /* istanbul ignore if */
37898 if (it.async) {
37899 out += ' throw new ValidationError([' + (__err) + ']); ';
37900 } else {
37901 out += ' validate.errors = [' + (__err) + ']; return false; ';
37902 }
37903 } else {
37904 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
37905 }
37906 }
37907 out += ' } ';
37908 }
37909 }
37910 if (it.schema.$ref && !$refKeywords) {
37911 out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' ';
37912 if ($breakOnError) {
37913 out += ' } if (errors === ';
37914 if ($top) {
37915 out += '0';
37916 } else {
37917 out += 'errs_' + ($lvl);
37918 }
37919 out += ') { ';
37920 $closingBraces2 += '}';
37921 }
37922 } else {
37923 var arr2 = it.RULES;
37924 if (arr2) {
37925 var $rulesGroup, i2 = -1,
37926 l2 = arr2.length - 1;
37927 while (i2 < l2) {
37928 $rulesGroup = arr2[i2 += 1];
37929 if ($shouldUseGroup($rulesGroup)) {
37930 if ($rulesGroup.type) {
37931 out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
37932 }
37933 if (it.opts.useDefaults) {
37934 if ($rulesGroup.type == 'object' && it.schema.properties) {
37935 var $schema = it.schema.properties,
37936 $schemaKeys = Object.keys($schema);
37937 var arr3 = $schemaKeys;
37938 if (arr3) {
37939 var $propertyKey, i3 = -1,
37940 l3 = arr3.length - 1;
37941 while (i3 < l3) {
37942 $propertyKey = arr3[i3 += 1];
37943 var $sch = $schema[$propertyKey];
37944 if ($sch.default !== undefined) {
37945 var $passData = $data + it.util.getProperty($propertyKey);
37946 if (it.compositeRule) {
37947 if (it.opts.strictDefaults) {
37948 var $defaultMsg = 'default is ignored for: ' + $passData;
37949 if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
37950 else throw new Error($defaultMsg);
37951 }
37952 } else {
37953 out += ' if (' + ($passData) + ' === undefined ';
37954 if (it.opts.useDefaults == 'empty') {
37955 out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
37956 }
37957 out += ' ) ' + ($passData) + ' = ';
37958 if (it.opts.useDefaults == 'shared') {
37959 out += ' ' + (it.useDefault($sch.default)) + ' ';
37960 } else {
37961 out += ' ' + (JSON.stringify($sch.default)) + ' ';
37962 }
37963 out += '; ';
37964 }
37965 }
37966 }
37967 }
37968 } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {
37969 var arr4 = it.schema.items;
37970 if (arr4) {
37971 var $sch, $i = -1,
37972 l4 = arr4.length - 1;
37973 while ($i < l4) {
37974 $sch = arr4[$i += 1];
37975 if ($sch.default !== undefined) {
37976 var $passData = $data + '[' + $i + ']';
37977 if (it.compositeRule) {
37978 if (it.opts.strictDefaults) {
37979 var $defaultMsg = 'default is ignored for: ' + $passData;
37980 if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
37981 else throw new Error($defaultMsg);
37982 }
37983 } else {
37984 out += ' if (' + ($passData) + ' === undefined ';
37985 if (it.opts.useDefaults == 'empty') {
37986 out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
37987 }
37988 out += ' ) ' + ($passData) + ' = ';
37989 if (it.opts.useDefaults == 'shared') {
37990 out += ' ' + (it.useDefault($sch.default)) + ' ';
37991 } else {
37992 out += ' ' + (JSON.stringify($sch.default)) + ' ';
37993 }
37994 out += '; ';
37995 }
37996 }
37997 }
37998 }
37999 }
38000 }
38001 var arr5 = $rulesGroup.rules;
38002 if (arr5) {
38003 var $rule, i5 = -1,
38004 l5 = arr5.length - 1;
38005 while (i5 < l5) {
38006 $rule = arr5[i5 += 1];
38007 if ($shouldUseRule($rule)) {
38008 var $code = $rule.code(it, $rule.keyword, $rulesGroup.type);
38009 if ($code) {
38010 out += ' ' + ($code) + ' ';
38011 if ($breakOnError) {
38012 $closingBraces1 += '}';
38013 }
38014 }
38015 }
38016 }
38017 }
38018 if ($breakOnError) {
38019 out += ' ' + ($closingBraces1) + ' ';
38020 $closingBraces1 = '';
38021 }
38022 if ($rulesGroup.type) {
38023 out += ' } ';
38024 if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) {
38025 out += ' else { ';
38026 var $schemaPath = it.schemaPath + '.type',
38027 $errSchemaPath = it.errSchemaPath + '/type';
38028 var $$outStack = $$outStack || [];
38029 $$outStack.push(out);
38030 out = ''; /* istanbul ignore else */
38031 if (it.createErrors !== false) {
38032 out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
38033 if ($typeIsArray) {
38034 out += '' + ($typeSchema.join(","));
38035 } else {
38036 out += '' + ($typeSchema);
38037 }
38038 out += '\' } ';
38039 if (it.opts.messages !== false) {
38040 out += ' , message: \'should be ';
38041 if ($typeIsArray) {
38042 out += '' + ($typeSchema.join(","));
38043 } else {
38044 out += '' + ($typeSchema);
38045 }
38046 out += '\' ';
38047 }
38048 if (it.opts.verbose) {
38049 out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
38050 }
38051 out += ' } ';
38052 } else {
38053 out += ' {} ';
38054 }
38055 var __err = out;
38056 out = $$outStack.pop();
38057 if (!it.compositeRule && $breakOnError) {
38058 /* istanbul ignore if */
38059 if (it.async) {
38060 out += ' throw new ValidationError([' + (__err) + ']); ';
38061 } else {
38062 out += ' validate.errors = [' + (__err) + ']; return false; ';
38063 }
38064 } else {
38065 out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
38066 }
38067 out += ' } ';
38068 }
38069 }
38070 if ($breakOnError) {
38071 out += ' if (errors === ';
38072 if ($top) {
38073 out += '0';
38074 } else {
38075 out += 'errs_' + ($lvl);
38076 }
38077 out += ') { ';
38078 $closingBraces2 += '}';
38079 }
38080 }
38081 }
38082 }
38083 }
38084 if ($breakOnError) {
38085 out += ' ' + ($closingBraces2) + ' ';
38086 }
38087 if ($top) {
38088 if ($async) {
38089 out += ' if (errors === 0) return data; ';
38090 out += ' else throw new ValidationError(vErrors); ';
38091 } else {
38092 out += ' validate.errors = vErrors; ';
38093 out += ' return errors === 0; ';
38094 }
38095 out += ' }; return validate;';
38096 } else {
38097 out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
38098 }
38099
38100 function $shouldUseGroup($rulesGroup) {
38101 var rules = $rulesGroup.rules;
38102 for (var i = 0; i < rules.length; i++)
38103 if ($shouldUseRule(rules[i])) return true;
38104 }
38105
38106 function $shouldUseRule($rule) {
38107 return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule));
38108 }
38109
38110 function $ruleImplementsSomeKeyword($rule) {
38111 var impl = $rule.implements;
38112 for (var i = 0; i < impl.length; i++)
38113 if (it.schema[impl[i]] !== undefined) return true;
38114 }
38115 return out;
38116}
38117
38118
38119/***/ }),
38120
38121/***/ 58093:
38122/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
38123
38124"use strict";
38125
38126
38127var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
38128var customRuleCode = __webpack_require__(87921);
38129var definitionSchema = __webpack_require__(55533);
38130
38131module.exports = {
38132 add: addKeyword,
38133 get: getKeyword,
38134 remove: removeKeyword,
38135 validate: validateKeyword
38136};
38137
38138
38139/**
38140 * Define custom keyword
38141 * @this Ajv
38142 * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
38143 * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
38144 * @return {Ajv} this for method chaining
38145 */
38146function addKeyword(keyword, definition) {
38147 /* jshint validthis: true */
38148 /* eslint no-shadow: 0 */
38149 var RULES = this.RULES;
38150 if (RULES.keywords[keyword])
38151 throw new Error('Keyword ' + keyword + ' is already defined');
38152
38153 if (!IDENTIFIER.test(keyword))
38154 throw new Error('Keyword ' + keyword + ' is not a valid identifier');
38155
38156 if (definition) {
38157 this.validateKeyword(definition, true);
38158
38159 var dataType = definition.type;
38160 if (Array.isArray(dataType)) {
38161 for (var i=0; i<dataType.length; i++)
38162 _addRule(keyword, dataType[i], definition);
38163 } else {
38164 _addRule(keyword, dataType, definition);
38165 }
38166
38167 var metaSchema = definition.metaSchema;
38168 if (metaSchema) {
38169 if (definition.$data && this._opts.$data) {
38170 metaSchema = {
38171 anyOf: [
38172 metaSchema,
38173 { '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
38174 ]
38175 };
38176 }
38177 definition.validateSchema = this.compile(metaSchema, true);
38178 }
38179 }
38180
38181 RULES.keywords[keyword] = RULES.all[keyword] = true;
38182
38183
38184 function _addRule(keyword, dataType, definition) {
38185 var ruleGroup;
38186 for (var i=0; i<RULES.length; i++) {
38187 var rg = RULES[i];
38188 if (rg.type == dataType) {
38189 ruleGroup = rg;
38190 break;
38191 }
38192 }
38193
38194 if (!ruleGroup) {
38195 ruleGroup = { type: dataType, rules: [] };
38196 RULES.push(ruleGroup);
38197 }
38198
38199 var rule = {
38200 keyword: keyword,
38201 definition: definition,
38202 custom: true,
38203 code: customRuleCode,
38204 implements: definition.implements
38205 };
38206 ruleGroup.rules.push(rule);
38207 RULES.custom[keyword] = rule;
38208 }
38209
38210 return this;
38211}
38212
38213
38214/**
38215 * Get keyword
38216 * @this Ajv
38217 * @param {String} keyword pre-defined or custom keyword.
38218 * @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
38219 */
38220function getKeyword(keyword) {
38221 /* jshint validthis: true */
38222 var rule = this.RULES.custom[keyword];
38223 return rule ? rule.definition : this.RULES.keywords[keyword] || false;
38224}
38225
38226
38227/**
38228 * Remove keyword
38229 * @this Ajv
38230 * @param {String} keyword pre-defined or custom keyword.
38231 * @return {Ajv} this for method chaining
38232 */
38233function removeKeyword(keyword) {
38234 /* jshint validthis: true */
38235 var RULES = this.RULES;
38236 delete RULES.keywords[keyword];
38237 delete RULES.all[keyword];
38238 delete RULES.custom[keyword];
38239 for (var i=0; i<RULES.length; i++) {
38240 var rules = RULES[i].rules;
38241 for (var j=0; j<rules.length; j++) {
38242 if (rules[j].keyword == keyword) {
38243 rules.splice(j, 1);
38244 break;
38245 }
38246 }
38247 }
38248 return this;
38249}
38250
38251
38252/**
38253 * Validate keyword definition
38254 * @this Ajv
38255 * @param {Object} definition keyword definition object.
38256 * @param {Boolean} throwError true to throw exception if definition is invalid
38257 * @return {boolean} validation result
38258 */
38259function validateKeyword(definition, throwError) {
38260 validateKeyword.errors = null;
38261 var v = this._validateKeyword = this._validateKeyword
38262 || this.compile(definitionSchema, true);
38263
38264 if (v(definition)) return true;
38265 validateKeyword.errors = v.errors;
38266 if (throwError)
38267 throw new Error('custom keyword definition is invalid: ' + this.errorsText(v.errors));
38268 else
38269 return false;
38270}
38271
38272
38273/***/ }),
38274
38275/***/ 9455:
38276/***/ (function(module) {
38277
38278"use strict";
38279/*!
38280 * arr-diff <https://github.com/jonschlinkert/arr-diff>
38281 *
38282 * Copyright (c) 2014-2017, Jon Schlinkert.
38283 * Released under the MIT License.
38284 */
38285
38286
38287
38288module.exports = function diff(arr/*, arrays*/) {
38289 var len = arguments.length;
38290 var idx = 0;
38291 while (++idx < len) {
38292 arr = diffArray(arr, arguments[idx]);
38293 }
38294 return arr;
38295};
38296
38297function diffArray(one, two) {
38298 if (!Array.isArray(two)) {
38299 return one.slice();
38300 }
38301
38302 var tlen = two.length
38303 var olen = one.length;
38304 var idx = -1;
38305 var arr = [];
38306
38307 while (++idx < olen) {
38308 var ele = one[idx];
38309
38310 var hasEle = false;
38311 for (var i = 0; i < tlen; i++) {
38312 var val = two[i];
38313
38314 if (ele === val) {
38315 hasEle = true;
38316 break;
38317 }
38318 }
38319
38320 if (hasEle === false) {
38321 arr.push(ele);
38322 }
38323 }
38324 return arr;
38325}
38326
38327
38328/***/ }),
38329
38330/***/ 27299:
38331/***/ (function(module) {
38332
38333"use strict";
38334/*!
38335 * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
38336 *
38337 * Copyright (c) 2014-2017, Jon Schlinkert.
38338 * Released under the MIT License.
38339 */
38340
38341
38342
38343module.exports = function (arr) {
38344 return flat(arr, []);
38345};
38346
38347function flat(arr, res) {
38348 var i = 0, cur;
38349 var len = arr.length;
38350 for (; i < len; i++) {
38351 cur = arr[i];
38352 Array.isArray(cur) ? flat(cur, res) : res.push(cur);
38353 }
38354 return res;
38355}
38356
38357
38358/***/ }),
38359
38360/***/ 69123:
38361/***/ (function(module) {
38362
38363"use strict";
38364
38365
38366module.exports = function union(init) {
38367 if (!Array.isArray(init)) {
38368 throw new TypeError('arr-union expects the first argument to be an array.');
38369 }
38370
38371 var len = arguments.length;
38372 var i = 0;
38373
38374 while (++i < len) {
38375 var arg = arguments[i];
38376 if (!arg) continue;
38377
38378 if (!Array.isArray(arg)) {
38379 arg = [arg];
38380 }
38381
38382 for (var j = 0; j < arg.length; j++) {
38383 var ele = arg[j];
38384
38385 if (init.indexOf(ele) >= 0) {
38386 continue;
38387 }
38388 init.push(ele);
38389 }
38390 }
38391 return init;
38392};
38393
38394
38395/***/ }),
38396
38397/***/ 19009:
38398/***/ (function(module) {
38399
38400"use strict";
38401/*!
38402 * array-unique <https://github.com/jonschlinkert/array-unique>
38403 *
38404 * Copyright (c) 2014-2015, Jon Schlinkert.
38405 * Licensed under the MIT License.
38406 */
38407
38408
38409
38410module.exports = function unique(arr) {
38411 if (!Array.isArray(arr)) {
38412 throw new TypeError('array-unique expects an array.');
38413 }
38414
38415 var len = arr.length;
38416 var i = -1;
38417
38418 while (i++ < len) {
38419 var j = i + 1;
38420
38421 for (; j < arr.length; ++j) {
38422 if (arr[i] === arr[j]) {
38423 arr.splice(j--, 1);
38424 }
38425 }
38426 }
38427 return arr;
38428};
38429
38430module.exports.immutable = function uniqueImmutable(arr) {
38431 if (!Array.isArray(arr)) {
38432 throw new TypeError('array-unique expects an array.');
38433 }
38434
38435 var arrLen = arr.length;
38436 var newArr = new Array(arrLen);
38437
38438 for (var i = 0; i < arrLen; i++) {
38439 newArr[i] = arr[i];
38440 }
38441
38442 return module.exports(newArr);
38443};
38444
38445
38446/***/ }),
38447
38448/***/ 64353:
38449/***/ (function(module) {
38450
38451"use strict";
38452/*!
38453 * assign-symbols <https://github.com/jonschlinkert/assign-symbols>
38454 *
38455 * Copyright (c) 2015, Jon Schlinkert.
38456 * Licensed under the MIT License.
38457 */
38458
38459
38460
38461module.exports = function(receiver, objects) {
38462 if (receiver === null || typeof receiver === 'undefined') {
38463 throw new TypeError('expected first argument to be an object.');
38464 }
38465
38466 if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {
38467 return receiver;
38468 }
38469
38470 if (typeof Object.getOwnPropertySymbols !== 'function') {
38471 return receiver;
38472 }
38473
38474 var isEnumerable = Object.prototype.propertyIsEnumerable;
38475 var target = Object(receiver);
38476 var len = arguments.length, i = 0;
38477
38478 while (++i < len) {
38479 var provider = Object(arguments[i]);
38480 var names = Object.getOwnPropertySymbols(provider);
38481
38482 for (var j = 0; j < names.length; j++) {
38483 var key = names[j];
38484
38485 if (isEnumerable.call(provider, key)) {
38486 target[key] = provider[key];
38487 }
38488 }
38489 }
38490 return target;
38491};
38492
38493
38494/***/ }),
38495
38496/***/ 83327:
38497/***/ (function(module) {
38498
38499"use strict";
38500
38501
38502function atob(str) {
38503 return Buffer.from(str, 'base64').toString('binary');
38504}
38505
38506module.exports = atob.atob = atob;
38507
38508
38509/***/ }),
38510
38511/***/ 87263:
38512/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
38513
38514"use strict";
38515
38516
38517var util = __webpack_require__(31669);
38518var define = __webpack_require__(90563);
38519var CacheBase = __webpack_require__(63375);
38520var Emitter = __webpack_require__(79458);
38521var isObject = __webpack_require__(96667);
38522var merge = __webpack_require__(4870);
38523var pascal = __webpack_require__(27255);
38524var cu = __webpack_require__(71523);
38525
38526/**
38527 * Optionally define a custom `cache` namespace to use.
38528 */
38529
38530function namespace(name) {
38531 var Cache = name ? CacheBase.namespace(name) : CacheBase;
38532 var fns = [];
38533
38534 /**
38535 * Create an instance of `Base` with the given `config` and `options`.
38536 *
38537 * ```js
38538 * // initialize with `config` and `options`
38539 * var app = new Base({isApp: true}, {abc: true});
38540 * app.set('foo', 'bar');
38541 *
38542 * // values defined with the given `config` object will be on the root of the instance
38543 * console.log(app.baz); //=> undefined
38544 * console.log(app.foo); //=> 'bar'
38545 * // or use `.get`
38546 * console.log(app.get('isApp')); //=> true
38547 * console.log(app.get('foo')); //=> 'bar'
38548 *
38549 * // values defined with the given `options` object will be on `app.options
38550 * console.log(app.options.abc); //=> true
38551 * ```
38552 *
38553 * @param {Object} `config` If supplied, this object is passed to [cache-base][] to merge onto the the instance upon instantiation.
38554 * @param {Object} `options` If supplied, this object is used to initialize the `base.options` object.
38555 * @api public
38556 */
38557
38558 function Base(config, options) {
38559 if (!(this instanceof Base)) {
38560 return new Base(config, options);
38561 }
38562 Cache.call(this, config);
38563 this.is('base');
38564 this.initBase(config, options);
38565 }
38566
38567 /**
38568 * Inherit cache-base
38569 */
38570
38571 util.inherits(Base, Cache);
38572
38573 /**
38574 * Add static emitter methods
38575 */
38576
38577 Emitter(Base);
38578
38579 /**
38580 * Initialize `Base` defaults with the given `config` object
38581 */
38582
38583 Base.prototype.initBase = function(config, options) {
38584 this.options = merge({}, this.options, options);
38585 this.cache = this.cache || {};
38586 this.define('registered', {});
38587 if (name) this[name] = {};
38588
38589 // make `app._callbacks` non-enumerable
38590 this.define('_callbacks', this._callbacks);
38591 if (isObject(config)) {
38592 this.visit('set', config);
38593 }
38594 Base.run(this, 'use', fns);
38595 };
38596
38597 /**
38598 * Set the given `name` on `app._name` and `app.is*` properties. Used for doing
38599 * lookups in plugins.
38600 *
38601 * ```js
38602 * app.is('foo');
38603 * console.log(app._name);
38604 * //=> 'foo'
38605 * console.log(app.isFoo);
38606 * //=> true
38607 * app.is('bar');
38608 * console.log(app.isFoo);
38609 * //=> true
38610 * console.log(app.isBar);
38611 * //=> true
38612 * console.log(app._name);
38613 * //=> 'bar'
38614 * ```
38615 * @name .is
38616 * @param {String} `name`
38617 * @return {Boolean}
38618 * @api public
38619 */
38620
38621 Base.prototype.is = function(name) {
38622 if (typeof name !== 'string') {
38623 throw new TypeError('expected name to be a string');
38624 }
38625 this.define('is' + pascal(name), true);
38626 this.define('_name', name);
38627 this.define('_appname', name);
38628 return this;
38629 };
38630
38631 /**
38632 * Returns true if a plugin has already been registered on an instance.
38633 *
38634 * Plugin implementors are encouraged to use this first thing in a plugin
38635 * to prevent the plugin from being called more than once on the same
38636 * instance.
38637 *
38638 * ```js
38639 * var base = new Base();
38640 * base.use(function(app) {
38641 * if (app.isRegistered('myPlugin')) return;
38642 * // do stuff to `app`
38643 * });
38644 *
38645 * // to also record the plugin as being registered
38646 * base.use(function(app) {
38647 * if (app.isRegistered('myPlugin', true)) return;
38648 * // do stuff to `app`
38649 * });
38650 * ```
38651 * @name .isRegistered
38652 * @emits `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once.
38653 * @param {String} `name` The plugin name.
38654 * @param {Boolean} `register` If the plugin if not already registered, to record it as being registered pass `true` as the second argument.
38655 * @return {Boolean} Returns true if a plugin is already registered.
38656 * @api public
38657 */
38658
38659 Base.prototype.isRegistered = function(name, register) {
38660 if (this.registered.hasOwnProperty(name)) {
38661 return true;
38662 }
38663 if (register !== false) {
38664 this.registered[name] = true;
38665 this.emit('plugin', name);
38666 }
38667 return false;
38668 };
38669
38670 /**
38671 * Define a plugin function to be called immediately upon init. Plugins are chainable
38672 * and expose the following arguments to the plugin function:
38673 *
38674 * - `app`: the current instance of `Base`
38675 * - `base`: the [first ancestor instance](#base) of `Base`
38676 *
38677 * ```js
38678 * var app = new Base()
38679 * .use(foo)
38680 * .use(bar)
38681 * .use(baz)
38682 * ```
38683 * @name .use
38684 * @param {Function} `fn` plugin function to call
38685 * @return {Object} Returns the item instance for chaining.
38686 * @api public
38687 */
38688
38689 Base.prototype.use = function(fn) {
38690 fn.call(this, this);
38691 return this;
38692 };
38693
38694 /**
38695 * The `.define` method is used for adding non-enumerable property on the instance.
38696 * Dot-notation is **not supported** with `define`.
38697 *
38698 * ```js
38699 * // arbitrary `render` function using lodash `template`
38700 * app.define('render', function(str, locals) {
38701 * return _.template(str)(locals);
38702 * });
38703 * ```
38704 * @name .define
38705 * @param {String} `key` The name of the property to define.
38706 * @param {any} `value`
38707 * @return {Object} Returns the instance for chaining.
38708 * @api public
38709 */
38710
38711 Base.prototype.define = function(key, val) {
38712 if (isObject(key)) {
38713 return this.visit('define', key);
38714 }
38715 define(this, key, val);
38716 return this;
38717 };
38718
38719 /**
38720 * Mix property `key` onto the Base prototype. If base is inherited using
38721 * `Base.extend` this method will be overridden by a new `mixin` method that will
38722 * only add properties to the prototype of the inheriting application.
38723 *
38724 * ```js
38725 * app.mixin('foo', function() {
38726 * // do stuff
38727 * });
38728 * ```
38729 * @name .mixin
38730 * @param {String} `key`
38731 * @param {Object|Array} `val`
38732 * @return {Object} Returns the `base` instance for chaining.
38733 * @api public
38734 */
38735
38736 Base.prototype.mixin = function(key, val) {
38737 Base.prototype[key] = val;
38738 return this;
38739 };
38740
38741 /**
38742 * Non-enumberable mixin array, used by the static [Base.mixin]() method.
38743 */
38744
38745 Base.prototype.mixins = Base.prototype.mixins || [];
38746
38747 /**
38748 * Getter/setter used when creating nested instances of `Base`, for storing a reference
38749 * to the first ancestor instance. This works by setting an instance of `Base` on the `parent`
38750 * property of a "child" instance. The `base` property defaults to the current instance if
38751 * no `parent` property is defined.
38752 *
38753 * ```js
38754 * // create an instance of `Base`, this is our first ("base") instance
38755 * var first = new Base();
38756 * first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later
38757 *
38758 * // create another instance
38759 * var second = new Base();
38760 * // create a reference to the first instance (`first`)
38761 * second.parent = first;
38762 *
38763 * // create another instance
38764 * var third = new Base();
38765 * // create a reference to the previous instance (`second`)
38766 * // repeat this pattern every time a "child" instance is created
38767 * third.parent = second;
38768 *
38769 * // we can always access the first instance using the `base` property
38770 * console.log(first.base.foo);
38771 * //=> 'bar'
38772 * console.log(second.base.foo);
38773 * //=> 'bar'
38774 * console.log(third.base.foo);
38775 * //=> 'bar'
38776 * // and now you know how to get to third base ;)
38777 * ```
38778 * @name .base
38779 * @api public
38780 */
38781
38782 Object.defineProperty(Base.prototype, 'base', {
38783 configurable: true,
38784 get: function() {
38785 return this.parent ? this.parent.base : this;
38786 }
38787 });
38788
38789 /**
38790 * Static method for adding global plugin functions that will
38791 * be added to an instance when created.
38792 *
38793 * ```js
38794 * Base.use(function(app) {
38795 * app.foo = 'bar';
38796 * });
38797 * var app = new Base();
38798 * console.log(app.foo);
38799 * //=> 'bar'
38800 * ```
38801 * @name #use
38802 * @param {Function} `fn` Plugin function to use on each instance.
38803 * @return {Object} Returns the `Base` constructor for chaining
38804 * @api public
38805 */
38806
38807 define(Base, 'use', function(fn) {
38808 fns.push(fn);
38809 return Base;
38810 });
38811
38812 /**
38813 * Run an array of functions by passing each function
38814 * to a method on the given object specified by the given property.
38815 *
38816 * @param {Object} `obj` Object containing method to use.
38817 * @param {String} `prop` Name of the method on the object to use.
38818 * @param {Array} `arr` Array of functions to pass to the method.
38819 */
38820
38821 define(Base, 'run', function(obj, prop, arr) {
38822 var len = arr.length, i = 0;
38823 while (len--) {
38824 obj[prop](arr[i++]);
38825 }
38826 return Base;
38827 });
38828
38829 /**
38830 * Static method for inheriting the prototype and static methods of the `Base` class.
38831 * This method greatly simplifies the process of creating inheritance-based applications.
38832 * See [static-extend][] for more details.
38833 *
38834 * ```js
38835 * var extend = cu.extend(Parent);
38836 * Parent.extend(Child);
38837 *
38838 * // optional methods
38839 * Parent.extend(Child, {
38840 * foo: function() {},
38841 * bar: function() {}
38842 * });
38843 * ```
38844 * @name #extend
38845 * @param {Function} `Ctor` constructor to extend
38846 * @param {Object} `methods` Optional prototype properties to mix in.
38847 * @return {Object} Returns the `Base` constructor for chaining
38848 * @api public
38849 */
38850
38851 define(Base, 'extend', cu.extend(Base, function(Ctor, Parent) {
38852 Ctor.prototype.mixins = Ctor.prototype.mixins || [];
38853
38854 define(Ctor, 'mixin', function(fn) {
38855 var mixin = fn(Ctor.prototype, Ctor);
38856 if (typeof mixin === 'function') {
38857 Ctor.prototype.mixins.push(mixin);
38858 }
38859 return Ctor;
38860 });
38861
38862 define(Ctor, 'mixins', function(Child) {
38863 Base.run(Child, 'mixin', Ctor.prototype.mixins);
38864 return Ctor;
38865 });
38866
38867 Ctor.prototype.mixin = function(key, value) {
38868 Ctor.prototype[key] = value;
38869 return this;
38870 };
38871 return Base;
38872 }));
38873
38874 /**
38875 * Used for adding methods to the `Base` prototype, and/or to the prototype of child instances.
38876 * When a mixin function returns a function, the returned function is pushed onto the `.mixins`
38877 * array, making it available to be used on inheriting classes whenever `Base.mixins()` is
38878 * called (e.g. `Base.mixins(Child)`).
38879 *
38880 * ```js
38881 * Base.mixin(function(proto) {
38882 * proto.foo = function(msg) {
38883 * return 'foo ' + msg;
38884 * };
38885 * });
38886 * ```
38887 * @name #mixin
38888 * @param {Function} `fn` Function to call
38889 * @return {Object} Returns the `Base` constructor for chaining
38890 * @api public
38891 */
38892
38893 define(Base, 'mixin', function(fn) {
38894 var mixin = fn(Base.prototype, Base);
38895 if (typeof mixin === 'function') {
38896 Base.prototype.mixins.push(mixin);
38897 }
38898 return Base;
38899 });
38900
38901 /**
38902 * Static method for running global mixin functions against a child constructor.
38903 * Mixins must be registered before calling this method.
38904 *
38905 * ```js
38906 * Base.extend(Child);
38907 * Base.mixins(Child);
38908 * ```
38909 * @name #mixins
38910 * @param {Function} `Child` Constructor function of a child class
38911 * @return {Object} Returns the `Base` constructor for chaining
38912 * @api public
38913 */
38914
38915 define(Base, 'mixins', function(Child) {
38916 Base.run(Child, 'mixin', Base.prototype.mixins);
38917 return Base;
38918 });
38919
38920 /**
38921 * Similar to `util.inherit`, but copies all static properties, prototype properties, and
38922 * getters/setters from `Provider` to `Receiver`. See [class-utils][]{#inherit} for more details.
38923 *
38924 * ```js
38925 * Base.inherit(Foo, Bar);
38926 * ```
38927 * @name #inherit
38928 * @param {Function} `Receiver` Receiving (child) constructor
38929 * @param {Function} `Provider` Providing (parent) constructor
38930 * @return {Object} Returns the `Base` constructor for chaining
38931 * @api public
38932 */
38933
38934 define(Base, 'inherit', cu.inherit);
38935 define(Base, 'bubble', cu.bubble);
38936 return Base;
38937}
38938
38939/**
38940 * Expose `Base` with default settings
38941 */
38942
38943module.exports = namespace();
38944
38945/**
38946 * Allow users to define a namespace
38947 */
38948
38949module.exports.namespace = namespace;
38950
38951
38952/***/ }),
38953
38954/***/ 90563:
38955/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
38956
38957"use strict";
38958/*!
38959 * define-property <https://github.com/jonschlinkert/define-property>
38960 *
38961 * Copyright (c) 2015, 2017, Jon Schlinkert.
38962 * Released under the MIT License.
38963 */
38964
38965
38966
38967var isDescriptor = __webpack_require__(44133);
38968
38969module.exports = function defineProperty(obj, prop, val) {
38970 if (typeof obj !== 'object' && typeof obj !== 'function') {
38971 throw new TypeError('expected an object or function.');
38972 }
38973
38974 if (typeof prop !== 'string') {
38975 throw new TypeError('expected `prop` to be a string.');
38976 }
38977
38978 if (isDescriptor(val) && ('set' in val || 'get' in val)) {
38979 return Object.defineProperty(obj, prop, val);
38980 }
38981
38982 return Object.defineProperty(obj, prop, {
38983 configurable: true,
38984 enumerable: false,
38985 writable: true,
38986 value: val
38987 });
38988};
38989
38990
38991/***/ }),
38992
38993/***/ 63375:
38994/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
38995
38996"use strict";
38997
38998
38999var isObject = __webpack_require__(96667);
39000var Emitter = __webpack_require__(79458);
39001var visit = __webpack_require__(16704);
39002var toPath = __webpack_require__(71708);
39003var union = __webpack_require__(7716);
39004var del = __webpack_require__(5834);
39005var get = __webpack_require__(89304);
39006var has = __webpack_require__(41825);
39007var set = __webpack_require__(34857);
39008
39009/**
39010 * Create a `Cache` constructor that when instantiated will
39011 * store values on the given `prop`.
39012 *
39013 * ```js
39014 * var Cache = require('cache-base').namespace('data');
39015 * var cache = new Cache();
39016 *
39017 * cache.set('foo', 'bar');
39018 * //=> {data: {foo: 'bar'}}
39019 * ```
39020 * @param {String} `prop` The property name to use for storing values.
39021 * @return {Function} Returns a custom `Cache` constructor
39022 * @api public
39023 */
39024
39025function namespace(prop) {
39026
39027 /**
39028 * Create a new `Cache`. Internally the `Cache` constructor is created using
39029 * the `namespace` function, with `cache` defined as the storage object.
39030 *
39031 * ```js
39032 * var app = new Cache();
39033 * ```
39034 * @param {Object} `cache` Optionally pass an object to initialize with.
39035 * @constructor
39036 * @api public
39037 */
39038
39039 function Cache(cache) {
39040 if (prop) {
39041 this[prop] = {};
39042 }
39043 if (cache) {
39044 this.set(cache);
39045 }
39046 }
39047
39048 /**
39049 * Inherit Emitter
39050 */
39051
39052 Emitter(Cache.prototype);
39053
39054 /**
39055 * Assign `value` to `key`. Also emits `set` with
39056 * the key and value.
39057 *
39058 * ```js
39059 * app.on('set', function(key, val) {
39060 * // do something when `set` is emitted
39061 * });
39062 *
39063 * app.set(key, value);
39064 *
39065 * // also takes an object or array
39066 * app.set({name: 'Halle'});
39067 * app.set([{foo: 'bar'}, {baz: 'quux'}]);
39068 * console.log(app);
39069 * //=> {name: 'Halle', foo: 'bar', baz: 'quux'}
39070 * ```
39071 *
39072 * @name .set
39073 * @emits `set` with `key` and `value` as arguments.
39074 * @param {String} `key`
39075 * @param {any} `value`
39076 * @return {Object} Returns the instance for chaining.
39077 * @api public
39078 */
39079
39080 Cache.prototype.set = function(key, val) {
39081 if (Array.isArray(key) && arguments.length === 2) {
39082 key = toPath(key);
39083 }
39084 if (isObject(key) || Array.isArray(key)) {
39085 this.visit('set', key);
39086 } else {
39087 set(prop ? this[prop] : this, key, val);
39088 this.emit('set', key, val);
39089 }
39090 return this;
39091 };
39092
39093 /**
39094 * Union `array` to `key`. Also emits `set` with
39095 * the key and value.
39096 *
39097 * ```js
39098 * app.union('a.b', ['foo']);
39099 * app.union('a.b', ['bar']);
39100 * console.log(app.get('a'));
39101 * //=> {b: ['foo', 'bar']}
39102 * ```
39103 * @name .union
39104 * @param {String} `key`
39105 * @param {any} `value`
39106 * @return {Object} Returns the instance for chaining.
39107 * @api public
39108 */
39109
39110 Cache.prototype.union = function(key, val) {
39111 if (Array.isArray(key) && arguments.length === 2) {
39112 key = toPath(key);
39113 }
39114 var ctx = prop ? this[prop] : this;
39115 union(ctx, key, arrayify(val));
39116 this.emit('union', val);
39117 return this;
39118 };
39119
39120 /**
39121 * Return the value of `key`. Dot notation may be used
39122 * to get [nested property values][get-value].
39123 *
39124 * ```js
39125 * app.set('a.b.c', 'd');
39126 * app.get('a.b');
39127 * //=> {c: 'd'}
39128 *
39129 * app.get(['a', 'b']);
39130 * //=> {c: 'd'}
39131 * ```
39132 *
39133 * @name .get
39134 * @emits `get` with `key` and `value` as arguments.
39135 * @param {String} `key` The name of the property to get. Dot-notation may be used.
39136 * @return {any} Returns the value of `key`
39137 * @api public
39138 */
39139
39140 Cache.prototype.get = function(key) {
39141 key = toPath(arguments);
39142
39143 var ctx = prop ? this[prop] : this;
39144 var val = get(ctx, key);
39145
39146 this.emit('get', key, val);
39147 return val;
39148 };
39149
39150 /**
39151 * Return true if app has a stored value for `key`,
39152 * false only if value is `undefined`.
39153 *
39154 * ```js
39155 * app.set('foo', 'bar');
39156 * app.has('foo');
39157 * //=> true
39158 * ```
39159 *
39160 * @name .has
39161 * @emits `has` with `key` and true or false as arguments.
39162 * @param {String} `key`
39163 * @return {Boolean}
39164 * @api public
39165 */
39166
39167 Cache.prototype.has = function(key) {
39168 key = toPath(arguments);
39169
39170 var ctx = prop ? this[prop] : this;
39171 var val = get(ctx, key);
39172
39173 var has = typeof val !== 'undefined';
39174 this.emit('has', key, has);
39175 return has;
39176 };
39177
39178 /**
39179 * Delete one or more properties from the instance.
39180 *
39181 * ```js
39182 * app.del(); // delete all
39183 * // or
39184 * app.del('foo');
39185 * // or
39186 * app.del(['foo', 'bar']);
39187 * ```
39188 * @name .del
39189 * @emits `del` with the `key` as the only argument.
39190 * @param {String|Array} `key` Property name or array of property names.
39191 * @return {Object} Returns the instance for chaining.
39192 * @api public
39193 */
39194
39195 Cache.prototype.del = function(key) {
39196 if (Array.isArray(key)) {
39197 this.visit('del', key);
39198 } else {
39199 del(prop ? this[prop] : this, key);
39200 this.emit('del', key);
39201 }
39202 return this;
39203 };
39204
39205 /**
39206 * Reset the entire cache to an empty object.
39207 *
39208 * ```js
39209 * app.clear();
39210 * ```
39211 * @api public
39212 */
39213
39214 Cache.prototype.clear = function() {
39215 if (prop) {
39216 this[prop] = {};
39217 }
39218 };
39219
39220 /**
39221 * Visit `method` over the properties in the given object, or map
39222 * visit over the object-elements in an array.
39223 *
39224 * @name .visit
39225 * @param {String} `method` The name of the `base` method to call.
39226 * @param {Object|Array} `val` The object or array to iterate over.
39227 * @return {Object} Returns the instance for chaining.
39228 * @api public
39229 */
39230
39231 Cache.prototype.visit = function(method, val) {
39232 visit(this, method, val);
39233 return this;
39234 };
39235
39236 return Cache;
39237}
39238
39239/**
39240 * Cast val to an array
39241 */
39242
39243function arrayify(val) {
39244 return val ? (Array.isArray(val) ? val : [val]) : [];
39245}
39246
39247/**
39248 * Expose `Cache`
39249 */
39250
39251module.exports = namespace();
39252
39253/**
39254 * Expose `Cache.namespace`
39255 */
39256
39257module.exports.namespace = namespace;
39258
39259
39260/***/ }),
39261
39262/***/ 92430:
39263/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
39264
39265"use strict";
39266
39267/**
39268 * trace-event - A library to create a trace of your node app per
39269 * Google's Trace Event format:
39270 * // JSSTYLED
39271 * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU
39272 */
39273Object.defineProperty(exports, "__esModule", ({ value: true }));
39274var tslib_1 = __webpack_require__(29859);
39275var stream_1 = __webpack_require__(92413);
39276function evCommon() {
39277 var hrtime = process.hrtime(); // [seconds, nanoseconds]
39278 var ts = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); // microseconds
39279 return {
39280 ts: ts,
39281 pid: process.pid,
39282 tid: process.pid // no meaningful tid for node.js
39283 };
39284}
39285var Tracer = /** @class */ (function (_super) {
39286 tslib_1.__extends(Tracer, _super);
39287 function Tracer(opts) {
39288 if (opts === void 0) { opts = {}; }
39289 var _this = _super.call(this) || this;
39290 _this.noStream = false;
39291 _this.events = [];
39292 if (typeof opts !== "object") {
39293 throw new Error("Invalid options passed (must be an object)");
39294 }
39295 if (opts.parent != null && typeof opts.parent !== "object") {
39296 throw new Error("Invalid option (parent) passed (must be an object)");
39297 }
39298 if (opts.fields != null && typeof opts.fields !== "object") {
39299 throw new Error("Invalid option (fields) passed (must be an object)");
39300 }
39301 if (opts.objectMode != null &&
39302 (opts.objectMode !== true && opts.objectMode !== false)) {
39303 throw new Error("Invalid option (objectsMode) passed (must be a boolean)");
39304 }
39305 _this.noStream = opts.noStream || false;
39306 _this.parent = opts.parent;
39307 if (_this.parent) {
39308 _this.fields = Object.assign({}, opts.parent && opts.parent.fields);
39309 }
39310 else {
39311 _this.fields = {};
39312 }
39313 if (opts.fields) {
39314 Object.assign(_this.fields, opts.fields);
39315 }
39316 if (!_this.fields.cat) {
39317 // trace-viewer *requires* `cat`, so let's have a fallback.
39318 _this.fields.cat = "default";
39319 }
39320 else if (Array.isArray(_this.fields.cat)) {
39321 _this.fields.cat = _this.fields.cat.join(",");
39322 }
39323 if (!_this.fields.args) {
39324 // trace-viewer *requires* `args`, so let's have a fallback.
39325 _this.fields.args = {};
39326 }
39327 if (_this.parent) {
39328 // TODO: Not calling Readable ctor here. Does that cause probs?
39329 // Probably if trying to pipe from the child.
39330 // Might want a serpate TracerChild class for these guys.
39331 _this._push = _this.parent._push.bind(_this.parent);
39332 }
39333 else {
39334 _this._objectMode = Boolean(opts.objectMode);
39335 var streamOpts = { objectMode: _this._objectMode };
39336 if (_this._objectMode) {
39337 _this._push = _this.push;
39338 }
39339 else {
39340 _this._push = _this._pushString;
39341 streamOpts.encoding = "utf8";
39342 }
39343 stream_1.Readable.call(_this, streamOpts);
39344 }
39345 return _this;
39346 }
39347 /**
39348 * If in no streamMode in order to flush out the trace
39349 * you need to call flush.
39350 */
39351 Tracer.prototype.flush = function () {
39352 if (this.noStream === true) {
39353 for (var _i = 0, _a = this.events; _i < _a.length; _i++) {
39354 var evt = _a[_i];
39355 this._push(evt);
39356 }
39357 this._flush();
39358 }
39359 };
39360 Tracer.prototype._read = function (_) { };
39361 Tracer.prototype._pushString = function (ev) {
39362 var separator = "";
39363 if (!this.firstPush) {
39364 this.push("[");
39365 this.firstPush = true;
39366 }
39367 else {
39368 separator = ",\n";
39369 }
39370 this.push(separator + JSON.stringify(ev), "utf8");
39371 };
39372 Tracer.prototype._flush = function () {
39373 if (!this._objectMode) {
39374 this.push("]");
39375 }
39376 };
39377 Tracer.prototype.child = function (fields) {
39378 return new Tracer({
39379 parent: this,
39380 fields: fields
39381 });
39382 };
39383 Tracer.prototype.begin = function (fields) {
39384 return this.mkEventFunc("b")(fields);
39385 };
39386 Tracer.prototype.end = function (fields) {
39387 return this.mkEventFunc("e")(fields);
39388 };
39389 Tracer.prototype.completeEvent = function (fields) {
39390 return this.mkEventFunc("X")(fields);
39391 };
39392 Tracer.prototype.instantEvent = function (fields) {
39393 return this.mkEventFunc("I")(fields);
39394 };
39395 Tracer.prototype.mkEventFunc = function (ph) {
39396 var _this = this;
39397 return function (fields) {
39398 var ev = evCommon();
39399 // Assign the event phase.
39400 ev.ph = ph;
39401 if (fields) {
39402 if (typeof fields === "string") {
39403 ev.name = fields;
39404 }
39405 else {
39406 for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) {
39407 var k = _a[_i];
39408 if (k === "cat") {
39409 ev.cat = fields.cat.join(",");
39410 }
39411 else {
39412 ev[k] = fields[k];
39413 }
39414 }
39415 }
39416 }
39417 if (!_this.noStream) {
39418 _this._push(ev);
39419 }
39420 else {
39421 _this.events.push(ev);
39422 }
39423 };
39424 };
39425 return Tracer;
39426}(stream_1.Readable));
39427exports.Tracer = Tracer;
39428/*
39429 * These correspond to the "Async events" in the Trace Events doc.
39430 *
39431 * Required fields:
39432 * - name
39433 * - id
39434 *
39435 * Optional fields:
39436 * - cat (array)
39437 * - args (object)
39438 * - TODO: stack fields, other optional fields?
39439 *
39440 * Dev Note: We don't explicitly assert that correct fields are
39441 * used for speed (premature optimization alert!).
39442 */
39443//# sourceMappingURL=trace-event.js.map
39444
39445/***/ }),
39446
39447/***/ 71523:
39448/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
39449
39450"use strict";
39451
39452
39453var util = __webpack_require__(31669);
39454var union = __webpack_require__(69123);
39455var define = __webpack_require__(5477);
39456var staticExtend = __webpack_require__(69457);
39457var isObj = __webpack_require__(96667);
39458
39459/**
39460 * Expose class utils
39461 */
39462
39463var cu = module.exports;
39464
39465/**
39466 * Expose class utils: `cu`
39467 */
39468
39469cu.isObject = function isObject(val) {
39470 return isObj(val) || typeof val === 'function';
39471};
39472
39473/**
39474 * Returns true if an array has any of the given elements, or an
39475 * object has any of the give keys.
39476 *
39477 * ```js
39478 * cu.has(['a', 'b', 'c'], 'c');
39479 * //=> true
39480 *
39481 * cu.has(['a', 'b', 'c'], ['c', 'z']);
39482 * //=> true
39483 *
39484 * cu.has({a: 'b', c: 'd'}, ['c', 'z']);
39485 * //=> true
39486 * ```
39487 * @param {Object} `obj`
39488 * @param {String|Array} `val`
39489 * @return {Boolean}
39490 * @api public
39491 */
39492
39493cu.has = function has(obj, val) {
39494 val = cu.arrayify(val);
39495 var len = val.length;
39496
39497 if (cu.isObject(obj)) {
39498 for (var key in obj) {
39499 if (val.indexOf(key) > -1) {
39500 return true;
39501 }
39502 }
39503
39504 var keys = cu.nativeKeys(obj);
39505 return cu.has(keys, val);
39506 }
39507
39508 if (Array.isArray(obj)) {
39509 var arr = obj;
39510 while (len--) {
39511 if (arr.indexOf(val[len]) > -1) {
39512 return true;
39513 }
39514 }
39515 return false;
39516 }
39517
39518 throw new TypeError('expected an array or object.');
39519};
39520
39521/**
39522 * Returns true if an array or object has all of the given values.
39523 *
39524 * ```js
39525 * cu.hasAll(['a', 'b', 'c'], 'c');
39526 * //=> true
39527 *
39528 * cu.hasAll(['a', 'b', 'c'], ['c', 'z']);
39529 * //=> false
39530 *
39531 * cu.hasAll({a: 'b', c: 'd'}, ['c', 'z']);
39532 * //=> false
39533 * ```
39534 * @param {Object|Array} `val`
39535 * @param {String|Array} `values`
39536 * @return {Boolean}
39537 * @api public
39538 */
39539
39540cu.hasAll = function hasAll(val, values) {
39541 values = cu.arrayify(values);
39542 var len = values.length;
39543 while (len--) {
39544 if (!cu.has(val, values[len])) {
39545 return false;
39546 }
39547 }
39548 return true;
39549};
39550
39551/**
39552 * Cast the given value to an array.
39553 *
39554 * ```js
39555 * cu.arrayify('foo');
39556 * //=> ['foo']
39557 *
39558 * cu.arrayify(['foo']);
39559 * //=> ['foo']
39560 * ```
39561 *
39562 * @param {String|Array} `val`
39563 * @return {Array}
39564 * @api public
39565 */
39566
39567cu.arrayify = function arrayify(val) {
39568 return val ? (Array.isArray(val) ? val : [val]) : [];
39569};
39570
39571/**
39572 * Noop
39573 */
39574
39575cu.noop = function noop() {
39576 return;
39577};
39578
39579/**
39580 * Returns the first argument passed to the function.
39581 */
39582
39583cu.identity = function identity(val) {
39584 return val;
39585};
39586
39587/**
39588 * Returns true if a value has a `contructor`
39589 *
39590 * ```js
39591 * cu.hasConstructor({});
39592 * //=> true
39593 *
39594 * cu.hasConstructor(Object.create(null));
39595 * //=> false
39596 * ```
39597 * @param {Object} `value`
39598 * @return {Boolean}
39599 * @api public
39600 */
39601
39602cu.hasConstructor = function hasConstructor(val) {
39603 return cu.isObject(val) && typeof val.constructor !== 'undefined';
39604};
39605
39606/**
39607 * Get the native `ownPropertyNames` from the constructor of the
39608 * given `object`. An empty array is returned if the object does
39609 * not have a constructor.
39610 *
39611 * ```js
39612 * cu.nativeKeys({a: 'b', b: 'c', c: 'd'})
39613 * //=> ['a', 'b', 'c']
39614 *
39615 * cu.nativeKeys(function(){})
39616 * //=> ['length', 'caller']
39617 * ```
39618 *
39619 * @param {Object} `obj` Object that has a `constructor`.
39620 * @return {Array} Array of keys.
39621 * @api public
39622 */
39623
39624cu.nativeKeys = function nativeKeys(val) {
39625 if (!cu.hasConstructor(val)) return [];
39626 var keys = Object.getOwnPropertyNames(val);
39627 if ('caller' in val) keys.push('caller');
39628 return keys;
39629};
39630
39631/**
39632 * Returns property descriptor `key` if it's an "own" property
39633 * of the given object.
39634 *
39635 * ```js
39636 * function App() {}
39637 * Object.defineProperty(App.prototype, 'count', {
39638 * get: function() {
39639 * return Object.keys(this).length;
39640 * }
39641 * });
39642 * cu.getDescriptor(App.prototype, 'count');
39643 * // returns:
39644 * // {
39645 * // get: [Function],
39646 * // set: undefined,
39647 * // enumerable: false,
39648 * // configurable: false
39649 * // }
39650 * ```
39651 *
39652 * @param {Object} `obj`
39653 * @param {String} `key`
39654 * @return {Object} Returns descriptor `key`
39655 * @api public
39656 */
39657
39658cu.getDescriptor = function getDescriptor(obj, key) {
39659 if (!cu.isObject(obj)) {
39660 throw new TypeError('expected an object.');
39661 }
39662 if (typeof key !== 'string') {
39663 throw new TypeError('expected key to be a string.');
39664 }
39665 return Object.getOwnPropertyDescriptor(obj, key);
39666};
39667
39668/**
39669 * Copy a descriptor from one object to another.
39670 *
39671 * ```js
39672 * function App() {}
39673 * Object.defineProperty(App.prototype, 'count', {
39674 * get: function() {
39675 * return Object.keys(this).length;
39676 * }
39677 * });
39678 * var obj = {};
39679 * cu.copyDescriptor(obj, App.prototype, 'count');
39680 * ```
39681 * @param {Object} `receiver`
39682 * @param {Object} `provider`
39683 * @param {String} `name`
39684 * @return {Object}
39685 * @api public
39686 */
39687
39688cu.copyDescriptor = function copyDescriptor(receiver, provider, name) {
39689 if (!cu.isObject(receiver)) {
39690 throw new TypeError('expected receiving object to be an object.');
39691 }
39692 if (!cu.isObject(provider)) {
39693 throw new TypeError('expected providing object to be an object.');
39694 }
39695 if (typeof name !== 'string') {
39696 throw new TypeError('expected name to be a string.');
39697 }
39698
39699 var val = cu.getDescriptor(provider, name);
39700 if (val) Object.defineProperty(receiver, name, val);
39701};
39702
39703/**
39704 * Copy static properties, prototype properties, and descriptors
39705 * from one object to another.
39706 *
39707 * @param {Object} `receiver`
39708 * @param {Object} `provider`
39709 * @param {String|Array} `omit` One or more properties to omit
39710 * @return {Object}
39711 * @api public
39712 */
39713
39714cu.copy = function copy(receiver, provider, omit) {
39715 if (!cu.isObject(receiver)) {
39716 throw new TypeError('expected receiving object to be an object.');
39717 }
39718 if (!cu.isObject(provider)) {
39719 throw new TypeError('expected providing object to be an object.');
39720 }
39721 var props = Object.getOwnPropertyNames(provider);
39722 var keys = Object.keys(provider);
39723 var len = props.length,
39724 key;
39725 omit = cu.arrayify(omit);
39726
39727 while (len--) {
39728 key = props[len];
39729
39730 if (cu.has(keys, key)) {
39731 define(receiver, key, provider[key]);
39732 } else if (!(key in receiver) && !cu.has(omit, key)) {
39733 cu.copyDescriptor(receiver, provider, key);
39734 }
39735 }
39736};
39737
39738/**
39739 * Inherit the static properties, prototype properties, and descriptors
39740 * from of an object.
39741 *
39742 * @param {Object} `receiver`
39743 * @param {Object} `provider`
39744 * @param {String|Array} `omit` One or more properties to omit
39745 * @return {Object}
39746 * @api public
39747 */
39748
39749cu.inherit = function inherit(receiver, provider, omit) {
39750 if (!cu.isObject(receiver)) {
39751 throw new TypeError('expected receiving object to be an object.');
39752 }
39753 if (!cu.isObject(provider)) {
39754 throw new TypeError('expected providing object to be an object.');
39755 }
39756
39757 var keys = [];
39758 for (var key in provider) {
39759 keys.push(key);
39760 receiver[key] = provider[key];
39761 }
39762
39763 keys = keys.concat(cu.arrayify(omit));
39764
39765 var a = provider.prototype || provider;
39766 var b = receiver.prototype || receiver;
39767 cu.copy(b, a, keys);
39768};
39769
39770/**
39771 * Returns a function for extending the static properties,
39772 * prototype properties, and descriptors from the `Parent`
39773 * constructor onto `Child` constructors.
39774 *
39775 * ```js
39776 * var extend = cu.extend(Parent);
39777 * Parent.extend(Child);
39778 *
39779 * // optional methods
39780 * Parent.extend(Child, {
39781 * foo: function() {},
39782 * bar: function() {}
39783 * });
39784 * ```
39785 * @param {Function} `Parent` Parent ctor
39786 * @param {Function} `extend` Optional extend function to handle custom extensions. Useful when updating methods that require a specific prototype.
39787 * @param {Function} `Child` Child ctor
39788 * @param {Object} `proto` Optionally pass additional prototype properties to inherit.
39789 * @return {Object}
39790 * @api public
39791 */
39792
39793cu.extend = function() {
39794 // keep it lazy, instead of assigning to `cu.extend`
39795 return staticExtend.apply(null, arguments);
39796};
39797
39798/**
39799 * Bubble up events emitted from static methods on the Parent ctor.
39800 *
39801 * @param {Object} `Parent`
39802 * @param {Array} `events` Event names to bubble up
39803 * @api public
39804 */
39805
39806cu.bubble = function(Parent, events) {
39807 events = events || [];
39808 Parent.bubble = function(Child, arr) {
39809 if (Array.isArray(arr)) {
39810 events = union([], events, arr);
39811 }
39812 var len = events.length;
39813 var idx = -1;
39814 while (++idx < len) {
39815 var name = events[idx];
39816 Parent.on(name, Child.emit.bind(Child, name));
39817 }
39818 cu.bubble(Child, events);
39819 };
39820};
39821
39822
39823/***/ }),
39824
39825/***/ 16704:
39826/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
39827
39828"use strict";
39829/*!
39830 * collection-visit <https://github.com/jonschlinkert/collection-visit>
39831 *
39832 * Copyright (c) 2015, 2017, Jon Schlinkert.
39833 * Released under the MIT License.
39834 */
39835
39836
39837
39838var visit = __webpack_require__(59248);
39839var mapVisit = __webpack_require__(11270);
39840
39841module.exports = function(collection, method, val) {
39842 var result;
39843
39844 if (typeof val === 'string' && (method in collection)) {
39845 var args = [].slice.call(arguments, 2);
39846 result = collection[method].apply(collection, args);
39847 } else if (Array.isArray(val)) {
39848 result = mapVisit.apply(null, arguments);
39849 } else {
39850 result = visit.apply(null, arguments);
39851 }
39852
39853 if (typeof result !== 'undefined') {
39854 return result;
39855 }
39856
39857 return collection;
39858};
39859
39860
39861/***/ }),
39862
39863/***/ 79458:
39864/***/ (function(module) {
39865
39866
39867/**
39868 * Expose `Emitter`.
39869 */
39870
39871if (true) {
39872 module.exports = Emitter;
39873}
39874
39875/**
39876 * Initialize a new `Emitter`.
39877 *
39878 * @api public
39879 */
39880
39881function Emitter(obj) {
39882 if (obj) return mixin(obj);
39883};
39884
39885/**
39886 * Mixin the emitter properties.
39887 *
39888 * @param {Object} obj
39889 * @return {Object}
39890 * @api private
39891 */
39892
39893function mixin(obj) {
39894 for (var key in Emitter.prototype) {
39895 obj[key] = Emitter.prototype[key];
39896 }
39897 return obj;
39898}
39899
39900/**
39901 * Listen on the given `event` with `fn`.
39902 *
39903 * @param {String} event
39904 * @param {Function} fn
39905 * @return {Emitter}
39906 * @api public
39907 */
39908
39909Emitter.prototype.on =
39910Emitter.prototype.addEventListener = function(event, fn){
39911 this._callbacks = this._callbacks || {};
39912 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
39913 .push(fn);
39914 return this;
39915};
39916
39917/**
39918 * Adds an `event` listener that will be invoked a single
39919 * time then automatically removed.
39920 *
39921 * @param {String} event
39922 * @param {Function} fn
39923 * @return {Emitter}
39924 * @api public
39925 */
39926
39927Emitter.prototype.once = function(event, fn){
39928 function on() {
39929 this.off(event, on);
39930 fn.apply(this, arguments);
39931 }
39932
39933 on.fn = fn;
39934 this.on(event, on);
39935 return this;
39936};
39937
39938/**
39939 * Remove the given callback for `event` or all
39940 * registered callbacks.
39941 *
39942 * @param {String} event
39943 * @param {Function} fn
39944 * @return {Emitter}
39945 * @api public
39946 */
39947
39948Emitter.prototype.off =
39949Emitter.prototype.removeListener =
39950Emitter.prototype.removeAllListeners =
39951Emitter.prototype.removeEventListener = function(event, fn){
39952 this._callbacks = this._callbacks || {};
39953
39954 // all
39955 if (0 == arguments.length) {
39956 this._callbacks = {};
39957 return this;
39958 }
39959
39960 // specific event
39961 var callbacks = this._callbacks['$' + event];
39962 if (!callbacks) return this;
39963
39964 // remove all handlers
39965 if (1 == arguments.length) {
39966 delete this._callbacks['$' + event];
39967 return this;
39968 }
39969
39970 // remove specific handler
39971 var cb;
39972 for (var i = 0; i < callbacks.length; i++) {
39973 cb = callbacks[i];
39974 if (cb === fn || cb.fn === fn) {
39975 callbacks.splice(i, 1);
39976 break;
39977 }
39978 }
39979
39980 // Remove event specific arrays for event types that no
39981 // one is subscribed for to avoid memory leak.
39982 if (callbacks.length === 0) {
39983 delete this._callbacks['$' + event];
39984 }
39985
39986 return this;
39987};
39988
39989/**
39990 * Emit `event` with the given args.
39991 *
39992 * @param {String} event
39993 * @param {Mixed} ...
39994 * @return {Emitter}
39995 */
39996
39997Emitter.prototype.emit = function(event){
39998 this._callbacks = this._callbacks || {};
39999
40000 var args = new Array(arguments.length - 1)
40001 , callbacks = this._callbacks['$' + event];
40002
40003 for (var i = 1; i < arguments.length; i++) {
40004 args[i - 1] = arguments[i];
40005 }
40006
40007 if (callbacks) {
40008 callbacks = callbacks.slice(0);
40009 for (var i = 0, len = callbacks.length; i < len; ++i) {
40010 callbacks[i].apply(this, args);
40011 }
40012 }
40013
40014 return this;
40015};
40016
40017/**
40018 * Return array of callbacks for `event`.
40019 *
40020 * @param {String} event
40021 * @return {Array}
40022 * @api public
40023 */
40024
40025Emitter.prototype.listeners = function(event){
40026 this._callbacks = this._callbacks || {};
40027 return this._callbacks['$' + event] || [];
40028};
40029
40030/**
40031 * Check if this emitter has `event` handlers.
40032 *
40033 * @param {String} event
40034 * @return {Boolean}
40035 * @api public
40036 */
40037
40038Emitter.prototype.hasListeners = function(event){
40039 return !! this.listeners(event).length;
40040};
40041
40042
40043/***/ }),
40044
40045/***/ 3605:
40046/***/ (function(module) {
40047
40048"use strict";
40049/*!
40050 * copy-descriptor <https://github.com/jonschlinkert/copy-descriptor>
40051 *
40052 * Copyright (c) 2015, Jon Schlinkert.
40053 * Licensed under the MIT License.
40054 */
40055
40056
40057
40058/**
40059 * Copy a descriptor from one object to another.
40060 *
40061 * ```js
40062 * function App() {
40063 * this.cache = {};
40064 * }
40065 * App.prototype.set = function(key, val) {
40066 * this.cache[key] = val;
40067 * return this;
40068 * };
40069 * Object.defineProperty(App.prototype, 'count', {
40070 * get: function() {
40071 * return Object.keys(this.cache).length;
40072 * }
40073 * });
40074 *
40075 * copy(App.prototype, 'count', 'len');
40076 *
40077 * // create an instance
40078 * var app = new App();
40079 *
40080 * app.set('a', true);
40081 * app.set('b', true);
40082 * app.set('c', true);
40083 *
40084 * console.log(app.count);
40085 * //=> 3
40086 * console.log(app.len);
40087 * //=> 3
40088 * ```
40089 * @name copy
40090 * @param {Object} `receiver` The target object
40091 * @param {Object} `provider` The provider object
40092 * @param {String} `from` The key to copy on provider.
40093 * @param {String} `to` Optionally specify a new key name to use.
40094 * @return {Object}
40095 * @api public
40096 */
40097
40098module.exports = function copyDescriptor(receiver, provider, from, to) {
40099 if (!isObject(provider) && typeof provider !== 'function') {
40100 to = from;
40101 from = provider;
40102 provider = receiver;
40103 }
40104 if (!isObject(receiver) && typeof receiver !== 'function') {
40105 throw new TypeError('expected the first argument to be an object');
40106 }
40107 if (!isObject(provider) && typeof provider !== 'function') {
40108 throw new TypeError('expected provider to be an object');
40109 }
40110
40111 if (typeof to !== 'string') {
40112 to = from;
40113 }
40114 if (typeof from !== 'string') {
40115 throw new TypeError('expected key to be a string');
40116 }
40117
40118 if (!(from in provider)) {
40119 throw new Error('property "' + from + '" does not exist');
40120 }
40121
40122 var val = Object.getOwnPropertyDescriptor(provider, from);
40123 if (val) Object.defineProperty(receiver, to, val);
40124};
40125
40126function isObject(val) {
40127 return {}.toString.call(val) === '[object Object]';
40128}
40129
40130
40131
40132/***/ }),
40133
40134/***/ 78334:
40135/***/ (function(__unused_webpack_module, exports) {
40136
40137// Copyright Joyent, Inc. and other Node contributors.
40138//
40139// Permission is hereby granted, free of charge, to any person obtaining a
40140// copy of this software and associated documentation files (the
40141// "Software"), to deal in the Software without restriction, including
40142// without limitation the rights to use, copy, modify, merge, publish,
40143// distribute, sublicense, and/or sell copies of the Software, and to permit
40144// persons to whom the Software is furnished to do so, subject to the
40145// following conditions:
40146//
40147// The above copyright notice and this permission notice shall be included
40148// in all copies or substantial portions of the Software.
40149//
40150// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
40151// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40152// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
40153// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
40154// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
40155// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
40156// USE OR OTHER DEALINGS IN THE SOFTWARE.
40157
40158// NOTE: These type checking functions intentionally don't use `instanceof`
40159// because it is fragile and can be easily faked with `Object.create()`.
40160
40161function isArray(arg) {
40162 if (Array.isArray) {
40163 return Array.isArray(arg);
40164 }
40165 return objectToString(arg) === '[object Array]';
40166}
40167exports.isArray = isArray;
40168
40169function isBoolean(arg) {
40170 return typeof arg === 'boolean';
40171}
40172exports.isBoolean = isBoolean;
40173
40174function isNull(arg) {
40175 return arg === null;
40176}
40177exports.isNull = isNull;
40178
40179function isNullOrUndefined(arg) {
40180 return arg == null;
40181}
40182exports.isNullOrUndefined = isNullOrUndefined;
40183
40184function isNumber(arg) {
40185 return typeof arg === 'number';
40186}
40187exports.isNumber = isNumber;
40188
40189function isString(arg) {
40190 return typeof arg === 'string';
40191}
40192exports.isString = isString;
40193
40194function isSymbol(arg) {
40195 return typeof arg === 'symbol';
40196}
40197exports.isSymbol = isSymbol;
40198
40199function isUndefined(arg) {
40200 return arg === void 0;
40201}
40202exports.isUndefined = isUndefined;
40203
40204function isRegExp(re) {
40205 return objectToString(re) === '[object RegExp]';
40206}
40207exports.isRegExp = isRegExp;
40208
40209function isObject(arg) {
40210 return typeof arg === 'object' && arg !== null;
40211}
40212exports.isObject = isObject;
40213
40214function isDate(d) {
40215 return objectToString(d) === '[object Date]';
40216}
40217exports.isDate = isDate;
40218
40219function isError(e) {
40220 return (objectToString(e) === '[object Error]' || e instanceof Error);
40221}
40222exports.isError = isError;
40223
40224function isFunction(arg) {
40225 return typeof arg === 'function';
40226}
40227exports.isFunction = isFunction;
40228
40229function isPrimitive(arg) {
40230 return arg === null ||
40231 typeof arg === 'boolean' ||
40232 typeof arg === 'number' ||
40233 typeof arg === 'string' ||
40234 typeof arg === 'symbol' || // ES6 symbol
40235 typeof arg === 'undefined';
40236}
40237exports.isPrimitive = isPrimitive;
40238
40239exports.isBuffer = Buffer.isBuffer;
40240
40241function objectToString(o) {
40242 return Object.prototype.toString.call(o);
40243}
40244
40245
40246/***/ }),
40247
40248/***/ 95748:
40249/***/ (function(module) {
40250
40251"use strict";
40252
40253var token = '%[a-f0-9]{2}';
40254var singleMatcher = new RegExp(token, 'gi');
40255var multiMatcher = new RegExp('(' + token + ')+', 'gi');
40256
40257function decodeComponents(components, split) {
40258 try {
40259 // Try to decode the entire string first
40260 return decodeURIComponent(components.join(''));
40261 } catch (err) {
40262 // Do nothing
40263 }
40264
40265 if (components.length === 1) {
40266 return components;
40267 }
40268
40269 split = split || 1;
40270
40271 // Split the array in 2 parts
40272 var left = components.slice(0, split);
40273 var right = components.slice(split);
40274
40275 return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
40276}
40277
40278function decode(input) {
40279 try {
40280 return decodeURIComponent(input);
40281 } catch (err) {
40282 var tokens = input.match(singleMatcher);
40283
40284 for (var i = 1; i < tokens.length; i++) {
40285 input = decodeComponents(tokens, i).join('');
40286
40287 tokens = input.match(singleMatcher);
40288 }
40289
40290 return input;
40291 }
40292}
40293
40294function customDecodeURIComponent(input) {
40295 // Keep track of all the replacements and prefill the map with the `BOM`
40296 var replaceMap = {
40297 '%FE%FF': '\uFFFD\uFFFD',
40298 '%FF%FE': '\uFFFD\uFFFD'
40299 };
40300
40301 var match = multiMatcher.exec(input);
40302 while (match) {
40303 try {
40304 // Decode as big chunks as possible
40305 replaceMap[match[0]] = decodeURIComponent(match[0]);
40306 } catch (err) {
40307 var result = decode(match[0]);
40308
40309 if (result !== match[0]) {
40310 replaceMap[match[0]] = result;
40311 }
40312 }
40313
40314 match = multiMatcher.exec(input);
40315 }
40316
40317 // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
40318 replaceMap['%C2'] = '\uFFFD';
40319
40320 var entries = Object.keys(replaceMap);
40321
40322 for (var i = 0; i < entries.length; i++) {
40323 // Replace all decoded components
40324 var key = entries[i];
40325 input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
40326 }
40327
40328 return input;
40329}
40330
40331module.exports = function (encodedURI) {
40332 if (typeof encodedURI !== 'string') {
40333 throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
40334 }
40335
40336 try {
40337 encodedURI = encodedURI.replace(/\+/g, ' ');
40338
40339 // Try the built in decoder first
40340 return decodeURIComponent(encodedURI);
40341 } catch (err) {
40342 // Fallback to a more advanced decoder
40343 return customDecodeURIComponent(encodedURI);
40344 }
40345};
40346
40347
40348/***/ }),
40349
40350/***/ 5477:
40351/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40352
40353"use strict";
40354/*!
40355 * define-property <https://github.com/jonschlinkert/define-property>
40356 *
40357 * Copyright (c) 2015, Jon Schlinkert.
40358 * Licensed under the MIT License.
40359 */
40360
40361
40362
40363var isDescriptor = __webpack_require__(49924);
40364
40365module.exports = function defineProperty(obj, prop, val) {
40366 if (typeof obj !== 'object' && typeof obj !== 'function') {
40367 throw new TypeError('expected an object or function.');
40368 }
40369
40370 if (typeof prop !== 'string') {
40371 throw new TypeError('expected `prop` to be a string.');
40372 }
40373
40374 if (isDescriptor(val) && ('set' in val || 'get' in val)) {
40375 return Object.defineProperty(obj, prop, val);
40376 }
40377
40378 return Object.defineProperty(obj, prop, {
40379 configurable: true,
40380 enumerable: false,
40381 writable: true,
40382 value: val
40383 });
40384};
40385
40386
40387/***/ }),
40388
40389/***/ 30138:
40390/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40391
40392"use strict";
40393/*!
40394 * is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
40395 *
40396 * Copyright (c) 2015, Jon Schlinkert.
40397 * Licensed under the MIT License.
40398 */
40399
40400
40401
40402var typeOf = __webpack_require__(1057);
40403
40404// accessor descriptor properties
40405var accessor = {
40406 get: 'function',
40407 set: 'function',
40408 configurable: 'boolean',
40409 enumerable: 'boolean'
40410};
40411
40412function isAccessorDescriptor(obj, prop) {
40413 if (typeof prop === 'string') {
40414 var val = Object.getOwnPropertyDescriptor(obj, prop);
40415 return typeof val !== 'undefined';
40416 }
40417
40418 if (typeOf(obj) !== 'object') {
40419 return false;
40420 }
40421
40422 if (has(obj, 'value') || has(obj, 'writable')) {
40423 return false;
40424 }
40425
40426 if (!has(obj, 'get') || typeof obj.get !== 'function') {
40427 return false;
40428 }
40429
40430 // tldr: it's valid to have "set" be undefined
40431 // "set" might be undefined if `Object.getOwnPropertyDescriptor`
40432 // was used to get the value, and only `get` was defined by the user
40433 if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
40434 return false;
40435 }
40436
40437 for (var key in obj) {
40438 if (!accessor.hasOwnProperty(key)) {
40439 continue;
40440 }
40441
40442 if (typeOf(obj[key]) === accessor[key]) {
40443 continue;
40444 }
40445
40446 if (typeof obj[key] !== 'undefined') {
40447 return false;
40448 }
40449 }
40450 return true;
40451}
40452
40453function has(obj, key) {
40454 return {}.hasOwnProperty.call(obj, key);
40455}
40456
40457/**
40458 * Expose `isAccessorDescriptor`
40459 */
40460
40461module.exports = isAccessorDescriptor;
40462
40463
40464/***/ }),
40465
40466/***/ 1057:
40467/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40468
40469var isBuffer = __webpack_require__(9848);
40470var toString = Object.prototype.toString;
40471
40472/**
40473 * Get the native `typeof` a value.
40474 *
40475 * @param {*} `val`
40476 * @return {*} Native javascript type
40477 */
40478
40479module.exports = function kindOf(val) {
40480 // primitivies
40481 if (typeof val === 'undefined') {
40482 return 'undefined';
40483 }
40484 if (val === null) {
40485 return 'null';
40486 }
40487 if (val === true || val === false || val instanceof Boolean) {
40488 return 'boolean';
40489 }
40490 if (typeof val === 'string' || val instanceof String) {
40491 return 'string';
40492 }
40493 if (typeof val === 'number' || val instanceof Number) {
40494 return 'number';
40495 }
40496
40497 // functions
40498 if (typeof val === 'function' || val instanceof Function) {
40499 return 'function';
40500 }
40501
40502 // array
40503 if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
40504 return 'array';
40505 }
40506
40507 // check for instances of RegExp and Date before calling `toString`
40508 if (val instanceof RegExp) {
40509 return 'regexp';
40510 }
40511 if (val instanceof Date) {
40512 return 'date';
40513 }
40514
40515 // other objects
40516 var type = toString.call(val);
40517
40518 if (type === '[object RegExp]') {
40519 return 'regexp';
40520 }
40521 if (type === '[object Date]') {
40522 return 'date';
40523 }
40524 if (type === '[object Arguments]') {
40525 return 'arguments';
40526 }
40527 if (type === '[object Error]') {
40528 return 'error';
40529 }
40530
40531 // buffer
40532 if (isBuffer(val)) {
40533 return 'buffer';
40534 }
40535
40536 // es6: Map, WeakMap, Set, WeakSet
40537 if (type === '[object Set]') {
40538 return 'set';
40539 }
40540 if (type === '[object WeakSet]') {
40541 return 'weakset';
40542 }
40543 if (type === '[object Map]') {
40544 return 'map';
40545 }
40546 if (type === '[object WeakMap]') {
40547 return 'weakmap';
40548 }
40549 if (type === '[object Symbol]') {
40550 return 'symbol';
40551 }
40552
40553 // typed arrays
40554 if (type === '[object Int8Array]') {
40555 return 'int8array';
40556 }
40557 if (type === '[object Uint8Array]') {
40558 return 'uint8array';
40559 }
40560 if (type === '[object Uint8ClampedArray]') {
40561 return 'uint8clampedarray';
40562 }
40563 if (type === '[object Int16Array]') {
40564 return 'int16array';
40565 }
40566 if (type === '[object Uint16Array]') {
40567 return 'uint16array';
40568 }
40569 if (type === '[object Int32Array]') {
40570 return 'int32array';
40571 }
40572 if (type === '[object Uint32Array]') {
40573 return 'uint32array';
40574 }
40575 if (type === '[object Float32Array]') {
40576 return 'float32array';
40577 }
40578 if (type === '[object Float64Array]') {
40579 return 'float64array';
40580 }
40581
40582 // must be a plain object
40583 return 'object';
40584};
40585
40586
40587/***/ }),
40588
40589/***/ 9848:
40590/***/ (function(module) {
40591
40592/*!
40593 * Determine if an object is a Buffer
40594 *
40595 * @author Feross Aboukhadijeh <https://feross.org>
40596 * @license MIT
40597 */
40598
40599// The _isBuffer check is for Safari 5-7 support, because it's missing
40600// Object.prototype.constructor. Remove this eventually
40601module.exports = function (obj) {
40602 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
40603}
40604
40605function isBuffer (obj) {
40606 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
40607}
40608
40609// For Node v0.10 support. Remove this eventually.
40610function isSlowBuffer (obj) {
40611 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
40612}
40613
40614
40615/***/ }),
40616
40617/***/ 54963:
40618/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40619
40620"use strict";
40621/*!
40622 * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
40623 *
40624 * Copyright (c) 2015, Jon Schlinkert.
40625 * Licensed under the MIT License.
40626 */
40627
40628
40629
40630var typeOf = __webpack_require__(31072);
40631
40632// data descriptor properties
40633var data = {
40634 configurable: 'boolean',
40635 enumerable: 'boolean',
40636 writable: 'boolean'
40637};
40638
40639function isDataDescriptor(obj, prop) {
40640 if (typeOf(obj) !== 'object') {
40641 return false;
40642 }
40643
40644 if (typeof prop === 'string') {
40645 var val = Object.getOwnPropertyDescriptor(obj, prop);
40646 return typeof val !== 'undefined';
40647 }
40648
40649 if (!('value' in obj) && !('writable' in obj)) {
40650 return false;
40651 }
40652
40653 for (var key in obj) {
40654 if (key === 'value') continue;
40655
40656 if (!data.hasOwnProperty(key)) {
40657 continue;
40658 }
40659
40660 if (typeOf(obj[key]) === data[key]) {
40661 continue;
40662 }
40663
40664 if (typeof obj[key] !== 'undefined') {
40665 return false;
40666 }
40667 }
40668 return true;
40669}
40670
40671/**
40672 * Expose `isDataDescriptor`
40673 */
40674
40675module.exports = isDataDescriptor;
40676
40677
40678/***/ }),
40679
40680/***/ 31072:
40681/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40682
40683var isBuffer = __webpack_require__(9848);
40684var toString = Object.prototype.toString;
40685
40686/**
40687 * Get the native `typeof` a value.
40688 *
40689 * @param {*} `val`
40690 * @return {*} Native javascript type
40691 */
40692
40693module.exports = function kindOf(val) {
40694 // primitivies
40695 if (typeof val === 'undefined') {
40696 return 'undefined';
40697 }
40698 if (val === null) {
40699 return 'null';
40700 }
40701 if (val === true || val === false || val instanceof Boolean) {
40702 return 'boolean';
40703 }
40704 if (typeof val === 'string' || val instanceof String) {
40705 return 'string';
40706 }
40707 if (typeof val === 'number' || val instanceof Number) {
40708 return 'number';
40709 }
40710
40711 // functions
40712 if (typeof val === 'function' || val instanceof Function) {
40713 return 'function';
40714 }
40715
40716 // array
40717 if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
40718 return 'array';
40719 }
40720
40721 // check for instances of RegExp and Date before calling `toString`
40722 if (val instanceof RegExp) {
40723 return 'regexp';
40724 }
40725 if (val instanceof Date) {
40726 return 'date';
40727 }
40728
40729 // other objects
40730 var type = toString.call(val);
40731
40732 if (type === '[object RegExp]') {
40733 return 'regexp';
40734 }
40735 if (type === '[object Date]') {
40736 return 'date';
40737 }
40738 if (type === '[object Arguments]') {
40739 return 'arguments';
40740 }
40741 if (type === '[object Error]') {
40742 return 'error';
40743 }
40744
40745 // buffer
40746 if (isBuffer(val)) {
40747 return 'buffer';
40748 }
40749
40750 // es6: Map, WeakMap, Set, WeakSet
40751 if (type === '[object Set]') {
40752 return 'set';
40753 }
40754 if (type === '[object WeakSet]') {
40755 return 'weakset';
40756 }
40757 if (type === '[object Map]') {
40758 return 'map';
40759 }
40760 if (type === '[object WeakMap]') {
40761 return 'weakmap';
40762 }
40763 if (type === '[object Symbol]') {
40764 return 'symbol';
40765 }
40766
40767 // typed arrays
40768 if (type === '[object Int8Array]') {
40769 return 'int8array';
40770 }
40771 if (type === '[object Uint8Array]') {
40772 return 'uint8array';
40773 }
40774 if (type === '[object Uint8ClampedArray]') {
40775 return 'uint8clampedarray';
40776 }
40777 if (type === '[object Int16Array]') {
40778 return 'int16array';
40779 }
40780 if (type === '[object Uint16Array]') {
40781 return 'uint16array';
40782 }
40783 if (type === '[object Int32Array]') {
40784 return 'int32array';
40785 }
40786 if (type === '[object Uint32Array]') {
40787 return 'uint32array';
40788 }
40789 if (type === '[object Float32Array]') {
40790 return 'float32array';
40791 }
40792 if (type === '[object Float64Array]') {
40793 return 'float64array';
40794 }
40795
40796 // must be a plain object
40797 return 'object';
40798};
40799
40800
40801/***/ }),
40802
40803/***/ 49924:
40804/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40805
40806"use strict";
40807/*!
40808 * is-descriptor <https://github.com/jonschlinkert/is-descriptor>
40809 *
40810 * Copyright (c) 2015-2017, Jon Schlinkert.
40811 * Released under the MIT License.
40812 */
40813
40814
40815
40816var typeOf = __webpack_require__(42649);
40817var isAccessor = __webpack_require__(30138);
40818var isData = __webpack_require__(54963);
40819
40820module.exports = function isDescriptor(obj, key) {
40821 if (typeOf(obj) !== 'object') {
40822 return false;
40823 }
40824 if ('get' in obj) {
40825 return isAccessor(obj, key);
40826 }
40827 return isData(obj, key);
40828};
40829
40830
40831/***/ }),
40832
40833/***/ 42649:
40834/***/ (function(module) {
40835
40836var toString = Object.prototype.toString;
40837
40838/**
40839 * Get the native `typeof` a value.
40840 *
40841 * @param {*} `val`
40842 * @return {*} Native javascript type
40843 */
40844
40845module.exports = function kindOf(val) {
40846 var type = typeof val;
40847
40848 // primitivies
40849 if (type === 'undefined') {
40850 return 'undefined';
40851 }
40852 if (val === null) {
40853 return 'null';
40854 }
40855 if (val === true || val === false || val instanceof Boolean) {
40856 return 'boolean';
40857 }
40858 if (type === 'string' || val instanceof String) {
40859 return 'string';
40860 }
40861 if (type === 'number' || val instanceof Number) {
40862 return 'number';
40863 }
40864
40865 // functions
40866 if (type === 'function' || val instanceof Function) {
40867 if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {
40868 return 'generatorfunction';
40869 }
40870 return 'function';
40871 }
40872
40873 // array
40874 if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
40875 return 'array';
40876 }
40877
40878 // check for instances of RegExp and Date before calling `toString`
40879 if (val instanceof RegExp) {
40880 return 'regexp';
40881 }
40882 if (val instanceof Date) {
40883 return 'date';
40884 }
40885
40886 // other objects
40887 type = toString.call(val);
40888
40889 if (type === '[object RegExp]') {
40890 return 'regexp';
40891 }
40892 if (type === '[object Date]') {
40893 return 'date';
40894 }
40895 if (type === '[object Arguments]') {
40896 return 'arguments';
40897 }
40898 if (type === '[object Error]') {
40899 return 'error';
40900 }
40901 if (type === '[object Promise]') {
40902 return 'promise';
40903 }
40904
40905 // buffer
40906 if (isBuffer(val)) {
40907 return 'buffer';
40908 }
40909
40910 // es6: Map, WeakMap, Set, WeakSet
40911 if (type === '[object Set]') {
40912 return 'set';
40913 }
40914 if (type === '[object WeakSet]') {
40915 return 'weakset';
40916 }
40917 if (type === '[object Map]') {
40918 return 'map';
40919 }
40920 if (type === '[object WeakMap]') {
40921 return 'weakmap';
40922 }
40923 if (type === '[object Symbol]') {
40924 return 'symbol';
40925 }
40926
40927 if (type === '[object Map Iterator]') {
40928 return 'mapiterator';
40929 }
40930 if (type === '[object Set Iterator]') {
40931 return 'setiterator';
40932 }
40933 if (type === '[object String Iterator]') {
40934 return 'stringiterator';
40935 }
40936 if (type === '[object Array Iterator]') {
40937 return 'arrayiterator';
40938 }
40939
40940 // typed arrays
40941 if (type === '[object Int8Array]') {
40942 return 'int8array';
40943 }
40944 if (type === '[object Uint8Array]') {
40945 return 'uint8array';
40946 }
40947 if (type === '[object Uint8ClampedArray]') {
40948 return 'uint8clampedarray';
40949 }
40950 if (type === '[object Int16Array]') {
40951 return 'int16array';
40952 }
40953 if (type === '[object Uint16Array]') {
40954 return 'uint16array';
40955 }
40956 if (type === '[object Int32Array]') {
40957 return 'int32array';
40958 }
40959 if (type === '[object Uint32Array]') {
40960 return 'uint32array';
40961 }
40962 if (type === '[object Float32Array]') {
40963 return 'float32array';
40964 }
40965 if (type === '[object Float64Array]') {
40966 return 'float64array';
40967 }
40968
40969 // must be a plain object
40970 return 'object';
40971};
40972
40973/**
40974 * If you need to support Safari 5-7 (8-10 yr-old browser),
40975 * take a look at https://github.com/feross/is-buffer
40976 */
40977
40978function isBuffer(val) {
40979 return val.constructor
40980 && typeof val.constructor.isBuffer === 'function'
40981 && val.constructor.isBuffer(val);
40982}
40983
40984
40985/***/ }),
40986
40987/***/ 89901:
40988/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
40989
40990"use strict";
40991/*
40992 MIT License http://www.opensource.org/licenses/mit-license.php
40993 Author Tobias Koppers @sokra
40994*/
40995
40996
40997const DescriptionFileUtils = __webpack_require__(70232);
40998const getInnerRequest = __webpack_require__(91878);
40999
41000module.exports = class AliasFieldPlugin {
41001 constructor(source, field, target) {
41002 this.source = source;
41003 this.field = field;
41004 this.target = target;
41005 }
41006
41007 apply(resolver) {
41008 const target = resolver.ensureHook(this.target);
41009 resolver
41010 .getHook(this.source)
41011 .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => {
41012 if (!request.descriptionFileData) return callback();
41013 const innerRequest = getInnerRequest(resolver, request);
41014 if (!innerRequest) return callback();
41015 const fieldData = DescriptionFileUtils.getField(
41016 request.descriptionFileData,
41017 this.field
41018 );
41019 if (typeof fieldData !== "object") {
41020 if (resolveContext.log)
41021 resolveContext.log(
41022 "Field '" +
41023 this.field +
41024 "' doesn't contain a valid alias configuration"
41025 );
41026 return callback();
41027 }
41028 const data1 = fieldData[innerRequest];
41029 const data2 = fieldData[innerRequest.replace(/^\.\//, "")];
41030 const data = typeof data1 !== "undefined" ? data1 : data2;
41031 if (data === innerRequest) return callback();
41032 if (data === undefined) return callback();
41033 if (data === false) {
41034 const ignoreObj = Object.assign({}, request, {
41035 path: false
41036 });
41037 return callback(null, ignoreObj);
41038 }
41039 const obj = Object.assign({}, request, {
41040 path: request.descriptionFileRoot,
41041 request: data
41042 });
41043 resolver.doResolve(
41044 target,
41045 obj,
41046 "aliased from description file " +
41047 request.descriptionFilePath +
41048 " with mapping '" +
41049 innerRequest +
41050 "' to '" +
41051 data +
41052 "'",
41053 resolveContext,
41054 (err, result) => {
41055 if (err) return callback(err);
41056
41057 // Don't allow other aliasing or raw request
41058 if (result === undefined) return callback(null, null);
41059 callback(null, result);
41060 }
41061 );
41062 });
41063 }
41064};
41065
41066
41067/***/ }),
41068
41069/***/ 15005:
41070/***/ (function(module) {
41071
41072"use strict";
41073/*
41074 MIT License http://www.opensource.org/licenses/mit-license.php
41075 Author Tobias Koppers @sokra
41076*/
41077
41078
41079function startsWith(string, searchString) {
41080 const stringLength = string.length;
41081 const searchLength = searchString.length;
41082
41083 // early out if the search length is greater than the search string
41084 if (searchLength > stringLength) {
41085 return false;
41086 }
41087 let index = -1;
41088 while (++index < searchLength) {
41089 if (string.charCodeAt(index) !== searchString.charCodeAt(index)) {
41090 return false;
41091 }
41092 }
41093 return true;
41094}
41095
41096module.exports = class AliasPlugin {
41097 constructor(source, options, target) {
41098 this.source = source;
41099 this.options = Array.isArray(options) ? options : [options];
41100 this.target = target;
41101 }
41102
41103 apply(resolver) {
41104 const target = resolver.ensureHook(this.target);
41105 resolver
41106 .getHook(this.source)
41107 .tapAsync("AliasPlugin", (request, resolveContext, callback) => {
41108 const innerRequest = request.request || request.path;
41109 if (!innerRequest) return callback();
41110 for (const item of this.options) {
41111 if (
41112 innerRequest === item.name ||
41113 (!item.onlyModule && startsWith(innerRequest, item.name + "/"))
41114 ) {
41115 if (
41116 innerRequest !== item.alias &&
41117 !startsWith(innerRequest, item.alias + "/")
41118 ) {
41119 const newRequestStr =
41120 item.alias + innerRequest.substr(item.name.length);
41121 const obj = Object.assign({}, request, {
41122 request: newRequestStr
41123 });
41124 return resolver.doResolve(
41125 target,
41126 obj,
41127 "aliased with mapping '" +
41128 item.name +
41129 "': '" +
41130 item.alias +
41131 "' to '" +
41132 newRequestStr +
41133 "'",
41134 resolveContext,
41135 (err, result) => {
41136 if (err) return callback(err);
41137
41138 // Don't allow other aliasing or raw request
41139 if (result === undefined) return callback(null, null);
41140 callback(null, result);
41141 }
41142 );
41143 }
41144 }
41145 }
41146 return callback();
41147 });
41148 }
41149};
41150
41151
41152/***/ }),
41153
41154/***/ 2271:
41155/***/ (function(module) {
41156
41157"use strict";
41158/*
41159 MIT License http://www.opensource.org/licenses/mit-license.php
41160 Author Tobias Koppers @sokra
41161*/
41162
41163
41164module.exports = class AppendPlugin {
41165 constructor(source, appending, target) {
41166 this.source = source;
41167 this.appending = appending;
41168 this.target = target;
41169 }
41170
41171 apply(resolver) {
41172 const target = resolver.ensureHook(this.target);
41173 resolver
41174 .getHook(this.source)
41175 .tapAsync("AppendPlugin", (request, resolveContext, callback) => {
41176 const obj = Object.assign({}, request, {
41177 path: request.path + this.appending,
41178 relativePath:
41179 request.relativePath && request.relativePath + this.appending
41180 });
41181 resolver.doResolve(
41182 target,
41183 obj,
41184 this.appending,
41185 resolveContext,
41186 callback
41187 );
41188 });
41189 }
41190};
41191
41192
41193/***/ }),
41194
41195/***/ 75544:
41196/***/ (function(module) {
41197
41198"use strict";
41199/*
41200 MIT License http://www.opensource.org/licenses/mit-license.php
41201 Author Tobias Koppers @sokra
41202*/
41203
41204
41205class Storage {
41206 constructor(duration) {
41207 this.duration = duration;
41208 this.running = new Map();
41209 this.data = new Map();
41210 this.levels = [];
41211 if (duration > 0) {
41212 this.levels.push(
41213 new Set(),
41214 new Set(),
41215 new Set(),
41216 new Set(),
41217 new Set(),
41218 new Set(),
41219 new Set(),
41220 new Set(),
41221 new Set()
41222 );
41223 for (let i = 8000; i < duration; i += 500) this.levels.push(new Set());
41224 }
41225 this.count = 0;
41226 this.interval = null;
41227 this.needTickCheck = false;
41228 this.nextTick = null;
41229 this.passive = true;
41230 this.tick = this.tick.bind(this);
41231 }
41232
41233 ensureTick() {
41234 if (!this.interval && this.duration > 0 && !this.nextTick)
41235 this.interval = setInterval(
41236 this.tick,
41237 Math.floor(this.duration / this.levels.length)
41238 );
41239 }
41240
41241 finished(name, err, result) {
41242 const callbacks = this.running.get(name);
41243 this.running.delete(name);
41244 if (this.duration > 0) {
41245 this.data.set(name, [err, result]);
41246 const levelData = this.levels[0];
41247 this.count -= levelData.size;
41248 levelData.add(name);
41249 this.count += levelData.size;
41250 this.ensureTick();
41251 }
41252 for (let i = 0; i < callbacks.length; i++) {
41253 callbacks[i](err, result);
41254 }
41255 }
41256
41257 finishedSync(name, err, result) {
41258 if (this.duration > 0) {
41259 this.data.set(name, [err, result]);
41260 const levelData = this.levels[0];
41261 this.count -= levelData.size;
41262 levelData.add(name);
41263 this.count += levelData.size;
41264 this.ensureTick();
41265 }
41266 }
41267
41268 provide(name, provider, callback) {
41269 if (typeof name !== "string") {
41270 callback(new TypeError("path must be a string"));
41271 return;
41272 }
41273 let running = this.running.get(name);
41274 if (running) {
41275 running.push(callback);
41276 return;
41277 }
41278 if (this.duration > 0) {
41279 this.checkTicks();
41280 const data = this.data.get(name);
41281 if (data) {
41282 return process.nextTick(() => {
41283 callback.apply(null, data);
41284 });
41285 }
41286 }
41287 this.running.set(name, (running = [callback]));
41288 provider(name, (err, result) => {
41289 this.finished(name, err, result);
41290 });
41291 }
41292
41293 provideSync(name, provider) {
41294 if (typeof name !== "string") {
41295 throw new TypeError("path must be a string");
41296 }
41297 if (this.duration > 0) {
41298 this.checkTicks();
41299 const data = this.data.get(name);
41300 if (data) {
41301 if (data[0]) throw data[0];
41302 return data[1];
41303 }
41304 }
41305 let result;
41306 try {
41307 result = provider(name);
41308 } catch (e) {
41309 this.finishedSync(name, e);
41310 throw e;
41311 }
41312 this.finishedSync(name, null, result);
41313 return result;
41314 }
41315
41316 tick() {
41317 const decay = this.levels.pop();
41318 for (let item of decay) {
41319 this.data.delete(item);
41320 }
41321 this.count -= decay.size;
41322 decay.clear();
41323 this.levels.unshift(decay);
41324 if (this.count === 0) {
41325 clearInterval(this.interval);
41326 this.interval = null;
41327 this.nextTick = null;
41328 return true;
41329 } else if (this.nextTick) {
41330 this.nextTick += Math.floor(this.duration / this.levels.length);
41331 const time = new Date().getTime();
41332 if (this.nextTick > time) {
41333 this.nextTick = null;
41334 this.interval = setInterval(
41335 this.tick,
41336 Math.floor(this.duration / this.levels.length)
41337 );
41338 return true;
41339 }
41340 } else if (this.passive) {
41341 clearInterval(this.interval);
41342 this.interval = null;
41343 this.nextTick =
41344 new Date().getTime() + Math.floor(this.duration / this.levels.length);
41345 } else {
41346 this.passive = true;
41347 }
41348 }
41349
41350 checkTicks() {
41351 this.passive = false;
41352 if (this.nextTick) {
41353 while (!this.tick());
41354 }
41355 }
41356
41357 purge(what) {
41358 if (!what) {
41359 this.count = 0;
41360 clearInterval(this.interval);
41361 this.nextTick = null;
41362 this.data.clear();
41363 this.levels.forEach(level => {
41364 level.clear();
41365 });
41366 } else if (typeof what === "string") {
41367 for (let key of this.data.keys()) {
41368 if (key.startsWith(what)) this.data.delete(key);
41369 }
41370 } else {
41371 for (let i = what.length - 1; i >= 0; i--) {
41372 this.purge(what[i]);
41373 }
41374 }
41375 }
41376}
41377
41378module.exports = class CachedInputFileSystem {
41379 constructor(fileSystem, duration) {
41380 this.fileSystem = fileSystem;
41381 this._statStorage = new Storage(duration);
41382 this._readdirStorage = new Storage(duration);
41383 this._readFileStorage = new Storage(duration);
41384 this._readJsonStorage = new Storage(duration);
41385 this._readlinkStorage = new Storage(duration);
41386
41387 this._stat = this.fileSystem.stat
41388 ? this.fileSystem.stat.bind(this.fileSystem)
41389 : null;
41390 if (!this._stat) this.stat = null;
41391
41392 this._statSync = this.fileSystem.statSync
41393 ? this.fileSystem.statSync.bind(this.fileSystem)
41394 : null;
41395 if (!this._statSync) this.statSync = null;
41396
41397 this._readdir = this.fileSystem.readdir
41398 ? this.fileSystem.readdir.bind(this.fileSystem)
41399 : null;
41400 if (!this._readdir) this.readdir = null;
41401
41402 this._readdirSync = this.fileSystem.readdirSync
41403 ? this.fileSystem.readdirSync.bind(this.fileSystem)
41404 : null;
41405 if (!this._readdirSync) this.readdirSync = null;
41406
41407 this._readFile = this.fileSystem.readFile
41408 ? this.fileSystem.readFile.bind(this.fileSystem)
41409 : null;
41410 if (!this._readFile) this.readFile = null;
41411
41412 this._readFileSync = this.fileSystem.readFileSync
41413 ? this.fileSystem.readFileSync.bind(this.fileSystem)
41414 : null;
41415 if (!this._readFileSync) this.readFileSync = null;
41416
41417 if (this.fileSystem.readJson) {
41418 this._readJson = this.fileSystem.readJson.bind(this.fileSystem);
41419 } else if (this.readFile) {
41420 this._readJson = (path, callback) => {
41421 this.readFile(path, (err, buffer) => {
41422 if (err) return callback(err);
41423 let data;
41424 try {
41425 data = JSON.parse(buffer.toString("utf-8"));
41426 } catch (e) {
41427 return callback(e);
41428 }
41429 callback(null, data);
41430 });
41431 };
41432 } else {
41433 this.readJson = null;
41434 }
41435 if (this.fileSystem.readJsonSync) {
41436 this._readJsonSync = this.fileSystem.readJsonSync.bind(this.fileSystem);
41437 } else if (this.readFileSync) {
41438 this._readJsonSync = path => {
41439 const buffer = this.readFileSync(path);
41440 const data = JSON.parse(buffer.toString("utf-8"));
41441 return data;
41442 };
41443 } else {
41444 this.readJsonSync = null;
41445 }
41446
41447 this._readlink = this.fileSystem.readlink
41448 ? this.fileSystem.readlink.bind(this.fileSystem)
41449 : null;
41450 if (!this._readlink) this.readlink = null;
41451
41452 this._readlinkSync = this.fileSystem.readlinkSync
41453 ? this.fileSystem.readlinkSync.bind(this.fileSystem)
41454 : null;
41455 if (!this._readlinkSync) this.readlinkSync = null;
41456 }
41457
41458 stat(path, callback) {
41459 this._statStorage.provide(path, this._stat, callback);
41460 }
41461
41462 readdir(path, callback) {
41463 this._readdirStorage.provide(path, this._readdir, callback);
41464 }
41465
41466 readFile(path, callback) {
41467 this._readFileStorage.provide(path, this._readFile, callback);
41468 }
41469
41470 readJson(path, callback) {
41471 this._readJsonStorage.provide(path, this._readJson, callback);
41472 }
41473
41474 readlink(path, callback) {
41475 this._readlinkStorage.provide(path, this._readlink, callback);
41476 }
41477
41478 statSync(path) {
41479 return this._statStorage.provideSync(path, this._statSync);
41480 }
41481
41482 readdirSync(path) {
41483 return this._readdirStorage.provideSync(path, this._readdirSync);
41484 }
41485
41486 readFileSync(path) {
41487 return this._readFileStorage.provideSync(path, this._readFileSync);
41488 }
41489
41490 readJsonSync(path) {
41491 return this._readJsonStorage.provideSync(path, this._readJsonSync);
41492 }
41493
41494 readlinkSync(path) {
41495 return this._readlinkStorage.provideSync(path, this._readlinkSync);
41496 }
41497
41498 purge(what) {
41499 this._statStorage.purge(what);
41500 this._readdirStorage.purge(what);
41501 this._readFileStorage.purge(what);
41502 this._readlinkStorage.purge(what);
41503 this._readJsonStorage.purge(what);
41504 }
41505};
41506
41507
41508/***/ }),
41509
41510/***/ 56821:
41511/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41512
41513"use strict";
41514/*
41515 MIT License http://www.opensource.org/licenses/mit-license.php
41516 Author Tobias Koppers @sokra
41517*/
41518
41519
41520const concord = __webpack_require__(94323);
41521const DescriptionFileUtils = __webpack_require__(70232);
41522const forEachBail = __webpack_require__(60059);
41523
41524module.exports = class ConcordExtensionsPlugin {
41525 constructor(source, options, target) {
41526 this.source = source;
41527 this.options = options;
41528 this.target = target;
41529 }
41530
41531 apply(resolver) {
41532 const target = resolver.ensureHook(this.target);
41533 resolver
41534 .getHook(this.source)
41535 .tapAsync(
41536 "ConcordExtensionsPlugin",
41537 (request, resolveContext, callback) => {
41538 const concordField = DescriptionFileUtils.getField(
41539 request.descriptionFileData,
41540 "concord"
41541 );
41542 if (!concordField) return callback();
41543 const extensions = concord.getExtensions(
41544 request.context,
41545 concordField
41546 );
41547 if (!extensions) return callback();
41548 forEachBail(
41549 extensions,
41550 (appending, callback) => {
41551 const obj = Object.assign({}, request, {
41552 path: request.path + appending,
41553 relativePath:
41554 request.relativePath && request.relativePath + appending
41555 });
41556 resolver.doResolve(
41557 target,
41558 obj,
41559 "concord extension: " + appending,
41560 resolveContext,
41561 callback
41562 );
41563 },
41564 (err, result) => {
41565 if (err) return callback(err);
41566
41567 // Don't allow other processing
41568 if (result === undefined) return callback(null, null);
41569 callback(null, result);
41570 }
41571 );
41572 }
41573 );
41574 }
41575};
41576
41577
41578/***/ }),
41579
41580/***/ 27878:
41581/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41582
41583"use strict";
41584/*
41585 MIT License http://www.opensource.org/licenses/mit-license.php
41586 Author Tobias Koppers @sokra
41587*/
41588
41589
41590const path = __webpack_require__(85622);
41591const concord = __webpack_require__(94323);
41592const DescriptionFileUtils = __webpack_require__(70232);
41593
41594module.exports = class ConcordMainPlugin {
41595 constructor(source, options, target) {
41596 this.source = source;
41597 this.options = options;
41598 this.target = target;
41599 }
41600
41601 apply(resolver) {
41602 const target = resolver.ensureHook(this.target);
41603 resolver
41604 .getHook(this.source)
41605 .tapAsync("ConcordMainPlugin", (request, resolveContext, callback) => {
41606 if (request.path !== request.descriptionFileRoot) return callback();
41607 const concordField = DescriptionFileUtils.getField(
41608 request.descriptionFileData,
41609 "concord"
41610 );
41611 if (!concordField) return callback();
41612 const mainModule = concord.getMain(request.context, concordField);
41613 if (!mainModule) return callback();
41614 const obj = Object.assign({}, request, {
41615 request: mainModule
41616 });
41617 const filename = path.basename(request.descriptionFilePath);
41618 return resolver.doResolve(
41619 target,
41620 obj,
41621 "use " + mainModule + " from " + filename,
41622 resolveContext,
41623 callback
41624 );
41625 });
41626 }
41627};
41628
41629
41630/***/ }),
41631
41632/***/ 50297:
41633/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41634
41635"use strict";
41636/*
41637 MIT License http://www.opensource.org/licenses/mit-license.php
41638 Author Tobias Koppers @sokra
41639*/
41640
41641
41642const concord = __webpack_require__(94323);
41643const DescriptionFileUtils = __webpack_require__(70232);
41644const getInnerRequest = __webpack_require__(91878);
41645
41646module.exports = class ConcordModulesPlugin {
41647 constructor(source, options, target) {
41648 this.source = source;
41649 this.options = options;
41650 this.target = target;
41651 }
41652
41653 apply(resolver) {
41654 const target = resolver.ensureHook(this.target);
41655 resolver
41656 .getHook(this.source)
41657 .tapAsync("ConcordModulesPlugin", (request, resolveContext, callback) => {
41658 const innerRequest = getInnerRequest(resolver, request);
41659 if (!innerRequest) return callback();
41660 const concordField = DescriptionFileUtils.getField(
41661 request.descriptionFileData,
41662 "concord"
41663 );
41664 if (!concordField) return callback();
41665 const data = concord.matchModule(
41666 request.context,
41667 concordField,
41668 innerRequest
41669 );
41670 if (data === innerRequest) return callback();
41671 if (data === undefined) return callback();
41672 if (data === false) {
41673 const ignoreObj = Object.assign({}, request, {
41674 path: false
41675 });
41676 return callback(null, ignoreObj);
41677 }
41678 const obj = Object.assign({}, request, {
41679 path: request.descriptionFileRoot,
41680 request: data
41681 });
41682 resolver.doResolve(
41683 target,
41684 obj,
41685 "aliased from description file " +
41686 request.descriptionFilePath +
41687 " with mapping '" +
41688 innerRequest +
41689 "' to '" +
41690 data +
41691 "'",
41692 resolveContext,
41693 (err, result) => {
41694 if (err) return callback(err);
41695
41696 // Don't allow other aliasing or raw request
41697 if (result === undefined) return callback(null, null);
41698 callback(null, result);
41699 }
41700 );
41701 });
41702 }
41703};
41704
41705
41706/***/ }),
41707
41708/***/ 95637:
41709/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41710
41711"use strict";
41712/*
41713MIT License http://www.opensource.org/licenses/mit-license.php
41714Author Tobias Koppers @sokra
41715*/
41716
41717
41718const DescriptionFileUtils = __webpack_require__(70232);
41719
41720module.exports = class DescriptionFilePlugin {
41721 constructor(source, filenames, target) {
41722 this.source = source;
41723 this.filenames = [].concat(filenames);
41724 this.target = target;
41725 }
41726
41727 apply(resolver) {
41728 const target = resolver.ensureHook(this.target);
41729 resolver
41730 .getHook(this.source)
41731 .tapAsync(
41732 "DescriptionFilePlugin",
41733 (request, resolveContext, callback) => {
41734 const directory = request.path;
41735 DescriptionFileUtils.loadDescriptionFile(
41736 resolver,
41737 directory,
41738 this.filenames,
41739 resolveContext,
41740 (err, result) => {
41741 if (err) return callback(err);
41742 if (!result) {
41743 if (resolveContext.missing) {
41744 this.filenames.forEach(filename => {
41745 resolveContext.missing.add(
41746 resolver.join(directory, filename)
41747 );
41748 });
41749 }
41750 if (resolveContext.log)
41751 resolveContext.log("No description file found");
41752 return callback();
41753 }
41754 const relativePath =
41755 "." +
41756 request.path
41757 .substr(result.directory.length)
41758 .replace(/\\/g, "/");
41759 const obj = Object.assign({}, request, {
41760 descriptionFilePath: result.path,
41761 descriptionFileData: result.content,
41762 descriptionFileRoot: result.directory,
41763 relativePath: relativePath
41764 });
41765 resolver.doResolve(
41766 target,
41767 obj,
41768 "using description file: " +
41769 result.path +
41770 " (relative path: " +
41771 relativePath +
41772 ")",
41773 resolveContext,
41774 (err, result) => {
41775 if (err) return callback(err);
41776
41777 // Don't allow other processing
41778 if (result === undefined) return callback(null, null);
41779 callback(null, result);
41780 }
41781 );
41782 }
41783 );
41784 }
41785 );
41786 }
41787};
41788
41789
41790/***/ }),
41791
41792/***/ 70232:
41793/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
41794
41795"use strict";
41796/*
41797 MIT License http://www.opensource.org/licenses/mit-license.php
41798 Author Tobias Koppers @sokra
41799*/
41800
41801
41802const forEachBail = __webpack_require__(60059);
41803
41804function loadDescriptionFile(
41805 resolver,
41806 directory,
41807 filenames,
41808 resolveContext,
41809 callback
41810) {
41811 (function findDescriptionFile() {
41812 forEachBail(
41813 filenames,
41814 (filename, callback) => {
41815 const descriptionFilePath = resolver.join(directory, filename);
41816 if (resolver.fileSystem.readJson) {
41817 resolver.fileSystem.readJson(descriptionFilePath, (err, content) => {
41818 if (err) {
41819 if (typeof err.code !== "undefined") return callback();
41820 return onJson(err);
41821 }
41822 onJson(null, content);
41823 });
41824 } else {
41825 resolver.fileSystem.readFile(descriptionFilePath, (err, content) => {
41826 if (err) return callback();
41827 let json;
41828 try {
41829 json = JSON.parse(content);
41830 } catch (e) {
41831 onJson(e);
41832 }
41833 onJson(null, json);
41834 });
41835 }
41836
41837 function onJson(err, content) {
41838 if (err) {
41839 if (resolveContext.log)
41840 resolveContext.log(
41841 descriptionFilePath + " (directory description file): " + err
41842 );
41843 else
41844 err.message =
41845 descriptionFilePath + " (directory description file): " + err;
41846 return callback(err);
41847 }
41848 callback(null, {
41849 content: content,
41850 directory: directory,
41851 path: descriptionFilePath
41852 });
41853 }
41854 },
41855 (err, result) => {
41856 if (err) return callback(err);
41857 if (result) {
41858 return callback(null, result);
41859 } else {
41860 directory = cdUp(directory);
41861 if (!directory) {
41862 return callback();
41863 } else {
41864 return findDescriptionFile();
41865 }
41866 }
41867 }
41868 );
41869 })();
41870}
41871
41872function getField(content, field) {
41873 if (!content) return undefined;
41874 if (Array.isArray(field)) {
41875 let current = content;
41876 for (let j = 0; j < field.length; j++) {
41877 if (current === null || typeof current !== "object") {
41878 current = null;
41879 break;
41880 }
41881 current = current[field[j]];
41882 }
41883 if (typeof current === "object") {
41884 return current;
41885 }
41886 } else {
41887 if (typeof content[field] === "object") {
41888 return content[field];
41889 }
41890 }
41891}
41892
41893function cdUp(directory) {
41894 if (directory === "/") return null;
41895 const i = directory.lastIndexOf("/"),
41896 j = directory.lastIndexOf("\\");
41897 const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
41898 if (p < 0) return null;
41899 return directory.substr(0, p || 1);
41900}
41901
41902exports.loadDescriptionFile = loadDescriptionFile;
41903exports.getField = getField;
41904exports.cdUp = cdUp;
41905
41906
41907/***/ }),
41908
41909/***/ 48504:
41910/***/ (function(module) {
41911
41912"use strict";
41913/*
41914 MIT License http://www.opensource.org/licenses/mit-license.php
41915 Author Tobias Koppers @sokra
41916*/
41917
41918
41919module.exports = class DirectoryExistsPlugin {
41920 constructor(source, target) {
41921 this.source = source;
41922 this.target = target;
41923 }
41924
41925 apply(resolver) {
41926 const target = resolver.ensureHook(this.target);
41927 resolver
41928 .getHook(this.source)
41929 .tapAsync(
41930 "DirectoryExistsPlugin",
41931 (request, resolveContext, callback) => {
41932 const fs = resolver.fileSystem;
41933 const directory = request.path;
41934 fs.stat(directory, (err, stat) => {
41935 if (err || !stat) {
41936 if (resolveContext.missing) resolveContext.missing.add(directory);
41937 if (resolveContext.log)
41938 resolveContext.log(directory + " doesn't exist");
41939 return callback();
41940 }
41941 if (!stat.isDirectory()) {
41942 if (resolveContext.missing) resolveContext.missing.add(directory);
41943 if (resolveContext.log)
41944 resolveContext.log(directory + " is not a directory");
41945 return callback();
41946 }
41947 resolver.doResolve(
41948 target,
41949 request,
41950 "existing directory",
41951 resolveContext,
41952 callback
41953 );
41954 });
41955 }
41956 );
41957 }
41958};
41959
41960
41961/***/ }),
41962
41963/***/ 68372:
41964/***/ (function(module) {
41965
41966"use strict";
41967/*
41968 MIT License http://www.opensource.org/licenses/mit-license.php
41969 Author Tobias Koppers @sokra
41970*/
41971
41972
41973module.exports = class FileExistsPlugin {
41974 constructor(source, target) {
41975 this.source = source;
41976 this.target = target;
41977 }
41978
41979 apply(resolver) {
41980 const target = resolver.ensureHook(this.target);
41981 const fs = resolver.fileSystem;
41982 resolver
41983 .getHook(this.source)
41984 .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => {
41985 const file = request.path;
41986 fs.stat(file, (err, stat) => {
41987 if (err || !stat) {
41988 if (resolveContext.missing) resolveContext.missing.add(file);
41989 if (resolveContext.log) resolveContext.log(file + " doesn't exist");
41990 return callback();
41991 }
41992 if (!stat.isFile()) {
41993 if (resolveContext.missing) resolveContext.missing.add(file);
41994 if (resolveContext.log) resolveContext.log(file + " is not a file");
41995 return callback();
41996 }
41997 resolver.doResolve(
41998 target,
41999 request,
42000 "existing file: " + file,
42001 resolveContext,
42002 callback
42003 );
42004 });
42005 });
42006 }
42007};
42008
42009
42010/***/ }),
42011
42012/***/ 63602:
42013/***/ (function(module) {
42014
42015"use strict";
42016/*
42017 MIT License http://www.opensource.org/licenses/mit-license.php
42018 Author Tobias Koppers @sokra
42019*/
42020
42021
42022module.exports = class FileKindPlugin {
42023 constructor(source, target) {
42024 this.source = source;
42025 this.target = target;
42026 }
42027
42028 apply(resolver) {
42029 const target = resolver.ensureHook(this.target);
42030 resolver
42031 .getHook(this.source)
42032 .tapAsync("FileKindPlugin", (request, resolveContext, callback) => {
42033 if (request.directory) return callback();
42034 const obj = Object.assign({}, request);
42035 delete obj.directory;
42036 resolver.doResolve(target, obj, null, resolveContext, callback);
42037 });
42038 }
42039};
42040
42041
42042/***/ }),
42043
42044/***/ 31693:
42045/***/ (function(module) {
42046
42047"use strict";
42048/*
42049 MIT License http://www.opensource.org/licenses/mit-license.php
42050 Author Tobias Koppers @sokra
42051*/
42052
42053
42054module.exports = class JoinRequestPlugin {
42055 constructor(source, target) {
42056 this.source = source;
42057 this.target = target;
42058 }
42059
42060 apply(resolver) {
42061 const target = resolver.ensureHook(this.target);
42062 resolver
42063 .getHook(this.source)
42064 .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => {
42065 const obj = Object.assign({}, request, {
42066 path: resolver.join(request.path, request.request),
42067 relativePath:
42068 request.relativePath &&
42069 resolver.join(request.relativePath, request.request),
42070 request: undefined
42071 });
42072 resolver.doResolve(target, obj, null, resolveContext, callback);
42073 });
42074 }
42075};
42076
42077
42078/***/ }),
42079
42080/***/ 7064:
42081/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
42082
42083"use strict";
42084/*
42085 MIT License http://www.opensource.org/licenses/mit-license.php
42086 Author Tobias Koppers @sokra
42087*/
42088
42089
42090const path = __webpack_require__(85622);
42091
42092module.exports = class MainFieldPlugin {
42093 constructor(source, options, target) {
42094 this.source = source;
42095 this.options = options;
42096 this.target = target;
42097 }
42098
42099 apply(resolver) {
42100 const target = resolver.ensureHook(this.target);
42101 resolver
42102 .getHook(this.source)
42103 .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => {
42104 if (request.path !== request.descriptionFileRoot) return callback();
42105 if (request.alreadyTriedMainField === request.descriptionFilePath)
42106 return callback();
42107 const content = request.descriptionFileData;
42108 const filename = path.basename(request.descriptionFilePath);
42109 let mainModule;
42110 const field = this.options.name;
42111 if (Array.isArray(field)) {
42112 let current = content;
42113 for (let j = 0; j < field.length; j++) {
42114 if (current === null || typeof current !== "object") {
42115 current = null;
42116 break;
42117 }
42118 current = current[field[j]];
42119 }
42120 if (typeof current === "string") {
42121 mainModule = current;
42122 }
42123 } else {
42124 if (typeof content[field] === "string") {
42125 mainModule = content[field];
42126 }
42127 }
42128 if (!mainModule) return callback();
42129 if (this.options.forceRelative && !/^\.\.?\//.test(mainModule))
42130 mainModule = "./" + mainModule;
42131 const obj = Object.assign({}, request, {
42132 request: mainModule,
42133 alreadyTriedMainField: request.descriptionFilePath
42134 });
42135 return resolver.doResolve(
42136 target,
42137 obj,
42138 "use " +
42139 mainModule +
42140 " from " +
42141 this.options.name +
42142 " in " +
42143 filename,
42144 resolveContext,
42145 callback
42146 );
42147 });
42148 }
42149};
42150
42151
42152/***/ }),
42153
42154/***/ 23780:
42155/***/ (function(module) {
42156
42157"use strict";
42158/*
42159 MIT License http://www.opensource.org/licenses/mit-license.php
42160 Author Tobias Koppers @sokra
42161*/
42162
42163
42164module.exports = class ModuleAppendPlugin {
42165 constructor(source, appending, target) {
42166 this.source = source;
42167 this.appending = appending;
42168 this.target = target;
42169 }
42170
42171 apply(resolver) {
42172 const target = resolver.ensureHook(this.target);
42173 resolver
42174 .getHook(this.source)
42175 .tapAsync("ModuleAppendPlugin", (request, resolveContext, callback) => {
42176 const i = request.request.indexOf("/"),
42177 j = request.request.indexOf("\\");
42178 const p = i < 0 ? j : j < 0 ? i : i < j ? i : j;
42179 let moduleName, remainingRequest;
42180 if (p < 0) {
42181 moduleName = request.request;
42182 remainingRequest = "";
42183 } else {
42184 moduleName = request.request.substr(0, p);
42185 remainingRequest = request.request.substr(p);
42186 }
42187 if (moduleName === "." || moduleName === "..") return callback();
42188 const moduleFinalName = moduleName + this.appending;
42189 const obj = Object.assign({}, request, {
42190 request: moduleFinalName + remainingRequest
42191 });
42192 resolver.doResolve(
42193 target,
42194 obj,
42195 "module variation " + moduleFinalName,
42196 resolveContext,
42197 callback
42198 );
42199 });
42200 }
42201};
42202
42203
42204/***/ }),
42205
42206/***/ 9529:
42207/***/ (function(module) {
42208
42209"use strict";
42210/*
42211 MIT License http://www.opensource.org/licenses/mit-license.php
42212 Author Tobias Koppers @sokra
42213*/
42214
42215
42216module.exports = class ModuleKindPlugin {
42217 constructor(source, target) {
42218 this.source = source;
42219 this.target = target;
42220 }
42221
42222 apply(resolver) {
42223 const target = resolver.ensureHook(this.target);
42224 resolver
42225 .getHook(this.source)
42226 .tapAsync("ModuleKindPlugin", (request, resolveContext, callback) => {
42227 if (!request.module) return callback();
42228 const obj = Object.assign({}, request);
42229 delete obj.module;
42230 resolver.doResolve(
42231 target,
42232 obj,
42233 "resolve as module",
42234 resolveContext,
42235 (err, result) => {
42236 if (err) return callback(err);
42237
42238 // Don't allow other alternatives
42239 if (result === undefined) return callback(null, null);
42240 callback(null, result);
42241 }
42242 );
42243 });
42244 }
42245};
42246
42247
42248/***/ }),
42249
42250/***/ 23195:
42251/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
42252
42253"use strict";
42254/*
42255 MIT License http://www.opensource.org/licenses/mit-license.php
42256 Author Tobias Koppers @sokra
42257*/
42258
42259
42260const forEachBail = __webpack_require__(60059);
42261const getPaths = __webpack_require__(49395);
42262
42263module.exports = class ModulesInHierachicDirectoriesPlugin {
42264 constructor(source, directories, target) {
42265 this.source = source;
42266 this.directories = [].concat(directories);
42267 this.target = target;
42268 }
42269
42270 apply(resolver) {
42271 const target = resolver.ensureHook(this.target);
42272 resolver
42273 .getHook(this.source)
42274 .tapAsync(
42275 "ModulesInHierachicDirectoriesPlugin",
42276 (request, resolveContext, callback) => {
42277 const fs = resolver.fileSystem;
42278 const addrs = getPaths(request.path)
42279 .paths.map(p => {
42280 return this.directories.map(d => resolver.join(p, d));
42281 })
42282 .reduce((array, p) => {
42283 array.push.apply(array, p);
42284 return array;
42285 }, []);
42286 forEachBail(
42287 addrs,
42288 (addr, callback) => {
42289 fs.stat(addr, (err, stat) => {
42290 if (!err && stat && stat.isDirectory()) {
42291 const obj = Object.assign({}, request, {
42292 path: addr,
42293 request: "./" + request.request
42294 });
42295 const message = "looking for modules in " + addr;
42296 return resolver.doResolve(
42297 target,
42298 obj,
42299 message,
42300 resolveContext,
42301 callback
42302 );
42303 }
42304 if (resolveContext.log)
42305 resolveContext.log(
42306 addr + " doesn't exist or is not a directory"
42307 );
42308 if (resolveContext.missing) resolveContext.missing.add(addr);
42309 return callback();
42310 });
42311 },
42312 callback
42313 );
42314 }
42315 );
42316 }
42317};
42318
42319
42320/***/ }),
42321
42322/***/ 3092:
42323/***/ (function(module) {
42324
42325"use strict";
42326/*
42327 MIT License http://www.opensource.org/licenses/mit-license.php
42328 Author Tobias Koppers @sokra
42329*/
42330
42331
42332module.exports = class ModulesInRootPlugin {
42333 constructor(source, path, target) {
42334 this.source = source;
42335 this.path = path;
42336 this.target = target;
42337 }
42338
42339 apply(resolver) {
42340 const target = resolver.ensureHook(this.target);
42341 resolver
42342 .getHook(this.source)
42343 .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => {
42344 const obj = Object.assign({}, request, {
42345 path: this.path,
42346 request: "./" + request.request
42347 });
42348 resolver.doResolve(
42349 target,
42350 obj,
42351 "looking for modules in " + this.path,
42352 resolveContext,
42353 callback
42354 );
42355 });
42356 }
42357};
42358
42359
42360/***/ }),
42361
42362/***/ 50959:
42363/***/ (function(module) {
42364
42365"use strict";
42366/*
42367 MIT License http://www.opensource.org/licenses/mit-license.php
42368 Author Tobias Koppers @sokra
42369*/
42370
42371
42372module.exports = class NextPlugin {
42373 constructor(source, target) {
42374 this.source = source;
42375 this.target = target;
42376 }
42377
42378 apply(resolver) {
42379 const target = resolver.ensureHook(this.target);
42380 resolver
42381 .getHook(this.source)
42382 .tapAsync("NextPlugin", (request, resolveContext, callback) => {
42383 resolver.doResolve(target, request, null, resolveContext, callback);
42384 });
42385 }
42386};
42387
42388
42389/***/ }),
42390
42391/***/ 13445:
42392/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
42393
42394"use strict";
42395/*
42396 MIT License http://www.opensource.org/licenses/mit-license.php
42397 Author Tobias Koppers @sokra
42398*/
42399
42400
42401const fs = __webpack_require__(82161);
42402
42403class NodeJsInputFileSystem {
42404 readdir(path, callback) {
42405 fs.readdir(path, (err, files) => {
42406 callback(
42407 err,
42408 files &&
42409 files.map(file => {
42410 return file.normalize ? file.normalize("NFC") : file;
42411 })
42412 );
42413 });
42414 }
42415
42416 readdirSync(path) {
42417 const files = fs.readdirSync(path);
42418 return (
42419 files &&
42420 files.map(file => {
42421 return file.normalize ? file.normalize("NFC") : file;
42422 })
42423 );
42424 }
42425}
42426
42427const fsMethods = [
42428 "stat",
42429 "statSync",
42430 "readFile",
42431 "readFileSync",
42432 "readlink",
42433 "readlinkSync"
42434];
42435
42436for (const key of fsMethods) {
42437 Object.defineProperty(NodeJsInputFileSystem.prototype, key, {
42438 configurable: true,
42439 writable: true,
42440 value: fs[key].bind(fs)
42441 });
42442}
42443
42444module.exports = NodeJsInputFileSystem;
42445
42446
42447/***/ }),
42448
42449/***/ 9743:
42450/***/ (function(module) {
42451
42452"use strict";
42453/*
42454 MIT License http://www.opensource.org/licenses/mit-license.php
42455 Author Tobias Koppers @sokra
42456*/
42457
42458
42459module.exports = class ParsePlugin {
42460 constructor(source, target) {
42461 this.source = source;
42462 this.target = target;
42463 }
42464
42465 apply(resolver) {
42466 const target = resolver.ensureHook(this.target);
42467 resolver
42468 .getHook(this.source)
42469 .tapAsync("ParsePlugin", (request, resolveContext, callback) => {
42470 const parsed = resolver.parse(request.request);
42471 const obj = Object.assign({}, request, parsed);
42472 if (request.query && !parsed.query) {
42473 obj.query = request.query;
42474 }
42475 if (parsed && resolveContext.log) {
42476 if (parsed.module) resolveContext.log("Parsed request is a module");
42477 if (parsed.directory)
42478 resolveContext.log("Parsed request is a directory");
42479 }
42480 resolver.doResolve(target, obj, null, resolveContext, callback);
42481 });
42482 }
42483};
42484
42485
42486/***/ }),
42487
42488/***/ 82797:
42489/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
42490
42491"use strict";
42492/*
42493 MIT License http://www.opensource.org/licenses/mit-license.php
42494 Author Tobias Koppers @sokra
42495*/
42496
42497
42498const util = __webpack_require__(31669);
42499
42500const Tapable = __webpack_require__(41116);
42501const SyncHook = __webpack_require__(48242);
42502const AsyncSeriesBailHook = __webpack_require__(39537);
42503const AsyncSeriesHook = __webpack_require__(11522);
42504const createInnerContext = __webpack_require__(6369);
42505
42506const REGEXP_NOT_MODULE = /^\.$|^\.[\\/]|^\.\.$|^\.\.[\\/]|^\/|^[A-Z]:[\\/]/i;
42507const REGEXP_DIRECTORY = /[\\/]$/i;
42508
42509const memoryFsJoin = __webpack_require__(65775);
42510const memoizedJoin = new Map();
42511const memoryFsNormalize = __webpack_require__(69038);
42512
42513function withName(name, hook) {
42514 hook.name = name;
42515 return hook;
42516}
42517
42518function toCamelCase(str) {
42519 return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase());
42520}
42521
42522const deprecatedPushToMissing = util.deprecate((set, item) => {
42523 set.add(item);
42524}, "Resolver: 'missing' is now a Set. Use add instead of push.");
42525
42526const deprecatedResolveContextInCallback = util.deprecate(x => {
42527 return x;
42528}, "Resolver: The callback argument was splitted into resolveContext and callback.");
42529
42530const deprecatedHookAsString = util.deprecate(x => {
42531 return x;
42532}, "Resolver#doResolve: The type arguments (string) is now a hook argument (Hook). Pass a reference to the hook instead.");
42533
42534class Resolver extends Tapable {
42535 constructor(fileSystem) {
42536 super();
42537 this.fileSystem = fileSystem;
42538 this.hooks = {
42539 resolveStep: withName("resolveStep", new SyncHook(["hook", "request"])),
42540 noResolve: withName("noResolve", new SyncHook(["request", "error"])),
42541 resolve: withName(
42542 "resolve",
42543 new AsyncSeriesBailHook(["request", "resolveContext"])
42544 ),
42545 result: new AsyncSeriesHook(["result", "resolveContext"])
42546 };
42547 this._pluginCompat.tap("Resolver: before/after", options => {
42548 if (/^before-/.test(options.name)) {
42549 options.name = options.name.substr(7);
42550 options.stage = -10;
42551 } else if (/^after-/.test(options.name)) {
42552 options.name = options.name.substr(6);
42553 options.stage = 10;
42554 }
42555 });
42556 this._pluginCompat.tap("Resolver: step hooks", options => {
42557 const name = options.name;
42558 const stepHook = !/^resolve(-s|S)tep$|^no(-r|R)esolve$/.test(name);
42559 if (stepHook) {
42560 options.async = true;
42561 this.ensureHook(name);
42562 const fn = options.fn;
42563 options.fn = (request, resolverContext, callback) => {
42564 const innerCallback = (err, result) => {
42565 if (err) return callback(err);
42566 if (result !== undefined) return callback(null, result);
42567 callback();
42568 };
42569 for (const key in resolverContext) {
42570 innerCallback[key] = resolverContext[key];
42571 }
42572 fn.call(this, request, innerCallback);
42573 };
42574 }
42575 });
42576 }
42577
42578 ensureHook(name) {
42579 if (typeof name !== "string") return name;
42580 name = toCamelCase(name);
42581 if (/^before/.test(name)) {
42582 return this.ensureHook(
42583 name[6].toLowerCase() + name.substr(7)
42584 ).withOptions({
42585 stage: -10
42586 });
42587 }
42588 if (/^after/.test(name)) {
42589 return this.ensureHook(
42590 name[5].toLowerCase() + name.substr(6)
42591 ).withOptions({
42592 stage: 10
42593 });
42594 }
42595 const hook = this.hooks[name];
42596 if (!hook) {
42597 return (this.hooks[name] = withName(
42598 name,
42599 new AsyncSeriesBailHook(["request", "resolveContext"])
42600 ));
42601 }
42602 return hook;
42603 }
42604
42605 getHook(name) {
42606 if (typeof name !== "string") return name;
42607 name = toCamelCase(name);
42608 if (/^before/.test(name)) {
42609 return this.getHook(name[6].toLowerCase() + name.substr(7)).withOptions({
42610 stage: -10
42611 });
42612 }
42613 if (/^after/.test(name)) {
42614 return this.getHook(name[5].toLowerCase() + name.substr(6)).withOptions({
42615 stage: 10
42616 });
42617 }
42618 const hook = this.hooks[name];
42619 if (!hook) {
42620 throw new Error(`Hook ${name} doesn't exist`);
42621 }
42622 return hook;
42623 }
42624
42625 resolveSync(context, path, request) {
42626 let err,
42627 result,
42628 sync = false;
42629 this.resolve(context, path, request, {}, (e, r) => {
42630 err = e;
42631 result = r;
42632 sync = true;
42633 });
42634 if (!sync)
42635 throw new Error(
42636 "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!"
42637 );
42638 if (err) throw err;
42639 return result;
42640 }
42641
42642 resolve(context, path, request, resolveContext, callback) {
42643 // TODO remove in enhanced-resolve 5
42644 // For backward compatiblity START
42645 if (typeof callback !== "function") {
42646 callback = deprecatedResolveContextInCallback(resolveContext);
42647 // resolveContext is a function containing additional properties
42648 // It's now used for resolveContext and callback
42649 }
42650 // END
42651 const obj = {
42652 context: context,
42653 path: path,
42654 request: request
42655 };
42656
42657 const message = "resolve '" + request + "' in '" + path + "'";
42658
42659 // Try to resolve assuming there is no error
42660 // We don't log stuff in this case
42661 return this.doResolve(
42662 this.hooks.resolve,
42663 obj,
42664 message,
42665 {
42666 missing: resolveContext.missing,
42667 stack: resolveContext.stack
42668 },
42669 (err, result) => {
42670 if (!err && result) {
42671 return callback(
42672 null,
42673 result.path === false ? false : result.path + (result.query || ""),
42674 result
42675 );
42676 }
42677
42678 const localMissing = new Set();
42679 // TODO remove in enhanced-resolve 5
42680 localMissing.push = item => deprecatedPushToMissing(localMissing, item);
42681 const log = [];
42682
42683 return this.doResolve(
42684 this.hooks.resolve,
42685 obj,
42686 message,
42687 {
42688 log: msg => {
42689 if (resolveContext.log) {
42690 resolveContext.log(msg);
42691 }
42692 log.push(msg);
42693 },
42694 missing: localMissing,
42695 stack: resolveContext.stack
42696 },
42697 (err, result) => {
42698 if (err) return callback(err);
42699
42700 const error = new Error("Can't " + message);
42701 error.details = log.join("\n");
42702 error.missing = Array.from(localMissing);
42703 this.hooks.noResolve.call(obj, error);
42704 return callback(error);
42705 }
42706 );
42707 }
42708 );
42709 }
42710
42711 doResolve(hook, request, message, resolveContext, callback) {
42712 // TODO remove in enhanced-resolve 5
42713 // For backward compatiblity START
42714 if (typeof callback !== "function") {
42715 callback = deprecatedResolveContextInCallback(resolveContext);
42716 // resolveContext is a function containing additional properties
42717 // It's now used for resolveContext and callback
42718 }
42719 if (typeof hook === "string") {
42720 const name = toCamelCase(hook);
42721 hook = deprecatedHookAsString(this.hooks[name]);
42722 if (!hook) {
42723 throw new Error(`Hook "${name}" doesn't exist`);
42724 }
42725 }
42726 // END
42727 if (typeof callback !== "function")
42728 throw new Error("callback is not a function " + Array.from(arguments));
42729 if (!resolveContext)
42730 throw new Error(
42731 "resolveContext is not an object " + Array.from(arguments)
42732 );
42733
42734 const stackLine =
42735 hook.name +
42736 ": (" +
42737 request.path +
42738 ") " +
42739 (request.request || "") +
42740 (request.query || "") +
42741 (request.directory ? " directory" : "") +
42742 (request.module ? " module" : "");
42743
42744 let newStack;
42745 if (resolveContext.stack) {
42746 newStack = new Set(resolveContext.stack);
42747 if (resolveContext.stack.has(stackLine)) {
42748 // Prevent recursion
42749 const recursionError = new Error(
42750 "Recursion in resolving\nStack:\n " +
42751 Array.from(newStack).join("\n ")
42752 );
42753 recursionError.recursion = true;
42754 if (resolveContext.log)
42755 resolveContext.log("abort resolving because of recursion");
42756 return callback(recursionError);
42757 }
42758 newStack.add(stackLine);
42759 } else {
42760 newStack = new Set([stackLine]);
42761 }
42762 this.hooks.resolveStep.call(hook, request);
42763
42764 if (hook.isUsed()) {
42765 const innerContext = createInnerContext(
42766 {
42767 log: resolveContext.log,
42768 missing: resolveContext.missing,
42769 stack: newStack
42770 },
42771 message
42772 );
42773 return hook.callAsync(request, innerContext, (err, result) => {
42774 if (err) return callback(err);
42775 if (result) return callback(null, result);
42776 callback();
42777 });
42778 } else {
42779 callback();
42780 }
42781 }
42782
42783 parse(identifier) {
42784 if (identifier === "") return null;
42785 const part = {
42786 request: "",
42787 query: "",
42788 module: false,
42789 directory: false,
42790 file: false
42791 };
42792 const idxQuery = identifier.indexOf("?");
42793 if (idxQuery === 0) {
42794 part.query = identifier;
42795 } else if (idxQuery > 0) {
42796 part.request = identifier.slice(0, idxQuery);
42797 part.query = identifier.slice(idxQuery);
42798 } else {
42799 part.request = identifier;
42800 }
42801 if (part.request) {
42802 part.module = this.isModule(part.request);
42803 part.directory = this.isDirectory(part.request);
42804 if (part.directory) {
42805 part.request = part.request.substr(0, part.request.length - 1);
42806 }
42807 }
42808 return part;
42809 }
42810
42811 isModule(path) {
42812 return !REGEXP_NOT_MODULE.test(path);
42813 }
42814
42815 isDirectory(path) {
42816 return REGEXP_DIRECTORY.test(path);
42817 }
42818
42819 join(path, request) {
42820 let cacheEntry;
42821 let pathCache = memoizedJoin.get(path);
42822 if (typeof pathCache === "undefined") {
42823 memoizedJoin.set(path, (pathCache = new Map()));
42824 } else {
42825 cacheEntry = pathCache.get(request);
42826 if (typeof cacheEntry !== "undefined") return cacheEntry;
42827 }
42828 cacheEntry = memoryFsJoin(path, request);
42829 pathCache.set(request, cacheEntry);
42830 return cacheEntry;
42831 }
42832
42833 normalize(path) {
42834 return memoryFsNormalize(path);
42835 }
42836}
42837
42838module.exports = Resolver;
42839
42840
42841/***/ }),
42842
42843/***/ 34129:
42844/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
42845
42846"use strict";
42847/*
42848 MIT License http://www.opensource.org/licenses/mit-license.php
42849 Author Tobias Koppers @sokra
42850*/
42851
42852
42853const Resolver = __webpack_require__(82797);
42854
42855const SyncAsyncFileSystemDecorator = __webpack_require__(83230);
42856
42857const ParsePlugin = __webpack_require__(9743);
42858const DescriptionFilePlugin = __webpack_require__(95637);
42859const NextPlugin = __webpack_require__(50959);
42860const TryNextPlugin = __webpack_require__(31702);
42861const ModuleKindPlugin = __webpack_require__(9529);
42862const FileKindPlugin = __webpack_require__(63602);
42863const JoinRequestPlugin = __webpack_require__(31693);
42864const ModulesInHierachicDirectoriesPlugin = __webpack_require__(23195);
42865const ModulesInRootPlugin = __webpack_require__(3092);
42866const AliasPlugin = __webpack_require__(15005);
42867const AliasFieldPlugin = __webpack_require__(89901);
42868const ConcordExtensionsPlugin = __webpack_require__(56821);
42869const ConcordMainPlugin = __webpack_require__(27878);
42870const ConcordModulesPlugin = __webpack_require__(50297);
42871const DirectoryExistsPlugin = __webpack_require__(48504);
42872const FileExistsPlugin = __webpack_require__(68372);
42873const SymlinkPlugin = __webpack_require__(51104);
42874const MainFieldPlugin = __webpack_require__(7064);
42875const UseFilePlugin = __webpack_require__(41232);
42876const AppendPlugin = __webpack_require__(2271);
42877const RootPlugin = __webpack_require__(32669);
42878const RestrictionsPlugin = __webpack_require__(49751);
42879const ResultPlugin = __webpack_require__(19258);
42880const ModuleAppendPlugin = __webpack_require__(23780);
42881const UnsafeCachePlugin = __webpack_require__(81809);
42882
42883exports.createResolver = function(options) {
42884 //// OPTIONS ////
42885
42886 // A list of directories to resolve modules from, can be absolute path or folder name
42887 let modules = options.modules || ["node_modules"];
42888
42889 // A list of description files to read from
42890 const descriptionFiles = options.descriptionFiles || ["package.json"];
42891
42892 // A list of additional resolve plugins which should be applied
42893 // The slice is there to create a copy, because otherwise pushing into plugins
42894 // changes the original options.plugins array, causing duplicate plugins
42895 const plugins = (options.plugins && options.plugins.slice()) || [];
42896
42897 // A list of main fields in description files
42898 let mainFields = options.mainFields || ["main"];
42899
42900 // A list of alias fields in description files
42901 const aliasFields = options.aliasFields || [];
42902
42903 // A list of main files in directories
42904 const mainFiles = options.mainFiles || ["index"];
42905
42906 // A list of extensions which should be tried for files
42907 let extensions = options.extensions || [".js", ".json", ".node"];
42908
42909 // Enforce that a extension from extensions must be used
42910 const enforceExtension = options.enforceExtension || false;
42911
42912 // A list of module extensions which should be tried for modules
42913 let moduleExtensions = options.moduleExtensions || [];
42914
42915 // Enforce that a extension from moduleExtensions must be used
42916 const enforceModuleExtension = options.enforceModuleExtension || false;
42917
42918 // A list of module alias configurations or an object which maps key to value
42919 let alias = options.alias || [];
42920
42921 // Resolve symlinks to their symlinked location
42922 const symlinks =
42923 typeof options.symlinks !== "undefined" ? options.symlinks : true;
42924
42925 // Resolve to a context instead of a file
42926 const resolveToContext = options.resolveToContext || false;
42927
42928 // A list of root paths
42929 const roots = options.roots || [];
42930
42931 const restrictions = options.restrictions || [];
42932
42933 // Use this cache object to unsafely cache the successful requests
42934 let unsafeCache = options.unsafeCache || false;
42935
42936 // Whether or not the unsafeCache should include request context as part of the cache key.
42937 const cacheWithContext =
42938 typeof options.cacheWithContext !== "undefined"
42939 ? options.cacheWithContext
42940 : true;
42941
42942 // Enable concord description file instructions
42943 const enableConcord = options.concord || false;
42944
42945 // A function which decides whether a request should be cached or not.
42946 // an object is passed with `path` and `request` properties.
42947 const cachePredicate =
42948 options.cachePredicate ||
42949 function() {
42950 return true;
42951 };
42952
42953 // The file system which should be used
42954 const fileSystem = options.fileSystem;
42955
42956 // Use only the sync constiants of the file system calls
42957 const useSyncFileSystemCalls = options.useSyncFileSystemCalls;
42958
42959 // A prepared Resolver to which the plugins are attached
42960 let resolver = options.resolver;
42961
42962 //// options processing ////
42963
42964 if (!resolver) {
42965 resolver = new Resolver(
42966 useSyncFileSystemCalls
42967 ? new SyncAsyncFileSystemDecorator(fileSystem)
42968 : fileSystem
42969 );
42970 }
42971
42972 extensions = [].concat(extensions);
42973 moduleExtensions = [].concat(moduleExtensions);
42974
42975 modules = mergeFilteredToArray([].concat(modules), item => {
42976 return !isAbsolutePath(item);
42977 });
42978
42979 mainFields = mainFields.map(item => {
42980 if (typeof item === "string" || Array.isArray(item)) {
42981 item = {
42982 name: item,
42983 forceRelative: true
42984 };
42985 }
42986 return item;
42987 });
42988
42989 if (typeof alias === "object" && !Array.isArray(alias)) {
42990 alias = Object.keys(alias).map(key => {
42991 let onlyModule = false;
42992 let obj = alias[key];
42993 if (/\$$/.test(key)) {
42994 onlyModule = true;
42995 key = key.substr(0, key.length - 1);
42996 }
42997 if (typeof obj === "string") {
42998 obj = {
42999 alias: obj
43000 };
43001 }
43002 obj = Object.assign(
43003 {
43004 name: key,
43005 onlyModule: onlyModule
43006 },
43007 obj
43008 );
43009 return obj;
43010 });
43011 }
43012
43013 if (unsafeCache && typeof unsafeCache !== "object") {
43014 unsafeCache = {};
43015 }
43016
43017 //// pipeline ////
43018
43019 resolver.ensureHook("resolve");
43020 resolver.ensureHook("parsedResolve");
43021 resolver.ensureHook("describedResolve");
43022 resolver.ensureHook("rawModule");
43023 resolver.ensureHook("module");
43024 resolver.ensureHook("relative");
43025 resolver.ensureHook("describedRelative");
43026 resolver.ensureHook("directory");
43027 resolver.ensureHook("existingDirectory");
43028 resolver.ensureHook("undescribedRawFile");
43029 resolver.ensureHook("rawFile");
43030 resolver.ensureHook("file");
43031 resolver.ensureHook("existingFile");
43032 resolver.ensureHook("resolved");
43033
43034 // resolve
43035 if (unsafeCache) {
43036 plugins.push(
43037 new UnsafeCachePlugin(
43038 "resolve",
43039 cachePredicate,
43040 unsafeCache,
43041 cacheWithContext,
43042 "new-resolve"
43043 )
43044 );
43045 plugins.push(new ParsePlugin("new-resolve", "parsed-resolve"));
43046 } else {
43047 plugins.push(new ParsePlugin("resolve", "parsed-resolve"));
43048 }
43049
43050 // parsed-resolve
43051 plugins.push(
43052 new DescriptionFilePlugin(
43053 "parsed-resolve",
43054 descriptionFiles,
43055 "described-resolve"
43056 )
43057 );
43058 plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve"));
43059
43060 // described-resolve
43061 if (alias.length > 0)
43062 plugins.push(new AliasPlugin("described-resolve", alias, "resolve"));
43063 if (enableConcord) {
43064 plugins.push(new ConcordModulesPlugin("described-resolve", {}, "resolve"));
43065 }
43066 aliasFields.forEach(item => {
43067 plugins.push(new AliasFieldPlugin("described-resolve", item, "resolve"));
43068 });
43069 plugins.push(new ModuleKindPlugin("after-described-resolve", "raw-module"));
43070 roots.forEach(root => {
43071 plugins.push(new RootPlugin("after-described-resolve", root, "relative"));
43072 });
43073 plugins.push(new JoinRequestPlugin("after-described-resolve", "relative"));
43074
43075 // raw-module
43076 moduleExtensions.forEach(item => {
43077 plugins.push(new ModuleAppendPlugin("raw-module", item, "module"));
43078 });
43079 if (!enforceModuleExtension)
43080 plugins.push(new TryNextPlugin("raw-module", null, "module"));
43081
43082 // module
43083 modules.forEach(item => {
43084 if (Array.isArray(item))
43085 plugins.push(
43086 new ModulesInHierachicDirectoriesPlugin("module", item, "resolve")
43087 );
43088 else plugins.push(new ModulesInRootPlugin("module", item, "resolve"));
43089 });
43090
43091 // relative
43092 plugins.push(
43093 new DescriptionFilePlugin(
43094 "relative",
43095 descriptionFiles,
43096 "described-relative"
43097 )
43098 );
43099 plugins.push(new NextPlugin("after-relative", "described-relative"));
43100
43101 // described-relative
43102 plugins.push(new FileKindPlugin("described-relative", "raw-file"));
43103 plugins.push(
43104 new TryNextPlugin("described-relative", "as directory", "directory")
43105 );
43106
43107 // directory
43108 plugins.push(new DirectoryExistsPlugin("directory", "existing-directory"));
43109
43110 if (resolveToContext) {
43111 // existing-directory
43112 plugins.push(new NextPlugin("existing-directory", "resolved"));
43113 } else {
43114 // existing-directory
43115 if (enableConcord) {
43116 plugins.push(new ConcordMainPlugin("existing-directory", {}, "resolve"));
43117 }
43118 mainFields.forEach(item => {
43119 plugins.push(new MainFieldPlugin("existing-directory", item, "resolve"));
43120 });
43121 mainFiles.forEach(item => {
43122 plugins.push(
43123 new UseFilePlugin("existing-directory", item, "undescribed-raw-file")
43124 );
43125 });
43126
43127 // undescribed-raw-file
43128 plugins.push(
43129 new DescriptionFilePlugin(
43130 "undescribed-raw-file",
43131 descriptionFiles,
43132 "raw-file"
43133 )
43134 );
43135 plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file"));
43136
43137 // raw-file
43138 if (!enforceExtension) {
43139 plugins.push(new TryNextPlugin("raw-file", "no extension", "file"));
43140 }
43141 if (enableConcord) {
43142 plugins.push(new ConcordExtensionsPlugin("raw-file", {}, "file"));
43143 }
43144 extensions.forEach(item => {
43145 plugins.push(new AppendPlugin("raw-file", item, "file"));
43146 });
43147
43148 // file
43149 if (alias.length > 0)
43150 plugins.push(new AliasPlugin("file", alias, "resolve"));
43151 if (enableConcord) {
43152 plugins.push(new ConcordModulesPlugin("file", {}, "resolve"));
43153 }
43154 aliasFields.forEach(item => {
43155 plugins.push(new AliasFieldPlugin("file", item, "resolve"));
43156 });
43157 if (symlinks) plugins.push(new SymlinkPlugin("file", "relative"));
43158 plugins.push(new FileExistsPlugin("file", "existing-file"));
43159
43160 // existing-file
43161 plugins.push(new NextPlugin("existing-file", "resolved"));
43162 }
43163
43164 // resolved
43165 if (restrictions.length > 0) {
43166 plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions));
43167 }
43168 plugins.push(new ResultPlugin(resolver.hooks.resolved));
43169
43170 //// RESOLVER ////
43171
43172 plugins.forEach(plugin => {
43173 plugin.apply(resolver);
43174 });
43175
43176 return resolver;
43177};
43178
43179function mergeFilteredToArray(array, filter) {
43180 return array.reduce((array, item) => {
43181 if (filter(item)) {
43182 const lastElement = array[array.length - 1];
43183 if (Array.isArray(lastElement)) {
43184 lastElement.push(item);
43185 } else {
43186 array.push([item]);
43187 }
43188 return array;
43189 } else {
43190 array.push(item);
43191 return array;
43192 }
43193 }, []);
43194}
43195
43196function isAbsolutePath(path) {
43197 return /^[A-Z]:|^\//.test(path);
43198}
43199
43200
43201/***/ }),
43202
43203/***/ 49751:
43204/***/ (function(module) {
43205
43206"use strict";
43207/*
43208 MIT License http://www.opensource.org/licenses/mit-license.php
43209 Author Ivan Kopeykin @vankop
43210*/
43211
43212
43213
43214const slashCode = "/".charCodeAt(0);
43215const backslashCode = "\\".charCodeAt(0);
43216
43217const isInside = (path, parent) => {
43218 if (!path.startsWith(parent)) return false;
43219 if (path.length === parent.length) return true;
43220 const charCode = path.charCodeAt(parent.length);
43221 return charCode === slashCode || charCode === backslashCode;
43222};
43223
43224module.exports = class RestrictionsPlugin {
43225 constructor(source, restrictions) {
43226 this.source = source;
43227 this.restrictions = restrictions;
43228 }
43229
43230 apply(resolver) {
43231 resolver
43232 .getHook(this.source)
43233 .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => {
43234 if (typeof request.path === "string") {
43235 const path = request.path;
43236
43237 for (let i = 0; i < this.restrictions.length; i++) {
43238 const rule = this.restrictions[i];
43239 if (typeof rule === "string") {
43240 if (!isInside(path, rule)) {
43241 if (resolveContext.log) {
43242 resolveContext.log(
43243 `${path} is not inside of the restriction ${rule}`
43244 );
43245 }
43246 return callback(null, null);
43247 }
43248 } else if (!rule.test(path)) {
43249 if (resolveContext.log) {
43250 resolveContext.log(
43251 `${path} doesn't match the restriction ${rule}`
43252 );
43253 }
43254 return callback(null, null);
43255 }
43256 }
43257 }
43258
43259 callback();
43260 });
43261 }
43262};
43263
43264
43265/***/ }),
43266
43267/***/ 19258:
43268/***/ (function(module) {
43269
43270"use strict";
43271/*
43272 MIT License http://www.opensource.org/licenses/mit-license.php
43273 Author Tobias Koppers @sokra
43274*/
43275
43276
43277module.exports = class ResultPlugin {
43278 constructor(source) {
43279 this.source = source;
43280 }
43281
43282 apply(resolver) {
43283 this.source.tapAsync(
43284 "ResultPlugin",
43285 (request, resolverContext, callback) => {
43286 const obj = Object.assign({}, request);
43287 if (resolverContext.log)
43288 resolverContext.log("reporting result " + obj.path);
43289 resolver.hooks.result.callAsync(obj, resolverContext, err => {
43290 if (err) return callback(err);
43291 callback(null, obj);
43292 });
43293 }
43294 );
43295 }
43296};
43297
43298
43299/***/ }),
43300
43301/***/ 32669:
43302/***/ (function(module) {
43303
43304"use strict";
43305/*
43306 MIT License http://www.opensource.org/licenses/mit-license.php
43307 Author Ivan Kopeykin @vankop
43308*/
43309
43310
43311
43312/** @typedef {import("./Resolver")} Resolver */
43313/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
43314
43315class RootPlugin {
43316 /**
43317 * @param {string | ResolveStepHook} source source hook
43318 * @param {Array<string>} root roots
43319 * @param {string | ResolveStepHook} target target hook
43320 */
43321 constructor(source, root, target) {
43322 this.root = root;
43323 this.source = source;
43324 this.target = target;
43325 }
43326
43327 /**
43328 * @param {Resolver} resolver the resolver
43329 * @returns {void}
43330 */
43331 apply(resolver) {
43332 const target = resolver.ensureHook(this.target);
43333
43334 resolver
43335 .getHook(this.source)
43336 .tapAsync("RootPlugin", (request, resolveContext, callback) => {
43337 const req = request.request;
43338 if (!req) return callback();
43339 if (!req.startsWith("/")) return callback();
43340
43341 const path = resolver.join(this.root, req.slice(1));
43342 const obj = Object.assign(request, {
43343 path,
43344 relativePath: request.relativePath && path
43345 });
43346 resolver.doResolve(
43347 target,
43348 obj,
43349 `root path ${this.root}`,
43350 resolveContext,
43351 callback
43352 );
43353 });
43354 }
43355}
43356
43357module.exports = RootPlugin;
43358
43359
43360/***/ }),
43361
43362/***/ 51104:
43363/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
43364
43365"use strict";
43366/*
43367 MIT License http://www.opensource.org/licenses/mit-license.php
43368 Author Tobias Koppers @sokra
43369*/
43370
43371
43372const getPaths = __webpack_require__(49395);
43373const forEachBail = __webpack_require__(60059);
43374
43375module.exports = class SymlinkPlugin {
43376 constructor(source, target) {
43377 this.source = source;
43378 this.target = target;
43379 }
43380
43381 apply(resolver) {
43382 const target = resolver.ensureHook(this.target);
43383 const fs = resolver.fileSystem;
43384 resolver
43385 .getHook(this.source)
43386 .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => {
43387 const pathsResult = getPaths(request.path);
43388 const pathSeqments = pathsResult.seqments;
43389 const paths = pathsResult.paths;
43390
43391 let containsSymlink = false;
43392 forEachBail.withIndex(
43393 paths,
43394 (path, idx, callback) => {
43395 fs.readlink(path, (err, result) => {
43396 if (!err && result) {
43397 pathSeqments[idx] = result;
43398 containsSymlink = true;
43399 // Shortcut when absolute symlink found
43400 if (/^(\/|[a-zA-Z]:($|\\))/.test(result))
43401 return callback(null, idx);
43402 }
43403 callback();
43404 });
43405 },
43406 (err, idx) => {
43407 if (!containsSymlink) return callback();
43408 const resultSeqments =
43409 typeof idx === "number"
43410 ? pathSeqments.slice(0, idx + 1)
43411 : pathSeqments.slice();
43412 const result = resultSeqments.reverse().reduce((a, b) => {
43413 return resolver.join(a, b);
43414 });
43415 const obj = Object.assign({}, request, {
43416 path: result
43417 });
43418 resolver.doResolve(
43419 target,
43420 obj,
43421 "resolved symlink to " + result,
43422 resolveContext,
43423 callback
43424 );
43425 }
43426 );
43427 });
43428 }
43429};
43430
43431
43432/***/ }),
43433
43434/***/ 83230:
43435/***/ (function(module) {
43436
43437"use strict";
43438/*
43439 MIT License http://www.opensource.org/licenses/mit-license.php
43440 Author Tobias Koppers @sokra
43441*/
43442
43443
43444function SyncAsyncFileSystemDecorator(fs) {
43445 this.fs = fs;
43446 if (fs.statSync) {
43447 this.stat = function(arg, callback) {
43448 let result;
43449 try {
43450 result = fs.statSync(arg);
43451 } catch (e) {
43452 return callback(e);
43453 }
43454 callback(null, result);
43455 };
43456 }
43457 if (fs.readdirSync) {
43458 this.readdir = function(arg, callback) {
43459 let result;
43460 try {
43461 result = fs.readdirSync(arg);
43462 } catch (e) {
43463 return callback(e);
43464 }
43465 callback(null, result);
43466 };
43467 }
43468 if (fs.readFileSync) {
43469 this.readFile = function(arg, callback) {
43470 let result;
43471 try {
43472 result = fs.readFileSync(arg);
43473 } catch (e) {
43474 return callback(e);
43475 }
43476 callback(null, result);
43477 };
43478 }
43479 if (fs.readlinkSync) {
43480 this.readlink = function(arg, callback) {
43481 let result;
43482 try {
43483 result = fs.readlinkSync(arg);
43484 } catch (e) {
43485 return callback(e);
43486 }
43487 callback(null, result);
43488 };
43489 }
43490 if (fs.readJsonSync) {
43491 this.readJson = function(arg, callback) {
43492 let result;
43493 try {
43494 result = fs.readJsonSync(arg);
43495 } catch (e) {
43496 return callback(e);
43497 }
43498 callback(null, result);
43499 };
43500 }
43501}
43502module.exports = SyncAsyncFileSystemDecorator;
43503
43504
43505/***/ }),
43506
43507/***/ 31702:
43508/***/ (function(module) {
43509
43510"use strict";
43511/*
43512 MIT License http://www.opensource.org/licenses/mit-license.php
43513 Author Tobias Koppers @sokra
43514*/
43515
43516
43517module.exports = class TryNextPlugin {
43518 constructor(source, message, target) {
43519 this.source = source;
43520 this.message = message;
43521 this.target = target;
43522 }
43523
43524 apply(resolver) {
43525 const target = resolver.ensureHook(this.target);
43526 resolver
43527 .getHook(this.source)
43528 .tapAsync("TryNextPlugin", (request, resolveContext, callback) => {
43529 resolver.doResolve(
43530 target,
43531 request,
43532 this.message,
43533 resolveContext,
43534 callback
43535 );
43536 });
43537 }
43538};
43539
43540
43541/***/ }),
43542
43543/***/ 81809:
43544/***/ (function(module) {
43545
43546"use strict";
43547/*
43548 MIT License http://www.opensource.org/licenses/mit-license.php
43549 Author Tobias Koppers @sokra
43550*/
43551
43552
43553function getCacheId(request, withContext) {
43554 return JSON.stringify({
43555 context: withContext ? request.context : "",
43556 path: request.path,
43557 query: request.query,
43558 request: request.request
43559 });
43560}
43561
43562module.exports = class UnsafeCachePlugin {
43563 constructor(source, filterPredicate, cache, withContext, target) {
43564 this.source = source;
43565 this.filterPredicate = filterPredicate;
43566 this.withContext = withContext;
43567 this.cache = cache || {};
43568 this.target = target;
43569 }
43570
43571 apply(resolver) {
43572 const target = resolver.ensureHook(this.target);
43573 resolver
43574 .getHook(this.source)
43575 .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => {
43576 if (!this.filterPredicate(request)) return callback();
43577 const cacheId = getCacheId(request, this.withContext);
43578 const cacheEntry = this.cache[cacheId];
43579 if (cacheEntry) {
43580 return callback(null, cacheEntry);
43581 }
43582 resolver.doResolve(
43583 target,
43584 request,
43585 null,
43586 resolveContext,
43587 (err, result) => {
43588 if (err) return callback(err);
43589 if (result) return callback(null, (this.cache[cacheId] = result));
43590 callback();
43591 }
43592 );
43593 });
43594 }
43595};
43596
43597
43598/***/ }),
43599
43600/***/ 41232:
43601/***/ (function(module) {
43602
43603"use strict";
43604/*
43605 MIT License http://www.opensource.org/licenses/mit-license.php
43606 Author Tobias Koppers @sokra
43607*/
43608
43609
43610module.exports = class UseFilePlugin {
43611 constructor(source, filename, target) {
43612 this.source = source;
43613 this.filename = filename;
43614 this.target = target;
43615 }
43616
43617 apply(resolver) {
43618 const target = resolver.ensureHook(this.target);
43619 resolver
43620 .getHook(this.source)
43621 .tapAsync("UseFilePlugin", (request, resolveContext, callback) => {
43622 const filePath = resolver.join(request.path, this.filename);
43623 const obj = Object.assign({}, request, {
43624 path: filePath,
43625 relativePath:
43626 request.relativePath &&
43627 resolver.join(request.relativePath, this.filename)
43628 });
43629 resolver.doResolve(
43630 target,
43631 obj,
43632 "using path: " + filePath,
43633 resolveContext,
43634 callback
43635 );
43636 });
43637 }
43638};
43639
43640
43641/***/ }),
43642
43643/***/ 94323:
43644/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
43645
43646"use strict";
43647/*
43648 MIT License http://www.opensource.org/licenses/mit-license.php
43649 Author Tobias Koppers @sokra
43650*/
43651
43652
43653const globToRegExp = __webpack_require__(82876)/* .globToRegExp */ .P;
43654
43655function parseType(type) {
43656 const items = type.split("+");
43657 const t = items.shift();
43658 return {
43659 type: t === "*" ? null : t,
43660 features: items
43661 };
43662}
43663
43664function isTypeMatched(baseType, testedType) {
43665 if (typeof baseType === "string") baseType = parseType(baseType);
43666 if (typeof testedType === "string") testedType = parseType(testedType);
43667 if (testedType.type && testedType.type !== baseType.type) return false;
43668 return testedType.features.every(requiredFeature => {
43669 return baseType.features.indexOf(requiredFeature) >= 0;
43670 });
43671}
43672
43673function isResourceTypeMatched(baseType, testedType) {
43674 baseType = baseType.split("/");
43675 testedType = testedType.split("/");
43676 if (baseType.length !== testedType.length) return false;
43677 for (let i = 0; i < baseType.length; i++) {
43678 if (!isTypeMatched(baseType[i], testedType[i])) return false;
43679 }
43680 return true;
43681}
43682
43683function isResourceTypeSupported(context, type) {
43684 return (
43685 context.supportedResourceTypes &&
43686 context.supportedResourceTypes.some(supportedType => {
43687 return isResourceTypeMatched(supportedType, type);
43688 })
43689 );
43690}
43691
43692function isEnvironment(context, env) {
43693 return (
43694 context.environments &&
43695 context.environments.every(environment => {
43696 return isTypeMatched(environment, env);
43697 })
43698 );
43699}
43700
43701const globCache = {};
43702
43703function getGlobRegExp(glob) {
43704 const regExp = globCache[glob] || (globCache[glob] = globToRegExp(glob));
43705 return regExp;
43706}
43707
43708function matchGlob(glob, relativePath) {
43709 const regExp = getGlobRegExp(glob);
43710 return regExp.exec(relativePath);
43711}
43712
43713function isGlobMatched(glob, relativePath) {
43714 return !!matchGlob(glob, relativePath);
43715}
43716
43717function isConditionMatched(context, condition) {
43718 const items = condition.split("|");
43719 return items.some(function testFn(item) {
43720 item = item.trim();
43721 const inverted = /^!/.test(item);
43722 if (inverted) return !testFn(item.substr(1));
43723 if (/^[a-z]+:/.test(item)) {
43724 // match named condition
43725 const match = /^([a-z]+):\s*/.exec(item);
43726 const value = item.substr(match[0].length);
43727 const name = match[1];
43728 switch (name) {
43729 case "referrer":
43730 return isGlobMatched(value, context.referrer);
43731 default:
43732 return false;
43733 }
43734 } else if (item.indexOf("/") >= 0) {
43735 // match supported type
43736 return isResourceTypeSupported(context, item);
43737 } else {
43738 // match environment
43739 return isEnvironment(context, item);
43740 }
43741 });
43742}
43743
43744function isKeyMatched(context, key) {
43745 for (;;) {
43746 const match = /^\[([^\]]+)\]\s*/.exec(key);
43747 if (!match) return key;
43748 key = key.substr(match[0].length);
43749 const condition = match[1];
43750 if (!isConditionMatched(context, condition)) {
43751 return false;
43752 }
43753 }
43754}
43755
43756function getField(context, configuration, field) {
43757 let value;
43758 Object.keys(configuration).forEach(key => {
43759 const pureKey = isKeyMatched(context, key);
43760 if (pureKey === field) {
43761 value = configuration[key];
43762 }
43763 });
43764 return value;
43765}
43766
43767function getMain(context, configuration) {
43768 return getField(context, configuration, "main");
43769}
43770
43771function getExtensions(context, configuration) {
43772 return getField(context, configuration, "extensions");
43773}
43774
43775function matchModule(context, configuration, request) {
43776 const modulesField = getField(context, configuration, "modules");
43777 if (!modulesField) return request;
43778 let newRequest = request;
43779 const keys = Object.keys(modulesField);
43780 let iteration = 0;
43781 let match;
43782 let index;
43783 for (let i = 0; i < keys.length; i++) {
43784 const key = keys[i];
43785 const pureKey = isKeyMatched(context, key);
43786 match = matchGlob(pureKey, newRequest);
43787 if (match) {
43788 const value = modulesField[key];
43789 if (typeof value !== "string") {
43790 return value;
43791 } else if (/^\(.+\)$/.test(pureKey)) {
43792 newRequest = newRequest.replace(getGlobRegExp(pureKey), value);
43793 } else {
43794 index = 1;
43795 newRequest = value.replace(/(\/?\*)?\*/g, replaceMatcher);
43796 }
43797 i = -1;
43798 if (iteration++ > keys.length) {
43799 throw new Error("Request '" + request + "' matches recursively");
43800 }
43801 }
43802 }
43803 return newRequest;
43804
43805 function replaceMatcher(find) {
43806 switch (find) {
43807 case "/**": {
43808 const m = match[index++];
43809 return m ? "/" + m : "";
43810 }
43811 case "**":
43812 case "*":
43813 return match[index++];
43814 }
43815 }
43816}
43817
43818function matchType(context, configuration, relativePath) {
43819 const typesField = getField(context, configuration, "types");
43820 if (!typesField) return undefined;
43821 let type;
43822 Object.keys(typesField).forEach(key => {
43823 const pureKey = isKeyMatched(context, key);
43824 if (isGlobMatched(pureKey, relativePath)) {
43825 const value = typesField[key];
43826 if (!type && /\/\*$/.test(value))
43827 throw new Error(
43828 "value ('" +
43829 value +
43830 "') of key '" +
43831 key +
43832 "' contains '*', but there is no previous value defined"
43833 );
43834 type = value.replace(/\/\*$/, "/" + type);
43835 }
43836 });
43837 return type;
43838}
43839
43840exports.parseType = parseType;
43841exports.isTypeMatched = isTypeMatched;
43842exports.isResourceTypeSupported = isResourceTypeSupported;
43843exports.isEnvironment = isEnvironment;
43844exports.isGlobMatched = isGlobMatched;
43845exports.isConditionMatched = isConditionMatched;
43846exports.isKeyMatched = isKeyMatched;
43847exports.getField = getField;
43848exports.getMain = getMain;
43849exports.getExtensions = getExtensions;
43850exports.matchModule = matchModule;
43851exports.matchType = matchType;
43852
43853
43854/***/ }),
43855
43856/***/ 6369:
43857/***/ (function(module) {
43858
43859"use strict";
43860/*
43861 MIT License http://www.opensource.org/licenses/mit-license.php
43862 Author Tobias Koppers @sokra
43863*/
43864
43865
43866module.exports = function createInnerContext(
43867 options,
43868 message,
43869 messageOptional
43870) {
43871 let messageReported = false;
43872 const childContext = {
43873 log: (() => {
43874 if (!options.log) return undefined;
43875 if (!message) return options.log;
43876 const logFunction = msg => {
43877 if (!messageReported) {
43878 options.log(message);
43879 messageReported = true;
43880 }
43881 options.log(" " + msg);
43882 };
43883 return logFunction;
43884 })(),
43885 stack: options.stack,
43886 missing: options.missing
43887 };
43888 return childContext;
43889};
43890
43891
43892/***/ }),
43893
43894/***/ 60059:
43895/***/ (function(module) {
43896
43897"use strict";
43898/*
43899 MIT License http://www.opensource.org/licenses/mit-license.php
43900 Author Tobias Koppers @sokra
43901*/
43902
43903
43904module.exports = function forEachBail(array, iterator, callback) {
43905 if (array.length === 0) return callback();
43906 let currentPos = array.length;
43907 let currentResult;
43908 let done = [];
43909 for (let i = 0; i < array.length; i++) {
43910 const itCb = createIteratorCallback(i);
43911 iterator(array[i], itCb);
43912 if (currentPos === 0) break;
43913 }
43914
43915 function createIteratorCallback(i) {
43916 return (...args) => {
43917 if (i >= currentPos) return; // ignore
43918 done.push(i);
43919 if (args.length > 0) {
43920 currentPos = i + 1;
43921 done = done.filter(item => {
43922 return item <= i;
43923 });
43924 currentResult = args;
43925 }
43926 if (done.length === currentPos) {
43927 callback.apply(null, currentResult);
43928 currentPos = 0;
43929 }
43930 };
43931 }
43932};
43933
43934module.exports.withIndex = function forEachBailWithIndex(
43935 array,
43936 iterator,
43937 callback
43938) {
43939 if (array.length === 0) return callback();
43940 let currentPos = array.length;
43941 let currentResult;
43942 let done = [];
43943 for (let i = 0; i < array.length; i++) {
43944 const itCb = createIteratorCallback(i);
43945 iterator(array[i], i, itCb);
43946 if (currentPos === 0) break;
43947 }
43948
43949 function createIteratorCallback(i) {
43950 return (...args) => {
43951 if (i >= currentPos) return; // ignore
43952 done.push(i);
43953 if (args.length > 0) {
43954 currentPos = i + 1;
43955 done = done.filter(item => {
43956 return item <= i;
43957 });
43958 currentResult = args;
43959 }
43960 if (done.length === currentPos) {
43961 callback.apply(null, currentResult);
43962 currentPos = 0;
43963 }
43964 };
43965 }
43966};
43967
43968
43969/***/ }),
43970
43971/***/ 91878:
43972/***/ (function(module) {
43973
43974"use strict";
43975/*
43976 MIT License http://www.opensource.org/licenses/mit-license.php
43977 Author Tobias Koppers @sokra
43978*/
43979
43980
43981module.exports = function getInnerRequest(resolver, request) {
43982 if (
43983 typeof request.__innerRequest === "string" &&
43984 request.__innerRequest_request === request.request &&
43985 request.__innerRequest_relativePath === request.relativePath
43986 )
43987 return request.__innerRequest;
43988 let innerRequest;
43989 if (request.request) {
43990 innerRequest = request.request;
43991 if (/^\.\.?\//.test(innerRequest) && request.relativePath) {
43992 innerRequest = resolver.join(request.relativePath, innerRequest);
43993 }
43994 } else {
43995 innerRequest = request.relativePath;
43996 }
43997 request.__innerRequest_request = request.request;
43998 request.__innerRequest_relativePath = request.relativePath;
43999 return (request.__innerRequest = innerRequest);
44000};
44001
44002
44003/***/ }),
44004
44005/***/ 49395:
44006/***/ (function(module) {
44007
44008"use strict";
44009/*
44010 MIT License http://www.opensource.org/licenses/mit-license.php
44011 Author Tobias Koppers @sokra
44012*/
44013
44014
44015module.exports = function getPaths(path) {
44016 const parts = path.split(/(.*?[\\/]+)/);
44017 const paths = [path];
44018 const seqments = [parts[parts.length - 1]];
44019 let part = parts[parts.length - 1];
44020 path = path.substr(0, path.length - part.length - 1);
44021 for (let i = parts.length - 2; i > 2; i -= 2) {
44022 paths.push(path);
44023 part = parts[i];
44024 path = path.substr(0, path.length - part.length) || "/";
44025 seqments.push(part.substr(0, part.length - 1));
44026 }
44027 part = parts[1];
44028 seqments.push(part);
44029 paths.push(part);
44030 return {
44031 paths: paths,
44032 seqments: seqments
44033 };
44034};
44035
44036module.exports.basename = function basename(path) {
44037 const i = path.lastIndexOf("/"),
44038 j = path.lastIndexOf("\\");
44039 const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
44040 if (p < 0) return null;
44041 const s = path.substr(p + 1);
44042 return s;
44043};
44044
44045
44046/***/ }),
44047
44048/***/ 82876:
44049/***/ (function(__unused_webpack_module, exports) {
44050
44051"use strict";
44052/*
44053 MIT License http://www.opensource.org/licenses/mit-license.php
44054 Author Tobias Koppers @sokra
44055*/
44056
44057
44058function globToRegExp(glob) {
44059 // * [^\\\/]*
44060 // /**/ /.+/
44061 // ^* \./.+ (concord special)
44062 // ? [^\\\/]
44063 // [!...] [^...]
44064 // [^...] [^...]
44065 // / [\\\/]
44066 // {...,...} (...|...)
44067 // ?(...|...) (...|...)?
44068 // +(...|...) (...|...)+
44069 // *(...|...) (...|...)*
44070 // @(...|...) (...|...)
44071 if (/^\(.+\)$/.test(glob)) {
44072 // allow to pass an RegExp in brackets
44073 return new RegExp(glob.substr(1, glob.length - 2));
44074 }
44075 const tokens = tokenize(glob);
44076 const process = createRoot();
44077 const regExpStr = tokens.map(process).join("");
44078 return new RegExp("^" + regExpStr + "$");
44079}
44080
44081const SIMPLE_TOKENS = {
44082 "@(": "one",
44083 "?(": "zero-one",
44084 "+(": "one-many",
44085 "*(": "zero-many",
44086 "|": "segment-sep",
44087 "/**/": "any-path-segments",
44088 "**": "any-path",
44089 "*": "any-path-segment",
44090 "?": "any-char",
44091 "{": "or",
44092 "/": "path-sep",
44093 ",": "comma",
44094 ")": "closing-segment",
44095 "}": "closing-or"
44096};
44097
44098function tokenize(glob) {
44099 return glob
44100 .split(
44101 /([@?+*]\(|\/\*\*\/|\*\*|[?*]|\[[!^]?(?:[^\]\\]|\\.)+\]|\{|,|\/|[|)}])/g
44102 )
44103 .map(item => {
44104 if (!item) return null;
44105 const t = SIMPLE_TOKENS[item];
44106 if (t) {
44107 return {
44108 type: t
44109 };
44110 }
44111 if (item[0] === "[") {
44112 if (item[1] === "^" || item[1] === "!") {
44113 return {
44114 type: "inverted-char-set",
44115 value: item.substr(2, item.length - 3)
44116 };
44117 } else {
44118 return {
44119 type: "char-set",
44120 value: item.substr(1, item.length - 2)
44121 };
44122 }
44123 }
44124 return {
44125 type: "string",
44126 value: item
44127 };
44128 })
44129 .filter(Boolean)
44130 .concat({
44131 type: "end"
44132 });
44133}
44134
44135function createRoot() {
44136 const inOr = [];
44137 const process = createSeqment();
44138 let initial = true;
44139 return function(token) {
44140 switch (token.type) {
44141 case "or":
44142 inOr.push(initial);
44143 return "(";
44144 case "comma":
44145 if (inOr.length) {
44146 initial = inOr[inOr.length - 1];
44147 return "|";
44148 } else {
44149 return process(
44150 {
44151 type: "string",
44152 value: ","
44153 },
44154 initial
44155 );
44156 }
44157 case "closing-or":
44158 if (inOr.length === 0) throw new Error("Unmatched '}'");
44159 inOr.pop();
44160 return ")";
44161 case "end":
44162 if (inOr.length) throw new Error("Unmatched '{'");
44163 return process(token, initial);
44164 default: {
44165 const result = process(token, initial);
44166 initial = false;
44167 return result;
44168 }
44169 }
44170 };
44171}
44172
44173function createSeqment() {
44174 const inSeqment = [];
44175 const process = createSimple();
44176 return function(token, initial) {
44177 switch (token.type) {
44178 case "one":
44179 case "one-many":
44180 case "zero-many":
44181 case "zero-one":
44182 inSeqment.push(token.type);
44183 return "(";
44184 case "segment-sep":
44185 if (inSeqment.length) {
44186 return "|";
44187 } else {
44188 return process(
44189 {
44190 type: "string",
44191 value: "|"
44192 },
44193 initial
44194 );
44195 }
44196 case "closing-segment": {
44197 const segment = inSeqment.pop();
44198 switch (segment) {
44199 case "one":
44200 return ")";
44201 case "one-many":
44202 return ")+";
44203 case "zero-many":
44204 return ")*";
44205 case "zero-one":
44206 return ")?";
44207 }
44208 throw new Error("Unexcepted segment " + segment);
44209 }
44210 case "end":
44211 if (inSeqment.length > 0) {
44212 throw new Error("Unmatched segment, missing ')'");
44213 }
44214 return process(token, initial);
44215 default:
44216 return process(token, initial);
44217 }
44218 };
44219}
44220
44221function createSimple() {
44222 return function(token, initial) {
44223 switch (token.type) {
44224 case "path-sep":
44225 return "[\\\\/]+";
44226 case "any-path-segments":
44227 return "[\\\\/]+(?:(.+)[\\\\/]+)?";
44228 case "any-path":
44229 return "(.*)";
44230 case "any-path-segment":
44231 if (initial) {
44232 return "\\.[\\\\/]+(?:.*[\\\\/]+)?([^\\\\/]+)";
44233 } else {
44234 return "([^\\\\/]*)";
44235 }
44236 case "any-char":
44237 return "[^\\\\/]";
44238 case "inverted-char-set":
44239 return "[^" + token.value + "]";
44240 case "char-set":
44241 return "[" + token.value + "]";
44242 case "string":
44243 return token.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
44244 case "end":
44245 return "";
44246 default:
44247 throw new Error("Unsupported token '" + token.type + "'");
44248 }
44249 };
44250}
44251
44252exports.P = globToRegExp;
44253
44254
44255/***/ }),
44256
44257/***/ 87450:
44258/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
44259
44260"use strict";
44261/*
44262 MIT License http://www.opensource.org/licenses/mit-license.php
44263 Author Tobias Koppers @sokra
44264*/
44265
44266
44267const ResolverFactory = __webpack_require__(34129);
44268
44269const NodeJsInputFileSystem = __webpack_require__(13445);
44270const CachedInputFileSystem = __webpack_require__(75544);
44271
44272const nodeFileSystem = new CachedInputFileSystem(
44273 new NodeJsInputFileSystem(),
44274 4000
44275);
44276
44277const nodeContext = {
44278 environments: ["node+es3+es5+process+native"]
44279};
44280
44281const asyncResolver = ResolverFactory.createResolver({
44282 extensions: [".js", ".json", ".node"],
44283 fileSystem: nodeFileSystem
44284});
44285module.exports = function resolve(
44286 context,
44287 path,
44288 request,
44289 resolveContext,
44290 callback
44291) {
44292 if (typeof context === "string") {
44293 callback = resolveContext;
44294 resolveContext = request;
44295 request = path;
44296 path = context;
44297 context = nodeContext;
44298 }
44299 if (typeof callback !== "function") {
44300 callback = resolveContext;
44301 }
44302 asyncResolver.resolve(context, path, request, resolveContext, callback);
44303};
44304
44305const syncResolver = ResolverFactory.createResolver({
44306 extensions: [".js", ".json", ".node"],
44307 useSyncFileSystemCalls: true,
44308 fileSystem: nodeFileSystem
44309});
44310module.exports.sync = function resolveSync(context, path, request) {
44311 if (typeof context === "string") {
44312 request = path;
44313 path = context;
44314 context = nodeContext;
44315 }
44316 return syncResolver.resolveSync(context, path, request);
44317};
44318
44319const asyncContextResolver = ResolverFactory.createResolver({
44320 extensions: [".js", ".json", ".node"],
44321 resolveToContext: true,
44322 fileSystem: nodeFileSystem
44323});
44324module.exports.context = function resolveContext(
44325 context,
44326 path,
44327 request,
44328 resolveContext,
44329 callback
44330) {
44331 if (typeof context === "string") {
44332 callback = resolveContext;
44333 resolveContext = request;
44334 request = path;
44335 path = context;
44336 context = nodeContext;
44337 }
44338 if (typeof callback !== "function") {
44339 callback = resolveContext;
44340 }
44341 asyncContextResolver.resolve(
44342 context,
44343 path,
44344 request,
44345 resolveContext,
44346 callback
44347 );
44348};
44349
44350const syncContextResolver = ResolverFactory.createResolver({
44351 extensions: [".js", ".json", ".node"],
44352 resolveToContext: true,
44353 useSyncFileSystemCalls: true,
44354 fileSystem: nodeFileSystem
44355});
44356module.exports.context.sync = function resolveContextSync(
44357 context,
44358 path,
44359 request
44360) {
44361 if (typeof context === "string") {
44362 request = path;
44363 path = context;
44364 context = nodeContext;
44365 }
44366 return syncContextResolver.resolveSync(context, path, request);
44367};
44368
44369const asyncLoaderResolver = ResolverFactory.createResolver({
44370 extensions: [".js", ".json", ".node"],
44371 moduleExtensions: ["-loader"],
44372 mainFields: ["loader", "main"],
44373 fileSystem: nodeFileSystem
44374});
44375module.exports.loader = function resolveLoader(
44376 context,
44377 path,
44378 request,
44379 resolveContext,
44380 callback
44381) {
44382 if (typeof context === "string") {
44383 callback = resolveContext;
44384 resolveContext = request;
44385 request = path;
44386 path = context;
44387 context = nodeContext;
44388 }
44389 if (typeof callback !== "function") {
44390 callback = resolveContext;
44391 }
44392 asyncLoaderResolver.resolve(context, path, request, resolveContext, callback);
44393};
44394
44395const syncLoaderResolver = ResolverFactory.createResolver({
44396 extensions: [".js", ".json", ".node"],
44397 moduleExtensions: ["-loader"],
44398 mainFields: ["loader", "main"],
44399 useSyncFileSystemCalls: true,
44400 fileSystem: nodeFileSystem
44401});
44402module.exports.loader.sync = function resolveLoaderSync(
44403 context,
44404 path,
44405 request
44406) {
44407 if (typeof context === "string") {
44408 request = path;
44409 path = context;
44410 context = nodeContext;
44411 }
44412 return syncLoaderResolver.resolveSync(context, path, request);
44413};
44414
44415module.exports.create = function create(options) {
44416 options = Object.assign(
44417 {
44418 fileSystem: nodeFileSystem
44419 },
44420 options
44421 );
44422 const resolver = ResolverFactory.createResolver(options);
44423 return function(context, path, request, resolveContext, callback) {
44424 if (typeof context === "string") {
44425 callback = resolveContext;
44426 resolveContext = request;
44427 request = path;
44428 path = context;
44429 context = nodeContext;
44430 }
44431 if (typeof callback !== "function") {
44432 callback = resolveContext;
44433 }
44434 resolver.resolve(context, path, request, resolveContext, callback);
44435 };
44436};
44437
44438module.exports.create.sync = function createSync(options) {
44439 options = Object.assign(
44440 {
44441 useSyncFileSystemCalls: true,
44442 fileSystem: nodeFileSystem
44443 },
44444 options
44445 );
44446 const resolver = ResolverFactory.createResolver(options);
44447 return function(context, path, request) {
44448 if (typeof context === "string") {
44449 request = path;
44450 path = context;
44451 context = nodeContext;
44452 }
44453 return resolver.resolveSync(context, path, request);
44454 };
44455};
44456
44457// Export Resolver, FileSystems and Plugins
44458module.exports.ResolverFactory = ResolverFactory;
44459
44460module.exports.NodeJsInputFileSystem = NodeJsInputFileSystem;
44461module.exports.CachedInputFileSystem = CachedInputFileSystem;
44462
44463
44464/***/ }),
44465
44466/***/ 65775:
44467/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
44468
44469"use strict";
44470
44471
44472const normalize = __webpack_require__(69038);
44473
44474const absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i;
44475const absoluteNixRegExp = /^\//i;
44476
44477module.exports = function join(path, request) {
44478 if(!request) return normalize(path);
44479 if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\"));
44480 if(absoluteNixRegExp.test(request)) return normalize(request);
44481 if(path == "/") return normalize(path + request);
44482 if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\"));
44483 if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request);
44484 return normalize(path + "/" + request);
44485};
44486
44487
44488/***/ }),
44489
44490/***/ 69038:
44491/***/ (function(module) {
44492
44493"use strict";
44494
44495
44496// eslint-disable-next-line complexity
44497module.exports = function normalize(path) {
44498 var parts = path.split(/(\\+|\/+)/);
44499 if(parts.length === 1)
44500 return path;
44501 var result = [];
44502 var absolutePathStart = 0;
44503 for(var i = 0, sep = false; i < parts.length; i += 1, sep = !sep) {
44504 var part = parts[i];
44505 if(i === 0 && /^([A-Z]:)?$/i.test(part)) {
44506 result.push(part);
44507 absolutePathStart = 2;
44508 } else if(sep) {
44509 // UNC paths on Windows begin with a double backslash.
44510 if (i === 1 && parts[0].length === 0 && part === "\\\\") {
44511 result.push(part);
44512 } else {
44513 result.push(part[0]);
44514 }
44515 } else if(part === "..") {
44516 switch(result.length) {
44517 case 0:
44518 // i. e. ".." => ".."
44519 // i. e. "../a/b/c" => "../a/b/c"
44520 result.push(part);
44521 break;
44522 case 2:
44523 // i. e. "a/.." => ""
44524 // i. e. "/.." => "/"
44525 // i. e. "C:\.." => "C:\"
44526 // i. e. "a/../b/c" => "b/c"
44527 // i. e. "/../b/c" => "/b/c"
44528 // i. e. "C:\..\a\b\c" => "C:\a\b\c"
44529 if (result[0] !== ".") {
44530 i += 1;
44531 sep = !sep;
44532 result.length = absolutePathStart;
44533 } else {
44534 result.length = 0;
44535 result.push(part);
44536 }
44537 break;
44538 case 4:
44539 // i. e. "a/b/.." => "a"
44540 // i. e. "/a/.." => "/"
44541 // i. e. "C:\a\.." => "C:\"
44542 // i. e. "/a/../b/c" => "/b/c"
44543 if(absolutePathStart === 0) {
44544 result.length -= 3;
44545 } else {
44546 i += 1;
44547 sep = !sep;
44548 result.length = 2;
44549 }
44550 break;
44551 default:
44552 // i. e. "/a/b/.." => "/a"
44553 // i. e. "/a/b/../c" => "/a/c"
44554 result.length -= 3;
44555 break;
44556 }
44557 } else if(part === ".") {
44558 switch(result.length) {
44559 case 0:
44560 // i. e. "." => "."
44561 // i. e. "./a/b/c" => "./a/b/c"
44562 result.push(part);
44563 break;
44564 case 2:
44565 // i. e. "a/." => "a"
44566 // i. e. "/." => "/"
44567 // i. e. "C:\." => "C:\"
44568 // i. e. "C:\.\a\b\c" => "C:\a\b\c"
44569 if(absolutePathStart === 0) {
44570 result.length -= 1;
44571 } else {
44572 i += 1;
44573 sep = !sep;
44574 }
44575 break;
44576 default:
44577 // i. e. "a/b/." => "a/b"
44578 // i. e. "/a/." => "/"
44579 // i. e. "C:\a\." => "C:\"
44580 // i. e. "a/./b/c" => "a/b/c"
44581 // i. e. "/a/./b/c" => "/a/b/c"
44582 result.length -= 1;
44583 break;
44584 }
44585 } else if(part) {
44586 result.push(part);
44587 }
44588 }
44589 if(result.length === 1 && /^[A-Za-z]:$/.test(result[0]))
44590 return result[0] + "\\";
44591 return result.join("");
44592};
44593
44594
44595/***/ }),
44596
44597/***/ 39537:
44598/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
44599
44600"use strict";
44601/*
44602 MIT License http://www.opensource.org/licenses/mit-license.php
44603 Author Tobias Koppers @sokra
44604*/
44605
44606
44607const Hook = __webpack_require__(61292);
44608const HookCodeFactory = __webpack_require__(43699);
44609
44610class AsyncSeriesBailHookCodeFactory extends HookCodeFactory {
44611 content({ onError, onResult, resultReturns, onDone }) {
44612 return this.callTapsSeries({
44613 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
44614 onResult: (i, result, next) =>
44615 `if(${result} !== undefined) {\n${onResult(
44616 result
44617 )};\n} else {\n${next()}}\n`,
44618 resultReturns,
44619 onDone
44620 });
44621 }
44622}
44623
44624const factory = new AsyncSeriesBailHookCodeFactory();
44625
44626class AsyncSeriesBailHook extends Hook {
44627 compile(options) {
44628 factory.setup(this, options);
44629 return factory.create(options);
44630 }
44631}
44632
44633Object.defineProperties(AsyncSeriesBailHook.prototype, {
44634 _call: { value: undefined, configurable: true, writable: true }
44635});
44636
44637module.exports = AsyncSeriesBailHook;
44638
44639
44640/***/ }),
44641
44642/***/ 11522:
44643/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
44644
44645"use strict";
44646/*
44647 MIT License http://www.opensource.org/licenses/mit-license.php
44648 Author Tobias Koppers @sokra
44649*/
44650
44651
44652const Hook = __webpack_require__(61292);
44653const HookCodeFactory = __webpack_require__(43699);
44654
44655class AsyncSeriesHookCodeFactory extends HookCodeFactory {
44656 content({ onError, onDone }) {
44657 return this.callTapsSeries({
44658 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
44659 onDone
44660 });
44661 }
44662}
44663
44664const factory = new AsyncSeriesHookCodeFactory();
44665
44666class AsyncSeriesHook extends Hook {
44667 compile(options) {
44668 factory.setup(this, options);
44669 return factory.create(options);
44670 }
44671}
44672
44673Object.defineProperties(AsyncSeriesHook.prototype, {
44674 _call: { value: undefined, configurable: true, writable: true }
44675});
44676
44677module.exports = AsyncSeriesHook;
44678
44679
44680/***/ }),
44681
44682/***/ 61292:
44683/***/ (function(module) {
44684
44685"use strict";
44686/*
44687 MIT License http://www.opensource.org/licenses/mit-license.php
44688 Author Tobias Koppers @sokra
44689*/
44690
44691
44692class Hook {
44693 constructor(args) {
44694 if (!Array.isArray(args)) args = [];
44695 this._args = args;
44696 this.taps = [];
44697 this.interceptors = [];
44698 this.call = this._call;
44699 this.promise = this._promise;
44700 this.callAsync = this._callAsync;
44701 this._x = undefined;
44702 }
44703
44704 compile(options) {
44705 throw new Error("Abstract: should be overriden");
44706 }
44707
44708 _createCall(type) {
44709 return this.compile({
44710 taps: this.taps,
44711 interceptors: this.interceptors,
44712 args: this._args,
44713 type: type
44714 });
44715 }
44716
44717 tap(options, fn) {
44718 if (typeof options === "string") options = { name: options };
44719 if (typeof options !== "object" || options === null)
44720 throw new Error(
44721 "Invalid arguments to tap(options: Object, fn: function)"
44722 );
44723 options = Object.assign({ type: "sync", fn: fn }, options);
44724 if (typeof options.name !== "string" || options.name === "")
44725 throw new Error("Missing name for tap");
44726 options = this._runRegisterInterceptors(options);
44727 this._insert(options);
44728 }
44729
44730 tapAsync(options, fn) {
44731 if (typeof options === "string") options = { name: options };
44732 if (typeof options !== "object" || options === null)
44733 throw new Error(
44734 "Invalid arguments to tapAsync(options: Object, fn: function)"
44735 );
44736 options = Object.assign({ type: "async", fn: fn }, options);
44737 if (typeof options.name !== "string" || options.name === "")
44738 throw new Error("Missing name for tapAsync");
44739 options = this._runRegisterInterceptors(options);
44740 this._insert(options);
44741 }
44742
44743 tapPromise(options, fn) {
44744 if (typeof options === "string") options = { name: options };
44745 if (typeof options !== "object" || options === null)
44746 throw new Error(
44747 "Invalid arguments to tapPromise(options: Object, fn: function)"
44748 );
44749 options = Object.assign({ type: "promise", fn: fn }, options);
44750 if (typeof options.name !== "string" || options.name === "")
44751 throw new Error("Missing name for tapPromise");
44752 options = this._runRegisterInterceptors(options);
44753 this._insert(options);
44754 }
44755
44756 _runRegisterInterceptors(options) {
44757 for (const interceptor of this.interceptors) {
44758 if (interceptor.register) {
44759 const newOptions = interceptor.register(options);
44760 if (newOptions !== undefined) options = newOptions;
44761 }
44762 }
44763 return options;
44764 }
44765
44766 withOptions(options) {
44767 const mergeOptions = opt =>
44768 Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt);
44769
44770 // Prevent creating endless prototype chains
44771 options = Object.assign({}, options, this._withOptions);
44772 const base = this._withOptionsBase || this;
44773 const newHook = Object.create(base);
44774
44775 (newHook.tapAsync = (opt, fn) => base.tapAsync(mergeOptions(opt), fn)),
44776 (newHook.tap = (opt, fn) => base.tap(mergeOptions(opt), fn));
44777 newHook.tapPromise = (opt, fn) => base.tapPromise(mergeOptions(opt), fn);
44778 newHook._withOptions = options;
44779 newHook._withOptionsBase = base;
44780 return newHook;
44781 }
44782
44783 isUsed() {
44784 return this.taps.length > 0 || this.interceptors.length > 0;
44785 }
44786
44787 intercept(interceptor) {
44788 this._resetCompilation();
44789 this.interceptors.push(Object.assign({}, interceptor));
44790 if (interceptor.register) {
44791 for (let i = 0; i < this.taps.length; i++)
44792 this.taps[i] = interceptor.register(this.taps[i]);
44793 }
44794 }
44795
44796 _resetCompilation() {
44797 this.call = this._call;
44798 this.callAsync = this._callAsync;
44799 this.promise = this._promise;
44800 }
44801
44802 _insert(item) {
44803 this._resetCompilation();
44804 let before;
44805 if (typeof item.before === "string") before = new Set([item.before]);
44806 else if (Array.isArray(item.before)) {
44807 before = new Set(item.before);
44808 }
44809 let stage = 0;
44810 if (typeof item.stage === "number") stage = item.stage;
44811 let i = this.taps.length;
44812 while (i > 0) {
44813 i--;
44814 const x = this.taps[i];
44815 this.taps[i + 1] = x;
44816 const xStage = x.stage || 0;
44817 if (before) {
44818 if (before.has(x.name)) {
44819 before.delete(x.name);
44820 continue;
44821 }
44822 if (before.size > 0) {
44823 continue;
44824 }
44825 }
44826 if (xStage > stage) {
44827 continue;
44828 }
44829 i++;
44830 break;
44831 }
44832 this.taps[i] = item;
44833 }
44834}
44835
44836function createCompileDelegate(name, type) {
44837 return function lazyCompileHook(...args) {
44838 this[name] = this._createCall(type);
44839 return this[name](...args);
44840 };
44841}
44842
44843Object.defineProperties(Hook.prototype, {
44844 _call: {
44845 value: createCompileDelegate("call", "sync"),
44846 configurable: true,
44847 writable: true
44848 },
44849 _promise: {
44850 value: createCompileDelegate("promise", "promise"),
44851 configurable: true,
44852 writable: true
44853 },
44854 _callAsync: {
44855 value: createCompileDelegate("callAsync", "async"),
44856 configurable: true,
44857 writable: true
44858 }
44859});
44860
44861module.exports = Hook;
44862
44863
44864/***/ }),
44865
44866/***/ 43699:
44867/***/ (function(module) {
44868
44869"use strict";
44870/*
44871 MIT License http://www.opensource.org/licenses/mit-license.php
44872 Author Tobias Koppers @sokra
44873*/
44874
44875
44876class HookCodeFactory {
44877 constructor(config) {
44878 this.config = config;
44879 this.options = undefined;
44880 this._args = undefined;
44881 }
44882
44883 create(options) {
44884 this.init(options);
44885 let fn;
44886 switch (this.options.type) {
44887 case "sync":
44888 fn = new Function(
44889 this.args(),
44890 '"use strict";\n' +
44891 this.header() +
44892 this.content({
44893 onError: err => `throw ${err};\n`,
44894 onResult: result => `return ${result};\n`,
44895 resultReturns: true,
44896 onDone: () => "",
44897 rethrowIfPossible: true
44898 })
44899 );
44900 break;
44901 case "async":
44902 fn = new Function(
44903 this.args({
44904 after: "_callback"
44905 }),
44906 '"use strict";\n' +
44907 this.header() +
44908 this.content({
44909 onError: err => `_callback(${err});\n`,
44910 onResult: result => `_callback(null, ${result});\n`,
44911 onDone: () => "_callback();\n"
44912 })
44913 );
44914 break;
44915 case "promise":
44916 let errorHelperUsed = false;
44917 const content = this.content({
44918 onError: err => {
44919 errorHelperUsed = true;
44920 return `_error(${err});\n`;
44921 },
44922 onResult: result => `_resolve(${result});\n`,
44923 onDone: () => "_resolve();\n"
44924 });
44925 let code = "";
44926 code += '"use strict";\n';
44927 code += "return new Promise((_resolve, _reject) => {\n";
44928 if (errorHelperUsed) {
44929 code += "var _sync = true;\n";
44930 code += "function _error(_err) {\n";
44931 code += "if(_sync)\n";
44932 code += "_resolve(Promise.resolve().then(() => { throw _err; }));\n";
44933 code += "else\n";
44934 code += "_reject(_err);\n";
44935 code += "};\n";
44936 }
44937 code += this.header();
44938 code += content;
44939 if (errorHelperUsed) {
44940 code += "_sync = false;\n";
44941 }
44942 code += "});\n";
44943 fn = new Function(this.args(), code);
44944 break;
44945 }
44946 this.deinit();
44947 return fn;
44948 }
44949
44950 setup(instance, options) {
44951 instance._x = options.taps.map(t => t.fn);
44952 }
44953
44954 /**
44955 * @param {{ type: "sync" | "promise" | "async", taps: Array<Tap>, interceptors: Array<Interceptor> }} options
44956 */
44957 init(options) {
44958 this.options = options;
44959 this._args = options.args.slice();
44960 }
44961
44962 deinit() {
44963 this.options = undefined;
44964 this._args = undefined;
44965 }
44966
44967 header() {
44968 let code = "";
44969 if (this.needContext()) {
44970 code += "var _context = {};\n";
44971 } else {
44972 code += "var _context;\n";
44973 }
44974 code += "var _x = this._x;\n";
44975 if (this.options.interceptors.length > 0) {
44976 code += "var _taps = this.taps;\n";
44977 code += "var _interceptors = this.interceptors;\n";
44978 }
44979 for (let i = 0; i < this.options.interceptors.length; i++) {
44980 const interceptor = this.options.interceptors[i];
44981 if (interceptor.call) {
44982 code += `${this.getInterceptor(i)}.call(${this.args({
44983 before: interceptor.context ? "_context" : undefined
44984 })});\n`;
44985 }
44986 }
44987 return code;
44988 }
44989
44990 needContext() {
44991 for (const tap of this.options.taps) if (tap.context) return true;
44992 return false;
44993 }
44994
44995 callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) {
44996 let code = "";
44997 let hasTapCached = false;
44998 for (let i = 0; i < this.options.interceptors.length; i++) {
44999 const interceptor = this.options.interceptors[i];
45000 if (interceptor.tap) {
45001 if (!hasTapCached) {
45002 code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`;
45003 hasTapCached = true;
45004 }
45005 code += `${this.getInterceptor(i)}.tap(${
45006 interceptor.context ? "_context, " : ""
45007 }_tap${tapIndex});\n`;
45008 }
45009 }
45010 code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`;
45011 const tap = this.options.taps[tapIndex];
45012 switch (tap.type) {
45013 case "sync":
45014 if (!rethrowIfPossible) {
45015 code += `var _hasError${tapIndex} = false;\n`;
45016 code += "try {\n";
45017 }
45018 if (onResult) {
45019 code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({
45020 before: tap.context ? "_context" : undefined
45021 })});\n`;
45022 } else {
45023 code += `_fn${tapIndex}(${this.args({
45024 before: tap.context ? "_context" : undefined
45025 })});\n`;
45026 }
45027 if (!rethrowIfPossible) {
45028 code += "} catch(_err) {\n";
45029 code += `_hasError${tapIndex} = true;\n`;
45030 code += onError("_err");
45031 code += "}\n";
45032 code += `if(!_hasError${tapIndex}) {\n`;
45033 }
45034 if (onResult) {
45035 code += onResult(`_result${tapIndex}`);
45036 }
45037 if (onDone) {
45038 code += onDone();
45039 }
45040 if (!rethrowIfPossible) {
45041 code += "}\n";
45042 }
45043 break;
45044 case "async":
45045 let cbCode = "";
45046 if (onResult) cbCode += `(_err${tapIndex}, _result${tapIndex}) => {\n`;
45047 else cbCode += `_err${tapIndex} => {\n`;
45048 cbCode += `if(_err${tapIndex}) {\n`;
45049 cbCode += onError(`_err${tapIndex}`);
45050 cbCode += "} else {\n";
45051 if (onResult) {
45052 cbCode += onResult(`_result${tapIndex}`);
45053 }
45054 if (onDone) {
45055 cbCode += onDone();
45056 }
45057 cbCode += "}\n";
45058 cbCode += "}";
45059 code += `_fn${tapIndex}(${this.args({
45060 before: tap.context ? "_context" : undefined,
45061 after: cbCode
45062 })});\n`;
45063 break;
45064 case "promise":
45065 code += `var _hasResult${tapIndex} = false;\n`;
45066 code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({
45067 before: tap.context ? "_context" : undefined
45068 })});\n`;
45069 code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`;
45070 code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`;
45071 code += `_promise${tapIndex}.then(_result${tapIndex} => {\n`;
45072 code += `_hasResult${tapIndex} = true;\n`;
45073 if (onResult) {
45074 code += onResult(`_result${tapIndex}`);
45075 }
45076 if (onDone) {
45077 code += onDone();
45078 }
45079 code += `}, _err${tapIndex} => {\n`;
45080 code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`;
45081 code += onError(`_err${tapIndex}`);
45082 code += "});\n";
45083 break;
45084 }
45085 return code;
45086 }
45087
45088 callTapsSeries({
45089 onError,
45090 onResult,
45091 resultReturns,
45092 onDone,
45093 doneReturns,
45094 rethrowIfPossible
45095 }) {
45096 if (this.options.taps.length === 0) return onDone();
45097 const firstAsync = this.options.taps.findIndex(t => t.type !== "sync");
45098 const somethingReturns = resultReturns || doneReturns || false;
45099 let code = "";
45100 let current = onDone;
45101 for (let j = this.options.taps.length - 1; j >= 0; j--) {
45102 const i = j;
45103 const unroll = current !== onDone && this.options.taps[i].type !== "sync";
45104 if (unroll) {
45105 code += `function _next${i}() {\n`;
45106 code += current();
45107 code += `}\n`;
45108 current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`;
45109 }
45110 const done = current;
45111 const doneBreak = skipDone => {
45112 if (skipDone) return "";
45113 return onDone();
45114 };
45115 const content = this.callTap(i, {
45116 onError: error => onError(i, error, done, doneBreak),
45117 onResult:
45118 onResult &&
45119 (result => {
45120 return onResult(i, result, done, doneBreak);
45121 }),
45122 onDone: !onResult && done,
45123 rethrowIfPossible:
45124 rethrowIfPossible && (firstAsync < 0 || i < firstAsync)
45125 });
45126 current = () => content;
45127 }
45128 code += current();
45129 return code;
45130 }
45131
45132 callTapsLooping({ onError, onDone, rethrowIfPossible }) {
45133 if (this.options.taps.length === 0) return onDone();
45134 const syncOnly = this.options.taps.every(t => t.type === "sync");
45135 let code = "";
45136 if (!syncOnly) {
45137 code += "var _looper = () => {\n";
45138 code += "var _loopAsync = false;\n";
45139 }
45140 code += "var _loop;\n";
45141 code += "do {\n";
45142 code += "_loop = false;\n";
45143 for (let i = 0; i < this.options.interceptors.length; i++) {
45144 const interceptor = this.options.interceptors[i];
45145 if (interceptor.loop) {
45146 code += `${this.getInterceptor(i)}.loop(${this.args({
45147 before: interceptor.context ? "_context" : undefined
45148 })});\n`;
45149 }
45150 }
45151 code += this.callTapsSeries({
45152 onError,
45153 onResult: (i, result, next, doneBreak) => {
45154 let code = "";
45155 code += `if(${result} !== undefined) {\n`;
45156 code += "_loop = true;\n";
45157 if (!syncOnly) code += "if(_loopAsync) _looper();\n";
45158 code += doneBreak(true);
45159 code += `} else {\n`;
45160 code += next();
45161 code += `}\n`;
45162 return code;
45163 },
45164 onDone:
45165 onDone &&
45166 (() => {
45167 let code = "";
45168 code += "if(!_loop) {\n";
45169 code += onDone();
45170 code += "}\n";
45171 return code;
45172 }),
45173 rethrowIfPossible: rethrowIfPossible && syncOnly
45174 });
45175 code += "} while(_loop);\n";
45176 if (!syncOnly) {
45177 code += "_loopAsync = true;\n";
45178 code += "};\n";
45179 code += "_looper();\n";
45180 }
45181 return code;
45182 }
45183
45184 callTapsParallel({
45185 onError,
45186 onResult,
45187 onDone,
45188 rethrowIfPossible,
45189 onTap = (i, run) => run()
45190 }) {
45191 if (this.options.taps.length <= 1) {
45192 return this.callTapsSeries({
45193 onError,
45194 onResult,
45195 onDone,
45196 rethrowIfPossible
45197 });
45198 }
45199 let code = "";
45200 code += "do {\n";
45201 code += `var _counter = ${this.options.taps.length};\n`;
45202 if (onDone) {
45203 code += "var _done = () => {\n";
45204 code += onDone();
45205 code += "};\n";
45206 }
45207 for (let i = 0; i < this.options.taps.length; i++) {
45208 const done = () => {
45209 if (onDone) return "if(--_counter === 0) _done();\n";
45210 else return "--_counter;";
45211 };
45212 const doneBreak = skipDone => {
45213 if (skipDone || !onDone) return "_counter = 0;\n";
45214 else return "_counter = 0;\n_done();\n";
45215 };
45216 code += "if(_counter <= 0) break;\n";
45217 code += onTap(
45218 i,
45219 () =>
45220 this.callTap(i, {
45221 onError: error => {
45222 let code = "";
45223 code += "if(_counter > 0) {\n";
45224 code += onError(i, error, done, doneBreak);
45225 code += "}\n";
45226 return code;
45227 },
45228 onResult:
45229 onResult &&
45230 (result => {
45231 let code = "";
45232 code += "if(_counter > 0) {\n";
45233 code += onResult(i, result, done, doneBreak);
45234 code += "}\n";
45235 return code;
45236 }),
45237 onDone:
45238 !onResult &&
45239 (() => {
45240 return done();
45241 }),
45242 rethrowIfPossible
45243 }),
45244 done,
45245 doneBreak
45246 );
45247 }
45248 code += "} while(false);\n";
45249 return code;
45250 }
45251
45252 args({ before, after } = {}) {
45253 let allArgs = this._args;
45254 if (before) allArgs = [before].concat(allArgs);
45255 if (after) allArgs = allArgs.concat(after);
45256 if (allArgs.length === 0) {
45257 return "";
45258 } else {
45259 return allArgs.join(", ");
45260 }
45261 }
45262
45263 getTapFn(idx) {
45264 return `_x[${idx}]`;
45265 }
45266
45267 getTap(idx) {
45268 return `_taps[${idx}]`;
45269 }
45270
45271 getInterceptor(idx) {
45272 return `_interceptors[${idx}]`;
45273 }
45274}
45275
45276module.exports = HookCodeFactory;
45277
45278
45279/***/ }),
45280
45281/***/ 24393:
45282/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
45283
45284"use strict";
45285/*
45286 MIT License http://www.opensource.org/licenses/mit-license.php
45287 Author Tobias Koppers @sokra
45288*/
45289
45290
45291const Hook = __webpack_require__(61292);
45292const HookCodeFactory = __webpack_require__(43699);
45293
45294class SyncBailHookCodeFactory extends HookCodeFactory {
45295 content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) {
45296 return this.callTapsSeries({
45297 onError: (i, err) => onError(err),
45298 onResult: (i, result, next) =>
45299 `if(${result} !== undefined) {\n${onResult(
45300 result
45301 )};\n} else {\n${next()}}\n`,
45302 resultReturns,
45303 onDone,
45304 rethrowIfPossible
45305 });
45306 }
45307}
45308
45309const factory = new SyncBailHookCodeFactory();
45310
45311class SyncBailHook extends Hook {
45312 tapAsync() {
45313 throw new Error("tapAsync is not supported on a SyncBailHook");
45314 }
45315
45316 tapPromise() {
45317 throw new Error("tapPromise is not supported on a SyncBailHook");
45318 }
45319
45320 compile(options) {
45321 factory.setup(this, options);
45322 return factory.create(options);
45323 }
45324}
45325
45326module.exports = SyncBailHook;
45327
45328
45329/***/ }),
45330
45331/***/ 48242:
45332/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
45333
45334"use strict";
45335/*
45336 MIT License http://www.opensource.org/licenses/mit-license.php
45337 Author Tobias Koppers @sokra
45338*/
45339
45340
45341const Hook = __webpack_require__(61292);
45342const HookCodeFactory = __webpack_require__(43699);
45343
45344class SyncHookCodeFactory extends HookCodeFactory {
45345 content({ onError, onDone, rethrowIfPossible }) {
45346 return this.callTapsSeries({
45347 onError: (i, err) => onError(err),
45348 onDone,
45349 rethrowIfPossible
45350 });
45351 }
45352}
45353
45354const factory = new SyncHookCodeFactory();
45355
45356class SyncHook extends Hook {
45357 tapAsync() {
45358 throw new Error("tapAsync is not supported on a SyncHook");
45359 }
45360
45361 tapPromise() {
45362 throw new Error("tapPromise is not supported on a SyncHook");
45363 }
45364
45365 compile(options) {
45366 factory.setup(this, options);
45367 return factory.create(options);
45368 }
45369}
45370
45371module.exports = SyncHook;
45372
45373
45374/***/ }),
45375
45376/***/ 41116:
45377/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
45378
45379"use strict";
45380/*
45381 MIT License http://www.opensource.org/licenses/mit-license.php
45382 Author Tobias Koppers @sokra
45383*/
45384
45385
45386const util = __webpack_require__(31669);
45387const SyncBailHook = __webpack_require__(24393);
45388
45389function Tapable() {
45390 this._pluginCompat = new SyncBailHook(["options"]);
45391 this._pluginCompat.tap(
45392 {
45393 name: "Tapable camelCase",
45394 stage: 100
45395 },
45396 options => {
45397 options.names.add(
45398 options.name.replace(/[- ]([a-z])/g, (str, ch) => ch.toUpperCase())
45399 );
45400 }
45401 );
45402 this._pluginCompat.tap(
45403 {
45404 name: "Tapable this.hooks",
45405 stage: 200
45406 },
45407 options => {
45408 let hook;
45409 for (const name of options.names) {
45410 hook = this.hooks[name];
45411 if (hook !== undefined) {
45412 break;
45413 }
45414 }
45415 if (hook !== undefined) {
45416 const tapOpt = {
45417 name: options.fn.name || "unnamed compat plugin",
45418 stage: options.stage || 0
45419 };
45420 if (options.async) hook.tapAsync(tapOpt, options.fn);
45421 else hook.tap(tapOpt, options.fn);
45422 return true;
45423 }
45424 }
45425 );
45426}
45427module.exports = Tapable;
45428
45429Tapable.addCompatLayer = function addCompatLayer(instance) {
45430 Tapable.call(instance);
45431 instance.plugin = Tapable.prototype.plugin;
45432 instance.apply = Tapable.prototype.apply;
45433};
45434
45435Tapable.prototype.plugin = util.deprecate(function plugin(name, fn) {
45436 if (Array.isArray(name)) {
45437 name.forEach(function(name) {
45438 this.plugin(name, fn);
45439 }, this);
45440 return;
45441 }
45442 const result = this._pluginCompat.call({
45443 name: name,
45444 fn: fn,
45445 names: new Set([name])
45446 });
45447 if (!result) {
45448 throw new Error(
45449 `Plugin could not be registered at '${name}'. Hook was not found.\n` +
45450 "BREAKING CHANGE: There need to exist a hook at 'this.hooks'. " +
45451 "To create a compatibility layer for this hook, hook into 'this._pluginCompat'."
45452 );
45453 }
45454}, "Tapable.plugin is deprecated. Use new API on `.hooks` instead");
45455
45456Tapable.prototype.apply = util.deprecate(function apply() {
45457 for (var i = 0; i < arguments.length; i++) {
45458 arguments[i].apply(this);
45459 }
45460}, "Tapable.apply is deprecated. Call apply on the plugin directly instead");
45461
45462
45463/***/ }),
45464
45465/***/ 81744:
45466/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
45467
45468var prr = __webpack_require__(59570)
45469
45470function init (type, message, cause) {
45471 if (!!message && typeof message != 'string') {
45472 message = message.message || message.name
45473 }
45474 prr(this, {
45475 type : type
45476 , name : type
45477 // can be passed just a 'cause'
45478 , cause : typeof message != 'string' ? message : cause
45479 , message : message
45480 }, 'ewr')
45481}
45482
45483// generic prototype, not intended to be actually used - helpful for `instanceof`
45484function CustomError (message, cause) {
45485 Error.call(this)
45486 if (Error.captureStackTrace)
45487 Error.captureStackTrace(this, this.constructor)
45488 init.call(this, 'CustomError', message, cause)
45489}
45490
45491CustomError.prototype = new Error()
45492
45493function createError (errno, type, proto) {
45494 var err = function (message, cause) {
45495 init.call(this, type, message, cause)
45496 //TODO: the specificity here is stupid, errno should be available everywhere
45497 if (type == 'FilesystemError') {
45498 this.code = this.cause.code
45499 this.path = this.cause.path
45500 this.errno = this.cause.errno
45501 this.message =
45502 (errno.errno[this.cause.errno]
45503 ? errno.errno[this.cause.errno].description
45504 : this.cause.message)
45505 + (this.cause.path ? ' [' + this.cause.path + ']' : '')
45506 }
45507 Error.call(this)
45508 if (Error.captureStackTrace)
45509 Error.captureStackTrace(this, err)
45510 }
45511 err.prototype = !!proto ? new proto() : new CustomError()
45512 return err
45513}
45514
45515module.exports = function (errno) {
45516 var ce = function (type, proto) {
45517 return createError(errno, type, proto)
45518 }
45519 return {
45520 CustomError : CustomError
45521 , FilesystemError : ce('FilesystemError')
45522 , createError : ce
45523 }
45524}
45525
45526
45527/***/ }),
45528
45529/***/ 48916:
45530/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
45531
45532var all = module.exports.all = [
45533 {
45534 errno: -2,
45535 code: 'ENOENT',
45536 description: 'no such file or directory'
45537 },
45538 {
45539 errno: -1,
45540 code: 'UNKNOWN',
45541 description: 'unknown error'
45542 },
45543 {
45544 errno: 0,
45545 code: 'OK',
45546 description: 'success'
45547 },
45548 {
45549 errno: 1,
45550 code: 'EOF',
45551 description: 'end of file'
45552 },
45553 {
45554 errno: 2,
45555 code: 'EADDRINFO',
45556 description: 'getaddrinfo error'
45557 },
45558 {
45559 errno: 3,
45560 code: 'EACCES',
45561 description: 'permission denied'
45562 },
45563 {
45564 errno: 4,
45565 code: 'EAGAIN',
45566 description: 'resource temporarily unavailable'
45567 },
45568 {
45569 errno: 5,
45570 code: 'EADDRINUSE',
45571 description: 'address already in use'
45572 },
45573 {
45574 errno: 6,
45575 code: 'EADDRNOTAVAIL',
45576 description: 'address not available'
45577 },
45578 {
45579 errno: 7,
45580 code: 'EAFNOSUPPORT',
45581 description: 'address family not supported'
45582 },
45583 {
45584 errno: 8,
45585 code: 'EALREADY',
45586 description: 'connection already in progress'
45587 },
45588 {
45589 errno: 9,
45590 code: 'EBADF',
45591 description: 'bad file descriptor'
45592 },
45593 {
45594 errno: 10,
45595 code: 'EBUSY',
45596 description: 'resource busy or locked'
45597 },
45598 {
45599 errno: 11,
45600 code: 'ECONNABORTED',
45601 description: 'software caused connection abort'
45602 },
45603 {
45604 errno: 12,
45605 code: 'ECONNREFUSED',
45606 description: 'connection refused'
45607 },
45608 {
45609 errno: 13,
45610 code: 'ECONNRESET',
45611 description: 'connection reset by peer'
45612 },
45613 {
45614 errno: 14,
45615 code: 'EDESTADDRREQ',
45616 description: 'destination address required'
45617 },
45618 {
45619 errno: 15,
45620 code: 'EFAULT',
45621 description: 'bad address in system call argument'
45622 },
45623 {
45624 errno: 16,
45625 code: 'EHOSTUNREACH',
45626 description: 'host is unreachable'
45627 },
45628 {
45629 errno: 17,
45630 code: 'EINTR',
45631 description: 'interrupted system call'
45632 },
45633 {
45634 errno: 18,
45635 code: 'EINVAL',
45636 description: 'invalid argument'
45637 },
45638 {
45639 errno: 19,
45640 code: 'EISCONN',
45641 description: 'socket is already connected'
45642 },
45643 {
45644 errno: 20,
45645 code: 'EMFILE',
45646 description: 'too many open files'
45647 },
45648 {
45649 errno: 21,
45650 code: 'EMSGSIZE',
45651 description: 'message too long'
45652 },
45653 {
45654 errno: 22,
45655 code: 'ENETDOWN',
45656 description: 'network is down'
45657 },
45658 {
45659 errno: 23,
45660 code: 'ENETUNREACH',
45661 description: 'network is unreachable'
45662 },
45663 {
45664 errno: 24,
45665 code: 'ENFILE',
45666 description: 'file table overflow'
45667 },
45668 {
45669 errno: 25,
45670 code: 'ENOBUFS',
45671 description: 'no buffer space available'
45672 },
45673 {
45674 errno: 26,
45675 code: 'ENOMEM',
45676 description: 'not enough memory'
45677 },
45678 {
45679 errno: 27,
45680 code: 'ENOTDIR',
45681 description: 'not a directory'
45682 },
45683 {
45684 errno: 28,
45685 code: 'EISDIR',
45686 description: 'illegal operation on a directory'
45687 },
45688 {
45689 errno: 29,
45690 code: 'ENONET',
45691 description: 'machine is not on the network'
45692 },
45693 {
45694 errno: 31,
45695 code: 'ENOTCONN',
45696 description: 'socket is not connected'
45697 },
45698 {
45699 errno: 32,
45700 code: 'ENOTSOCK',
45701 description: 'socket operation on non-socket'
45702 },
45703 {
45704 errno: 33,
45705 code: 'ENOTSUP',
45706 description: 'operation not supported on socket'
45707 },
45708 {
45709 errno: 34,
45710 code: 'ENOENT',
45711 description: 'no such file or directory'
45712 },
45713 {
45714 errno: 35,
45715 code: 'ENOSYS',
45716 description: 'function not implemented'
45717 },
45718 {
45719 errno: 36,
45720 code: 'EPIPE',
45721 description: 'broken pipe'
45722 },
45723 {
45724 errno: 37,
45725 code: 'EPROTO',
45726 description: 'protocol error'
45727 },
45728 {
45729 errno: 38,
45730 code: 'EPROTONOSUPPORT',
45731 description: 'protocol not supported'
45732 },
45733 {
45734 errno: 39,
45735 code: 'EPROTOTYPE',
45736 description: 'protocol wrong type for socket'
45737 },
45738 {
45739 errno: 40,
45740 code: 'ETIMEDOUT',
45741 description: 'connection timed out'
45742 },
45743 {
45744 errno: 41,
45745 code: 'ECHARSET',
45746 description: 'invalid Unicode character'
45747 },
45748 {
45749 errno: 42,
45750 code: 'EAIFAMNOSUPPORT',
45751 description: 'address family for hostname not supported'
45752 },
45753 {
45754 errno: 44,
45755 code: 'EAISERVICE',
45756 description: 'servname not supported for ai_socktype'
45757 },
45758 {
45759 errno: 45,
45760 code: 'EAISOCKTYPE',
45761 description: 'ai_socktype not supported'
45762 },
45763 {
45764 errno: 46,
45765 code: 'ESHUTDOWN',
45766 description: 'cannot send after transport endpoint shutdown'
45767 },
45768 {
45769 errno: 47,
45770 code: 'EEXIST',
45771 description: 'file already exists'
45772 },
45773 {
45774 errno: 48,
45775 code: 'ESRCH',
45776 description: 'no such process'
45777 },
45778 {
45779 errno: 49,
45780 code: 'ENAMETOOLONG',
45781 description: 'name too long'
45782 },
45783 {
45784 errno: 50,
45785 code: 'EPERM',
45786 description: 'operation not permitted'
45787 },
45788 {
45789 errno: 51,
45790 code: 'ELOOP',
45791 description: 'too many symbolic links encountered'
45792 },
45793 {
45794 errno: 52,
45795 code: 'EXDEV',
45796 description: 'cross-device link not permitted'
45797 },
45798 {
45799 errno: 53,
45800 code: 'ENOTEMPTY',
45801 description: 'directory not empty'
45802 },
45803 {
45804 errno: 54,
45805 code: 'ENOSPC',
45806 description: 'no space left on device'
45807 },
45808 {
45809 errno: 55,
45810 code: 'EIO',
45811 description: 'i/o error'
45812 },
45813 {
45814 errno: 56,
45815 code: 'EROFS',
45816 description: 'read-only file system'
45817 },
45818 {
45819 errno: 57,
45820 code: 'ENODEV',
45821 description: 'no such device'
45822 },
45823 {
45824 errno: 58,
45825 code: 'ESPIPE',
45826 description: 'invalid seek'
45827 },
45828 {
45829 errno: 59,
45830 code: 'ECANCELED',
45831 description: 'operation canceled'
45832 }
45833]
45834
45835module.exports.errno = {}
45836module.exports.code = {}
45837
45838all.forEach(function (error) {
45839 module.exports.errno[error.errno] = error
45840 module.exports.code[error.code] = error
45841})
45842
45843module.exports.custom = __webpack_require__(81744)(module.exports)
45844module.exports.create = module.exports.custom.createError
45845
45846
45847/***/ }),
45848
45849/***/ 64352:
45850/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
45851
45852/*
45853 Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
45854
45855 Redistribution and use in source and binary forms, with or without
45856 modification, are permitted provided that the following conditions are met:
45857
45858 * Redistributions of source code must retain the above copyright
45859 notice, this list of conditions and the following disclaimer.
45860 * Redistributions in binary form must reproduce the above copyright
45861 notice, this list of conditions and the following disclaimer in the
45862 documentation and/or other materials provided with the distribution.
45863
45864 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
45865 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45866 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45867 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
45868 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
45869 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45870 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45871 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45872 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45873 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45874*/
45875(function () {
45876 'use strict';
45877
45878 var estraverse = __webpack_require__(40379);
45879
45880 function isNode(node) {
45881 if (node == null) {
45882 return false;
45883 }
45884 return typeof node === 'object' && typeof node.type === 'string';
45885 }
45886
45887 function isProperty(nodeType, key) {
45888 return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties';
45889 }
45890
45891 function Visitor(visitor, options) {
45892 options = options || {};
45893
45894 this.__visitor = visitor || this;
45895 this.__childVisitorKeys = options.childVisitorKeys
45896 ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys)
45897 : estraverse.VisitorKeys;
45898 if (options.fallback === 'iteration') {
45899 this.__fallback = Object.keys;
45900 } else if (typeof options.fallback === 'function') {
45901 this.__fallback = options.fallback;
45902 }
45903 }
45904
45905 /* Default method for visiting children.
45906 * When you need to call default visiting operation inside custom visiting
45907 * operation, you can use it with `this.visitChildren(node)`.
45908 */
45909 Visitor.prototype.visitChildren = function (node) {
45910 var type, children, i, iz, j, jz, child;
45911
45912 if (node == null) {
45913 return;
45914 }
45915
45916 type = node.type || estraverse.Syntax.Property;
45917
45918 children = this.__childVisitorKeys[type];
45919 if (!children) {
45920 if (this.__fallback) {
45921 children = this.__fallback(node);
45922 } else {
45923 throw new Error('Unknown node type ' + type + '.');
45924 }
45925 }
45926
45927 for (i = 0, iz = children.length; i < iz; ++i) {
45928 child = node[children[i]];
45929 if (child) {
45930 if (Array.isArray(child)) {
45931 for (j = 0, jz = child.length; j < jz; ++j) {
45932 if (child[j]) {
45933 if (isNode(child[j]) || isProperty(type, children[i])) {
45934 this.visit(child[j]);
45935 }
45936 }
45937 }
45938 } else if (isNode(child)) {
45939 this.visit(child);
45940 }
45941 }
45942 }
45943 };
45944
45945 /* Dispatching node. */
45946 Visitor.prototype.visit = function (node) {
45947 var type;
45948
45949 if (node == null) {
45950 return;
45951 }
45952
45953 type = node.type || estraverse.Syntax.Property;
45954 if (this.__visitor[type]) {
45955 this.__visitor[type].call(this, node);
45956 return;
45957 }
45958 this.visitChildren(node);
45959 };
45960
45961 exports.version = __webpack_require__(25916).version;
45962 exports.Visitor = Visitor;
45963 exports.visit = function (node, visitor, options) {
45964 var v = new Visitor(visitor, options);
45965 v.visit(node);
45966 };
45967}());
45968/* vim: set sw=4 ts=4 et tw=80 : */
45969
45970
45971/***/ }),
45972
45973/***/ 40379:
45974/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
45975
45976/*
45977 Copyright (C) 2012-2013 Yusuke Suzuki <utatane.tea@gmail.com>
45978 Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
45979
45980 Redistribution and use in source and binary forms, with or without
45981 modification, are permitted provided that the following conditions are met:
45982
45983 * Redistributions of source code must retain the above copyright
45984 notice, this list of conditions and the following disclaimer.
45985 * Redistributions in binary form must reproduce the above copyright
45986 notice, this list of conditions and the following disclaimer in the
45987 documentation and/or other materials provided with the distribution.
45988
45989 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
45990 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45991 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45992 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
45993 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
45994 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45995 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45996 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45997 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45998 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45999*/
46000/*jslint vars:false, bitwise:true*/
46001/*jshint indent:4*/
46002/*global exports:true*/
46003(function clone(exports) {
46004 'use strict';
46005
46006 var Syntax,
46007 VisitorOption,
46008 VisitorKeys,
46009 BREAK,
46010 SKIP,
46011 REMOVE;
46012
46013 function deepCopy(obj) {
46014 var ret = {}, key, val;
46015 for (key in obj) {
46016 if (obj.hasOwnProperty(key)) {
46017 val = obj[key];
46018 if (typeof val === 'object' && val !== null) {
46019 ret[key] = deepCopy(val);
46020 } else {
46021 ret[key] = val;
46022 }
46023 }
46024 }
46025 return ret;
46026 }
46027
46028 // based on LLVM libc++ upper_bound / lower_bound
46029 // MIT License
46030
46031 function upperBound(array, func) {
46032 var diff, len, i, current;
46033
46034 len = array.length;
46035 i = 0;
46036
46037 while (len) {
46038 diff = len >>> 1;
46039 current = i + diff;
46040 if (func(array[current])) {
46041 len = diff;
46042 } else {
46043 i = current + 1;
46044 len -= diff + 1;
46045 }
46046 }
46047 return i;
46048 }
46049
46050 Syntax = {
46051 AssignmentExpression: 'AssignmentExpression',
46052 AssignmentPattern: 'AssignmentPattern',
46053 ArrayExpression: 'ArrayExpression',
46054 ArrayPattern: 'ArrayPattern',
46055 ArrowFunctionExpression: 'ArrowFunctionExpression',
46056 AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
46057 BlockStatement: 'BlockStatement',
46058 BinaryExpression: 'BinaryExpression',
46059 BreakStatement: 'BreakStatement',
46060 CallExpression: 'CallExpression',
46061 CatchClause: 'CatchClause',
46062 ClassBody: 'ClassBody',
46063 ClassDeclaration: 'ClassDeclaration',
46064 ClassExpression: 'ClassExpression',
46065 ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
46066 ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
46067 ConditionalExpression: 'ConditionalExpression',
46068 ContinueStatement: 'ContinueStatement',
46069 DebuggerStatement: 'DebuggerStatement',
46070 DirectiveStatement: 'DirectiveStatement',
46071 DoWhileStatement: 'DoWhileStatement',
46072 EmptyStatement: 'EmptyStatement',
46073 ExportAllDeclaration: 'ExportAllDeclaration',
46074 ExportDefaultDeclaration: 'ExportDefaultDeclaration',
46075 ExportNamedDeclaration: 'ExportNamedDeclaration',
46076 ExportSpecifier: 'ExportSpecifier',
46077 ExpressionStatement: 'ExpressionStatement',
46078 ForStatement: 'ForStatement',
46079 ForInStatement: 'ForInStatement',
46080 ForOfStatement: 'ForOfStatement',
46081 FunctionDeclaration: 'FunctionDeclaration',
46082 FunctionExpression: 'FunctionExpression',
46083 GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
46084 Identifier: 'Identifier',
46085 IfStatement: 'IfStatement',
46086 ImportExpression: 'ImportExpression',
46087 ImportDeclaration: 'ImportDeclaration',
46088 ImportDefaultSpecifier: 'ImportDefaultSpecifier',
46089 ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
46090 ImportSpecifier: 'ImportSpecifier',
46091 Literal: 'Literal',
46092 LabeledStatement: 'LabeledStatement',
46093 LogicalExpression: 'LogicalExpression',
46094 MemberExpression: 'MemberExpression',
46095 MetaProperty: 'MetaProperty',
46096 MethodDefinition: 'MethodDefinition',
46097 ModuleSpecifier: 'ModuleSpecifier',
46098 NewExpression: 'NewExpression',
46099 ObjectExpression: 'ObjectExpression',
46100 ObjectPattern: 'ObjectPattern',
46101 Program: 'Program',
46102 Property: 'Property',
46103 RestElement: 'RestElement',
46104 ReturnStatement: 'ReturnStatement',
46105 SequenceExpression: 'SequenceExpression',
46106 SpreadElement: 'SpreadElement',
46107 Super: 'Super',
46108 SwitchStatement: 'SwitchStatement',
46109 SwitchCase: 'SwitchCase',
46110 TaggedTemplateExpression: 'TaggedTemplateExpression',
46111 TemplateElement: 'TemplateElement',
46112 TemplateLiteral: 'TemplateLiteral',
46113 ThisExpression: 'ThisExpression',
46114 ThrowStatement: 'ThrowStatement',
46115 TryStatement: 'TryStatement',
46116 UnaryExpression: 'UnaryExpression',
46117 UpdateExpression: 'UpdateExpression',
46118 VariableDeclaration: 'VariableDeclaration',
46119 VariableDeclarator: 'VariableDeclarator',
46120 WhileStatement: 'WhileStatement',
46121 WithStatement: 'WithStatement',
46122 YieldExpression: 'YieldExpression'
46123 };
46124
46125 VisitorKeys = {
46126 AssignmentExpression: ['left', 'right'],
46127 AssignmentPattern: ['left', 'right'],
46128 ArrayExpression: ['elements'],
46129 ArrayPattern: ['elements'],
46130 ArrowFunctionExpression: ['params', 'body'],
46131 AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
46132 BlockStatement: ['body'],
46133 BinaryExpression: ['left', 'right'],
46134 BreakStatement: ['label'],
46135 CallExpression: ['callee', 'arguments'],
46136 CatchClause: ['param', 'body'],
46137 ClassBody: ['body'],
46138 ClassDeclaration: ['id', 'superClass', 'body'],
46139 ClassExpression: ['id', 'superClass', 'body'],
46140 ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
46141 ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
46142 ConditionalExpression: ['test', 'consequent', 'alternate'],
46143 ContinueStatement: ['label'],
46144 DebuggerStatement: [],
46145 DirectiveStatement: [],
46146 DoWhileStatement: ['body', 'test'],
46147 EmptyStatement: [],
46148 ExportAllDeclaration: ['source'],
46149 ExportDefaultDeclaration: ['declaration'],
46150 ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
46151 ExportSpecifier: ['exported', 'local'],
46152 ExpressionStatement: ['expression'],
46153 ForStatement: ['init', 'test', 'update', 'body'],
46154 ForInStatement: ['left', 'right', 'body'],
46155 ForOfStatement: ['left', 'right', 'body'],
46156 FunctionDeclaration: ['id', 'params', 'body'],
46157 FunctionExpression: ['id', 'params', 'body'],
46158 GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
46159 Identifier: [],
46160 IfStatement: ['test', 'consequent', 'alternate'],
46161 ImportExpression: ['source'],
46162 ImportDeclaration: ['specifiers', 'source'],
46163 ImportDefaultSpecifier: ['local'],
46164 ImportNamespaceSpecifier: ['local'],
46165 ImportSpecifier: ['imported', 'local'],
46166 Literal: [],
46167 LabeledStatement: ['label', 'body'],
46168 LogicalExpression: ['left', 'right'],
46169 MemberExpression: ['object', 'property'],
46170 MetaProperty: ['meta', 'property'],
46171 MethodDefinition: ['key', 'value'],
46172 ModuleSpecifier: [],
46173 NewExpression: ['callee', 'arguments'],
46174 ObjectExpression: ['properties'],
46175 ObjectPattern: ['properties'],
46176 Program: ['body'],
46177 Property: ['key', 'value'],
46178 RestElement: [ 'argument' ],
46179 ReturnStatement: ['argument'],
46180 SequenceExpression: ['expressions'],
46181 SpreadElement: ['argument'],
46182 Super: [],
46183 SwitchStatement: ['discriminant', 'cases'],
46184 SwitchCase: ['test', 'consequent'],
46185 TaggedTemplateExpression: ['tag', 'quasi'],
46186 TemplateElement: [],
46187 TemplateLiteral: ['quasis', 'expressions'],
46188 ThisExpression: [],
46189 ThrowStatement: ['argument'],
46190 TryStatement: ['block', 'handler', 'finalizer'],
46191 UnaryExpression: ['argument'],
46192 UpdateExpression: ['argument'],
46193 VariableDeclaration: ['declarations'],
46194 VariableDeclarator: ['id', 'init'],
46195 WhileStatement: ['test', 'body'],
46196 WithStatement: ['object', 'body'],
46197 YieldExpression: ['argument']
46198 };
46199
46200 // unique id
46201 BREAK = {};
46202 SKIP = {};
46203 REMOVE = {};
46204
46205 VisitorOption = {
46206 Break: BREAK,
46207 Skip: SKIP,
46208 Remove: REMOVE
46209 };
46210
46211 function Reference(parent, key) {
46212 this.parent = parent;
46213 this.key = key;
46214 }
46215
46216 Reference.prototype.replace = function replace(node) {
46217 this.parent[this.key] = node;
46218 };
46219
46220 Reference.prototype.remove = function remove() {
46221 if (Array.isArray(this.parent)) {
46222 this.parent.splice(this.key, 1);
46223 return true;
46224 } else {
46225 this.replace(null);
46226 return false;
46227 }
46228 };
46229
46230 function Element(node, path, wrap, ref) {
46231 this.node = node;
46232 this.path = path;
46233 this.wrap = wrap;
46234 this.ref = ref;
46235 }
46236
46237 function Controller() { }
46238
46239 // API:
46240 // return property path array from root to current node
46241 Controller.prototype.path = function path() {
46242 var i, iz, j, jz, result, element;
46243
46244 function addToPath(result, path) {
46245 if (Array.isArray(path)) {
46246 for (j = 0, jz = path.length; j < jz; ++j) {
46247 result.push(path[j]);
46248 }
46249 } else {
46250 result.push(path);
46251 }
46252 }
46253
46254 // root node
46255 if (!this.__current.path) {
46256 return null;
46257 }
46258
46259 // first node is sentinel, second node is root element
46260 result = [];
46261 for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
46262 element = this.__leavelist[i];
46263 addToPath(result, element.path);
46264 }
46265 addToPath(result, this.__current.path);
46266 return result;
46267 };
46268
46269 // API:
46270 // return type of current node
46271 Controller.prototype.type = function () {
46272 var node = this.current();
46273 return node.type || this.__current.wrap;
46274 };
46275
46276 // API:
46277 // return array of parent elements
46278 Controller.prototype.parents = function parents() {
46279 var i, iz, result;
46280
46281 // first node is sentinel
46282 result = [];
46283 for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
46284 result.push(this.__leavelist[i].node);
46285 }
46286
46287 return result;
46288 };
46289
46290 // API:
46291 // return current node
46292 Controller.prototype.current = function current() {
46293 return this.__current.node;
46294 };
46295
46296 Controller.prototype.__execute = function __execute(callback, element) {
46297 var previous, result;
46298
46299 result = undefined;
46300
46301 previous = this.__current;
46302 this.__current = element;
46303 this.__state = null;
46304 if (callback) {
46305 result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
46306 }
46307 this.__current = previous;
46308
46309 return result;
46310 };
46311
46312 // API:
46313 // notify control skip / break
46314 Controller.prototype.notify = function notify(flag) {
46315 this.__state = flag;
46316 };
46317
46318 // API:
46319 // skip child nodes of current node
46320 Controller.prototype.skip = function () {
46321 this.notify(SKIP);
46322 };
46323
46324 // API:
46325 // break traversals
46326 Controller.prototype['break'] = function () {
46327 this.notify(BREAK);
46328 };
46329
46330 // API:
46331 // remove node
46332 Controller.prototype.remove = function () {
46333 this.notify(REMOVE);
46334 };
46335
46336 Controller.prototype.__initialize = function(root, visitor) {
46337 this.visitor = visitor;
46338 this.root = root;
46339 this.__worklist = [];
46340 this.__leavelist = [];
46341 this.__current = null;
46342 this.__state = null;
46343 this.__fallback = null;
46344 if (visitor.fallback === 'iteration') {
46345 this.__fallback = Object.keys;
46346 } else if (typeof visitor.fallback === 'function') {
46347 this.__fallback = visitor.fallback;
46348 }
46349
46350 this.__keys = VisitorKeys;
46351 if (visitor.keys) {
46352 this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
46353 }
46354 };
46355
46356 function isNode(node) {
46357 if (node == null) {
46358 return false;
46359 }
46360 return typeof node === 'object' && typeof node.type === 'string';
46361 }
46362
46363 function isProperty(nodeType, key) {
46364 return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
46365 }
46366
46367 Controller.prototype.traverse = function traverse(root, visitor) {
46368 var worklist,
46369 leavelist,
46370 element,
46371 node,
46372 nodeType,
46373 ret,
46374 key,
46375 current,
46376 current2,
46377 candidates,
46378 candidate,
46379 sentinel;
46380
46381 this.__initialize(root, visitor);
46382
46383 sentinel = {};
46384
46385 // reference
46386 worklist = this.__worklist;
46387 leavelist = this.__leavelist;
46388
46389 // initialize
46390 worklist.push(new Element(root, null, null, null));
46391 leavelist.push(new Element(null, null, null, null));
46392
46393 while (worklist.length) {
46394 element = worklist.pop();
46395
46396 if (element === sentinel) {
46397 element = leavelist.pop();
46398
46399 ret = this.__execute(visitor.leave, element);
46400
46401 if (this.__state === BREAK || ret === BREAK) {
46402 return;
46403 }
46404 continue;
46405 }
46406
46407 if (element.node) {
46408
46409 ret = this.__execute(visitor.enter, element);
46410
46411 if (this.__state === BREAK || ret === BREAK) {
46412 return;
46413 }
46414
46415 worklist.push(sentinel);
46416 leavelist.push(element);
46417
46418 if (this.__state === SKIP || ret === SKIP) {
46419 continue;
46420 }
46421
46422 node = element.node;
46423 nodeType = node.type || element.wrap;
46424 candidates = this.__keys[nodeType];
46425 if (!candidates) {
46426 if (this.__fallback) {
46427 candidates = this.__fallback(node);
46428 } else {
46429 throw new Error('Unknown node type ' + nodeType + '.');
46430 }
46431 }
46432
46433 current = candidates.length;
46434 while ((current -= 1) >= 0) {
46435 key = candidates[current];
46436 candidate = node[key];
46437 if (!candidate) {
46438 continue;
46439 }
46440
46441 if (Array.isArray(candidate)) {
46442 current2 = candidate.length;
46443 while ((current2 -= 1) >= 0) {
46444 if (!candidate[current2]) {
46445 continue;
46446 }
46447 if (isProperty(nodeType, candidates[current])) {
46448 element = new Element(candidate[current2], [key, current2], 'Property', null);
46449 } else if (isNode(candidate[current2])) {
46450 element = new Element(candidate[current2], [key, current2], null, null);
46451 } else {
46452 continue;
46453 }
46454 worklist.push(element);
46455 }
46456 } else if (isNode(candidate)) {
46457 worklist.push(new Element(candidate, key, null, null));
46458 }
46459 }
46460 }
46461 }
46462 };
46463
46464 Controller.prototype.replace = function replace(root, visitor) {
46465 var worklist,
46466 leavelist,
46467 node,
46468 nodeType,
46469 target,
46470 element,
46471 current,
46472 current2,
46473 candidates,
46474 candidate,
46475 sentinel,
46476 outer,
46477 key;
46478
46479 function removeElem(element) {
46480 var i,
46481 key,
46482 nextElem,
46483 parent;
46484
46485 if (element.ref.remove()) {
46486 // When the reference is an element of an array.
46487 key = element.ref.key;
46488 parent = element.ref.parent;
46489
46490 // If removed from array, then decrease following items' keys.
46491 i = worklist.length;
46492 while (i--) {
46493 nextElem = worklist[i];
46494 if (nextElem.ref && nextElem.ref.parent === parent) {
46495 if (nextElem.ref.key < key) {
46496 break;
46497 }
46498 --nextElem.ref.key;
46499 }
46500 }
46501 }
46502 }
46503
46504 this.__initialize(root, visitor);
46505
46506 sentinel = {};
46507
46508 // reference
46509 worklist = this.__worklist;
46510 leavelist = this.__leavelist;
46511
46512 // initialize
46513 outer = {
46514 root: root
46515 };
46516 element = new Element(root, null, null, new Reference(outer, 'root'));
46517 worklist.push(element);
46518 leavelist.push(element);
46519
46520 while (worklist.length) {
46521 element = worklist.pop();
46522
46523 if (element === sentinel) {
46524 element = leavelist.pop();
46525
46526 target = this.__execute(visitor.leave, element);
46527
46528 // node may be replaced with null,
46529 // so distinguish between undefined and null in this place
46530 if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
46531 // replace
46532 element.ref.replace(target);
46533 }
46534
46535 if (this.__state === REMOVE || target === REMOVE) {
46536 removeElem(element);
46537 }
46538
46539 if (this.__state === BREAK || target === BREAK) {
46540 return outer.root;
46541 }
46542 continue;
46543 }
46544
46545 target = this.__execute(visitor.enter, element);
46546
46547 // node may be replaced with null,
46548 // so distinguish between undefined and null in this place
46549 if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
46550 // replace
46551 element.ref.replace(target);
46552 element.node = target;
46553 }
46554
46555 if (this.__state === REMOVE || target === REMOVE) {
46556 removeElem(element);
46557 element.node = null;
46558 }
46559
46560 if (this.__state === BREAK || target === BREAK) {
46561 return outer.root;
46562 }
46563
46564 // node may be null
46565 node = element.node;
46566 if (!node) {
46567 continue;
46568 }
46569
46570 worklist.push(sentinel);
46571 leavelist.push(element);
46572
46573 if (this.__state === SKIP || target === SKIP) {
46574 continue;
46575 }
46576
46577 nodeType = node.type || element.wrap;
46578 candidates = this.__keys[nodeType];
46579 if (!candidates) {
46580 if (this.__fallback) {
46581 candidates = this.__fallback(node);
46582 } else {
46583 throw new Error('Unknown node type ' + nodeType + '.');
46584 }
46585 }
46586
46587 current = candidates.length;
46588 while ((current -= 1) >= 0) {
46589 key = candidates[current];
46590 candidate = node[key];
46591 if (!candidate) {
46592 continue;
46593 }
46594
46595 if (Array.isArray(candidate)) {
46596 current2 = candidate.length;
46597 while ((current2 -= 1) >= 0) {
46598 if (!candidate[current2]) {
46599 continue;
46600 }
46601 if (isProperty(nodeType, candidates[current])) {
46602 element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
46603 } else if (isNode(candidate[current2])) {
46604 element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
46605 } else {
46606 continue;
46607 }
46608 worklist.push(element);
46609 }
46610 } else if (isNode(candidate)) {
46611 worklist.push(new Element(candidate, key, null, new Reference(node, key)));
46612 }
46613 }
46614 }
46615
46616 return outer.root;
46617 };
46618
46619 function traverse(root, visitor) {
46620 var controller = new Controller();
46621 return controller.traverse(root, visitor);
46622 }
46623
46624 function replace(root, visitor) {
46625 var controller = new Controller();
46626 return controller.replace(root, visitor);
46627 }
46628
46629 function extendCommentRange(comment, tokens) {
46630 var target;
46631
46632 target = upperBound(tokens, function search(token) {
46633 return token.range[0] > comment.range[0];
46634 });
46635
46636 comment.extendedRange = [comment.range[0], comment.range[1]];
46637
46638 if (target !== tokens.length) {
46639 comment.extendedRange[1] = tokens[target].range[0];
46640 }
46641
46642 target -= 1;
46643 if (target >= 0) {
46644 comment.extendedRange[0] = tokens[target].range[1];
46645 }
46646
46647 return comment;
46648 }
46649
46650 function attachComments(tree, providedComments, tokens) {
46651 // At first, we should calculate extended comment ranges.
46652 var comments = [], comment, len, i, cursor;
46653
46654 if (!tree.range) {
46655 throw new Error('attachComments needs range information');
46656 }
46657
46658 // tokens array is empty, we attach comments to tree as 'leadingComments'
46659 if (!tokens.length) {
46660 if (providedComments.length) {
46661 for (i = 0, len = providedComments.length; i < len; i += 1) {
46662 comment = deepCopy(providedComments[i]);
46663 comment.extendedRange = [0, tree.range[0]];
46664 comments.push(comment);
46665 }
46666 tree.leadingComments = comments;
46667 }
46668 return tree;
46669 }
46670
46671 for (i = 0, len = providedComments.length; i < len; i += 1) {
46672 comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
46673 }
46674
46675 // This is based on John Freeman's implementation.
46676 cursor = 0;
46677 traverse(tree, {
46678 enter: function (node) {
46679 var comment;
46680
46681 while (cursor < comments.length) {
46682 comment = comments[cursor];
46683 if (comment.extendedRange[1] > node.range[0]) {
46684 break;
46685 }
46686
46687 if (comment.extendedRange[1] === node.range[0]) {
46688 if (!node.leadingComments) {
46689 node.leadingComments = [];
46690 }
46691 node.leadingComments.push(comment);
46692 comments.splice(cursor, 1);
46693 } else {
46694 cursor += 1;
46695 }
46696 }
46697
46698 // already out of owned node
46699 if (cursor === comments.length) {
46700 return VisitorOption.Break;
46701 }
46702
46703 if (comments[cursor].extendedRange[0] > node.range[1]) {
46704 return VisitorOption.Skip;
46705 }
46706 }
46707 });
46708
46709 cursor = 0;
46710 traverse(tree, {
46711 leave: function (node) {
46712 var comment;
46713
46714 while (cursor < comments.length) {
46715 comment = comments[cursor];
46716 if (node.range[1] < comment.extendedRange[0]) {
46717 break;
46718 }
46719
46720 if (node.range[1] === comment.extendedRange[0]) {
46721 if (!node.trailingComments) {
46722 node.trailingComments = [];
46723 }
46724 node.trailingComments.push(comment);
46725 comments.splice(cursor, 1);
46726 } else {
46727 cursor += 1;
46728 }
46729 }
46730
46731 // already out of owned node
46732 if (cursor === comments.length) {
46733 return VisitorOption.Break;
46734 }
46735
46736 if (comments[cursor].extendedRange[0] > node.range[1]) {
46737 return VisitorOption.Skip;
46738 }
46739 }
46740 });
46741
46742 return tree;
46743 }
46744
46745 exports.version = __webpack_require__(35464)/* .version */ .i8;
46746 exports.Syntax = Syntax;
46747 exports.traverse = traverse;
46748 exports.replace = replace;
46749 exports.attachComments = attachComments;
46750 exports.VisitorKeys = VisitorKeys;
46751 exports.VisitorOption = VisitorOption;
46752 exports.Controller = Controller;
46753 exports.cloneEnvironment = function () { return clone({}); };
46754
46755 return exports;
46756}(exports));
46757/* vim: set sw=4 ts=4 et tw=80 : */
46758
46759
46760/***/ }),
46761
46762/***/ 67913:
46763/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
46764
46765"use strict";
46766
46767
46768/**
46769 * Local dependencies
46770 */
46771
46772var compilers = __webpack_require__(44102);
46773var parsers = __webpack_require__(97129);
46774
46775/**
46776 * Module dependencies
46777 */
46778
46779var debug = __webpack_require__(31185)('expand-brackets');
46780var extend = __webpack_require__(28727);
46781var Snapdragon = __webpack_require__(79285);
46782var toRegex = __webpack_require__(51279);
46783
46784/**
46785 * Parses the given POSIX character class `pattern` and returns a
46786 * string that can be used for creating regular expressions for matching.
46787 *
46788 * @param {String} `pattern`
46789 * @param {Object} `options`
46790 * @return {Object}
46791 * @api public
46792 */
46793
46794function brackets(pattern, options) {
46795 debug('initializing from <%s>', __filename);
46796 var res = brackets.create(pattern, options);
46797 return res.output;
46798}
46799
46800/**
46801 * Takes an array of strings and a POSIX character class pattern, and returns a new
46802 * array with only the strings that matched the pattern.
46803 *
46804 * ```js
46805 * var brackets = require('expand-brackets');
46806 * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]'));
46807 * //=> ['a']
46808 *
46809 * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+'));
46810 * //=> ['a', 'ab']
46811 * ```
46812 * @param {Array} `arr` Array of strings to match
46813 * @param {String} `pattern` POSIX character class pattern(s)
46814 * @param {Object} `options`
46815 * @return {Array}
46816 * @api public
46817 */
46818
46819brackets.match = function(arr, pattern, options) {
46820 arr = [].concat(arr);
46821 var opts = extend({}, options);
46822 var isMatch = brackets.matcher(pattern, opts);
46823 var len = arr.length;
46824 var idx = -1;
46825 var res = [];
46826
46827 while (++idx < len) {
46828 var ele = arr[idx];
46829 if (isMatch(ele)) {
46830 res.push(ele);
46831 }
46832 }
46833
46834 if (res.length === 0) {
46835 if (opts.failglob === true) {
46836 throw new Error('no matches found for "' + pattern + '"');
46837 }
46838
46839 if (opts.nonull === true || opts.nullglob === true) {
46840 return [pattern.split('\\').join('')];
46841 }
46842 }
46843 return res;
46844};
46845
46846/**
46847 * Returns true if the specified `string` matches the given
46848 * brackets `pattern`.
46849 *
46850 * ```js
46851 * var brackets = require('expand-brackets');
46852 *
46853 * console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]'));
46854 * //=> true
46855 * console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]'));
46856 * //=> false
46857 * ```
46858 * @param {String} `string` String to match
46859 * @param {String} `pattern` Poxis pattern
46860 * @param {String} `options`
46861 * @return {Boolean}
46862 * @api public
46863 */
46864
46865brackets.isMatch = function(str, pattern, options) {
46866 return brackets.matcher(pattern, options)(str);
46867};
46868
46869/**
46870 * Takes a POSIX character class pattern and returns a matcher function. The returned
46871 * function takes the string to match as its only argument.
46872 *
46873 * ```js
46874 * var brackets = require('expand-brackets');
46875 * var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]');
46876 *
46877 * console.log(isMatch('a.a'));
46878 * //=> false
46879 * console.log(isMatch('a.A'));
46880 * //=> true
46881 * ```
46882 * @param {String} `pattern` Poxis pattern
46883 * @param {String} `options`
46884 * @return {Boolean}
46885 * @api public
46886 */
46887
46888brackets.matcher = function(pattern, options) {
46889 var re = brackets.makeRe(pattern, options);
46890 return function(str) {
46891 return re.test(str);
46892 };
46893};
46894
46895/**
46896 * Create a regular expression from the given `pattern`.
46897 *
46898 * ```js
46899 * var brackets = require('expand-brackets');
46900 * var re = brackets.makeRe('[[:alpha:]]');
46901 * console.log(re);
46902 * //=> /^(?:[a-zA-Z])$/
46903 * ```
46904 * @param {String} `pattern` The pattern to convert to regex.
46905 * @param {Object} `options`
46906 * @return {RegExp}
46907 * @api public
46908 */
46909
46910brackets.makeRe = function(pattern, options) {
46911 var res = brackets.create(pattern, options);
46912 var opts = extend({strictErrors: false}, options);
46913 return toRegex(res.output, opts);
46914};
46915
46916/**
46917 * Parses the given POSIX character class `pattern` and returns an object
46918 * with the compiled `output` and optional source `map`.
46919 *
46920 * ```js
46921 * var brackets = require('expand-brackets');
46922 * console.log(brackets('[[:alpha:]]'));
46923 * // { options: { source: 'string' },
46924 * // input: '[[:alpha:]]',
46925 * // state: {},
46926 * // compilers:
46927 * // { eos: [Function],
46928 * // noop: [Function],
46929 * // bos: [Function],
46930 * // not: [Function],
46931 * // escape: [Function],
46932 * // text: [Function],
46933 * // posix: [Function],
46934 * // bracket: [Function],
46935 * // 'bracket.open': [Function],
46936 * // 'bracket.inner': [Function],
46937 * // 'bracket.literal': [Function],
46938 * // 'bracket.close': [Function] },
46939 * // output: '[a-zA-Z]',
46940 * // ast:
46941 * // { type: 'root',
46942 * // errors: [],
46943 * // nodes: [ [Object], [Object], [Object] ] },
46944 * // parsingErrors: [] }
46945 * ```
46946 * @param {String} `pattern`
46947 * @param {Object} `options`
46948 * @return {Object}
46949 * @api public
46950 */
46951
46952brackets.create = function(pattern, options) {
46953 var snapdragon = (options && options.snapdragon) || new Snapdragon(options);
46954 compilers(snapdragon);
46955 parsers(snapdragon);
46956
46957 var ast = snapdragon.parse(pattern, options);
46958 ast.input = pattern;
46959 var res = snapdragon.compile(ast, options);
46960 res.input = pattern;
46961 return res;
46962};
46963
46964/**
46965 * Expose `brackets` constructor, parsers and compilers
46966 */
46967
46968brackets.compilers = compilers;
46969brackets.parsers = parsers;
46970
46971/**
46972 * Expose `brackets`
46973 * @type {Function}
46974 */
46975
46976module.exports = brackets;
46977
46978
46979/***/ }),
46980
46981/***/ 44102:
46982/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
46983
46984"use strict";
46985
46986
46987var posix = __webpack_require__(88412);
46988
46989module.exports = function(brackets) {
46990 brackets.compiler
46991
46992 /**
46993 * Escaped characters
46994 */
46995
46996 .set('escape', function(node) {
46997 return this.emit('\\' + node.val.replace(/^\\/, ''), node);
46998 })
46999
47000 /**
47001 * Text
47002 */
47003
47004 .set('text', function(node) {
47005 return this.emit(node.val.replace(/([{}])/g, '\\$1'), node);
47006 })
47007
47008 /**
47009 * POSIX character classes
47010 */
47011
47012 .set('posix', function(node) {
47013 if (node.val === '[::]') {
47014 return this.emit('\\[::\\]', node);
47015 }
47016
47017 var val = posix[node.inner];
47018 if (typeof val === 'undefined') {
47019 val = '[' + node.inner + ']';
47020 }
47021 return this.emit(val, node);
47022 })
47023
47024 /**
47025 * Non-posix brackets
47026 */
47027
47028 .set('bracket', function(node) {
47029 return this.mapVisit(node.nodes);
47030 })
47031 .set('bracket.open', function(node) {
47032 return this.emit(node.val, node);
47033 })
47034 .set('bracket.inner', function(node) {
47035 var inner = node.val;
47036
47037 if (inner === '[' || inner === ']') {
47038 return this.emit('\\' + node.val, node);
47039 }
47040 if (inner === '^]') {
47041 return this.emit('^\\]', node);
47042 }
47043 if (inner === '^') {
47044 return this.emit('^', node);
47045 }
47046
47047 if (/-/.test(inner) && !/(\d-\d|\w-\w)/.test(inner)) {
47048 inner = inner.split('-').join('\\-');
47049 }
47050
47051 var isNegated = inner.charAt(0) === '^';
47052 // add slashes to negated brackets, per spec
47053 if (isNegated && inner.indexOf('/') === -1) {
47054 inner += '/';
47055 }
47056 if (isNegated && inner.indexOf('.') === -1) {
47057 inner += '.';
47058 }
47059
47060 // don't unescape `0` (octal literal)
47061 inner = inner.replace(/\\([1-9])/g, '$1');
47062 return this.emit(inner, node);
47063 })
47064 .set('bracket.close', function(node) {
47065 var val = node.val.replace(/^\\/, '');
47066 if (node.parent.escaped === true) {
47067 return this.emit('\\' + val, node);
47068 }
47069 return this.emit(val, node);
47070 });
47071};
47072
47073
47074/***/ }),
47075
47076/***/ 97129:
47077/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47078
47079"use strict";
47080
47081
47082var utils = __webpack_require__(34467);
47083var define = __webpack_require__(5477);
47084
47085/**
47086 * Text regex
47087 */
47088
47089var TEXT_REGEX = '(\\[(?=.*\\])|\\])+';
47090var not = utils.createRegex(TEXT_REGEX);
47091
47092/**
47093 * Brackets parsers
47094 */
47095
47096function parsers(brackets) {
47097 brackets.state = brackets.state || {};
47098 brackets.parser.sets.bracket = brackets.parser.sets.bracket || [];
47099 brackets.parser
47100
47101 .capture('escape', function() {
47102 if (this.isInside('bracket')) return;
47103 var pos = this.position();
47104 var m = this.match(/^\\(.)/);
47105 if (!m) return;
47106
47107 return pos({
47108 type: 'escape',
47109 val: m[0]
47110 });
47111 })
47112
47113 /**
47114 * Text parser
47115 */
47116
47117 .capture('text', function() {
47118 if (this.isInside('bracket')) return;
47119 var pos = this.position();
47120 var m = this.match(not);
47121 if (!m || !m[0]) return;
47122
47123 return pos({
47124 type: 'text',
47125 val: m[0]
47126 });
47127 })
47128
47129 /**
47130 * POSIX character classes: "[[:alpha:][:digits:]]"
47131 */
47132
47133 .capture('posix', function() {
47134 var pos = this.position();
47135 var m = this.match(/^\[:(.*?):\](?=.*\])/);
47136 if (!m) return;
47137
47138 var inside = this.isInside('bracket');
47139 if (inside) {
47140 brackets.posix++;
47141 }
47142
47143 return pos({
47144 type: 'posix',
47145 insideBracket: inside,
47146 inner: m[1],
47147 val: m[0]
47148 });
47149 })
47150
47151 /**
47152 * Bracket (noop)
47153 */
47154
47155 .capture('bracket', function() {})
47156
47157 /**
47158 * Open: '['
47159 */
47160
47161 .capture('bracket.open', function() {
47162 var parsed = this.parsed;
47163 var pos = this.position();
47164 var m = this.match(/^\[(?=.*\])/);
47165 if (!m) return;
47166
47167 var prev = this.prev();
47168 var last = utils.last(prev.nodes);
47169
47170 if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
47171 last.val = last.val.slice(0, last.val.length - 1);
47172 return pos({
47173 type: 'escape',
47174 val: m[0]
47175 });
47176 }
47177
47178 var open = pos({
47179 type: 'bracket.open',
47180 val: m[0]
47181 });
47182
47183 if (last.type === 'bracket.open' || this.isInside('bracket')) {
47184 open.val = '\\' + open.val;
47185 open.type = 'bracket.inner';
47186 open.escaped = true;
47187 return open;
47188 }
47189
47190 var node = pos({
47191 type: 'bracket',
47192 nodes: [open]
47193 });
47194
47195 define(node, 'parent', prev);
47196 define(open, 'parent', node);
47197 this.push('bracket', node);
47198 prev.nodes.push(node);
47199 })
47200
47201 /**
47202 * Bracket text
47203 */
47204
47205 .capture('bracket.inner', function() {
47206 if (!this.isInside('bracket')) return;
47207 var pos = this.position();
47208 var m = this.match(not);
47209 if (!m || !m[0]) return;
47210
47211 var next = this.input.charAt(0);
47212 var val = m[0];
47213
47214 var node = pos({
47215 type: 'bracket.inner',
47216 val: val
47217 });
47218
47219 if (val === '\\\\') {
47220 return node;
47221 }
47222
47223 var first = val.charAt(0);
47224 var last = val.slice(-1);
47225
47226 if (first === '!') {
47227 val = '^' + val.slice(1);
47228 }
47229
47230 if (last === '\\' || (val === '^' && next === ']')) {
47231 val += this.input[0];
47232 this.consume(1);
47233 }
47234
47235 node.val = val;
47236 return node;
47237 })
47238
47239 /**
47240 * Close: ']'
47241 */
47242
47243 .capture('bracket.close', function() {
47244 var parsed = this.parsed;
47245 var pos = this.position();
47246 var m = this.match(/^\]/);
47247 if (!m) return;
47248
47249 var prev = this.prev();
47250 var last = utils.last(prev.nodes);
47251
47252 if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
47253 last.val = last.val.slice(0, last.val.length - 1);
47254
47255 return pos({
47256 type: 'escape',
47257 val: m[0]
47258 });
47259 }
47260
47261 var node = pos({
47262 type: 'bracket.close',
47263 rest: this.input,
47264 val: m[0]
47265 });
47266
47267 if (last.type === 'bracket.open') {
47268 node.type = 'bracket.inner';
47269 node.escaped = true;
47270 return node;
47271 }
47272
47273 var bracket = this.pop('bracket');
47274 if (!this.isType(bracket, 'bracket')) {
47275 if (this.options.strict) {
47276 throw new Error('missing opening "["');
47277 }
47278 node.type = 'bracket.inner';
47279 node.escaped = true;
47280 return node;
47281 }
47282
47283 bracket.nodes.push(node);
47284 define(node, 'parent', bracket);
47285 });
47286}
47287
47288/**
47289 * Brackets parsers
47290 */
47291
47292module.exports = parsers;
47293
47294/**
47295 * Expose text regex
47296 */
47297
47298module.exports.TEXT_REGEX = TEXT_REGEX;
47299
47300
47301/***/ }),
47302
47303/***/ 34467:
47304/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
47305
47306"use strict";
47307
47308
47309var toRegex = __webpack_require__(51279);
47310var regexNot = __webpack_require__(30931);
47311var cached;
47312
47313/**
47314 * Get the last element from `array`
47315 * @param {Array} `array`
47316 * @return {*}
47317 */
47318
47319exports.last = function(arr) {
47320 return arr[arr.length - 1];
47321};
47322
47323/**
47324 * Create and cache regex to use for text nodes
47325 */
47326
47327exports.createRegex = function(pattern, include) {
47328 if (cached) return cached;
47329 var opts = {contains: true, strictClose: false};
47330 var not = regexNot.create(pattern, opts);
47331 var re;
47332
47333 if (typeof include === 'string') {
47334 re = toRegex('^(?:' + include + '|' + not + ')', opts);
47335 } else {
47336 re = toRegex(not, opts);
47337 }
47338
47339 return (cached = re);
47340};
47341
47342
47343/***/ }),
47344
47345/***/ 28727:
47346/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47347
47348"use strict";
47349
47350
47351var isObject = __webpack_require__(18493);
47352
47353module.exports = function extend(o/*, objects*/) {
47354 if (!isObject(o)) { o = {}; }
47355
47356 var len = arguments.length;
47357 for (var i = 1; i < len; i++) {
47358 var obj = arguments[i];
47359
47360 if (isObject(obj)) {
47361 assign(o, obj);
47362 }
47363 }
47364 return o;
47365};
47366
47367function assign(a, b) {
47368 for (var key in b) {
47369 if (hasOwn(b, key)) {
47370 a[key] = b[key];
47371 }
47372 }
47373}
47374
47375/**
47376 * Returns true if the given `key` is an own property of `obj`.
47377 */
47378
47379function hasOwn(obj, key) {
47380 return Object.prototype.hasOwnProperty.call(obj, key);
47381}
47382
47383
47384/***/ }),
47385
47386/***/ 66675:
47387/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47388
47389"use strict";
47390
47391
47392/**
47393 * Module dependencies
47394 */
47395
47396var extend = __webpack_require__(28727);
47397var unique = __webpack_require__(19009);
47398var toRegex = __webpack_require__(51279);
47399
47400/**
47401 * Local dependencies
47402 */
47403
47404var compilers = __webpack_require__(90752);
47405var parsers = __webpack_require__(32269);
47406var Extglob = __webpack_require__(31052);
47407var utils = __webpack_require__(91439);
47408var MAX_LENGTH = 1024 * 64;
47409
47410/**
47411 * Convert the given `extglob` pattern into a regex-compatible string. Returns
47412 * an object with the compiled result and the parsed AST.
47413 *
47414 * ```js
47415 * var extglob = require('extglob');
47416 * console.log(extglob('*.!(*a)'));
47417 * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
47418 * ```
47419 * @param {String} `pattern`
47420 * @param {Object} `options`
47421 * @return {String}
47422 * @api public
47423 */
47424
47425function extglob(pattern, options) {
47426 return extglob.create(pattern, options).output;
47427}
47428
47429/**
47430 * Takes an array of strings and an extglob pattern and returns a new
47431 * array that contains only the strings that match the pattern.
47432 *
47433 * ```js
47434 * var extglob = require('extglob');
47435 * console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)'));
47436 * //=> ['a.b', 'a.c']
47437 * ```
47438 * @param {Array} `list` Array of strings to match
47439 * @param {String} `pattern` Extglob pattern
47440 * @param {Object} `options`
47441 * @return {Array} Returns an array of matches
47442 * @api public
47443 */
47444
47445extglob.match = function(list, pattern, options) {
47446 if (typeof pattern !== 'string') {
47447 throw new TypeError('expected pattern to be a string');
47448 }
47449
47450 list = utils.arrayify(list);
47451 var isMatch = extglob.matcher(pattern, options);
47452 var len = list.length;
47453 var idx = -1;
47454 var matches = [];
47455
47456 while (++idx < len) {
47457 var ele = list[idx];
47458
47459 if (isMatch(ele)) {
47460 matches.push(ele);
47461 }
47462 }
47463
47464 // if no options were passed, uniquify results and return
47465 if (typeof options === 'undefined') {
47466 return unique(matches);
47467 }
47468
47469 if (matches.length === 0) {
47470 if (options.failglob === true) {
47471 throw new Error('no matches found for "' + pattern + '"');
47472 }
47473 if (options.nonull === true || options.nullglob === true) {
47474 return [pattern.split('\\').join('')];
47475 }
47476 }
47477
47478 return options.nodupes !== false ? unique(matches) : matches;
47479};
47480
47481/**
47482 * Returns true if the specified `string` matches the given
47483 * extglob `pattern`.
47484 *
47485 * ```js
47486 * var extglob = require('extglob');
47487 *
47488 * console.log(extglob.isMatch('a.a', '*.!(*a)'));
47489 * //=> false
47490 * console.log(extglob.isMatch('a.b', '*.!(*a)'));
47491 * //=> true
47492 * ```
47493 * @param {String} `string` String to match
47494 * @param {String} `pattern` Extglob pattern
47495 * @param {String} `options`
47496 * @return {Boolean}
47497 * @api public
47498 */
47499
47500extglob.isMatch = function(str, pattern, options) {
47501 if (typeof pattern !== 'string') {
47502 throw new TypeError('expected pattern to be a string');
47503 }
47504
47505 if (typeof str !== 'string') {
47506 throw new TypeError('expected a string');
47507 }
47508
47509 if (pattern === str) {
47510 return true;
47511 }
47512
47513 if (pattern === '' || pattern === ' ' || pattern === '.') {
47514 return pattern === str;
47515 }
47516
47517 var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher);
47518 return isMatch(str);
47519};
47520
47521/**
47522 * Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but
47523 * the pattern can match any part of the string.
47524 *
47525 * ```js
47526 * var extglob = require('extglob');
47527 * console.log(extglob.contains('aa/bb/cc', '*b'));
47528 * //=> true
47529 * console.log(extglob.contains('aa/bb/cc', '*d'));
47530 * //=> false
47531 * ```
47532 * @param {String} `str` The string to match.
47533 * @param {String} `pattern` Glob pattern to use for matching.
47534 * @param {Object} `options`
47535 * @return {Boolean} Returns true if the patter matches any part of `str`.
47536 * @api public
47537 */
47538
47539extglob.contains = function(str, pattern, options) {
47540 if (typeof str !== 'string') {
47541 throw new TypeError('expected a string');
47542 }
47543
47544 if (pattern === '' || pattern === ' ' || pattern === '.') {
47545 return pattern === str;
47546 }
47547
47548 var opts = extend({}, options, {contains: true});
47549 opts.strictClose = false;
47550 opts.strictOpen = false;
47551 return extglob.isMatch(str, pattern, opts);
47552};
47553
47554/**
47555 * Takes an extglob pattern and returns a matcher function. The returned
47556 * function takes the string to match as its only argument.
47557 *
47558 * ```js
47559 * var extglob = require('extglob');
47560 * var isMatch = extglob.matcher('*.!(*a)');
47561 *
47562 * console.log(isMatch('a.a'));
47563 * //=> false
47564 * console.log(isMatch('a.b'));
47565 * //=> true
47566 * ```
47567 * @param {String} `pattern` Extglob pattern
47568 * @param {String} `options`
47569 * @return {Boolean}
47570 * @api public
47571 */
47572
47573extglob.matcher = function(pattern, options) {
47574 if (typeof pattern !== 'string') {
47575 throw new TypeError('expected pattern to be a string');
47576 }
47577
47578 function matcher() {
47579 var re = extglob.makeRe(pattern, options);
47580 return function(str) {
47581 return re.test(str);
47582 };
47583 }
47584
47585 return utils.memoize('matcher', pattern, options, matcher);
47586};
47587
47588/**
47589 * Convert the given `extglob` pattern into a regex-compatible string. Returns
47590 * an object with the compiled result and the parsed AST.
47591 *
47592 * ```js
47593 * var extglob = require('extglob');
47594 * console.log(extglob.create('*.!(*a)').output);
47595 * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
47596 * ```
47597 * @param {String} `str`
47598 * @param {Object} `options`
47599 * @return {String}
47600 * @api public
47601 */
47602
47603extglob.create = function(pattern, options) {
47604 if (typeof pattern !== 'string') {
47605 throw new TypeError('expected pattern to be a string');
47606 }
47607
47608 function create() {
47609 var ext = new Extglob(options);
47610 var ast = ext.parse(pattern, options);
47611 return ext.compile(ast, options);
47612 }
47613
47614 return utils.memoize('create', pattern, options, create);
47615};
47616
47617/**
47618 * Returns an array of matches captured by `pattern` in `string`, or `null`
47619 * if the pattern did not match.
47620 *
47621 * ```js
47622 * var extglob = require('extglob');
47623 * extglob.capture(pattern, string[, options]);
47624 *
47625 * console.log(extglob.capture('test/*.js', 'test/foo.js'));
47626 * //=> ['foo']
47627 * console.log(extglob.capture('test/*.js', 'foo/bar.css'));
47628 * //=> null
47629 * ```
47630 * @param {String} `pattern` Glob pattern to use for matching.
47631 * @param {String} `string` String to match
47632 * @param {Object} `options` See available [options](#options) for changing how matches are performed
47633 * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
47634 * @api public
47635 */
47636
47637extglob.capture = function(pattern, str, options) {
47638 var re = extglob.makeRe(pattern, extend({capture: true}, options));
47639
47640 function match() {
47641 return function(string) {
47642 var match = re.exec(string);
47643 if (!match) {
47644 return null;
47645 }
47646
47647 return match.slice(1);
47648 };
47649 }
47650
47651 var capture = utils.memoize('capture', pattern, options, match);
47652 return capture(str);
47653};
47654
47655/**
47656 * Create a regular expression from the given `pattern` and `options`.
47657 *
47658 * ```js
47659 * var extglob = require('extglob');
47660 * var re = extglob.makeRe('*.!(*a)');
47661 * console.log(re);
47662 * //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/
47663 * ```
47664 * @param {String} `pattern` The pattern to convert to regex.
47665 * @param {Object} `options`
47666 * @return {RegExp}
47667 * @api public
47668 */
47669
47670extglob.makeRe = function(pattern, options) {
47671 if (pattern instanceof RegExp) {
47672 return pattern;
47673 }
47674
47675 if (typeof pattern !== 'string') {
47676 throw new TypeError('expected pattern to be a string');
47677 }
47678
47679 if (pattern.length > MAX_LENGTH) {
47680 throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
47681 }
47682
47683 function makeRe() {
47684 var opts = extend({strictErrors: false}, options);
47685 if (opts.strictErrors === true) opts.strict = true;
47686 var res = extglob.create(pattern, opts);
47687 return toRegex(res.output, opts);
47688 }
47689
47690 var regex = utils.memoize('makeRe', pattern, options, makeRe);
47691 if (regex.source.length > MAX_LENGTH) {
47692 throw new SyntaxError('potentially malicious regex detected');
47693 }
47694
47695 return regex;
47696};
47697
47698/**
47699 * Cache
47700 */
47701
47702extglob.cache = utils.cache;
47703extglob.clearCache = function() {
47704 extglob.cache.__data__ = {};
47705};
47706
47707/**
47708 * Expose `Extglob` constructor, parsers and compilers
47709 */
47710
47711extglob.Extglob = Extglob;
47712extglob.compilers = compilers;
47713extglob.parsers = parsers;
47714
47715/**
47716 * Expose `extglob`
47717 * @type {Function}
47718 */
47719
47720module.exports = extglob;
47721
47722
47723/***/ }),
47724
47725/***/ 90752:
47726/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47727
47728"use strict";
47729
47730
47731var brackets = __webpack_require__(67913);
47732
47733/**
47734 * Extglob compilers
47735 */
47736
47737module.exports = function(extglob) {
47738 function star() {
47739 if (typeof extglob.options.star === 'function') {
47740 return extglob.options.star.apply(this, arguments);
47741 }
47742 if (typeof extglob.options.star === 'string') {
47743 return extglob.options.star;
47744 }
47745 return '.*?';
47746 }
47747
47748 /**
47749 * Use `expand-brackets` compilers
47750 */
47751
47752 extglob.use(brackets.compilers);
47753 extglob.compiler
47754
47755 /**
47756 * Escaped: "\\*"
47757 */
47758
47759 .set('escape', function(node) {
47760 return this.emit(node.val, node);
47761 })
47762
47763 /**
47764 * Dot: "."
47765 */
47766
47767 .set('dot', function(node) {
47768 return this.emit('\\' + node.val, node);
47769 })
47770
47771 /**
47772 * Question mark: "?"
47773 */
47774
47775 .set('qmark', function(node) {
47776 var val = '[^\\\\/.]';
47777 var prev = this.prev();
47778
47779 if (node.parsed.slice(-1) === '(') {
47780 var ch = node.rest.charAt(0);
47781 if (ch !== '!' && ch !== '=' && ch !== ':') {
47782 return this.emit(val, node);
47783 }
47784 return this.emit(node.val, node);
47785 }
47786
47787 if (prev.type === 'text' && prev.val) {
47788 return this.emit(val, node);
47789 }
47790
47791 if (node.val.length > 1) {
47792 val += '{' + node.val.length + '}';
47793 }
47794 return this.emit(val, node);
47795 })
47796
47797 /**
47798 * Plus: "+"
47799 */
47800
47801 .set('plus', function(node) {
47802 var prev = node.parsed.slice(-1);
47803 if (prev === ']' || prev === ')') {
47804 return this.emit(node.val, node);
47805 }
47806 var ch = this.output.slice(-1);
47807 if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) {
47808 return this.emit('\\+', node);
47809 }
47810 if (/\w/.test(ch) && !node.inside) {
47811 return this.emit('+\\+?', node);
47812 }
47813 return this.emit('+', node);
47814 })
47815
47816 /**
47817 * Star: "*"
47818 */
47819
47820 .set('star', function(node) {
47821 var prev = this.prev();
47822 var prefix = prev.type !== 'text' && prev.type !== 'escape'
47823 ? '(?!\\.)'
47824 : '';
47825
47826 return this.emit(prefix + star.call(this, node), node);
47827 })
47828
47829 /**
47830 * Parens
47831 */
47832
47833 .set('paren', function(node) {
47834 return this.mapVisit(node.nodes);
47835 })
47836 .set('paren.open', function(node) {
47837 var capture = this.options.capture ? '(' : '';
47838
47839 switch (node.parent.prefix) {
47840 case '!':
47841 case '^':
47842 return this.emit(capture + '(?:(?!(?:', node);
47843 case '*':
47844 case '+':
47845 case '?':
47846 case '@':
47847 return this.emit(capture + '(?:', node);
47848 default: {
47849 var val = node.val;
47850 if (this.options.bash === true) {
47851 val = '\\' + val;
47852 } else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') {
47853 val += '?:';
47854 }
47855
47856 return this.emit(val, node);
47857 }
47858 }
47859 })
47860 .set('paren.close', function(node) {
47861 var capture = this.options.capture ? ')' : '';
47862
47863 switch (node.prefix) {
47864 case '!':
47865 case '^':
47866 var prefix = /^(\)|$)/.test(node.rest) ? '$' : '';
47867 var str = star.call(this, node);
47868
47869 // if the extglob has a slash explicitly defined, we know the user wants
47870 // to match slashes, so we need to ensure the "star" regex allows for it
47871 if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) {
47872 str = '.*?';
47873 }
47874
47875 return this.emit(prefix + ('))' + str + ')') + capture, node);
47876 case '*':
47877 case '+':
47878 case '?':
47879 return this.emit(')' + node.prefix + capture, node);
47880 case '@':
47881 return this.emit(')' + capture, node);
47882 default: {
47883 var val = (this.options.bash === true ? '\\' : '') + ')';
47884 return this.emit(val, node);
47885 }
47886 }
47887 })
47888
47889 /**
47890 * Text
47891 */
47892
47893 .set('text', function(node) {
47894 var val = node.val.replace(/[\[\]]/g, '\\$&');
47895 return this.emit(val, node);
47896 });
47897};
47898
47899
47900/***/ }),
47901
47902/***/ 31052:
47903/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47904
47905"use strict";
47906
47907
47908/**
47909 * Module dependencies
47910 */
47911
47912var Snapdragon = __webpack_require__(79285);
47913var define = __webpack_require__(62250);
47914var extend = __webpack_require__(28727);
47915
47916/**
47917 * Local dependencies
47918 */
47919
47920var compilers = __webpack_require__(90752);
47921var parsers = __webpack_require__(32269);
47922
47923/**
47924 * Customize Snapdragon parser and renderer
47925 */
47926
47927function Extglob(options) {
47928 this.options = extend({source: 'extglob'}, options);
47929 this.snapdragon = this.options.snapdragon || new Snapdragon(this.options);
47930 this.snapdragon.patterns = this.snapdragon.patterns || {};
47931 this.compiler = this.snapdragon.compiler;
47932 this.parser = this.snapdragon.parser;
47933
47934 compilers(this.snapdragon);
47935 parsers(this.snapdragon);
47936
47937 /**
47938 * Override Snapdragon `.parse` method
47939 */
47940
47941 define(this.snapdragon, 'parse', function(str, options) {
47942 var parsed = Snapdragon.prototype.parse.apply(this, arguments);
47943 parsed.input = str;
47944
47945 // escape unmatched brace/bracket/parens
47946 var last = this.parser.stack.pop();
47947 if (last && this.options.strict !== true) {
47948 var node = last.nodes[0];
47949 node.val = '\\' + node.val;
47950 var sibling = node.parent.nodes[1];
47951 if (sibling.type === 'star') {
47952 sibling.loose = true;
47953 }
47954 }
47955
47956 // add non-enumerable parser reference
47957 define(parsed, 'parser', this.parser);
47958 return parsed;
47959 });
47960
47961 /**
47962 * Decorate `.parse` method
47963 */
47964
47965 define(this, 'parse', function(ast, options) {
47966 return this.snapdragon.parse.apply(this.snapdragon, arguments);
47967 });
47968
47969 /**
47970 * Decorate `.compile` method
47971 */
47972
47973 define(this, 'compile', function(ast, options) {
47974 return this.snapdragon.compile.apply(this.snapdragon, arguments);
47975 });
47976
47977}
47978
47979/**
47980 * Expose `Extglob`
47981 */
47982
47983module.exports = Extglob;
47984
47985
47986/***/ }),
47987
47988/***/ 32269:
47989/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
47990
47991"use strict";
47992
47993
47994var brackets = __webpack_require__(67913);
47995var define = __webpack_require__(62250);
47996var utils = __webpack_require__(91439);
47997
47998/**
47999 * Characters to use in text regex (we want to "not" match
48000 * characters that are matched by other parsers)
48001 */
48002
48003var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+';
48004var not = utils.createRegex(TEXT_REGEX);
48005
48006/**
48007 * Extglob parsers
48008 */
48009
48010function parsers(extglob) {
48011 extglob.state = extglob.state || {};
48012
48013 /**
48014 * Use `expand-brackets` parsers
48015 */
48016
48017 extglob.use(brackets.parsers);
48018 extglob.parser.sets.paren = extglob.parser.sets.paren || [];
48019 extglob.parser
48020
48021 /**
48022 * Extglob open: "*("
48023 */
48024
48025 .capture('paren.open', function() {
48026 var parsed = this.parsed;
48027 var pos = this.position();
48028 var m = this.match(/^([!@*?+])?\(/);
48029 if (!m) return;
48030
48031 var prev = this.prev();
48032 var prefix = m[1];
48033 var val = m[0];
48034
48035 var open = pos({
48036 type: 'paren.open',
48037 parsed: parsed,
48038 val: val
48039 });
48040
48041 var node = pos({
48042 type: 'paren',
48043 prefix: prefix,
48044 nodes: [open]
48045 });
48046
48047 // if nested negation extglobs, just cancel them out to simplify
48048 if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') {
48049 prev.prefix = '@';
48050 node.prefix = '@';
48051 }
48052
48053 define(node, 'rest', this.input);
48054 define(node, 'parsed', parsed);
48055 define(node, 'parent', prev);
48056 define(open, 'parent', node);
48057
48058 this.push('paren', node);
48059 prev.nodes.push(node);
48060 })
48061
48062 /**
48063 * Extglob close: ")"
48064 */
48065
48066 .capture('paren.close', function() {
48067 var parsed = this.parsed;
48068 var pos = this.position();
48069 var m = this.match(/^\)/);
48070 if (!m) return;
48071
48072 var parent = this.pop('paren');
48073 var node = pos({
48074 type: 'paren.close',
48075 rest: this.input,
48076 parsed: parsed,
48077 val: m[0]
48078 });
48079
48080 if (!this.isType(parent, 'paren')) {
48081 if (this.options.strict) {
48082 throw new Error('missing opening paren: "("');
48083 }
48084 node.escaped = true;
48085 return node;
48086 }
48087
48088 node.prefix = parent.prefix;
48089 parent.nodes.push(node);
48090 define(node, 'parent', parent);
48091 })
48092
48093 /**
48094 * Escape: "\\."
48095 */
48096
48097 .capture('escape', function() {
48098 var pos = this.position();
48099 var m = this.match(/^\\(.)/);
48100 if (!m) return;
48101
48102 return pos({
48103 type: 'escape',
48104 val: m[0],
48105 ch: m[1]
48106 });
48107 })
48108
48109 /**
48110 * Question marks: "?"
48111 */
48112
48113 .capture('qmark', function() {
48114 var parsed = this.parsed;
48115 var pos = this.position();
48116 var m = this.match(/^\?+(?!\()/);
48117 if (!m) return;
48118 extglob.state.metachar = true;
48119 return pos({
48120 type: 'qmark',
48121 rest: this.input,
48122 parsed: parsed,
48123 val: m[0]
48124 });
48125 })
48126
48127 /**
48128 * Character parsers
48129 */
48130
48131 .capture('star', /^\*(?!\()/)
48132 .capture('plus', /^\+(?!\()/)
48133 .capture('dot', /^\./)
48134 .capture('text', not);
48135};
48136
48137/**
48138 * Expose text regex string
48139 */
48140
48141module.exports.TEXT_REGEX = TEXT_REGEX;
48142
48143/**
48144 * Extglob parsers
48145 */
48146
48147module.exports = parsers;
48148
48149
48150/***/ }),
48151
48152/***/ 91439:
48153/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
48154
48155"use strict";
48156
48157
48158var regex = __webpack_require__(30931);
48159var Cache = __webpack_require__(49908);
48160
48161/**
48162 * Utils
48163 */
48164
48165var utils = module.exports;
48166var cache = utils.cache = new Cache();
48167
48168/**
48169 * Cast `val` to an array
48170 * @return {Array}
48171 */
48172
48173utils.arrayify = function(val) {
48174 if (!Array.isArray(val)) {
48175 return [val];
48176 }
48177 return val;
48178};
48179
48180/**
48181 * Memoize a generated regex or function
48182 */
48183
48184utils.memoize = function(type, pattern, options, fn) {
48185 var key = utils.createKey(type + pattern, options);
48186
48187 if (cache.has(type, key)) {
48188 return cache.get(type, key);
48189 }
48190
48191 var val = fn(pattern, options);
48192 if (options && options.cache === false) {
48193 return val;
48194 }
48195
48196 cache.set(type, key, val);
48197 return val;
48198};
48199
48200/**
48201 * Create the key to use for memoization. The key is generated
48202 * by iterating over the options and concatenating key-value pairs
48203 * to the pattern string.
48204 */
48205
48206utils.createKey = function(pattern, options) {
48207 var key = pattern;
48208 if (typeof options === 'undefined') {
48209 return key;
48210 }
48211 for (var prop in options) {
48212 key += ';' + prop + '=' + String(options[prop]);
48213 }
48214 return key;
48215};
48216
48217/**
48218 * Create the regex to use for matching text
48219 */
48220
48221utils.createRegex = function(str) {
48222 var opts = {contains: true, strictClose: false};
48223 return regex(str, opts);
48224};
48225
48226
48227/***/ }),
48228
48229/***/ 62250:
48230/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
48231
48232"use strict";
48233/*!
48234 * define-property <https://github.com/jonschlinkert/define-property>
48235 *
48236 * Copyright (c) 2015, 2017, Jon Schlinkert.
48237 * Released under the MIT License.
48238 */
48239
48240
48241
48242var isDescriptor = __webpack_require__(44133);
48243
48244module.exports = function defineProperty(obj, prop, val) {
48245 if (typeof obj !== 'object' && typeof obj !== 'function') {
48246 throw new TypeError('expected an object or function.');
48247 }
48248
48249 if (typeof prop !== 'string') {
48250 throw new TypeError('expected `prop` to be a string.');
48251 }
48252
48253 if (isDescriptor(val) && ('set' in val || 'get' in val)) {
48254 return Object.defineProperty(obj, prop, val);
48255 }
48256
48257 return Object.defineProperty(obj, prop, {
48258 configurable: true,
48259 enumerable: false,
48260 writable: true,
48261 value: val
48262 });
48263};
48264
48265
48266/***/ }),
48267
48268/***/ 63933:
48269/***/ (function(module) {
48270
48271"use strict";
48272
48273
48274// do not edit .js files directly - edit src/index.jst
48275
48276
48277
48278module.exports = function equal(a, b) {
48279 if (a === b) return true;
48280
48281 if (a && b && typeof a == 'object' && typeof b == 'object') {
48282 if (a.constructor !== b.constructor) return false;
48283
48284 var length, i, keys;
48285 if (Array.isArray(a)) {
48286 length = a.length;
48287 if (length != b.length) return false;
48288 for (i = length; i-- !== 0;)
48289 if (!equal(a[i], b[i])) return false;
48290 return true;
48291 }
48292
48293
48294
48295 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
48296 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
48297 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
48298
48299 keys = Object.keys(a);
48300 length = keys.length;
48301 if (length !== Object.keys(b).length) return false;
48302
48303 for (i = length; i-- !== 0;)
48304 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
48305
48306 for (i = length; i-- !== 0;) {
48307 var key = keys[i];
48308
48309 if (!equal(a[key], b[key])) return false;
48310 }
48311
48312 return true;
48313 }
48314
48315 // true if both NaN, false otherwise
48316 return a!==a && b!==b;
48317};
48318
48319
48320/***/ }),
48321
48322/***/ 73600:
48323/***/ (function(module) {
48324
48325"use strict";
48326
48327
48328module.exports = function (data, opts) {
48329 if (!opts) opts = {};
48330 if (typeof opts === 'function') opts = { cmp: opts };
48331 var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;
48332
48333 var cmp = opts.cmp && (function (f) {
48334 return function (node) {
48335 return function (a, b) {
48336 var aobj = { key: a, value: node[a] };
48337 var bobj = { key: b, value: node[b] };
48338 return f(aobj, bobj);
48339 };
48340 };
48341 })(opts.cmp);
48342
48343 var seen = [];
48344 return (function stringify (node) {
48345 if (node && node.toJSON && typeof node.toJSON === 'function') {
48346 node = node.toJSON();
48347 }
48348
48349 if (node === undefined) return;
48350 if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';
48351 if (typeof node !== 'object') return JSON.stringify(node);
48352
48353 var i, out;
48354 if (Array.isArray(node)) {
48355 out = '[';
48356 for (i = 0; i < node.length; i++) {
48357 if (i) out += ',';
48358 out += stringify(node[i]) || 'null';
48359 }
48360 return out + ']';
48361 }
48362
48363 if (node === null) return 'null';
48364
48365 if (seen.indexOf(node) !== -1) {
48366 if (cycles) return JSON.stringify('__cycle__');
48367 throw new TypeError('Converting circular structure to JSON');
48368 }
48369
48370 var seenIndex = seen.push(node) - 1;
48371 var keys = Object.keys(node).sort(cmp && cmp(node));
48372 out = '';
48373 for (i = 0; i < keys.length; i++) {
48374 var key = keys[i];
48375 var value = stringify(node[key]);
48376
48377 if (!value) continue;
48378 if (out) out += ',';
48379 out += JSON.stringify(key) + ':' + value;
48380 }
48381 seen.splice(seenIndex, 1);
48382 return '{' + out + '}';
48383 })(data);
48384};
48385
48386
48387/***/ }),
48388
48389/***/ 43086:
48390/***/ (function(module) {
48391
48392"use strict";
48393/*!
48394 * for-in <https://github.com/jonschlinkert/for-in>
48395 *
48396 * Copyright (c) 2014-2017, Jon Schlinkert.
48397 * Released under the MIT License.
48398 */
48399
48400
48401
48402module.exports = function forIn(obj, fn, thisArg) {
48403 for (var key in obj) {
48404 if (fn.call(thisArg, obj[key], key, obj) === false) {
48405 break;
48406 }
48407 }
48408};
48409
48410
48411/***/ }),
48412
48413/***/ 49908:
48414/***/ (function(module, exports, __webpack_require__) {
48415
48416"use strict";
48417/*!
48418 * fragment-cache <https://github.com/jonschlinkert/fragment-cache>
48419 *
48420 * Copyright (c) 2016-2017, Jon Schlinkert.
48421 * Released under the MIT License.
48422 */
48423
48424
48425
48426var MapCache = __webpack_require__(4337);
48427
48428/**
48429 * Create a new `FragmentCache` with an optional object to use for `caches`.
48430 *
48431 * ```js
48432 * var fragment = new FragmentCache();
48433 * ```
48434 * @name FragmentCache
48435 * @param {String} `cacheName`
48436 * @return {Object} Returns the [map-cache][] instance.
48437 * @api public
48438 */
48439
48440function FragmentCache(caches) {
48441 this.caches = caches || {};
48442}
48443
48444/**
48445 * Prototype
48446 */
48447
48448FragmentCache.prototype = {
48449
48450 /**
48451 * Get cache `name` from the `fragment.caches` object. Creates a new
48452 * `MapCache` if it doesn't already exist.
48453 *
48454 * ```js
48455 * var cache = fragment.cache('files');
48456 * console.log(fragment.caches.hasOwnProperty('files'));
48457 * //=> true
48458 * ```
48459 * @name .cache
48460 * @param {String} `cacheName`
48461 * @return {Object} Returns the [map-cache][] instance.
48462 * @api public
48463 */
48464
48465 cache: function(cacheName) {
48466 return this.caches[cacheName] || (this.caches[cacheName] = new MapCache());
48467 },
48468
48469 /**
48470 * Set a value for property `key` on cache `name`
48471 *
48472 * ```js
48473 * fragment.set('files', 'somefile.js', new File({path: 'somefile.js'}));
48474 * ```
48475 * @name .set
48476 * @param {String} `name`
48477 * @param {String} `key` Property name to set
48478 * @param {any} `val` The value of `key`
48479 * @return {Object} The cache instance for chaining
48480 * @api public
48481 */
48482
48483 set: function(cacheName, key, val) {
48484 var cache = this.cache(cacheName);
48485 cache.set(key, val);
48486 return cache;
48487 },
48488
48489 /**
48490 * Returns true if a non-undefined value is set for `key` on fragment cache `name`.
48491 *
48492 * ```js
48493 * var cache = fragment.cache('files');
48494 * cache.set('somefile.js');
48495 *
48496 * console.log(cache.has('somefile.js'));
48497 * //=> true
48498 *
48499 * console.log(cache.has('some-other-file.js'));
48500 * //=> false
48501 * ```
48502 * @name .has
48503 * @param {String} `name` Cache name
48504 * @param {String} `key` Optionally specify a property to check for on cache `name`
48505 * @return {Boolean}
48506 * @api public
48507 */
48508
48509 has: function(cacheName, key) {
48510 return typeof this.get(cacheName, key) !== 'undefined';
48511 },
48512
48513 /**
48514 * Get `name`, or if specified, the value of `key`. Invokes the [cache]() method,
48515 * so that cache `name` will be created it doesn't already exist. If `key` is not passed,
48516 * the entire cache (`name`) is returned.
48517 *
48518 * ```js
48519 * var Vinyl = require('vinyl');
48520 * var cache = fragment.cache('files');
48521 * cache.set('somefile.js', new Vinyl({path: 'somefile.js'}));
48522 * console.log(cache.get('somefile.js'));
48523 * //=> <File "somefile.js">
48524 * ```
48525 * @name .get
48526 * @param {String} `name`
48527 * @return {Object} Returns cache `name`, or the value of `key` if specified
48528 * @api public
48529 */
48530
48531 get: function(name, key) {
48532 var cache = this.cache(name);
48533 if (typeof key === 'string') {
48534 return cache.get(key);
48535 }
48536 return cache;
48537 }
48538};
48539
48540/**
48541 * Expose `FragmentCache`
48542 */
48543
48544exports = module.exports = FragmentCache;
48545
48546
48547/***/ }),
48548
48549/***/ 89304:
48550/***/ (function(module) {
48551
48552/*!
48553 * get-value <https://github.com/jonschlinkert/get-value>
48554 *
48555 * Copyright (c) 2014-2015, Jon Schlinkert.
48556 * Licensed under the MIT License.
48557 */
48558
48559module.exports = function(obj, prop, a, b, c) {
48560 if (!isObject(obj) || !prop) {
48561 return obj;
48562 }
48563
48564 prop = toString(prop);
48565
48566 // allowing for multiple properties to be passed as
48567 // a string or array, but much faster (3-4x) than doing
48568 // `[].slice.call(arguments)`
48569 if (a) prop += '.' + toString(a);
48570 if (b) prop += '.' + toString(b);
48571 if (c) prop += '.' + toString(c);
48572
48573 if (prop in obj) {
48574 return obj[prop];
48575 }
48576
48577 var segs = prop.split('.');
48578 var len = segs.length;
48579 var i = -1;
48580
48581 while (obj && (++i < len)) {
48582 var key = segs[i];
48583 while (key[key.length - 1] === '\\') {
48584 key = key.slice(0, -1) + '.' + segs[++i];
48585 }
48586 obj = obj[key];
48587 }
48588 return obj;
48589};
48590
48591function isObject(val) {
48592 return val !== null && (typeof val === 'object' || typeof val === 'function');
48593}
48594
48595function toString(val) {
48596 if (!val) return '';
48597 if (Array.isArray(val)) {
48598 return val.join('.');
48599 }
48600 return val;
48601}
48602
48603
48604/***/ }),
48605
48606/***/ 95581:
48607/***/ (function(module) {
48608
48609"use strict";
48610
48611
48612module.exports = clone
48613
48614function clone (obj) {
48615 if (obj === null || typeof obj !== 'object')
48616 return obj
48617
48618 if (obj instanceof Object)
48619 var copy = { __proto__: obj.__proto__ }
48620 else
48621 var copy = Object.create(null)
48622
48623 Object.getOwnPropertyNames(obj).forEach(function (key) {
48624 Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
48625 })
48626
48627 return copy
48628}
48629
48630
48631/***/ }),
48632
48633/***/ 82161:
48634/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
48635
48636var fs = __webpack_require__(35747)
48637var polyfills = __webpack_require__(60034)
48638var legacy = __webpack_require__(7077)
48639var clone = __webpack_require__(95581)
48640
48641var util = __webpack_require__(31669)
48642
48643/* istanbul ignore next - node 0.x polyfill */
48644var gracefulQueue
48645var previousSymbol
48646
48647/* istanbul ignore else - node 0.x polyfill */
48648if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
48649 gracefulQueue = Symbol.for('graceful-fs.queue')
48650 // This is used in testing by future versions
48651 previousSymbol = Symbol.for('graceful-fs.previous')
48652} else {
48653 gracefulQueue = '___graceful-fs.queue'
48654 previousSymbol = '___graceful-fs.previous'
48655}
48656
48657function noop () {}
48658
48659function publishQueue(context, queue) {
48660 Object.defineProperty(context, gracefulQueue, {
48661 get: function() {
48662 return queue
48663 }
48664 })
48665}
48666
48667var debug = noop
48668if (util.debuglog)
48669 debug = util.debuglog('gfs4')
48670else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
48671 debug = function() {
48672 var m = util.format.apply(util, arguments)
48673 m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
48674 console.error(m)
48675 }
48676
48677// Once time initialization
48678if (!fs[gracefulQueue]) {
48679 // This queue can be shared by multiple loaded instances
48680 var queue = global[gracefulQueue] || []
48681 publishQueue(fs, queue)
48682
48683 // Patch fs.close/closeSync to shared queue version, because we need
48684 // to retry() whenever a close happens *anywhere* in the program.
48685 // This is essential when multiple graceful-fs instances are
48686 // in play at the same time.
48687 fs.close = (function (fs$close) {
48688 function close (fd, cb) {
48689 return fs$close.call(fs, fd, function (err) {
48690 // This function uses the graceful-fs shared queue
48691 if (!err) {
48692 retry()
48693 }
48694
48695 if (typeof cb === 'function')
48696 cb.apply(this, arguments)
48697 })
48698 }
48699
48700 Object.defineProperty(close, previousSymbol, {
48701 value: fs$close
48702 })
48703 return close
48704 })(fs.close)
48705
48706 fs.closeSync = (function (fs$closeSync) {
48707 function closeSync (fd) {
48708 // This function uses the graceful-fs shared queue
48709 fs$closeSync.apply(fs, arguments)
48710 retry()
48711 }
48712
48713 Object.defineProperty(closeSync, previousSymbol, {
48714 value: fs$closeSync
48715 })
48716 return closeSync
48717 })(fs.closeSync)
48718
48719 if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
48720 process.on('exit', function() {
48721 debug(fs[gracefulQueue])
48722 __webpack_require__(42357).equal(fs[gracefulQueue].length, 0)
48723 })
48724 }
48725}
48726
48727if (!global[gracefulQueue]) {
48728 publishQueue(global, fs[gracefulQueue]);
48729}
48730
48731module.exports = patch(clone(fs))
48732if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
48733 module.exports = patch(fs)
48734 fs.__patched = true;
48735}
48736
48737function patch (fs) {
48738 // Everything that references the open() function needs to be in here
48739 polyfills(fs)
48740 fs.gracefulify = patch
48741
48742 fs.createReadStream = createReadStream
48743 fs.createWriteStream = createWriteStream
48744 var fs$readFile = fs.readFile
48745 fs.readFile = readFile
48746 function readFile (path, options, cb) {
48747 if (typeof options === 'function')
48748 cb = options, options = null
48749
48750 return go$readFile(path, options, cb)
48751
48752 function go$readFile (path, options, cb) {
48753 return fs$readFile(path, options, function (err) {
48754 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
48755 enqueue([go$readFile, [path, options, cb]])
48756 else {
48757 if (typeof cb === 'function')
48758 cb.apply(this, arguments)
48759 retry()
48760 }
48761 })
48762 }
48763 }
48764
48765 var fs$writeFile = fs.writeFile
48766 fs.writeFile = writeFile
48767 function writeFile (path, data, options, cb) {
48768 if (typeof options === 'function')
48769 cb = options, options = null
48770
48771 return go$writeFile(path, data, options, cb)
48772
48773 function go$writeFile (path, data, options, cb) {
48774 return fs$writeFile(path, data, options, function (err) {
48775 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
48776 enqueue([go$writeFile, [path, data, options, cb]])
48777 else {
48778 if (typeof cb === 'function')
48779 cb.apply(this, arguments)
48780 retry()
48781 }
48782 })
48783 }
48784 }
48785
48786 var fs$appendFile = fs.appendFile
48787 if (fs$appendFile)
48788 fs.appendFile = appendFile
48789 function appendFile (path, data, options, cb) {
48790 if (typeof options === 'function')
48791 cb = options, options = null
48792
48793 return go$appendFile(path, data, options, cb)
48794
48795 function go$appendFile (path, data, options, cb) {
48796 return fs$appendFile(path, data, options, function (err) {
48797 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
48798 enqueue([go$appendFile, [path, data, options, cb]])
48799 else {
48800 if (typeof cb === 'function')
48801 cb.apply(this, arguments)
48802 retry()
48803 }
48804 })
48805 }
48806 }
48807
48808 var fs$readdir = fs.readdir
48809 fs.readdir = readdir
48810 function readdir (path, options, cb) {
48811 var args = [path]
48812 if (typeof options !== 'function') {
48813 args.push(options)
48814 } else {
48815 cb = options
48816 }
48817 args.push(go$readdir$cb)
48818
48819 return go$readdir(args)
48820
48821 function go$readdir$cb (err, files) {
48822 if (files && files.sort)
48823 files.sort()
48824
48825 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
48826 enqueue([go$readdir, [args]])
48827
48828 else {
48829 if (typeof cb === 'function')
48830 cb.apply(this, arguments)
48831 retry()
48832 }
48833 }
48834 }
48835
48836 function go$readdir (args) {
48837 return fs$readdir.apply(fs, args)
48838 }
48839
48840 if (process.version.substr(0, 4) === 'v0.8') {
48841 var legStreams = legacy(fs)
48842 ReadStream = legStreams.ReadStream
48843 WriteStream = legStreams.WriteStream
48844 }
48845
48846 var fs$ReadStream = fs.ReadStream
48847 if (fs$ReadStream) {
48848 ReadStream.prototype = Object.create(fs$ReadStream.prototype)
48849 ReadStream.prototype.open = ReadStream$open
48850 }
48851
48852 var fs$WriteStream = fs.WriteStream
48853 if (fs$WriteStream) {
48854 WriteStream.prototype = Object.create(fs$WriteStream.prototype)
48855 WriteStream.prototype.open = WriteStream$open
48856 }
48857
48858 Object.defineProperty(fs, 'ReadStream', {
48859 get: function () {
48860 return ReadStream
48861 },
48862 set: function (val) {
48863 ReadStream = val
48864 },
48865 enumerable: true,
48866 configurable: true
48867 })
48868 Object.defineProperty(fs, 'WriteStream', {
48869 get: function () {
48870 return WriteStream
48871 },
48872 set: function (val) {
48873 WriteStream = val
48874 },
48875 enumerable: true,
48876 configurable: true
48877 })
48878
48879 // legacy names
48880 var FileReadStream = ReadStream
48881 Object.defineProperty(fs, 'FileReadStream', {
48882 get: function () {
48883 return FileReadStream
48884 },
48885 set: function (val) {
48886 FileReadStream = val
48887 },
48888 enumerable: true,
48889 configurable: true
48890 })
48891 var FileWriteStream = WriteStream
48892 Object.defineProperty(fs, 'FileWriteStream', {
48893 get: function () {
48894 return FileWriteStream
48895 },
48896 set: function (val) {
48897 FileWriteStream = val
48898 },
48899 enumerable: true,
48900 configurable: true
48901 })
48902
48903 function ReadStream (path, options) {
48904 if (this instanceof ReadStream)
48905 return fs$ReadStream.apply(this, arguments), this
48906 else
48907 return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
48908 }
48909
48910 function ReadStream$open () {
48911 var that = this
48912 open(that.path, that.flags, that.mode, function (err, fd) {
48913 if (err) {
48914 if (that.autoClose)
48915 that.destroy()
48916
48917 that.emit('error', err)
48918 } else {
48919 that.fd = fd
48920 that.emit('open', fd)
48921 that.read()
48922 }
48923 })
48924 }
48925
48926 function WriteStream (path, options) {
48927 if (this instanceof WriteStream)
48928 return fs$WriteStream.apply(this, arguments), this
48929 else
48930 return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
48931 }
48932
48933 function WriteStream$open () {
48934 var that = this
48935 open(that.path, that.flags, that.mode, function (err, fd) {
48936 if (err) {
48937 that.destroy()
48938 that.emit('error', err)
48939 } else {
48940 that.fd = fd
48941 that.emit('open', fd)
48942 }
48943 })
48944 }
48945
48946 function createReadStream (path, options) {
48947 return new fs.ReadStream(path, options)
48948 }
48949
48950 function createWriteStream (path, options) {
48951 return new fs.WriteStream(path, options)
48952 }
48953
48954 var fs$open = fs.open
48955 fs.open = open
48956 function open (path, flags, mode, cb) {
48957 if (typeof mode === 'function')
48958 cb = mode, mode = null
48959
48960 return go$open(path, flags, mode, cb)
48961
48962 function go$open (path, flags, mode, cb) {
48963 return fs$open(path, flags, mode, function (err, fd) {
48964 if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
48965 enqueue([go$open, [path, flags, mode, cb]])
48966 else {
48967 if (typeof cb === 'function')
48968 cb.apply(this, arguments)
48969 retry()
48970 }
48971 })
48972 }
48973 }
48974
48975 return fs
48976}
48977
48978function enqueue (elem) {
48979 debug('ENQUEUE', elem[0].name, elem[1])
48980 fs[gracefulQueue].push(elem)
48981}
48982
48983function retry () {
48984 var elem = fs[gracefulQueue].shift()
48985 if (elem) {
48986 debug('RETRY', elem[0].name, elem[1])
48987 elem[0].apply(null, elem[1])
48988 }
48989}
48990
48991
48992/***/ }),
48993
48994/***/ 7077:
48995/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
48996
48997var Stream = __webpack_require__(92413).Stream
48998
48999module.exports = legacy
49000
49001function legacy (fs) {
49002 return {
49003 ReadStream: ReadStream,
49004 WriteStream: WriteStream
49005 }
49006
49007 function ReadStream (path, options) {
49008 if (!(this instanceof ReadStream)) return new ReadStream(path, options);
49009
49010 Stream.call(this);
49011
49012 var self = this;
49013
49014 this.path = path;
49015 this.fd = null;
49016 this.readable = true;
49017 this.paused = false;
49018
49019 this.flags = 'r';
49020 this.mode = 438; /*=0666*/
49021 this.bufferSize = 64 * 1024;
49022
49023 options = options || {};
49024
49025 // Mixin options into this
49026 var keys = Object.keys(options);
49027 for (var index = 0, length = keys.length; index < length; index++) {
49028 var key = keys[index];
49029 this[key] = options[key];
49030 }
49031
49032 if (this.encoding) this.setEncoding(this.encoding);
49033
49034 if (this.start !== undefined) {
49035 if ('number' !== typeof this.start) {
49036 throw TypeError('start must be a Number');
49037 }
49038 if (this.end === undefined) {
49039 this.end = Infinity;
49040 } else if ('number' !== typeof this.end) {
49041 throw TypeError('end must be a Number');
49042 }
49043
49044 if (this.start > this.end) {
49045 throw new Error('start must be <= end');
49046 }
49047
49048 this.pos = this.start;
49049 }
49050
49051 if (this.fd !== null) {
49052 process.nextTick(function() {
49053 self._read();
49054 });
49055 return;
49056 }
49057
49058 fs.open(this.path, this.flags, this.mode, function (err, fd) {
49059 if (err) {
49060 self.emit('error', err);
49061 self.readable = false;
49062 return;
49063 }
49064
49065 self.fd = fd;
49066 self.emit('open', fd);
49067 self._read();
49068 })
49069 }
49070
49071 function WriteStream (path, options) {
49072 if (!(this instanceof WriteStream)) return new WriteStream(path, options);
49073
49074 Stream.call(this);
49075
49076 this.path = path;
49077 this.fd = null;
49078 this.writable = true;
49079
49080 this.flags = 'w';
49081 this.encoding = 'binary';
49082 this.mode = 438; /*=0666*/
49083 this.bytesWritten = 0;
49084
49085 options = options || {};
49086
49087 // Mixin options into this
49088 var keys = Object.keys(options);
49089 for (var index = 0, length = keys.length; index < length; index++) {
49090 var key = keys[index];
49091 this[key] = options[key];
49092 }
49093
49094 if (this.start !== undefined) {
49095 if ('number' !== typeof this.start) {
49096 throw TypeError('start must be a Number');
49097 }
49098 if (this.start < 0) {
49099 throw new Error('start must be >= zero');
49100 }
49101
49102 this.pos = this.start;
49103 }
49104
49105 this.busy = false;
49106 this._queue = [];
49107
49108 if (this.fd === null) {
49109 this._open = fs.open;
49110 this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
49111 this.flush();
49112 }
49113 }
49114}
49115
49116
49117/***/ }),
49118
49119/***/ 60034:
49120/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49121
49122var constants = __webpack_require__(27619)
49123
49124var origCwd = process.cwd
49125var cwd = null
49126
49127var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
49128
49129process.cwd = function() {
49130 if (!cwd)
49131 cwd = origCwd.call(process)
49132 return cwd
49133}
49134try {
49135 process.cwd()
49136} catch (er) {}
49137
49138var chdir = process.chdir
49139process.chdir = function(d) {
49140 cwd = null
49141 chdir.call(process, d)
49142}
49143
49144module.exports = patch
49145
49146function patch (fs) {
49147 // (re-)implement some things that are known busted or missing.
49148
49149 // lchmod, broken prior to 0.6.2
49150 // back-port the fix here.
49151 if (constants.hasOwnProperty('O_SYMLINK') &&
49152 process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
49153 patchLchmod(fs)
49154 }
49155
49156 // lutimes implementation, or no-op
49157 if (!fs.lutimes) {
49158 patchLutimes(fs)
49159 }
49160
49161 // https://github.com/isaacs/node-graceful-fs/issues/4
49162 // Chown should not fail on einval or eperm if non-root.
49163 // It should not fail on enosys ever, as this just indicates
49164 // that a fs doesn't support the intended operation.
49165
49166 fs.chown = chownFix(fs.chown)
49167 fs.fchown = chownFix(fs.fchown)
49168 fs.lchown = chownFix(fs.lchown)
49169
49170 fs.chmod = chmodFix(fs.chmod)
49171 fs.fchmod = chmodFix(fs.fchmod)
49172 fs.lchmod = chmodFix(fs.lchmod)
49173
49174 fs.chownSync = chownFixSync(fs.chownSync)
49175 fs.fchownSync = chownFixSync(fs.fchownSync)
49176 fs.lchownSync = chownFixSync(fs.lchownSync)
49177
49178 fs.chmodSync = chmodFixSync(fs.chmodSync)
49179 fs.fchmodSync = chmodFixSync(fs.fchmodSync)
49180 fs.lchmodSync = chmodFixSync(fs.lchmodSync)
49181
49182 fs.stat = statFix(fs.stat)
49183 fs.fstat = statFix(fs.fstat)
49184 fs.lstat = statFix(fs.lstat)
49185
49186 fs.statSync = statFixSync(fs.statSync)
49187 fs.fstatSync = statFixSync(fs.fstatSync)
49188 fs.lstatSync = statFixSync(fs.lstatSync)
49189
49190 // if lchmod/lchown do not exist, then make them no-ops
49191 if (!fs.lchmod) {
49192 fs.lchmod = function (path, mode, cb) {
49193 if (cb) process.nextTick(cb)
49194 }
49195 fs.lchmodSync = function () {}
49196 }
49197 if (!fs.lchown) {
49198 fs.lchown = function (path, uid, gid, cb) {
49199 if (cb) process.nextTick(cb)
49200 }
49201 fs.lchownSync = function () {}
49202 }
49203
49204 // on Windows, A/V software can lock the directory, causing this
49205 // to fail with an EACCES or EPERM if the directory contains newly
49206 // created files. Try again on failure, for up to 60 seconds.
49207
49208 // Set the timeout this long because some Windows Anti-Virus, such as Parity
49209 // bit9, may lock files for up to a minute, causing npm package install
49210 // failures. Also, take care to yield the scheduler. Windows scheduling gives
49211 // CPU to a busy looping process, which can cause the program causing the lock
49212 // contention to be starved of CPU by node, so the contention doesn't resolve.
49213 if (platform === "win32") {
49214 fs.rename = (function (fs$rename) { return function (from, to, cb) {
49215 var start = Date.now()
49216 var backoff = 0;
49217 fs$rename(from, to, function CB (er) {
49218 if (er
49219 && (er.code === "EACCES" || er.code === "EPERM")
49220 && Date.now() - start < 60000) {
49221 setTimeout(function() {
49222 fs.stat(to, function (stater, st) {
49223 if (stater && stater.code === "ENOENT")
49224 fs$rename(from, to, CB);
49225 else
49226 cb(er)
49227 })
49228 }, backoff)
49229 if (backoff < 100)
49230 backoff += 10;
49231 return;
49232 }
49233 if (cb) cb(er)
49234 })
49235 }})(fs.rename)
49236 }
49237
49238 // if read() returns EAGAIN, then just try it again.
49239 fs.read = (function (fs$read) {
49240 function read (fd, buffer, offset, length, position, callback_) {
49241 var callback
49242 if (callback_ && typeof callback_ === 'function') {
49243 var eagCounter = 0
49244 callback = function (er, _, __) {
49245 if (er && er.code === 'EAGAIN' && eagCounter < 10) {
49246 eagCounter ++
49247 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
49248 }
49249 callback_.apply(this, arguments)
49250 }
49251 }
49252 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
49253 }
49254
49255 // This ensures `util.promisify` works as it does for native `fs.read`.
49256 read.__proto__ = fs$read
49257 return read
49258 })(fs.read)
49259
49260 fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
49261 var eagCounter = 0
49262 while (true) {
49263 try {
49264 return fs$readSync.call(fs, fd, buffer, offset, length, position)
49265 } catch (er) {
49266 if (er.code === 'EAGAIN' && eagCounter < 10) {
49267 eagCounter ++
49268 continue
49269 }
49270 throw er
49271 }
49272 }
49273 }})(fs.readSync)
49274
49275 function patchLchmod (fs) {
49276 fs.lchmod = function (path, mode, callback) {
49277 fs.open( path
49278 , constants.O_WRONLY | constants.O_SYMLINK
49279 , mode
49280 , function (err, fd) {
49281 if (err) {
49282 if (callback) callback(err)
49283 return
49284 }
49285 // prefer to return the chmod error, if one occurs,
49286 // but still try to close, and report closing errors if they occur.
49287 fs.fchmod(fd, mode, function (err) {
49288 fs.close(fd, function(err2) {
49289 if (callback) callback(err || err2)
49290 })
49291 })
49292 })
49293 }
49294
49295 fs.lchmodSync = function (path, mode) {
49296 var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
49297
49298 // prefer to return the chmod error, if one occurs,
49299 // but still try to close, and report closing errors if they occur.
49300 var threw = true
49301 var ret
49302 try {
49303 ret = fs.fchmodSync(fd, mode)
49304 threw = false
49305 } finally {
49306 if (threw) {
49307 try {
49308 fs.closeSync(fd)
49309 } catch (er) {}
49310 } else {
49311 fs.closeSync(fd)
49312 }
49313 }
49314 return ret
49315 }
49316 }
49317
49318 function patchLutimes (fs) {
49319 if (constants.hasOwnProperty("O_SYMLINK")) {
49320 fs.lutimes = function (path, at, mt, cb) {
49321 fs.open(path, constants.O_SYMLINK, function (er, fd) {
49322 if (er) {
49323 if (cb) cb(er)
49324 return
49325 }
49326 fs.futimes(fd, at, mt, function (er) {
49327 fs.close(fd, function (er2) {
49328 if (cb) cb(er || er2)
49329 })
49330 })
49331 })
49332 }
49333
49334 fs.lutimesSync = function (path, at, mt) {
49335 var fd = fs.openSync(path, constants.O_SYMLINK)
49336 var ret
49337 var threw = true
49338 try {
49339 ret = fs.futimesSync(fd, at, mt)
49340 threw = false
49341 } finally {
49342 if (threw) {
49343 try {
49344 fs.closeSync(fd)
49345 } catch (er) {}
49346 } else {
49347 fs.closeSync(fd)
49348 }
49349 }
49350 return ret
49351 }
49352
49353 } else {
49354 fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
49355 fs.lutimesSync = function () {}
49356 }
49357 }
49358
49359 function chmodFix (orig) {
49360 if (!orig) return orig
49361 return function (target, mode, cb) {
49362 return orig.call(fs, target, mode, function (er) {
49363 if (chownErOk(er)) er = null
49364 if (cb) cb.apply(this, arguments)
49365 })
49366 }
49367 }
49368
49369 function chmodFixSync (orig) {
49370 if (!orig) return orig
49371 return function (target, mode) {
49372 try {
49373 return orig.call(fs, target, mode)
49374 } catch (er) {
49375 if (!chownErOk(er)) throw er
49376 }
49377 }
49378 }
49379
49380
49381 function chownFix (orig) {
49382 if (!orig) return orig
49383 return function (target, uid, gid, cb) {
49384 return orig.call(fs, target, uid, gid, function (er) {
49385 if (chownErOk(er)) er = null
49386 if (cb) cb.apply(this, arguments)
49387 })
49388 }
49389 }
49390
49391 function chownFixSync (orig) {
49392 if (!orig) return orig
49393 return function (target, uid, gid) {
49394 try {
49395 return orig.call(fs, target, uid, gid)
49396 } catch (er) {
49397 if (!chownErOk(er)) throw er
49398 }
49399 }
49400 }
49401
49402 function statFix (orig) {
49403 if (!orig) return orig
49404 // Older versions of Node erroneously returned signed integers for
49405 // uid + gid.
49406 return function (target, options, cb) {
49407 if (typeof options === 'function') {
49408 cb = options
49409 options = null
49410 }
49411 function callback (er, stats) {
49412 if (stats) {
49413 if (stats.uid < 0) stats.uid += 0x100000000
49414 if (stats.gid < 0) stats.gid += 0x100000000
49415 }
49416 if (cb) cb.apply(this, arguments)
49417 }
49418 return options ? orig.call(fs, target, options, callback)
49419 : orig.call(fs, target, callback)
49420 }
49421 }
49422
49423 function statFixSync (orig) {
49424 if (!orig) return orig
49425 // Older versions of Node erroneously returned signed integers for
49426 // uid + gid.
49427 return function (target, options) {
49428 var stats = options ? orig.call(fs, target, options)
49429 : orig.call(fs, target)
49430 if (stats.uid < 0) stats.uid += 0x100000000
49431 if (stats.gid < 0) stats.gid += 0x100000000
49432 return stats;
49433 }
49434 }
49435
49436 // ENOSYS means that the fs doesn't support the op. Just ignore
49437 // that, because it doesn't matter.
49438 //
49439 // if there's no getuid, or if getuid() is something other
49440 // than 0, and the error is EINVAL or EPERM, then just ignore
49441 // it.
49442 //
49443 // This specific case is a silent failure in cp, install, tar,
49444 // and most other unix tools that manage permissions.
49445 //
49446 // When running as root, or if other types of errors are
49447 // encountered, then it's strict.
49448 function chownErOk (er) {
49449 if (!er)
49450 return true
49451
49452 if (er.code === "ENOSYS")
49453 return true
49454
49455 var nonroot = !process.getuid || process.getuid() !== 0
49456 if (nonroot) {
49457 if (er.code === "EINVAL" || er.code === "EPERM")
49458 return true
49459 }
49460
49461 return false
49462 }
49463}
49464
49465
49466/***/ }),
49467
49468/***/ 41825:
49469/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49470
49471"use strict";
49472/*!
49473 * has-value <https://github.com/jonschlinkert/has-value>
49474 *
49475 * Copyright (c) 2014-2017, Jon Schlinkert.
49476 * Licensed under the MIT License.
49477 */
49478
49479
49480
49481var isObject = __webpack_require__(96667);
49482var hasValues = __webpack_require__(80455);
49483var get = __webpack_require__(89304);
49484
49485module.exports = function(val, prop) {
49486 return hasValues(isObject(val) && prop ? get(val, prop) : val);
49487};
49488
49489
49490/***/ }),
49491
49492/***/ 80455:
49493/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49494
49495"use strict";
49496/*!
49497 * has-values <https://github.com/jonschlinkert/has-values>
49498 *
49499 * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
49500 * Released under the MIT License.
49501 */
49502
49503
49504
49505var typeOf = __webpack_require__(54329);
49506var isNumber = __webpack_require__(87218);
49507
49508module.exports = function hasValue(val) {
49509 // is-number checks for NaN and other edge cases
49510 if (isNumber(val)) {
49511 return true;
49512 }
49513
49514 switch (typeOf(val)) {
49515 case 'null':
49516 case 'boolean':
49517 case 'function':
49518 return true;
49519 case 'string':
49520 case 'arguments':
49521 return val.length !== 0;
49522 case 'error':
49523 return val.message !== '';
49524 case 'array':
49525 var len = val.length;
49526 if (len === 0) {
49527 return false;
49528 }
49529 for (var i = 0; i < len; i++) {
49530 if (hasValue(val[i])) {
49531 return true;
49532 }
49533 }
49534 return false;
49535 case 'file':
49536 case 'map':
49537 case 'set':
49538 return val.size !== 0;
49539 case 'object':
49540 var keys = Object.keys(val);
49541 if (keys.length === 0) {
49542 return false;
49543 }
49544 for (var i = 0; i < keys.length; i++) {
49545 var key = keys[i];
49546 if (hasValue(val[key])) {
49547 return true;
49548 }
49549 }
49550 return false;
49551 default: {
49552 return false;
49553 }
49554 }
49555};
49556
49557
49558/***/ }),
49559
49560/***/ 93293:
49561/***/ (function(module) {
49562
49563/*!
49564 * Determine if an object is a Buffer
49565 *
49566 * @author Feross Aboukhadijeh <https://feross.org>
49567 * @license MIT
49568 */
49569
49570// The _isBuffer check is for Safari 5-7 support, because it's missing
49571// Object.prototype.constructor. Remove this eventually
49572module.exports = function (obj) {
49573 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
49574}
49575
49576function isBuffer (obj) {
49577 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
49578}
49579
49580// For Node v0.10 support. Remove this eventually.
49581function isSlowBuffer (obj) {
49582 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
49583}
49584
49585
49586/***/ }),
49587
49588/***/ 54329:
49589/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49590
49591var isBuffer = __webpack_require__(93293);
49592var toString = Object.prototype.toString;
49593
49594/**
49595 * Get the native `typeof` a value.
49596 *
49597 * @param {*} `val`
49598 * @return {*} Native javascript type
49599 */
49600
49601module.exports = function kindOf(val) {
49602 // primitivies
49603 if (typeof val === 'undefined') {
49604 return 'undefined';
49605 }
49606 if (val === null) {
49607 return 'null';
49608 }
49609 if (val === true || val === false || val instanceof Boolean) {
49610 return 'boolean';
49611 }
49612 if (typeof val === 'string' || val instanceof String) {
49613 return 'string';
49614 }
49615 if (typeof val === 'number' || val instanceof Number) {
49616 return 'number';
49617 }
49618
49619 // functions
49620 if (typeof val === 'function' || val instanceof Function) {
49621 return 'function';
49622 }
49623
49624 // array
49625 if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
49626 return 'array';
49627 }
49628
49629 // check for instances of RegExp and Date before calling `toString`
49630 if (val instanceof RegExp) {
49631 return 'regexp';
49632 }
49633 if (val instanceof Date) {
49634 return 'date';
49635 }
49636
49637 // other objects
49638 var type = toString.call(val);
49639
49640 if (type === '[object RegExp]') {
49641 return 'regexp';
49642 }
49643 if (type === '[object Date]') {
49644 return 'date';
49645 }
49646 if (type === '[object Arguments]') {
49647 return 'arguments';
49648 }
49649 if (type === '[object Error]') {
49650 return 'error';
49651 }
49652 if (type === '[object Promise]') {
49653 return 'promise';
49654 }
49655
49656 // buffer
49657 if (isBuffer(val)) {
49658 return 'buffer';
49659 }
49660
49661 // es6: Map, WeakMap, Set, WeakSet
49662 if (type === '[object Set]') {
49663 return 'set';
49664 }
49665 if (type === '[object WeakSet]') {
49666 return 'weakset';
49667 }
49668 if (type === '[object Map]') {
49669 return 'map';
49670 }
49671 if (type === '[object WeakMap]') {
49672 return 'weakmap';
49673 }
49674 if (type === '[object Symbol]') {
49675 return 'symbol';
49676 }
49677
49678 // typed arrays
49679 if (type === '[object Int8Array]') {
49680 return 'int8array';
49681 }
49682 if (type === '[object Uint8Array]') {
49683 return 'uint8array';
49684 }
49685 if (type === '[object Uint8ClampedArray]') {
49686 return 'uint8clampedarray';
49687 }
49688 if (type === '[object Int16Array]') {
49689 return 'int16array';
49690 }
49691 if (type === '[object Uint16Array]') {
49692 return 'uint16array';
49693 }
49694 if (type === '[object Int32Array]') {
49695 return 'int32array';
49696 }
49697 if (type === '[object Uint32Array]') {
49698 return 'uint32array';
49699 }
49700 if (type === '[object Float32Array]') {
49701 return 'float32array';
49702 }
49703 if (type === '[object Float64Array]') {
49704 return 'float64array';
49705 }
49706
49707 // must be a plain object
49708 return 'object';
49709};
49710
49711
49712/***/ }),
49713
49714/***/ 2989:
49715/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49716
49717try {
49718 var util = __webpack_require__(31669);
49719 /* istanbul ignore next */
49720 if (typeof util.inherits !== 'function') throw '';
49721 module.exports = util.inherits;
49722} catch (e) {
49723 /* istanbul ignore next */
49724 module.exports = __webpack_require__(97350);
49725}
49726
49727
49728/***/ }),
49729
49730/***/ 97350:
49731/***/ (function(module) {
49732
49733if (typeof Object.create === 'function') {
49734 // implementation from standard node.js 'util' module
49735 module.exports = function inherits(ctor, superCtor) {
49736 if (superCtor) {
49737 ctor.super_ = superCtor
49738 ctor.prototype = Object.create(superCtor.prototype, {
49739 constructor: {
49740 value: ctor,
49741 enumerable: false,
49742 writable: true,
49743 configurable: true
49744 }
49745 })
49746 }
49747 };
49748} else {
49749 // old school shim for old browsers
49750 module.exports = function inherits(ctor, superCtor) {
49751 if (superCtor) {
49752 ctor.super_ = superCtor
49753 var TempCtor = function () {}
49754 TempCtor.prototype = superCtor.prototype
49755 ctor.prototype = new TempCtor()
49756 ctor.prototype.constructor = ctor
49757 }
49758 }
49759}
49760
49761
49762/***/ }),
49763
49764/***/ 13121:
49765/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49766
49767"use strict";
49768/*!
49769 * is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
49770 *
49771 * Copyright (c) 2015-2017, Jon Schlinkert.
49772 * Released under the MIT License.
49773 */
49774
49775
49776
49777var typeOf = __webpack_require__(97458);
49778
49779// accessor descriptor properties
49780var accessor = {
49781 get: 'function',
49782 set: 'function',
49783 configurable: 'boolean',
49784 enumerable: 'boolean'
49785};
49786
49787function isAccessorDescriptor(obj, prop) {
49788 if (typeof prop === 'string') {
49789 var val = Object.getOwnPropertyDescriptor(obj, prop);
49790 return typeof val !== 'undefined';
49791 }
49792
49793 if (typeOf(obj) !== 'object') {
49794 return false;
49795 }
49796
49797 if (has(obj, 'value') || has(obj, 'writable')) {
49798 return false;
49799 }
49800
49801 if (!has(obj, 'get') || typeof obj.get !== 'function') {
49802 return false;
49803 }
49804
49805 // tldr: it's valid to have "set" be undefined
49806 // "set" might be undefined if `Object.getOwnPropertyDescriptor`
49807 // was used to get the value, and only `get` was defined by the user
49808 if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
49809 return false;
49810 }
49811
49812 for (var key in obj) {
49813 if (!accessor.hasOwnProperty(key)) {
49814 continue;
49815 }
49816
49817 if (typeOf(obj[key]) === accessor[key]) {
49818 continue;
49819 }
49820
49821 if (typeof obj[key] !== 'undefined') {
49822 return false;
49823 }
49824 }
49825 return true;
49826}
49827
49828function has(obj, key) {
49829 return {}.hasOwnProperty.call(obj, key);
49830}
49831
49832/**
49833 * Expose `isAccessorDescriptor`
49834 */
49835
49836module.exports = isAccessorDescriptor;
49837
49838
49839/***/ }),
49840
49841/***/ 97458:
49842/***/ (function(module) {
49843
49844var toString = Object.prototype.toString;
49845
49846module.exports = function kindOf(val) {
49847 if (val === void 0) return 'undefined';
49848 if (val === null) return 'null';
49849
49850 var type = typeof val;
49851 if (type === 'boolean') return 'boolean';
49852 if (type === 'string') return 'string';
49853 if (type === 'number') return 'number';
49854 if (type === 'symbol') return 'symbol';
49855 if (type === 'function') {
49856 return isGeneratorFn(val) ? 'generatorfunction' : 'function';
49857 }
49858
49859 if (isArray(val)) return 'array';
49860 if (isBuffer(val)) return 'buffer';
49861 if (isArguments(val)) return 'arguments';
49862 if (isDate(val)) return 'date';
49863 if (isError(val)) return 'error';
49864 if (isRegexp(val)) return 'regexp';
49865
49866 switch (ctorName(val)) {
49867 case 'Symbol': return 'symbol';
49868 case 'Promise': return 'promise';
49869
49870 // Set, Map, WeakSet, WeakMap
49871 case 'WeakMap': return 'weakmap';
49872 case 'WeakSet': return 'weakset';
49873 case 'Map': return 'map';
49874 case 'Set': return 'set';
49875
49876 // 8-bit typed arrays
49877 case 'Int8Array': return 'int8array';
49878 case 'Uint8Array': return 'uint8array';
49879 case 'Uint8ClampedArray': return 'uint8clampedarray';
49880
49881 // 16-bit typed arrays
49882 case 'Int16Array': return 'int16array';
49883 case 'Uint16Array': return 'uint16array';
49884
49885 // 32-bit typed arrays
49886 case 'Int32Array': return 'int32array';
49887 case 'Uint32Array': return 'uint32array';
49888 case 'Float32Array': return 'float32array';
49889 case 'Float64Array': return 'float64array';
49890 }
49891
49892 if (isGeneratorObj(val)) {
49893 return 'generator';
49894 }
49895
49896 // Non-plain objects
49897 type = toString.call(val);
49898 switch (type) {
49899 case '[object Object]': return 'object';
49900 // iterators
49901 case '[object Map Iterator]': return 'mapiterator';
49902 case '[object Set Iterator]': return 'setiterator';
49903 case '[object String Iterator]': return 'stringiterator';
49904 case '[object Array Iterator]': return 'arrayiterator';
49905 }
49906
49907 // other
49908 return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
49909};
49910
49911function ctorName(val) {
49912 return typeof val.constructor === 'function' ? val.constructor.name : null;
49913}
49914
49915function isArray(val) {
49916 if (Array.isArray) return Array.isArray(val);
49917 return val instanceof Array;
49918}
49919
49920function isError(val) {
49921 return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
49922}
49923
49924function isDate(val) {
49925 if (val instanceof Date) return true;
49926 return typeof val.toDateString === 'function'
49927 && typeof val.getDate === 'function'
49928 && typeof val.setDate === 'function';
49929}
49930
49931function isRegexp(val) {
49932 if (val instanceof RegExp) return true;
49933 return typeof val.flags === 'string'
49934 && typeof val.ignoreCase === 'boolean'
49935 && typeof val.multiline === 'boolean'
49936 && typeof val.global === 'boolean';
49937}
49938
49939function isGeneratorFn(name, val) {
49940 return ctorName(name) === 'GeneratorFunction';
49941}
49942
49943function isGeneratorObj(val) {
49944 return typeof val.throw === 'function'
49945 && typeof val.return === 'function'
49946 && typeof val.next === 'function';
49947}
49948
49949function isArguments(val) {
49950 try {
49951 if (typeof val.length === 'number' && typeof val.callee === 'function') {
49952 return true;
49953 }
49954 } catch (err) {
49955 if (err.message.indexOf('callee') !== -1) {
49956 return true;
49957 }
49958 }
49959 return false;
49960}
49961
49962/**
49963 * If you need to support Safari 5-7 (8-10 yr-old browser),
49964 * take a look at https://github.com/feross/is-buffer
49965 */
49966
49967function isBuffer(val) {
49968 if (val.constructor && typeof val.constructor.isBuffer === 'function') {
49969 return val.constructor.isBuffer(val);
49970 }
49971 return false;
49972}
49973
49974
49975/***/ }),
49976
49977/***/ 74194:
49978/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
49979
49980"use strict";
49981/*!
49982 * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
49983 *
49984 * Copyright (c) 2015-2017, Jon Schlinkert.
49985 * Released under the MIT License.
49986 */
49987
49988
49989
49990var typeOf = __webpack_require__(82401);
49991
49992module.exports = function isDataDescriptor(obj, prop) {
49993 // data descriptor properties
49994 var data = {
49995 configurable: 'boolean',
49996 enumerable: 'boolean',
49997 writable: 'boolean'
49998 };
49999
50000 if (typeOf(obj) !== 'object') {
50001 return false;
50002 }
50003
50004 if (typeof prop === 'string') {
50005 var val = Object.getOwnPropertyDescriptor(obj, prop);
50006 return typeof val !== 'undefined';
50007 }
50008
50009 if (!('value' in obj) && !('writable' in obj)) {
50010 return false;
50011 }
50012
50013 for (var key in obj) {
50014 if (key === 'value') continue;
50015
50016 if (!data.hasOwnProperty(key)) {
50017 continue;
50018 }
50019
50020 if (typeOf(obj[key]) === data[key]) {
50021 continue;
50022 }
50023
50024 if (typeof obj[key] !== 'undefined') {
50025 return false;
50026 }
50027 }
50028 return true;
50029};
50030
50031
50032/***/ }),
50033
50034/***/ 82401:
50035/***/ (function(module) {
50036
50037var toString = Object.prototype.toString;
50038
50039module.exports = function kindOf(val) {
50040 if (val === void 0) return 'undefined';
50041 if (val === null) return 'null';
50042
50043 var type = typeof val;
50044 if (type === 'boolean') return 'boolean';
50045 if (type === 'string') return 'string';
50046 if (type === 'number') return 'number';
50047 if (type === 'symbol') return 'symbol';
50048 if (type === 'function') {
50049 return isGeneratorFn(val) ? 'generatorfunction' : 'function';
50050 }
50051
50052 if (isArray(val)) return 'array';
50053 if (isBuffer(val)) return 'buffer';
50054 if (isArguments(val)) return 'arguments';
50055 if (isDate(val)) return 'date';
50056 if (isError(val)) return 'error';
50057 if (isRegexp(val)) return 'regexp';
50058
50059 switch (ctorName(val)) {
50060 case 'Symbol': return 'symbol';
50061 case 'Promise': return 'promise';
50062
50063 // Set, Map, WeakSet, WeakMap
50064 case 'WeakMap': return 'weakmap';
50065 case 'WeakSet': return 'weakset';
50066 case 'Map': return 'map';
50067 case 'Set': return 'set';
50068
50069 // 8-bit typed arrays
50070 case 'Int8Array': return 'int8array';
50071 case 'Uint8Array': return 'uint8array';
50072 case 'Uint8ClampedArray': return 'uint8clampedarray';
50073
50074 // 16-bit typed arrays
50075 case 'Int16Array': return 'int16array';
50076 case 'Uint16Array': return 'uint16array';
50077
50078 // 32-bit typed arrays
50079 case 'Int32Array': return 'int32array';
50080 case 'Uint32Array': return 'uint32array';
50081 case 'Float32Array': return 'float32array';
50082 case 'Float64Array': return 'float64array';
50083 }
50084
50085 if (isGeneratorObj(val)) {
50086 return 'generator';
50087 }
50088
50089 // Non-plain objects
50090 type = toString.call(val);
50091 switch (type) {
50092 case '[object Object]': return 'object';
50093 // iterators
50094 case '[object Map Iterator]': return 'mapiterator';
50095 case '[object Set Iterator]': return 'setiterator';
50096 case '[object String Iterator]': return 'stringiterator';
50097 case '[object Array Iterator]': return 'arrayiterator';
50098 }
50099
50100 // other
50101 return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
50102};
50103
50104function ctorName(val) {
50105 return typeof val.constructor === 'function' ? val.constructor.name : null;
50106}
50107
50108function isArray(val) {
50109 if (Array.isArray) return Array.isArray(val);
50110 return val instanceof Array;
50111}
50112
50113function isError(val) {
50114 return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
50115}
50116
50117function isDate(val) {
50118 if (val instanceof Date) return true;
50119 return typeof val.toDateString === 'function'
50120 && typeof val.getDate === 'function'
50121 && typeof val.setDate === 'function';
50122}
50123
50124function isRegexp(val) {
50125 if (val instanceof RegExp) return true;
50126 return typeof val.flags === 'string'
50127 && typeof val.ignoreCase === 'boolean'
50128 && typeof val.multiline === 'boolean'
50129 && typeof val.global === 'boolean';
50130}
50131
50132function isGeneratorFn(name, val) {
50133 return ctorName(name) === 'GeneratorFunction';
50134}
50135
50136function isGeneratorObj(val) {
50137 return typeof val.throw === 'function'
50138 && typeof val.return === 'function'
50139 && typeof val.next === 'function';
50140}
50141
50142function isArguments(val) {
50143 try {
50144 if (typeof val.length === 'number' && typeof val.callee === 'function') {
50145 return true;
50146 }
50147 } catch (err) {
50148 if (err.message.indexOf('callee') !== -1) {
50149 return true;
50150 }
50151 }
50152 return false;
50153}
50154
50155/**
50156 * If you need to support Safari 5-7 (8-10 yr-old browser),
50157 * take a look at https://github.com/feross/is-buffer
50158 */
50159
50160function isBuffer(val) {
50161 if (val.constructor && typeof val.constructor.isBuffer === 'function') {
50162 return val.constructor.isBuffer(val);
50163 }
50164 return false;
50165}
50166
50167
50168/***/ }),
50169
50170/***/ 44133:
50171/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
50172
50173"use strict";
50174/*!
50175 * is-descriptor <https://github.com/jonschlinkert/is-descriptor>
50176 *
50177 * Copyright (c) 2015-2017, Jon Schlinkert.
50178 * Released under the MIT License.
50179 */
50180
50181
50182
50183var typeOf = __webpack_require__(46927);
50184var isAccessor = __webpack_require__(13121);
50185var isData = __webpack_require__(74194);
50186
50187module.exports = function isDescriptor(obj, key) {
50188 if (typeOf(obj) !== 'object') {
50189 return false;
50190 }
50191 if ('get' in obj) {
50192 return isAccessor(obj, key);
50193 }
50194 return isData(obj, key);
50195};
50196
50197
50198/***/ }),
50199
50200/***/ 46927:
50201/***/ (function(module) {
50202
50203var toString = Object.prototype.toString;
50204
50205module.exports = function kindOf(val) {
50206 if (val === void 0) return 'undefined';
50207 if (val === null) return 'null';
50208
50209 var type = typeof val;
50210 if (type === 'boolean') return 'boolean';
50211 if (type === 'string') return 'string';
50212 if (type === 'number') return 'number';
50213 if (type === 'symbol') return 'symbol';
50214 if (type === 'function') {
50215 return isGeneratorFn(val) ? 'generatorfunction' : 'function';
50216 }
50217
50218 if (isArray(val)) return 'array';
50219 if (isBuffer(val)) return 'buffer';
50220 if (isArguments(val)) return 'arguments';
50221 if (isDate(val)) return 'date';
50222 if (isError(val)) return 'error';
50223 if (isRegexp(val)) return 'regexp';
50224
50225 switch (ctorName(val)) {
50226 case 'Symbol': return 'symbol';
50227 case 'Promise': return 'promise';
50228
50229 // Set, Map, WeakSet, WeakMap
50230 case 'WeakMap': return 'weakmap';
50231 case 'WeakSet': return 'weakset';
50232 case 'Map': return 'map';
50233 case 'Set': return 'set';
50234
50235 // 8-bit typed arrays
50236 case 'Int8Array': return 'int8array';
50237 case 'Uint8Array': return 'uint8array';
50238 case 'Uint8ClampedArray': return 'uint8clampedarray';
50239
50240 // 16-bit typed arrays
50241 case 'Int16Array': return 'int16array';
50242 case 'Uint16Array': return 'uint16array';
50243
50244 // 32-bit typed arrays
50245 case 'Int32Array': return 'int32array';
50246 case 'Uint32Array': return 'uint32array';
50247 case 'Float32Array': return 'float32array';
50248 case 'Float64Array': return 'float64array';
50249 }
50250
50251 if (isGeneratorObj(val)) {
50252 return 'generator';
50253 }
50254
50255 // Non-plain objects
50256 type = toString.call(val);
50257 switch (type) {
50258 case '[object Object]': return 'object';
50259 // iterators
50260 case '[object Map Iterator]': return 'mapiterator';
50261 case '[object Set Iterator]': return 'setiterator';
50262 case '[object String Iterator]': return 'stringiterator';
50263 case '[object Array Iterator]': return 'arrayiterator';
50264 }
50265
50266 // other
50267 return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
50268};
50269
50270function ctorName(val) {
50271 return typeof val.constructor === 'function' ? val.constructor.name : null;
50272}
50273
50274function isArray(val) {
50275 if (Array.isArray) return Array.isArray(val);
50276 return val instanceof Array;
50277}
50278
50279function isError(val) {
50280 return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
50281}
50282
50283function isDate(val) {
50284 if (val instanceof Date) return true;
50285 return typeof val.toDateString === 'function'
50286 && typeof val.getDate === 'function'
50287 && typeof val.setDate === 'function';
50288}
50289
50290function isRegexp(val) {
50291 if (val instanceof RegExp) return true;
50292 return typeof val.flags === 'string'
50293 && typeof val.ignoreCase === 'boolean'
50294 && typeof val.multiline === 'boolean'
50295 && typeof val.global === 'boolean';
50296}
50297
50298function isGeneratorFn(name, val) {
50299 return ctorName(name) === 'GeneratorFunction';
50300}
50301
50302function isGeneratorObj(val) {
50303 return typeof val.throw === 'function'
50304 && typeof val.return === 'function'
50305 && typeof val.next === 'function';
50306}
50307
50308function isArguments(val) {
50309 try {
50310 if (typeof val.length === 'number' && typeof val.callee === 'function') {
50311 return true;
50312 }
50313 } catch (err) {
50314 if (err.message.indexOf('callee') !== -1) {
50315 return true;
50316 }
50317 }
50318 return false;
50319}
50320
50321/**
50322 * If you need to support Safari 5-7 (8-10 yr-old browser),
50323 * take a look at https://github.com/feross/is-buffer
50324 */
50325
50326function isBuffer(val) {
50327 if (val.constructor && typeof val.constructor.isBuffer === 'function') {
50328 return val.constructor.isBuffer(val);
50329 }
50330 return false;
50331}
50332
50333
50334/***/ }),
50335
50336/***/ 18493:
50337/***/ (function(module) {
50338
50339"use strict";
50340/*!
50341 * is-extendable <https://github.com/jonschlinkert/is-extendable>
50342 *
50343 * Copyright (c) 2015, Jon Schlinkert.
50344 * Licensed under the MIT License.
50345 */
50346
50347
50348
50349module.exports = function isExtendable(val) {
50350 return typeof val !== 'undefined' && val !== null
50351 && (typeof val === 'object' || typeof val === 'function');
50352};
50353
50354
50355/***/ }),
50356
50357/***/ 87218:
50358/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
50359
50360"use strict";
50361/*!
50362 * is-number <https://github.com/jonschlinkert/is-number>
50363 *
50364 * Copyright (c) 2014-2015, Jon Schlinkert.
50365 * Licensed under the MIT License.
50366 */
50367
50368
50369
50370var typeOf = __webpack_require__(48865);
50371
50372module.exports = function isNumber(num) {
50373 var type = typeOf(num);
50374
50375 if (type === 'string') {
50376 if (!num.trim()) return false;
50377 } else if (type !== 'number') {
50378 return false;
50379 }
50380
50381 return (num - num + 1) >= 0;
50382};
50383
50384
50385/***/ }),
50386
50387/***/ 81064:
50388/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
50389
50390"use strict";
50391/*!
50392 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
50393 *
50394 * Copyright (c) 2014-2017, Jon Schlinkert.
50395 * Released under the MIT License.
50396 */
50397
50398
50399
50400var isObject = __webpack_require__(96667);
50401
50402function isObjectObject(o) {
50403 return isObject(o) === true
50404 && Object.prototype.toString.call(o) === '[object Object]';
50405}
50406
50407module.exports = function isPlainObject(o) {
50408 var ctor,prot;
50409
50410 if (isObjectObject(o) === false) return false;
50411
50412 // If has modified constructor
50413 ctor = o.constructor;
50414 if (typeof ctor !== 'function') return false;
50415
50416 // If has modified prototype
50417 prot = ctor.prototype;
50418 if (isObjectObject(prot) === false) return false;
50419
50420 // If constructor does not have an Object-specific method
50421 if (prot.hasOwnProperty('isPrototypeOf') === false) {
50422 return false;
50423 }
50424
50425 // Most likely a plain Object
50426 return true;
50427};
50428
50429
50430/***/ }),
50431
50432/***/ 21352:
50433/***/ (function(module) {
50434
50435var toString = {}.toString;
50436
50437module.exports = Array.isArray || function (arr) {
50438 return toString.call(arr) == '[object Array]';
50439};
50440
50441
50442/***/ }),
50443
50444/***/ 96667:
50445/***/ (function(module) {
50446
50447"use strict";
50448/*!
50449 * isobject <https://github.com/jonschlinkert/isobject>
50450 *
50451 * Copyright (c) 2014-2017, Jon Schlinkert.
50452 * Released under the MIT License.
50453 */
50454
50455
50456
50457module.exports = function isObject(val) {
50458 return val != null && typeof val === 'object' && Array.isArray(val) === false;
50459};
50460
50461
50462/***/ }),
50463
50464/***/ 48335:
50465/***/ (function(module) {
50466
50467"use strict";
50468
50469
50470module.exports = parseJson
50471function parseJson (txt, reviver, context) {
50472 context = context || 20
50473 try {
50474 return JSON.parse(txt, reviver)
50475 } catch (e) {
50476 if (typeof txt !== 'string') {
50477 const isEmptyArray = Array.isArray(txt) && txt.length === 0
50478 const errorMessage = 'Cannot parse ' +
50479 (isEmptyArray ? 'an empty array' : String(txt))
50480 throw new TypeError(errorMessage)
50481 }
50482 const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i)
50483 const errIdx = syntaxErr
50484 ? +syntaxErr[1]
50485 : e.message.match(/^Unexpected end of JSON.*/i)
50486 ? txt.length - 1
50487 : null
50488 if (errIdx != null) {
50489 const start = errIdx <= context
50490 ? 0
50491 : errIdx - context
50492 const end = errIdx + context >= txt.length
50493 ? txt.length
50494 : errIdx + context
50495 e.message += ` while parsing near '${
50496 start === 0 ? '' : '...'
50497 }${txt.slice(start, end)}${
50498 end === txt.length ? '' : '...'
50499 }'`
50500 } else {
50501 e.message += ` while parsing '${txt.slice(0, context * 2)}'`
50502 }
50503 throw e
50504 }
50505}
50506
50507
50508/***/ }),
50509
50510/***/ 62437:
50511/***/ (function(module) {
50512
50513"use strict";
50514
50515
50516var traverse = module.exports = function (schema, opts, cb) {
50517 // Legacy support for v0.3.1 and earlier.
50518 if (typeof opts == 'function') {
50519 cb = opts;
50520 opts = {};
50521 }
50522
50523 cb = opts.cb || cb;
50524 var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};
50525 var post = cb.post || function() {};
50526
50527 _traverse(opts, pre, post, schema, '', schema);
50528};
50529
50530
50531traverse.keywords = {
50532 additionalItems: true,
50533 items: true,
50534 contains: true,
50535 additionalProperties: true,
50536 propertyNames: true,
50537 not: true
50538};
50539
50540traverse.arrayKeywords = {
50541 items: true,
50542 allOf: true,
50543 anyOf: true,
50544 oneOf: true
50545};
50546
50547traverse.propsKeywords = {
50548 definitions: true,
50549 properties: true,
50550 patternProperties: true,
50551 dependencies: true
50552};
50553
50554traverse.skipKeywords = {
50555 default: true,
50556 enum: true,
50557 const: true,
50558 required: true,
50559 maximum: true,
50560 minimum: true,
50561 exclusiveMaximum: true,
50562 exclusiveMinimum: true,
50563 multipleOf: true,
50564 maxLength: true,
50565 minLength: true,
50566 pattern: true,
50567 format: true,
50568 maxItems: true,
50569 minItems: true,
50570 uniqueItems: true,
50571 maxProperties: true,
50572 minProperties: true
50573};
50574
50575
50576function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
50577 if (schema && typeof schema == 'object' && !Array.isArray(schema)) {
50578 pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
50579 for (var key in schema) {
50580 var sch = schema[key];
50581 if (Array.isArray(sch)) {
50582 if (key in traverse.arrayKeywords) {
50583 for (var i=0; i<sch.length; i++)
50584 _traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
50585 }
50586 } else if (key in traverse.propsKeywords) {
50587 if (sch && typeof sch == 'object') {
50588 for (var prop in sch)
50589 _traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
50590 }
50591 } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
50592 _traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
50593 }
50594 }
50595 post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
50596 }
50597}
50598
50599
50600function escapeJsonPtr(str) {
50601 return str.replace(/~/g, '~0').replace(/\//g, '~1');
50602}
50603
50604
50605/***/ }),
50606
50607/***/ 48865:
50608/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
50609
50610var isBuffer = __webpack_require__(45408);
50611var toString = Object.prototype.toString;
50612
50613/**
50614 * Get the native `typeof` a value.
50615 *
50616 * @param {*} `val`
50617 * @return {*} Native javascript type
50618 */
50619
50620module.exports = function kindOf(val) {
50621 // primitivies
50622 if (typeof val === 'undefined') {
50623 return 'undefined';
50624 }
50625 if (val === null) {
50626 return 'null';
50627 }
50628 if (val === true || val === false || val instanceof Boolean) {
50629 return 'boolean';
50630 }
50631 if (typeof val === 'string' || val instanceof String) {
50632 return 'string';
50633 }
50634 if (typeof val === 'number' || val instanceof Number) {
50635 return 'number';
50636 }
50637
50638 // functions
50639 if (typeof val === 'function' || val instanceof Function) {
50640 return 'function';
50641 }
50642
50643 // array
50644 if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
50645 return 'array';
50646 }
50647
50648 // check for instances of RegExp and Date before calling `toString`
50649 if (val instanceof RegExp) {
50650 return 'regexp';
50651 }
50652 if (val instanceof Date) {
50653 return 'date';
50654 }
50655
50656 // other objects
50657 var type = toString.call(val);
50658
50659 if (type === '[object RegExp]') {
50660 return 'regexp';
50661 }
50662 if (type === '[object Date]') {
50663 return 'date';
50664 }
50665 if (type === '[object Arguments]') {
50666 return 'arguments';
50667 }
50668 if (type === '[object Error]') {
50669 return 'error';
50670 }
50671
50672 // buffer
50673 if (isBuffer(val)) {
50674 return 'buffer';
50675 }
50676
50677 // es6: Map, WeakMap, Set, WeakSet
50678 if (type === '[object Set]') {
50679 return 'set';
50680 }
50681 if (type === '[object WeakSet]') {
50682 return 'weakset';
50683 }
50684 if (type === '[object Map]') {
50685 return 'map';
50686 }
50687 if (type === '[object WeakMap]') {
50688 return 'weakmap';
50689 }
50690 if (type === '[object Symbol]') {
50691 return 'symbol';
50692 }
50693
50694 // typed arrays
50695 if (type === '[object Int8Array]') {
50696 return 'int8array';
50697 }
50698 if (type === '[object Uint8Array]') {
50699 return 'uint8array';
50700 }
50701 if (type === '[object Uint8ClampedArray]') {
50702 return 'uint8clampedarray';
50703 }
50704 if (type === '[object Int16Array]') {
50705 return 'int16array';
50706 }
50707 if (type === '[object Uint16Array]') {
50708 return 'uint16array';
50709 }
50710 if (type === '[object Int32Array]') {
50711 return 'int32array';
50712 }
50713 if (type === '[object Uint32Array]') {
50714 return 'uint32array';
50715 }
50716 if (type === '[object Float32Array]') {
50717 return 'float32array';
50718 }
50719 if (type === '[object Float64Array]') {
50720 return 'float64array';
50721 }
50722
50723 // must be a plain object
50724 return 'object';
50725};
50726
50727
50728/***/ }),
50729
50730/***/ 45408:
50731/***/ (function(module) {
50732
50733/*!
50734 * Determine if an object is a Buffer
50735 *
50736 * @author Feross Aboukhadijeh <https://feross.org>
50737 * @license MIT
50738 */
50739
50740// The _isBuffer check is for Safari 5-7 support, because it's missing
50741// Object.prototype.constructor. Remove this eventually
50742module.exports = function (obj) {
50743 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
50744}
50745
50746function isBuffer (obj) {
50747 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
50748}
50749
50750// For Node v0.10 support. Remove this eventually.
50751function isSlowBuffer (obj) {
50752 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
50753}
50754
50755
50756/***/ }),
50757
50758/***/ 99736:
50759/***/ (function(module) {
50760
50761"use strict";
50762
50763
50764class LoadingLoaderError extends Error {
50765 constructor(message) {
50766 super(message);
50767 this.name = "LoaderRunnerError";
50768 Error.captureStackTrace(this, this.constructor);
50769 }
50770}
50771
50772module.exports = LoadingLoaderError;
50773
50774
50775/***/ }),
50776
50777/***/ 73278:
50778/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
50779
50780/*
50781 MIT License http://www.opensource.org/licenses/mit-license.php
50782 Author Tobias Koppers @sokra
50783*/
50784var fs = __webpack_require__(35747);
50785var readFile = fs.readFile.bind(fs);
50786var loadLoader = __webpack_require__(5384);
50787
50788function utf8BufferToString(buf) {
50789 var str = buf.toString("utf-8");
50790 if(str.charCodeAt(0) === 0xFEFF) {
50791 return str.substr(1);
50792 } else {
50793 return str;
50794 }
50795}
50796
50797function splitQuery(req) {
50798 var i = req.indexOf("?");
50799 if(i < 0) return [req, ""];
50800 return [req.substr(0, i), req.substr(i)];
50801}
50802
50803function dirname(path) {
50804 if(path === "/") return "/";
50805 var i = path.lastIndexOf("/");
50806 var j = path.lastIndexOf("\\");
50807 var i2 = path.indexOf("/");
50808 var j2 = path.indexOf("\\");
50809 var idx = i > j ? i : j;
50810 var idx2 = i > j ? i2 : j2;
50811 if(idx < 0) return path;
50812 if(idx === idx2) return path.substr(0, idx + 1);
50813 return path.substr(0, idx);
50814}
50815
50816function createLoaderObject(loader) {
50817 var obj = {
50818 path: null,
50819 query: null,
50820 options: null,
50821 ident: null,
50822 normal: null,
50823 pitch: null,
50824 raw: null,
50825 data: null,
50826 pitchExecuted: false,
50827 normalExecuted: false
50828 };
50829 Object.defineProperty(obj, "request", {
50830 enumerable: true,
50831 get: function() {
50832 return obj.path + obj.query;
50833 },
50834 set: function(value) {
50835 if(typeof value === "string") {
50836 var splittedRequest = splitQuery(value);
50837 obj.path = splittedRequest[0];
50838 obj.query = splittedRequest[1];
50839 obj.options = undefined;
50840 obj.ident = undefined;
50841 } else {
50842 if(!value.loader)
50843 throw new Error("request should be a string or object with loader and object (" + JSON.stringify(value) + ")");
50844 obj.path = value.loader;
50845 obj.options = value.options;
50846 obj.ident = value.ident;
50847 if(obj.options === null)
50848 obj.query = "";
50849 else if(obj.options === undefined)
50850 obj.query = "";
50851 else if(typeof obj.options === "string")
50852 obj.query = "?" + obj.options;
50853 else if(obj.ident)
50854 obj.query = "??" + obj.ident;
50855 else if(typeof obj.options === "object" && obj.options.ident)
50856 obj.query = "??" + obj.options.ident;
50857 else
50858 obj.query = "?" + JSON.stringify(obj.options);
50859 }
50860 }
50861 });
50862 obj.request = loader;
50863 if(Object.preventExtensions) {
50864 Object.preventExtensions(obj);
50865 }
50866 return obj;
50867}
50868
50869function runSyncOrAsync(fn, context, args, callback) {
50870 var isSync = true;
50871 var isDone = false;
50872 var isError = false; // internal error
50873 var reportedError = false;
50874 context.async = function async() {
50875 if(isDone) {
50876 if(reportedError) return; // ignore
50877 throw new Error("async(): The callback was already called.");
50878 }
50879 isSync = false;
50880 return innerCallback;
50881 };
50882 var innerCallback = context.callback = function() {
50883 if(isDone) {
50884 if(reportedError) return; // ignore
50885 throw new Error("callback(): The callback was already called.");
50886 }
50887 isDone = true;
50888 isSync = false;
50889 try {
50890 callback.apply(null, arguments);
50891 } catch(e) {
50892 isError = true;
50893 throw e;
50894 }
50895 };
50896 try {
50897 var result = (function LOADER_EXECUTION() {
50898 return fn.apply(context, args);
50899 }());
50900 if(isSync) {
50901 isDone = true;
50902 if(result === undefined)
50903 return callback();
50904 if(result && typeof result === "object" && typeof result.then === "function") {
50905 return result.then(function(r) {
50906 callback(null, r);
50907 }, callback);
50908 }
50909 return callback(null, result);
50910 }
50911 } catch(e) {
50912 if(isError) throw e;
50913 if(isDone) {
50914 // loader is already "done", so we cannot use the callback function
50915 // for better debugging we print the error on the console
50916 if(typeof e === "object" && e.stack) console.error(e.stack);
50917 else console.error(e);
50918 return;
50919 }
50920 isDone = true;
50921 reportedError = true;
50922 callback(e);
50923 }
50924
50925}
50926
50927function convertArgs(args, raw) {
50928 if(!raw && Buffer.isBuffer(args[0]))
50929 args[0] = utf8BufferToString(args[0]);
50930 else if(raw && typeof args[0] === "string")
50931 args[0] = new Buffer(args[0], "utf-8"); // eslint-disable-line
50932}
50933
50934function iteratePitchingLoaders(options, loaderContext, callback) {
50935 // abort after last loader
50936 if(loaderContext.loaderIndex >= loaderContext.loaders.length)
50937 return processResource(options, loaderContext, callback);
50938
50939 var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
50940
50941 // iterate
50942 if(currentLoaderObject.pitchExecuted) {
50943 loaderContext.loaderIndex++;
50944 return iteratePitchingLoaders(options, loaderContext, callback);
50945 }
50946
50947 // load loader module
50948 loadLoader(currentLoaderObject, function(err) {
50949 if(err) {
50950 loaderContext.cacheable(false);
50951 return callback(err);
50952 }
50953 var fn = currentLoaderObject.pitch;
50954 currentLoaderObject.pitchExecuted = true;
50955 if(!fn) return iteratePitchingLoaders(options, loaderContext, callback);
50956
50957 runSyncOrAsync(
50958 fn,
50959 loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}],
50960 function(err) {
50961 if(err) return callback(err);
50962 var args = Array.prototype.slice.call(arguments, 1);
50963 if(args.length > 0) {
50964 loaderContext.loaderIndex--;
50965 iterateNormalLoaders(options, loaderContext, args, callback);
50966 } else {
50967 iteratePitchingLoaders(options, loaderContext, callback);
50968 }
50969 }
50970 );
50971 });
50972}
50973
50974function processResource(options, loaderContext, callback) {
50975 // set loader index to last loader
50976 loaderContext.loaderIndex = loaderContext.loaders.length - 1;
50977
50978 var resourcePath = loaderContext.resourcePath;
50979 if(resourcePath) {
50980 loaderContext.addDependency(resourcePath);
50981 options.readResource(resourcePath, function(err, buffer) {
50982 if(err) return callback(err);
50983 options.resourceBuffer = buffer;
50984 iterateNormalLoaders(options, loaderContext, [buffer], callback);
50985 });
50986 } else {
50987 iterateNormalLoaders(options, loaderContext, [null], callback);
50988 }
50989}
50990
50991function iterateNormalLoaders(options, loaderContext, args, callback) {
50992 if(loaderContext.loaderIndex < 0)
50993 return callback(null, args);
50994
50995 var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
50996
50997 // iterate
50998 if(currentLoaderObject.normalExecuted) {
50999 loaderContext.loaderIndex--;
51000 return iterateNormalLoaders(options, loaderContext, args, callback);
51001 }
51002
51003 var fn = currentLoaderObject.normal;
51004 currentLoaderObject.normalExecuted = true;
51005 if(!fn) {
51006 return iterateNormalLoaders(options, loaderContext, args, callback);
51007 }
51008
51009 convertArgs(args, currentLoaderObject.raw);
51010
51011 runSyncOrAsync(fn, loaderContext, args, function(err) {
51012 if(err) return callback(err);
51013
51014 var args = Array.prototype.slice.call(arguments, 1);
51015 iterateNormalLoaders(options, loaderContext, args, callback);
51016 });
51017}
51018
51019exports.getContext = function getContext(resource) {
51020 var splitted = splitQuery(resource);
51021 return dirname(splitted[0]);
51022};
51023
51024exports.runLoaders = function runLoaders(options, callback) {
51025 // read options
51026 var resource = options.resource || "";
51027 var loaders = options.loaders || [];
51028 var loaderContext = options.context || {};
51029 var readResource = options.readResource || readFile;
51030
51031 //
51032 var splittedResource = resource && splitQuery(resource);
51033 var resourcePath = splittedResource ? splittedResource[0] : undefined;
51034 var resourceQuery = splittedResource ? splittedResource[1] : undefined;
51035 var contextDirectory = resourcePath ? dirname(resourcePath) : null;
51036
51037 // execution state
51038 var requestCacheable = true;
51039 var fileDependencies = [];
51040 var contextDependencies = [];
51041
51042 // prepare loader objects
51043 loaders = loaders.map(createLoaderObject);
51044
51045 loaderContext.context = contextDirectory;
51046 loaderContext.loaderIndex = 0;
51047 loaderContext.loaders = loaders;
51048 loaderContext.resourcePath = resourcePath;
51049 loaderContext.resourceQuery = resourceQuery;
51050 loaderContext.async = null;
51051 loaderContext.callback = null;
51052 loaderContext.cacheable = function cacheable(flag) {
51053 if(flag === false) {
51054 requestCacheable = false;
51055 }
51056 };
51057 loaderContext.dependency = loaderContext.addDependency = function addDependency(file) {
51058 fileDependencies.push(file);
51059 };
51060 loaderContext.addContextDependency = function addContextDependency(context) {
51061 contextDependencies.push(context);
51062 };
51063 loaderContext.getDependencies = function getDependencies() {
51064 return fileDependencies.slice();
51065 };
51066 loaderContext.getContextDependencies = function getContextDependencies() {
51067 return contextDependencies.slice();
51068 };
51069 loaderContext.clearDependencies = function clearDependencies() {
51070 fileDependencies.length = 0;
51071 contextDependencies.length = 0;
51072 requestCacheable = true;
51073 };
51074 Object.defineProperty(loaderContext, "resource", {
51075 enumerable: true,
51076 get: function() {
51077 if(loaderContext.resourcePath === undefined)
51078 return undefined;
51079 return loaderContext.resourcePath + loaderContext.resourceQuery;
51080 },
51081 set: function(value) {
51082 var splittedResource = value && splitQuery(value);
51083 loaderContext.resourcePath = splittedResource ? splittedResource[0] : undefined;
51084 loaderContext.resourceQuery = splittedResource ? splittedResource[1] : undefined;
51085 }
51086 });
51087 Object.defineProperty(loaderContext, "request", {
51088 enumerable: true,
51089 get: function() {
51090 return loaderContext.loaders.map(function(o) {
51091 return o.request;
51092 }).concat(loaderContext.resource || "").join("!");
51093 }
51094 });
51095 Object.defineProperty(loaderContext, "remainingRequest", {
51096 enumerable: true,
51097 get: function() {
51098 if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource)
51099 return "";
51100 return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) {
51101 return o.request;
51102 }).concat(loaderContext.resource || "").join("!");
51103 }
51104 });
51105 Object.defineProperty(loaderContext, "currentRequest", {
51106 enumerable: true,
51107 get: function() {
51108 return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) {
51109 return o.request;
51110 }).concat(loaderContext.resource || "").join("!");
51111 }
51112 });
51113 Object.defineProperty(loaderContext, "previousRequest", {
51114 enumerable: true,
51115 get: function() {
51116 return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) {
51117 return o.request;
51118 }).join("!");
51119 }
51120 });
51121 Object.defineProperty(loaderContext, "query", {
51122 enumerable: true,
51123 get: function() {
51124 var entry = loaderContext.loaders[loaderContext.loaderIndex];
51125 return entry.options && typeof entry.options === "object" ? entry.options : entry.query;
51126 }
51127 });
51128 Object.defineProperty(loaderContext, "data", {
51129 enumerable: true,
51130 get: function() {
51131 return loaderContext.loaders[loaderContext.loaderIndex].data;
51132 }
51133 });
51134
51135 // finish loader context
51136 if(Object.preventExtensions) {
51137 Object.preventExtensions(loaderContext);
51138 }
51139
51140 var processOptions = {
51141 resourceBuffer: null,
51142 readResource: readResource
51143 };
51144 iteratePitchingLoaders(processOptions, loaderContext, function(err, result) {
51145 if(err) {
51146 return callback(err, {
51147 cacheable: requestCacheable,
51148 fileDependencies: fileDependencies,
51149 contextDependencies: contextDependencies
51150 });
51151 }
51152 callback(null, {
51153 result: result,
51154 resourceBuffer: processOptions.resourceBuffer,
51155 cacheable: requestCacheable,
51156 fileDependencies: fileDependencies,
51157 contextDependencies: contextDependencies
51158 });
51159 });
51160};
51161
51162
51163/***/ }),
51164
51165/***/ 5384:
51166/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51167
51168var LoaderLoadingError = __webpack_require__(99736);
51169
51170module.exports = function loadLoader(loader, callback) {
51171 if(typeof System === "object" && typeof System.import === "function") {
51172 System.import(loader.path).catch(callback).then(function(module) {
51173 loader.normal = typeof module === "function" ? module : module.default;
51174 loader.pitch = module.pitch;
51175 loader.raw = module.raw;
51176 if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") {
51177 return callback(new LoaderLoadingError(
51178 "Module '" + loader.path + "' is not a loader (must have normal or pitch function)"
51179 ));
51180 }
51181 callback();
51182 });
51183 } else {
51184 try {
51185 var module = require(loader.path);
51186 } catch(e) {
51187 // it is possible for node to choke on a require if the FD descriptor
51188 // limit has been reached. give it a chance to recover.
51189 if(e instanceof Error && e.code === "EMFILE") {
51190 var retry = loadLoader.bind(null, loader, callback);
51191 if(typeof setImmediate === "function") {
51192 // node >= 0.9.0
51193 return setImmediate(retry);
51194 } else {
51195 // node < 0.9.0
51196 return process.nextTick(retry);
51197 }
51198 }
51199 return callback(e);
51200 }
51201 if(typeof module !== "function" && typeof module !== "object") {
51202 return callback(new LoaderLoadingError(
51203 "Module '" + loader.path + "' is not a loader (export function or es6 module)"
51204 ));
51205 }
51206 loader.normal = typeof module === "function" ? module : module.default;
51207 loader.pitch = module.pitch;
51208 loader.raw = module.raw;
51209 if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") {
51210 return callback(new LoaderLoadingError(
51211 "Module '" + loader.path + "' is not a loader (must have normal or pitch function)"
51212 ));
51213 }
51214 callback();
51215 }
51216};
51217
51218
51219/***/ }),
51220
51221/***/ 4337:
51222/***/ (function(module) {
51223
51224"use strict";
51225/*!
51226 * map-cache <https://github.com/jonschlinkert/map-cache>
51227 *
51228 * Copyright (c) 2015, Jon Schlinkert.
51229 * Licensed under the MIT License.
51230 */
51231
51232
51233
51234var hasOwn = Object.prototype.hasOwnProperty;
51235
51236/**
51237 * Expose `MapCache`
51238 */
51239
51240module.exports = MapCache;
51241
51242/**
51243 * Creates a cache object to store key/value pairs.
51244 *
51245 * ```js
51246 * var cache = new MapCache();
51247 * ```
51248 *
51249 * @api public
51250 */
51251
51252function MapCache(data) {
51253 this.__data__ = data || {};
51254}
51255
51256/**
51257 * Adds `value` to `key` on the cache.
51258 *
51259 * ```js
51260 * cache.set('foo', 'bar');
51261 * ```
51262 *
51263 * @param {String} `key` The key of the value to cache.
51264 * @param {*} `value` The value to cache.
51265 * @returns {Object} Returns the `Cache` object for chaining.
51266 * @api public
51267 */
51268
51269MapCache.prototype.set = function mapSet(key, value) {
51270 if (key !== '__proto__') {
51271 this.__data__[key] = value;
51272 }
51273 return this;
51274};
51275
51276/**
51277 * Gets the cached value for `key`.
51278 *
51279 * ```js
51280 * cache.get('foo');
51281 * //=> 'bar'
51282 * ```
51283 *
51284 * @param {String} `key` The key of the value to get.
51285 * @returns {*} Returns the cached value.
51286 * @api public
51287 */
51288
51289MapCache.prototype.get = function mapGet(key) {
51290 return key === '__proto__' ? undefined : this.__data__[key];
51291};
51292
51293/**
51294 * Checks if a cached value for `key` exists.
51295 *
51296 * ```js
51297 * cache.has('foo');
51298 * //=> true
51299 * ```
51300 *
51301 * @param {String} `key` The key of the entry to check.
51302 * @returns {Boolean} Returns `true` if an entry for `key` exists, else `false`.
51303 * @api public
51304 */
51305
51306MapCache.prototype.has = function mapHas(key) {
51307 return key !== '__proto__' && hasOwn.call(this.__data__, key);
51308};
51309
51310/**
51311 * Removes `key` and its value from the cache.
51312 *
51313 * ```js
51314 * cache.del('foo');
51315 * ```
51316 * @title .del
51317 * @param {String} `key` The key of the value to remove.
51318 * @returns {Boolean} Returns `true` if the entry was removed successfully, else `false`.
51319 * @api public
51320 */
51321
51322MapCache.prototype.del = function mapDelete(key) {
51323 return this.has(key) && delete this.__data__[key];
51324};
51325
51326
51327/***/ }),
51328
51329/***/ 11270:
51330/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51331
51332"use strict";
51333
51334
51335var util = __webpack_require__(31669);
51336var visit = __webpack_require__(59248);
51337
51338/**
51339 * Map `visit` over an array of objects.
51340 *
51341 * @param {Object} `collection` The context in which to invoke `method`
51342 * @param {String} `method` Name of the method to call on `collection`
51343 * @param {Object} `arr` Array of objects.
51344 */
51345
51346module.exports = function mapVisit(collection, method, val) {
51347 if (isObject(val)) {
51348 return visit.apply(null, arguments);
51349 }
51350
51351 if (!Array.isArray(val)) {
51352 throw new TypeError('expected an array: ' + util.inspect(val));
51353 }
51354
51355 var args = [].slice.call(arguments, 3);
51356
51357 for (var i = 0; i < val.length; i++) {
51358 var ele = val[i];
51359 if (isObject(ele)) {
51360 visit.apply(null, [collection, method, ele].concat(args));
51361 } else {
51362 collection[method].apply(collection, [ele].concat(args));
51363 }
51364 }
51365};
51366
51367function isObject(val) {
51368 return val && (typeof val === 'function' || (!Array.isArray(val) && typeof val === 'object'));
51369}
51370
51371
51372/***/ }),
51373
51374/***/ 32327:
51375/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51376
51377/*
51378 MIT License http://www.opensource.org/licenses/mit-license.php
51379 Author Tobias Koppers @sokra
51380*/
51381
51382var normalize = __webpack_require__(25458);
51383var errors = __webpack_require__(48916);
51384var stream = __webpack_require__(68193);
51385
51386var ReadableStream = stream.Readable;
51387var WritableStream = stream.Writable;
51388
51389function MemoryFileSystemError(err, path) {
51390 Error.call(this)
51391 if (Error.captureStackTrace)
51392 Error.captureStackTrace(this, arguments.callee)
51393 this.code = err.code;
51394 this.errno = err.errno;
51395 this.message = err.description;
51396 this.path = path;
51397}
51398MemoryFileSystemError.prototype = new Error();
51399
51400function MemoryFileSystem(data) {
51401 this.data = data || {};
51402}
51403module.exports = MemoryFileSystem;
51404
51405function isDir(item) {
51406 if(typeof item !== "object") return false;
51407 return item[""] === true;
51408}
51409
51410function isFile(item) {
51411 if(typeof item !== "object") return false;
51412 return !item[""];
51413}
51414
51415function pathToArray(path) {
51416 path = normalize(path);
51417 var nix = /^\//.test(path);
51418 if(!nix) {
51419 if(!/^[A-Za-z]:/.test(path)) {
51420 throw new MemoryFileSystemError(errors.code.EINVAL, path);
51421 }
51422 path = path.replace(/[\\\/]+/g, "\\"); // multi slashs
51423 path = path.split(/[\\\/]/);
51424 path[0] = path[0].toUpperCase();
51425 } else {
51426 path = path.replace(/\/+/g, "/"); // multi slashs
51427 path = path.substr(1).split("/");
51428 }
51429 if(!path[path.length-1]) path.pop();
51430 return path;
51431}
51432
51433function trueFn() { return true; }
51434function falseFn() { return false; }
51435
51436MemoryFileSystem.prototype.meta = function(_path) {
51437 var path = pathToArray(_path);
51438 var current = this.data;
51439 for(var i = 0; i < path.length - 1; i++) {
51440 if(!isDir(current[path[i]]))
51441 return;
51442 current = current[path[i]];
51443 }
51444 return current[path[i]];
51445}
51446
51447MemoryFileSystem.prototype.existsSync = function(_path) {
51448 return !!this.meta(_path);
51449}
51450
51451MemoryFileSystem.prototype.statSync = function(_path) {
51452 var current = this.meta(_path);
51453 if(_path === "/" || isDir(current)) {
51454 return {
51455 isFile: falseFn,
51456 isDirectory: trueFn,
51457 isBlockDevice: falseFn,
51458 isCharacterDevice: falseFn,
51459 isSymbolicLink: falseFn,
51460 isFIFO: falseFn,
51461 isSocket: falseFn
51462 };
51463 } else if(isFile(current)) {
51464 return {
51465 isFile: trueFn,
51466 isDirectory: falseFn,
51467 isBlockDevice: falseFn,
51468 isCharacterDevice: falseFn,
51469 isSymbolicLink: falseFn,
51470 isFIFO: falseFn,
51471 isSocket: falseFn
51472 };
51473 } else {
51474 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51475 }
51476};
51477
51478MemoryFileSystem.prototype.readFileSync = function(_path, encoding) {
51479 var path = pathToArray(_path);
51480 var current = this.data;
51481 for(var i = 0; i < path.length - 1; i++) {
51482 if(!isDir(current[path[i]]))
51483 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51484 current = current[path[i]];
51485 }
51486 if(!isFile(current[path[i]])) {
51487 if(isDir(current[path[i]]))
51488 throw new MemoryFileSystemError(errors.code.EISDIR, _path);
51489 else
51490 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51491 }
51492 current = current[path[i]];
51493 return encoding ? current.toString(encoding) : current;
51494};
51495
51496MemoryFileSystem.prototype.readdirSync = function(_path) {
51497 if(_path === "/") return Object.keys(this.data).filter(Boolean);
51498 var path = pathToArray(_path);
51499 var current = this.data;
51500 for(var i = 0; i < path.length - 1; i++) {
51501 if(!isDir(current[path[i]]))
51502 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51503 current = current[path[i]];
51504 }
51505 if(!isDir(current[path[i]])) {
51506 if(isFile(current[path[i]]))
51507 throw new MemoryFileSystemError(errors.code.ENOTDIR, _path);
51508 else
51509 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51510 }
51511 return Object.keys(current[path[i]]).filter(Boolean);
51512};
51513
51514MemoryFileSystem.prototype.mkdirpSync = function(_path) {
51515 var path = pathToArray(_path);
51516 if(path.length === 0) return;
51517 var current = this.data;
51518 for(var i = 0; i < path.length; i++) {
51519 if(isFile(current[path[i]]))
51520 throw new MemoryFileSystemError(errors.code.ENOTDIR, _path);
51521 else if(!isDir(current[path[i]]))
51522 current[path[i]] = {"":true};
51523 current = current[path[i]];
51524 }
51525 return;
51526};
51527
51528MemoryFileSystem.prototype.mkdirSync = function(_path) {
51529 var path = pathToArray(_path);
51530 if(path.length === 0) return;
51531 var current = this.data;
51532 for(var i = 0; i < path.length - 1; i++) {
51533 if(!isDir(current[path[i]]))
51534 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51535 current = current[path[i]];
51536 }
51537 if(isDir(current[path[i]]))
51538 throw new MemoryFileSystemError(errors.code.EEXIST, _path);
51539 else if(isFile(current[path[i]]))
51540 throw new MemoryFileSystemError(errors.code.ENOTDIR, _path);
51541 current[path[i]] = {"":true};
51542 return;
51543};
51544
51545MemoryFileSystem.prototype._remove = function(_path, name, testFn) {
51546 var path = pathToArray(_path);
51547 if(path.length === 0) {
51548 throw new MemoryFileSystemError(errors.code.EPERM, _path);
51549 }
51550 var current = this.data;
51551 for(var i = 0; i < path.length - 1; i++) {
51552 if(!isDir(current[path[i]]))
51553 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51554 current = current[path[i]];
51555 }
51556 if(!testFn(current[path[i]]))
51557 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51558 delete current[path[i]];
51559 return;
51560};
51561
51562MemoryFileSystem.prototype.rmdirSync = function(_path) {
51563 return this._remove(_path, "Directory", isDir);
51564};
51565
51566MemoryFileSystem.prototype.unlinkSync = function(_path) {
51567 return this._remove(_path, "File", isFile);
51568};
51569
51570MemoryFileSystem.prototype.readlinkSync = function(_path) {
51571 throw new MemoryFileSystemError(errors.code.ENOSYS, _path);
51572};
51573
51574MemoryFileSystem.prototype.writeFileSync = function(_path, content, encoding) {
51575 if(!content && !encoding) throw new Error("No content");
51576 var path = pathToArray(_path);
51577 if(path.length === 0) {
51578 throw new MemoryFileSystemError(errors.code.EISDIR, _path);
51579 }
51580 var current = this.data;
51581 for(var i = 0; i < path.length - 1; i++) {
51582 if(!isDir(current[path[i]]))
51583 throw new MemoryFileSystemError(errors.code.ENOENT, _path);
51584 current = current[path[i]];
51585 }
51586 if(isDir(current[path[i]]))
51587 throw new MemoryFileSystemError(errors.code.EISDIR, _path);
51588 current[path[i]] = encoding || typeof content === "string" ? new Buffer(content, encoding) : content;
51589 return;
51590};
51591
51592MemoryFileSystem.prototype.join = __webpack_require__(89597);
51593MemoryFileSystem.prototype.pathToArray = pathToArray;
51594MemoryFileSystem.prototype.normalize = normalize;
51595
51596// stream functions
51597
51598MemoryFileSystem.prototype.createReadStream = function(path, options) {
51599 var stream = new ReadableStream();
51600 var done = false;
51601 var data;
51602 try {
51603 data = this.readFileSync(path);
51604 } catch (e) {
51605 stream._read = function() {
51606 if (done) {
51607 return;
51608 }
51609 done = true;
51610 this.emit('error', e);
51611 this.push(null);
51612 };
51613 return stream;
51614 }
51615 options = options || { };
51616 options.start = options.start || 0;
51617 options.end = options.end || data.length;
51618 stream._read = function() {
51619 if (done) {
51620 return;
51621 }
51622 done = true;
51623 this.push(data.slice(options.start, options.end));
51624 this.push(null);
51625 };
51626 return stream;
51627};
51628
51629MemoryFileSystem.prototype.createWriteStream = function(path, options) {
51630 var stream = new WritableStream(), self = this;
51631 try {
51632 // Zero the file and make sure it is writable
51633 this.writeFileSync(path, new Buffer(0));
51634 } catch(e) {
51635 // This or setImmediate?
51636 stream.once('prefinish', function() {
51637 stream.emit('error', e);
51638 });
51639 return stream;
51640 }
51641 var bl = [ ], len = 0;
51642 stream._write = function(chunk, encoding, callback) {
51643 bl.push(chunk);
51644 len += chunk.length;
51645 self.writeFile(path, Buffer.concat(bl, len), callback);
51646 }
51647 return stream;
51648};
51649
51650// async functions
51651
51652["stat", "readdir", "mkdirp", "rmdir", "unlink", "readlink"].forEach(function(fn) {
51653 MemoryFileSystem.prototype[fn] = function(path, callback) {
51654 try {
51655 var result = this[fn + "Sync"](path);
51656 } catch(e) {
51657 setImmediate(function() {
51658 callback(e);
51659 });
51660
51661 return;
51662 }
51663 setImmediate(function() {
51664 callback(null, result);
51665 });
51666 };
51667});
51668
51669["mkdir", "readFile"].forEach(function(fn) {
51670 MemoryFileSystem.prototype[fn] = function(path, optArg, callback) {
51671 if(!callback) {
51672 callback = optArg;
51673 optArg = undefined;
51674 }
51675 try {
51676 var result = this[fn + "Sync"](path, optArg);
51677 } catch(e) {
51678 setImmediate(function() {
51679 callback(e);
51680 });
51681
51682 return;
51683 }
51684 setImmediate(function() {
51685 callback(null, result);
51686 });
51687 };
51688});
51689
51690MemoryFileSystem.prototype.exists = function(path, callback) {
51691 return callback(this.existsSync(path));
51692}
51693
51694MemoryFileSystem.prototype.writeFile = function (path, content, encoding, callback) {
51695 if(!callback) {
51696 callback = encoding;
51697 encoding = undefined;
51698 }
51699 try {
51700 this.writeFileSync(path, content, encoding);
51701 } catch(e) {
51702 return callback(e);
51703 }
51704 return callback();
51705};
51706
51707
51708/***/ }),
51709
51710/***/ 89597:
51711/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51712
51713var normalize = __webpack_require__(25458);
51714
51715var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i;
51716var absoluteNixRegExp = /^\//i;
51717
51718module.exports = function join(path, request) {
51719 if(!request) return normalize(path);
51720 if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\"));
51721 if(absoluteNixRegExp.test(request)) return normalize(request);
51722 if(path == "/") return normalize(path + request);
51723 if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\"));
51724 if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request);
51725 return normalize(path + "/" + request);
51726};
51727
51728
51729/***/ }),
51730
51731/***/ 25458:
51732/***/ (function(module) {
51733
51734module.exports = function normalize(path) {
51735 var parts = path.split(/(\\+|\/+)/);
51736 if(parts.length === 1)
51737 return path;
51738 var result = [];
51739 var absolutePathStart = 0;
51740 for(var i = 0, sep = false; i < parts.length; i++, sep = !sep) {
51741 var part = parts[i];
51742 if(i === 0 && /^([A-Z]:)?$/i.test(part)) {
51743 result.push(part);
51744 absolutePathStart = 2;
51745 } else if(sep) {
51746 result.push(part[0]);
51747 } else if(part === "..") {
51748 switch(result.length) {
51749 case 0:
51750 // i. e. ".." => ".."
51751 // i. e. "../a/b/c" => "../a/b/c"
51752 result.push(part);
51753 break;
51754 case 2:
51755 // i. e. "a/.." => ""
51756 // i. e. "/.." => "/"
51757 // i. e. "C:\.." => "C:\"
51758 // i. e. "a/../b/c" => "b/c"
51759 // i. e. "/../b/c" => "/b/c"
51760 // i. e. "C:\..\a\b\c" => "C:\a\b\c"
51761 i++;
51762 sep = !sep;
51763 result.length = absolutePathStart;
51764 break;
51765 case 4:
51766 // i. e. "a/b/.." => "a"
51767 // i. e. "/a/.." => "/"
51768 // i. e. "C:\a\.." => "C:\"
51769 // i. e. "/a/../b/c" => "/b/c"
51770 if(absolutePathStart === 0) {
51771 result.length -= 3;
51772 } else {
51773 i++;
51774 sep = !sep;
51775 result.length = 2;
51776 }
51777 break;
51778 default:
51779 // i. e. "/a/b/.." => "/a"
51780 // i. e. "/a/b/../c" => "/a/c"
51781 result.length -= 3;
51782 break;
51783 }
51784 } else if(part === ".") {
51785 switch(result.length) {
51786 case 0:
51787 // i. e. "." => "."
51788 // i. e. "./a/b/c" => "./a/b/c"
51789 result.push(part);
51790 break;
51791 case 2:
51792 // i. e. "a/." => "a"
51793 // i. e. "/." => "/"
51794 // i. e. "C:\." => "C:\"
51795 // i. e. "C:\.\a\b\c" => "C:\a\b\c"
51796 if(absolutePathStart === 0) {
51797 result.length--;
51798 } else {
51799 i++;
51800 sep = !sep;
51801 }
51802 break;
51803 default:
51804 // i. e. "a/b/." => "a/b"
51805 // i. e. "/a/." => "/"
51806 // i. e. "C:\a\." => "C:\"
51807 // i. e. "a/./b/c" => "a/b/c"
51808 // i. e. "/a/./b/c" => "/a/b/c"
51809 result.length--;
51810 break;
51811 }
51812 } else if(part) {
51813 result.push(part);
51814 }
51815 }
51816 if(result.length === 1 && /^[A-Za-z]:$/.test(result))
51817 return result[0] + "\\";
51818 return result.join("");
51819};
51820
51821
51822/***/ }),
51823
51824/***/ 53024:
51825/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51826
51827"use strict";
51828
51829
51830/**
51831 * Module dependencies
51832 */
51833
51834var util = __webpack_require__(31669);
51835var braces = __webpack_require__(50559);
51836var toRegex = __webpack_require__(51279);
51837var extend = __webpack_require__(3767);
51838
51839/**
51840 * Local dependencies
51841 */
51842
51843var compilers = __webpack_require__(26113);
51844var parsers = __webpack_require__(14086);
51845var cache = __webpack_require__(34743);
51846var utils = __webpack_require__(63976);
51847var MAX_LENGTH = 1024 * 64;
51848
51849/**
51850 * The main function takes a list of strings and one or more
51851 * glob patterns to use for matching.
51852 *
51853 * ```js
51854 * var mm = require('micromatch');
51855 * mm(list, patterns[, options]);
51856 *
51857 * console.log(mm(['a.js', 'a.txt'], ['*.js']));
51858 * //=> [ 'a.js' ]
51859 * ```
51860 * @param {Array} `list` A list of strings to match
51861 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
51862 * @param {Object} `options` See available [options](#options) for changing how matches are performed
51863 * @return {Array} Returns an array of matches
51864 * @summary false
51865 * @api public
51866 */
51867
51868function micromatch(list, patterns, options) {
51869 patterns = utils.arrayify(patterns);
51870 list = utils.arrayify(list);
51871
51872 var len = patterns.length;
51873 if (list.length === 0 || len === 0) {
51874 return [];
51875 }
51876
51877 if (len === 1) {
51878 return micromatch.match(list, patterns[0], options);
51879 }
51880
51881 var omit = [];
51882 var keep = [];
51883 var idx = -1;
51884
51885 while (++idx < len) {
51886 var pattern = patterns[idx];
51887
51888 if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) {
51889 omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options));
51890 } else {
51891 keep.push.apply(keep, micromatch.match(list, pattern, options));
51892 }
51893 }
51894
51895 var matches = utils.diff(keep, omit);
51896 if (!options || options.nodupes !== false) {
51897 return utils.unique(matches);
51898 }
51899
51900 return matches;
51901}
51902
51903/**
51904 * Similar to the main function, but `pattern` must be a string.
51905 *
51906 * ```js
51907 * var mm = require('micromatch');
51908 * mm.match(list, pattern[, options]);
51909 *
51910 * console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
51911 * //=> ['a.a', 'a.aa']
51912 * ```
51913 * @param {Array} `list` Array of strings to match
51914 * @param {String} `pattern` Glob pattern to use for matching.
51915 * @param {Object} `options` See available [options](#options) for changing how matches are performed
51916 * @return {Array} Returns an array of matches
51917 * @api public
51918 */
51919
51920micromatch.match = function(list, pattern, options) {
51921 if (Array.isArray(pattern)) {
51922 throw new TypeError('expected pattern to be a string');
51923 }
51924
51925 var unixify = utils.unixify(options);
51926 var isMatch = memoize('match', pattern, options, micromatch.matcher);
51927 var matches = [];
51928
51929 list = utils.arrayify(list);
51930 var len = list.length;
51931 var idx = -1;
51932
51933 while (++idx < len) {
51934 var ele = list[idx];
51935 if (ele === pattern || isMatch(ele)) {
51936 matches.push(utils.value(ele, unixify, options));
51937 }
51938 }
51939
51940 // if no options were passed, uniquify results and return
51941 if (typeof options === 'undefined') {
51942 return utils.unique(matches);
51943 }
51944
51945 if (matches.length === 0) {
51946 if (options.failglob === true) {
51947 throw new Error('no matches found for "' + pattern + '"');
51948 }
51949 if (options.nonull === true || options.nullglob === true) {
51950 return [options.unescape ? utils.unescape(pattern) : pattern];
51951 }
51952 }
51953
51954 // if `opts.ignore` was defined, diff ignored list
51955 if (options.ignore) {
51956 matches = micromatch.not(matches, options.ignore, options);
51957 }
51958
51959 return options.nodupes !== false ? utils.unique(matches) : matches;
51960};
51961
51962/**
51963 * Returns true if the specified `string` matches the given glob `pattern`.
51964 *
51965 * ```js
51966 * var mm = require('micromatch');
51967 * mm.isMatch(string, pattern[, options]);
51968 *
51969 * console.log(mm.isMatch('a.a', '*.a'));
51970 * //=> true
51971 * console.log(mm.isMatch('a.b', '*.a'));
51972 * //=> false
51973 * ```
51974 * @param {String} `string` String to match
51975 * @param {String} `pattern` Glob pattern to use for matching.
51976 * @param {Object} `options` See available [options](#options) for changing how matches are performed
51977 * @return {Boolean} Returns true if the string matches the glob pattern.
51978 * @api public
51979 */
51980
51981micromatch.isMatch = function(str, pattern, options) {
51982 if (typeof str !== 'string') {
51983 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
51984 }
51985
51986 if (isEmptyString(str) || isEmptyString(pattern)) {
51987 return false;
51988 }
51989
51990 var equals = utils.equalsPattern(options);
51991 if (equals(str)) {
51992 return true;
51993 }
51994
51995 var isMatch = memoize('isMatch', pattern, options, micromatch.matcher);
51996 return isMatch(str);
51997};
51998
51999/**
52000 * Returns true if some of the strings in the given `list` match any of the
52001 * given glob `patterns`.
52002 *
52003 * ```js
52004 * var mm = require('micromatch');
52005 * mm.some(list, patterns[, options]);
52006 *
52007 * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
52008 * // true
52009 * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
52010 * // false
52011 * ```
52012 * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
52013 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
52014 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52015 * @return {Boolean} Returns true if any patterns match `str`
52016 * @api public
52017 */
52018
52019micromatch.some = function(list, patterns, options) {
52020 if (typeof list === 'string') {
52021 list = [list];
52022 }
52023 for (var i = 0; i < list.length; i++) {
52024 if (micromatch(list[i], patterns, options).length === 1) {
52025 return true;
52026 }
52027 }
52028 return false;
52029};
52030
52031/**
52032 * Returns true if every string in the given `list` matches
52033 * any of the given glob `patterns`.
52034 *
52035 * ```js
52036 * var mm = require('micromatch');
52037 * mm.every(list, patterns[, options]);
52038 *
52039 * console.log(mm.every('foo.js', ['foo.js']));
52040 * // true
52041 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
52042 * // true
52043 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
52044 * // false
52045 * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
52046 * // false
52047 * ```
52048 * @param {String|Array} `list` The string or array of strings to test.
52049 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
52050 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52051 * @return {Boolean} Returns true if any patterns match `str`
52052 * @api public
52053 */
52054
52055micromatch.every = function(list, patterns, options) {
52056 if (typeof list === 'string') {
52057 list = [list];
52058 }
52059 for (var i = 0; i < list.length; i++) {
52060 if (micromatch(list[i], patterns, options).length !== 1) {
52061 return false;
52062 }
52063 }
52064 return true;
52065};
52066
52067/**
52068 * Returns true if **any** of the given glob `patterns`
52069 * match the specified `string`.
52070 *
52071 * ```js
52072 * var mm = require('micromatch');
52073 * mm.any(string, patterns[, options]);
52074 *
52075 * console.log(mm.any('a.a', ['b.*', '*.a']));
52076 * //=> true
52077 * console.log(mm.any('a.a', 'b.*'));
52078 * //=> false
52079 * ```
52080 * @param {String|Array} `str` The string to test.
52081 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
52082 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52083 * @return {Boolean} Returns true if any patterns match `str`
52084 * @api public
52085 */
52086
52087micromatch.any = function(str, patterns, options) {
52088 if (typeof str !== 'string') {
52089 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
52090 }
52091
52092 if (isEmptyString(str) || isEmptyString(patterns)) {
52093 return false;
52094 }
52095
52096 if (typeof patterns === 'string') {
52097 patterns = [patterns];
52098 }
52099
52100 for (var i = 0; i < patterns.length; i++) {
52101 if (micromatch.isMatch(str, patterns[i], options)) {
52102 return true;
52103 }
52104 }
52105 return false;
52106};
52107
52108/**
52109 * Returns true if **all** of the given `patterns` match
52110 * the specified string.
52111 *
52112 * ```js
52113 * var mm = require('micromatch');
52114 * mm.all(string, patterns[, options]);
52115 *
52116 * console.log(mm.all('foo.js', ['foo.js']));
52117 * // true
52118 *
52119 * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
52120 * // false
52121 *
52122 * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
52123 * // true
52124 *
52125 * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
52126 * // true
52127 * ```
52128 * @param {String|Array} `str` The string to test.
52129 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
52130 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52131 * @return {Boolean} Returns true if any patterns match `str`
52132 * @api public
52133 */
52134
52135micromatch.all = function(str, patterns, options) {
52136 if (typeof str !== 'string') {
52137 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
52138 }
52139 if (typeof patterns === 'string') {
52140 patterns = [patterns];
52141 }
52142 for (var i = 0; i < patterns.length; i++) {
52143 if (!micromatch.isMatch(str, patterns[i], options)) {
52144 return false;
52145 }
52146 }
52147 return true;
52148};
52149
52150/**
52151 * Returns a list of strings that _**do not match any**_ of the given `patterns`.
52152 *
52153 * ```js
52154 * var mm = require('micromatch');
52155 * mm.not(list, patterns[, options]);
52156 *
52157 * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
52158 * //=> ['b.b', 'c.c']
52159 * ```
52160 * @param {Array} `list` Array of strings to match.
52161 * @param {String|Array} `patterns` One or more glob pattern to use for matching.
52162 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52163 * @return {Array} Returns an array of strings that **do not match** the given patterns.
52164 * @api public
52165 */
52166
52167micromatch.not = function(list, patterns, options) {
52168 var opts = extend({}, options);
52169 var ignore = opts.ignore;
52170 delete opts.ignore;
52171
52172 var unixify = utils.unixify(opts);
52173 list = utils.arrayify(list).map(unixify);
52174
52175 var matches = utils.diff(list, micromatch(list, patterns, opts));
52176 if (ignore) {
52177 matches = utils.diff(matches, micromatch(list, ignore));
52178 }
52179
52180 return opts.nodupes !== false ? utils.unique(matches) : matches;
52181};
52182
52183/**
52184 * Returns true if the given `string` contains the given pattern. Similar
52185 * to [.isMatch](#isMatch) but the pattern can match any part of the string.
52186 *
52187 * ```js
52188 * var mm = require('micromatch');
52189 * mm.contains(string, pattern[, options]);
52190 *
52191 * console.log(mm.contains('aa/bb/cc', '*b'));
52192 * //=> true
52193 * console.log(mm.contains('aa/bb/cc', '*d'));
52194 * //=> false
52195 * ```
52196 * @param {String} `str` The string to match.
52197 * @param {String|Array} `patterns` Glob pattern to use for matching.
52198 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52199 * @return {Boolean} Returns true if the patter matches any part of `str`.
52200 * @api public
52201 */
52202
52203micromatch.contains = function(str, patterns, options) {
52204 if (typeof str !== 'string') {
52205 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
52206 }
52207
52208 if (typeof patterns === 'string') {
52209 if (isEmptyString(str) || isEmptyString(patterns)) {
52210 return false;
52211 }
52212
52213 var equals = utils.equalsPattern(patterns, options);
52214 if (equals(str)) {
52215 return true;
52216 }
52217 var contains = utils.containsPattern(patterns, options);
52218 if (contains(str)) {
52219 return true;
52220 }
52221 }
52222
52223 var opts = extend({}, options, {contains: true});
52224 return micromatch.any(str, patterns, opts);
52225};
52226
52227/**
52228 * Returns true if the given pattern and options should enable
52229 * the `matchBase` option.
52230 * @return {Boolean}
52231 * @api private
52232 */
52233
52234micromatch.matchBase = function(pattern, options) {
52235 if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
52236 return options.basename === true || options.matchBase === true;
52237};
52238
52239/**
52240 * Filter the keys of the given object with the given `glob` pattern
52241 * and `options`. Does not attempt to match nested keys. If you need this feature,
52242 * use [glob-object][] instead.
52243 *
52244 * ```js
52245 * var mm = require('micromatch');
52246 * mm.matchKeys(object, patterns[, options]);
52247 *
52248 * var obj = { aa: 'a', ab: 'b', ac: 'c' };
52249 * console.log(mm.matchKeys(obj, '*b'));
52250 * //=> { ab: 'b' }
52251 * ```
52252 * @param {Object} `object` The object with keys to filter.
52253 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
52254 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52255 * @return {Object} Returns an object with only keys that match the given patterns.
52256 * @api public
52257 */
52258
52259micromatch.matchKeys = function(obj, patterns, options) {
52260 if (!utils.isObject(obj)) {
52261 throw new TypeError('expected the first argument to be an object');
52262 }
52263 var keys = micromatch(Object.keys(obj), patterns, options);
52264 return utils.pick(obj, keys);
52265};
52266
52267/**
52268 * Returns a memoized matcher function from the given glob `pattern` and `options`.
52269 * The returned function takes a string to match as its only argument and returns
52270 * true if the string is a match.
52271 *
52272 * ```js
52273 * var mm = require('micromatch');
52274 * mm.matcher(pattern[, options]);
52275 *
52276 * var isMatch = mm.matcher('*.!(*a)');
52277 * console.log(isMatch('a.a'));
52278 * //=> false
52279 * console.log(isMatch('a.b'));
52280 * //=> true
52281 * ```
52282 * @param {String} `pattern` Glob pattern
52283 * @param {Object} `options` See available [options](#options) for changing how matches are performed.
52284 * @return {Function} Returns a matcher function.
52285 * @api public
52286 */
52287
52288micromatch.matcher = function matcher(pattern, options) {
52289 if (Array.isArray(pattern)) {
52290 return compose(pattern, options, matcher);
52291 }
52292
52293 // if pattern is a regex
52294 if (pattern instanceof RegExp) {
52295 return test(pattern);
52296 }
52297
52298 // if pattern is invalid
52299 if (!utils.isString(pattern)) {
52300 throw new TypeError('expected pattern to be an array, string or regex');
52301 }
52302
52303 // if pattern is a non-glob string
52304 if (!utils.hasSpecialChars(pattern)) {
52305 if (options && options.nocase === true) {
52306 pattern = pattern.toLowerCase();
52307 }
52308 return utils.matchPath(pattern, options);
52309 }
52310
52311 // if pattern is a glob string
52312 var re = micromatch.makeRe(pattern, options);
52313
52314 // if `options.matchBase` or `options.basename` is defined
52315 if (micromatch.matchBase(pattern, options)) {
52316 return utils.matchBasename(re, options);
52317 }
52318
52319 function test(regex) {
52320 var equals = utils.equalsPattern(options);
52321 var unixify = utils.unixify(options);
52322
52323 return function(str) {
52324 if (equals(str)) {
52325 return true;
52326 }
52327
52328 if (regex.test(unixify(str))) {
52329 return true;
52330 }
52331 return false;
52332 };
52333 }
52334
52335 var fn = test(re);
52336 Object.defineProperty(fn, 'result', {
52337 configurable: true,
52338 enumerable: false,
52339 value: re.result
52340 });
52341 return fn;
52342};
52343
52344/**
52345 * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
52346 *
52347 * ```js
52348 * var mm = require('micromatch');
52349 * mm.capture(pattern, string[, options]);
52350 *
52351 * console.log(mm.capture('test/*.js', 'test/foo.js'));
52352 * //=> ['foo']
52353 * console.log(mm.capture('test/*.js', 'foo/bar.css'));
52354 * //=> null
52355 * ```
52356 * @param {String} `pattern` Glob pattern to use for matching.
52357 * @param {String} `string` String to match
52358 * @param {Object} `options` See available [options](#options) for changing how matches are performed
52359 * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
52360 * @api public
52361 */
52362
52363micromatch.capture = function(pattern, str, options) {
52364 var re = micromatch.makeRe(pattern, extend({capture: true}, options));
52365 var unixify = utils.unixify(options);
52366
52367 function match() {
52368 return function(string) {
52369 var match = re.exec(unixify(string));
52370 if (!match) {
52371 return null;
52372 }
52373
52374 return match.slice(1);
52375 };
52376 }
52377
52378 var capture = memoize('capture', pattern, options, match);
52379 return capture(str);
52380};
52381
52382/**
52383 * Create a regular expression from the given glob `pattern`.
52384 *
52385 * ```js
52386 * var mm = require('micromatch');
52387 * mm.makeRe(pattern[, options]);
52388 *
52389 * console.log(mm.makeRe('*.js'));
52390 * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
52391 * ```
52392 * @param {String} `pattern` A glob pattern to convert to regex.
52393 * @param {Object} `options` See available [options](#options) for changing how matches are performed.
52394 * @return {RegExp} Returns a regex created from the given pattern.
52395 * @api public
52396 */
52397
52398micromatch.makeRe = function(pattern, options) {
52399 if (typeof pattern !== 'string') {
52400 throw new TypeError('expected pattern to be a string');
52401 }
52402
52403 if (pattern.length > MAX_LENGTH) {
52404 throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
52405 }
52406
52407 function makeRe() {
52408 var result = micromatch.create(pattern, options);
52409 var ast_array = [];
52410 var output = result.map(function(obj) {
52411 obj.ast.state = obj.state;
52412 ast_array.push(obj.ast);
52413 return obj.output;
52414 });
52415
52416 var regex = toRegex(output.join('|'), options);
52417 Object.defineProperty(regex, 'result', {
52418 configurable: true,
52419 enumerable: false,
52420 value: ast_array
52421 });
52422 return regex;
52423 }
52424
52425 return memoize('makeRe', pattern, options, makeRe);
52426};
52427
52428/**
52429 * Expand the given brace `pattern`.
52430 *
52431 * ```js
52432 * var mm = require('micromatch');
52433 * console.log(mm.braces('foo/{a,b}/bar'));
52434 * //=> ['foo/(a|b)/bar']
52435 *
52436 * console.log(mm.braces('foo/{a,b}/bar', {expand: true}));
52437 * //=> ['foo/(a|b)/bar']
52438 * ```
52439 * @param {String} `pattern` String with brace pattern to expand.
52440 * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
52441 * @return {Array}
52442 * @api public
52443 */
52444
52445micromatch.braces = function(pattern, options) {
52446 if (typeof pattern !== 'string' && !Array.isArray(pattern)) {
52447 throw new TypeError('expected pattern to be an array or string');
52448 }
52449
52450 function expand() {
52451 if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
52452 return utils.arrayify(pattern);
52453 }
52454 return braces(pattern, options);
52455 }
52456
52457 return memoize('braces', pattern, options, expand);
52458};
52459
52460/**
52461 * Proxy to the [micromatch.braces](#method), for parity with
52462 * minimatch.
52463 */
52464
52465micromatch.braceExpand = function(pattern, options) {
52466 var opts = extend({}, options, {expand: true});
52467 return micromatch.braces(pattern, opts);
52468};
52469
52470/**
52471 * Parses the given glob `pattern` and returns an array of abstract syntax
52472 * trees (ASTs), with the compiled `output` and optional source `map` on
52473 * each AST.
52474 *
52475 * ```js
52476 * var mm = require('micromatch');
52477 * mm.create(pattern[, options]);
52478 *
52479 * console.log(mm.create('abc/*.js'));
52480 * // [{ options: { source: 'string', sourcemap: true },
52481 * // state: {},
52482 * // compilers:
52483 * // { ... },
52484 * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
52485 * // ast:
52486 * // { type: 'root',
52487 * // errors: [],
52488 * // nodes:
52489 * // [ ... ],
52490 * // dot: false,
52491 * // input: 'abc/*.js' },
52492 * // parsingErrors: [],
52493 * // map:
52494 * // { version: 3,
52495 * // sources: [ 'string' ],
52496 * // names: [],
52497 * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
52498 * // sourcesContent: [ 'abc/*.js' ] },
52499 * // position: { line: 1, column: 28 },
52500 * // content: {},
52501 * // files: {},
52502 * // idx: 6 }]
52503 * ```
52504 * @param {String} `pattern` Glob pattern to parse and compile.
52505 * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
52506 * @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
52507 * @api public
52508 */
52509
52510micromatch.create = function(pattern, options) {
52511 return memoize('create', pattern, options, function() {
52512 function create(str, opts) {
52513 return micromatch.compile(micromatch.parse(str, opts), opts);
52514 }
52515
52516 pattern = micromatch.braces(pattern, options);
52517 var len = pattern.length;
52518 var idx = -1;
52519 var res = [];
52520
52521 while (++idx < len) {
52522 res.push(create(pattern[idx], options));
52523 }
52524 return res;
52525 });
52526};
52527
52528/**
52529 * Parse the given `str` with the given `options`.
52530 *
52531 * ```js
52532 * var mm = require('micromatch');
52533 * mm.parse(pattern[, options]);
52534 *
52535 * var ast = mm.parse('a/{b,c}/d');
52536 * console.log(ast);
52537 * // { type: 'root',
52538 * // errors: [],
52539 * // input: 'a/{b,c}/d',
52540 * // nodes:
52541 * // [ { type: 'bos', val: '' },
52542 * // { type: 'text', val: 'a/' },
52543 * // { type: 'brace',
52544 * // nodes:
52545 * // [ { type: 'brace.open', val: '{' },
52546 * // { type: 'text', val: 'b,c' },
52547 * // { type: 'brace.close', val: '}' } ] },
52548 * // { type: 'text', val: '/d' },
52549 * // { type: 'eos', val: '' } ] }
52550 * ```
52551 * @param {String} `str`
52552 * @param {Object} `options`
52553 * @return {Object} Returns an AST
52554 * @api public
52555 */
52556
52557micromatch.parse = function(pattern, options) {
52558 if (typeof pattern !== 'string') {
52559 throw new TypeError('expected a string');
52560 }
52561
52562 function parse() {
52563 var snapdragon = utils.instantiate(null, options);
52564 parsers(snapdragon, options);
52565
52566 var ast = snapdragon.parse(pattern, options);
52567 utils.define(ast, 'snapdragon', snapdragon);
52568 ast.input = pattern;
52569 return ast;
52570 }
52571
52572 return memoize('parse', pattern, options, parse);
52573};
52574
52575/**
52576 * Compile the given `ast` or string with the given `options`.
52577 *
52578 * ```js
52579 * var mm = require('micromatch');
52580 * mm.compile(ast[, options]);
52581 *
52582 * var ast = mm.parse('a/{b,c}/d');
52583 * console.log(mm.compile(ast));
52584 * // { options: { source: 'string' },
52585 * // state: {},
52586 * // compilers:
52587 * // { eos: [Function],
52588 * // noop: [Function],
52589 * // bos: [Function],
52590 * // brace: [Function],
52591 * // 'brace.open': [Function],
52592 * // text: [Function],
52593 * // 'brace.close': [Function] },
52594 * // output: [ 'a/(b|c)/d' ],
52595 * // ast:
52596 * // { ... },
52597 * // parsingErrors: [] }
52598 * ```
52599 * @param {Object|String} `ast`
52600 * @param {Object} `options`
52601 * @return {Object} Returns an object that has an `output` property with the compiled string.
52602 * @api public
52603 */
52604
52605micromatch.compile = function(ast, options) {
52606 if (typeof ast === 'string') {
52607 ast = micromatch.parse(ast, options);
52608 }
52609
52610 return memoize('compile', ast.input, options, function() {
52611 var snapdragon = utils.instantiate(ast, options);
52612 compilers(snapdragon, options);
52613 return snapdragon.compile(ast, options);
52614 });
52615};
52616
52617/**
52618 * Clear the regex cache.
52619 *
52620 * ```js
52621 * mm.clearCache();
52622 * ```
52623 * @api public
52624 */
52625
52626micromatch.clearCache = function() {
52627 micromatch.cache.caches = {};
52628};
52629
52630/**
52631 * Returns true if the given value is effectively an empty string
52632 */
52633
52634function isEmptyString(val) {
52635 return String(val) === '' || String(val) === './';
52636}
52637
52638/**
52639 * Compose a matcher function with the given patterns.
52640 * This allows matcher functions to be compiled once and
52641 * called multiple times.
52642 */
52643
52644function compose(patterns, options, matcher) {
52645 var matchers;
52646
52647 return memoize('compose', String(patterns), options, function() {
52648 return function(file) {
52649 // delay composition until it's invoked the first time,
52650 // after that it won't be called again
52651 if (!matchers) {
52652 matchers = [];
52653 for (var i = 0; i < patterns.length; i++) {
52654 matchers.push(matcher(patterns[i], options));
52655 }
52656 }
52657
52658 var len = matchers.length;
52659 while (len--) {
52660 if (matchers[len](file) === true) {
52661 return true;
52662 }
52663 }
52664 return false;
52665 };
52666 });
52667}
52668
52669/**
52670 * Memoize a generated regex or function. A unique key is generated
52671 * from the `type` (usually method name), the `pattern`, and
52672 * user-defined options.
52673 */
52674
52675function memoize(type, pattern, options, fn) {
52676 var key = utils.createKey(type + '=' + pattern, options);
52677
52678 if (options && options.cache === false) {
52679 return fn(pattern, options);
52680 }
52681
52682 if (cache.has(type, key)) {
52683 return cache.get(type, key);
52684 }
52685
52686 var val = fn(pattern, options);
52687 cache.set(type, key, val);
52688 return val;
52689}
52690
52691/**
52692 * Expose compiler, parser and cache on `micromatch`
52693 */
52694
52695micromatch.compilers = compilers;
52696micromatch.parsers = parsers;
52697micromatch.caches = cache.caches;
52698
52699/**
52700 * Expose `micromatch`
52701 * @type {Function}
52702 */
52703
52704module.exports = micromatch;
52705
52706
52707/***/ }),
52708
52709/***/ 34743:
52710/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
52711
52712module.exports = new (__webpack_require__(49908))();
52713
52714
52715/***/ }),
52716
52717/***/ 26113:
52718/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
52719
52720"use strict";
52721
52722
52723var nanomatch = __webpack_require__(57925);
52724var extglob = __webpack_require__(66675);
52725
52726module.exports = function(snapdragon) {
52727 var compilers = snapdragon.compiler.compilers;
52728 var opts = snapdragon.options;
52729
52730 // register nanomatch compilers
52731 snapdragon.use(nanomatch.compilers);
52732
52733 // get references to some specific nanomatch compilers before they
52734 // are overridden by the extglob and/or custom compilers
52735 var escape = compilers.escape;
52736 var qmark = compilers.qmark;
52737 var slash = compilers.slash;
52738 var star = compilers.star;
52739 var text = compilers.text;
52740 var plus = compilers.plus;
52741 var dot = compilers.dot;
52742
52743 // register extglob compilers or escape exglobs if disabled
52744 if (opts.extglob === false || opts.noext === true) {
52745 snapdragon.compiler.use(escapeExtglobs);
52746 } else {
52747 snapdragon.use(extglob.compilers);
52748 }
52749
52750 snapdragon.use(function() {
52751 this.options.star = this.options.star || function(/*node*/) {
52752 return '[^\\\\/]*?';
52753 };
52754 });
52755
52756 // custom micromatch compilers
52757 snapdragon.compiler
52758
52759 // reset referenced compiler
52760 .set('dot', dot)
52761 .set('escape', escape)
52762 .set('plus', plus)
52763 .set('slash', slash)
52764 .set('qmark', qmark)
52765 .set('star', star)
52766 .set('text', text);
52767};
52768
52769function escapeExtglobs(compiler) {
52770 compiler.set('paren', function(node) {
52771 var val = '';
52772 visit(node, function(tok) {
52773 if (tok.val) val += (/^\W/.test(tok.val) ? '\\' : '') + tok.val;
52774 });
52775 return this.emit(val, node);
52776 });
52777
52778 /**
52779 * Visit `node` with the given `fn`
52780 */
52781
52782 function visit(node, fn) {
52783 return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
52784 }
52785
52786 /**
52787 * Map visit over array of `nodes`.
52788 */
52789
52790 function mapVisit(nodes, fn) {
52791 var len = nodes.length;
52792 var idx = -1;
52793 while (++idx < len) {
52794 visit(nodes[idx], fn);
52795 }
52796 }
52797}
52798
52799
52800/***/ }),
52801
52802/***/ 14086:
52803/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
52804
52805"use strict";
52806
52807
52808var extglob = __webpack_require__(66675);
52809var nanomatch = __webpack_require__(57925);
52810var regexNot = __webpack_require__(30931);
52811var toRegex = __webpack_require__(51279);
52812var not;
52813
52814/**
52815 * Characters to use in negation regex (we want to "not" match
52816 * characters that are matched by other parsers)
52817 */
52818
52819var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+';
52820var createNotRegex = function(opts) {
52821 return not || (not = textRegex(TEXT));
52822};
52823
52824/**
52825 * Parsers
52826 */
52827
52828module.exports = function(snapdragon) {
52829 var parsers = snapdragon.parser.parsers;
52830
52831 // register nanomatch parsers
52832 snapdragon.use(nanomatch.parsers);
52833
52834 // get references to some specific nanomatch parsers before they
52835 // are overridden by the extglob and/or parsers
52836 var escape = parsers.escape;
52837 var slash = parsers.slash;
52838 var qmark = parsers.qmark;
52839 var plus = parsers.plus;
52840 var star = parsers.star;
52841 var dot = parsers.dot;
52842
52843 // register extglob parsers
52844 snapdragon.use(extglob.parsers);
52845
52846 // custom micromatch parsers
52847 snapdragon.parser
52848 .use(function() {
52849 // override "notRegex" created in nanomatch parser
52850 this.notRegex = /^\!+(?!\()/;
52851 })
52852 // reset the referenced parsers
52853 .capture('escape', escape)
52854 .capture('slash', slash)
52855 .capture('qmark', qmark)
52856 .capture('star', star)
52857 .capture('plus', plus)
52858 .capture('dot', dot)
52859
52860 /**
52861 * Override `text` parser
52862 */
52863
52864 .capture('text', function() {
52865 if (this.isInside('bracket')) return;
52866 var pos = this.position();
52867 var m = this.match(createNotRegex(this.options));
52868 if (!m || !m[0]) return;
52869
52870 // escape regex boundary characters and simple brackets
52871 var val = m[0].replace(/([[\]^$])/g, '\\$1');
52872
52873 return pos({
52874 type: 'text',
52875 val: val
52876 });
52877 });
52878};
52879
52880/**
52881 * Create text regex
52882 */
52883
52884function textRegex(pattern) {
52885 var notStr = regexNot.create(pattern, {contains: true, strictClose: false});
52886 var prefix = '(?:[\\^]|\\\\|';
52887 return toRegex(prefix + notStr + ')', {strictClose: false});
52888}
52889
52890
52891/***/ }),
52892
52893/***/ 63976:
52894/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
52895
52896"use strict";
52897
52898
52899var utils = module.exports;
52900var path = __webpack_require__(85622);
52901
52902/**
52903 * Module dependencies
52904 */
52905
52906var Snapdragon = __webpack_require__(79285);
52907utils.define = __webpack_require__(35851);
52908utils.diff = __webpack_require__(9455);
52909utils.extend = __webpack_require__(3767);
52910utils.pick = __webpack_require__(38509);
52911utils.typeOf = __webpack_require__(19613);
52912utils.unique = __webpack_require__(19009);
52913
52914/**
52915 * Returns true if the platform is windows, or `path.sep` is `\\`.
52916 * This is defined as a function to allow `path.sep` to be set in unit tests,
52917 * or by the user, if there is a reason to do so.
52918 * @return {Boolean}
52919 */
52920
52921utils.isWindows = function() {
52922 return path.sep === '\\' || process.platform === 'win32';
52923};
52924
52925/**
52926 * Get the `Snapdragon` instance to use
52927 */
52928
52929utils.instantiate = function(ast, options) {
52930 var snapdragon;
52931 // if an instance was created by `.parse`, use that instance
52932 if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
52933 snapdragon = ast.snapdragon;
52934 // if the user supplies an instance on options, use that instance
52935 } else if (utils.typeOf(options) === 'object' && options.snapdragon) {
52936 snapdragon = options.snapdragon;
52937 // create a new instance
52938 } else {
52939 snapdragon = new Snapdragon(options);
52940 }
52941
52942 utils.define(snapdragon, 'parse', function(str, options) {
52943 var parsed = Snapdragon.prototype.parse.apply(this, arguments);
52944 parsed.input = str;
52945
52946 // escape unmatched brace/bracket/parens
52947 var last = this.parser.stack.pop();
52948 if (last && this.options.strictErrors !== true) {
52949 var open = last.nodes[0];
52950 var inner = last.nodes[1];
52951 if (last.type === 'bracket') {
52952 if (inner.val.charAt(0) === '[') {
52953 inner.val = '\\' + inner.val;
52954 }
52955
52956 } else {
52957 open.val = '\\' + open.val;
52958 var sibling = open.parent.nodes[1];
52959 if (sibling.type === 'star') {
52960 sibling.loose = true;
52961 }
52962 }
52963 }
52964
52965 // add non-enumerable parser reference
52966 utils.define(parsed, 'parser', this.parser);
52967 return parsed;
52968 });
52969
52970 return snapdragon;
52971};
52972
52973/**
52974 * Create the key to use for memoization. The key is generated
52975 * by iterating over the options and concatenating key-value pairs
52976 * to the pattern string.
52977 */
52978
52979utils.createKey = function(pattern, options) {
52980 if (utils.typeOf(options) !== 'object') {
52981 return pattern;
52982 }
52983 var val = pattern;
52984 var keys = Object.keys(options);
52985 for (var i = 0; i < keys.length; i++) {
52986 var key = keys[i];
52987 val += ';' + key + '=' + String(options[key]);
52988 }
52989 return val;
52990};
52991
52992/**
52993 * Cast `val` to an array
52994 * @return {Array}
52995 */
52996
52997utils.arrayify = function(val) {
52998 if (typeof val === 'string') return [val];
52999 return val ? (Array.isArray(val) ? val : [val]) : [];
53000};
53001
53002/**
53003 * Return true if `val` is a non-empty string
53004 */
53005
53006utils.isString = function(val) {
53007 return typeof val === 'string';
53008};
53009
53010/**
53011 * Return true if `val` is a non-empty string
53012 */
53013
53014utils.isObject = function(val) {
53015 return utils.typeOf(val) === 'object';
53016};
53017
53018/**
53019 * Returns true if the given `str` has special characters
53020 */
53021
53022utils.hasSpecialChars = function(str) {
53023 return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
53024};
53025
53026/**
53027 * Escape regex characters in the given string
53028 */
53029
53030utils.escapeRegex = function(str) {
53031 return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&');
53032};
53033
53034/**
53035 * Normalize slashes in the given filepath.
53036 *
53037 * @param {String} `filepath`
53038 * @return {String}
53039 */
53040
53041utils.toPosixPath = function(str) {
53042 return str.replace(/\\+/g, '/');
53043};
53044
53045/**
53046 * Strip backslashes before special characters in a string.
53047 *
53048 * @param {String} `str`
53049 * @return {String}
53050 */
53051
53052utils.unescape = function(str) {
53053 return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
53054};
53055
53056/**
53057 * Strip the prefix from a filepath
53058 * @param {String} `fp`
53059 * @return {String}
53060 */
53061
53062utils.stripPrefix = function(str) {
53063 if (str.charAt(0) !== '.') {
53064 return str;
53065 }
53066 var ch = str.charAt(1);
53067 if (utils.isSlash(ch)) {
53068 return str.slice(2);
53069 }
53070 return str;
53071};
53072
53073/**
53074 * Returns true if the given str is an escaped or
53075 * unescaped path character
53076 */
53077
53078utils.isSlash = function(str) {
53079 return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
53080};
53081
53082/**
53083 * Returns a function that returns true if the given
53084 * pattern matches or contains a `filepath`
53085 *
53086 * @param {String} `pattern`
53087 * @return {Function}
53088 */
53089
53090utils.matchPath = function(pattern, options) {
53091 return (options && options.contains)
53092 ? utils.containsPattern(pattern, options)
53093 : utils.equalsPattern(pattern, options);
53094};
53095
53096/**
53097 * Returns true if the given (original) filepath or unixified path are equal
53098 * to the given pattern.
53099 */
53100
53101utils._equals = function(filepath, unixPath, pattern) {
53102 return pattern === filepath || pattern === unixPath;
53103};
53104
53105/**
53106 * Returns true if the given (original) filepath or unixified path contain
53107 * the given pattern.
53108 */
53109
53110utils._contains = function(filepath, unixPath, pattern) {
53111 return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
53112};
53113
53114/**
53115 * Returns a function that returns true if the given
53116 * pattern is the same as a given `filepath`
53117 *
53118 * @param {String} `pattern`
53119 * @return {Function}
53120 */
53121
53122utils.equalsPattern = function(pattern, options) {
53123 var unixify = utils.unixify(options);
53124 options = options || {};
53125
53126 return function fn(filepath) {
53127 var equal = utils._equals(filepath, unixify(filepath), pattern);
53128 if (equal === true || options.nocase !== true) {
53129 return equal;
53130 }
53131 var lower = filepath.toLowerCase();
53132 return utils._equals(lower, unixify(lower), pattern);
53133 };
53134};
53135
53136/**
53137 * Returns a function that returns true if the given
53138 * pattern contains a `filepath`
53139 *
53140 * @param {String} `pattern`
53141 * @return {Function}
53142 */
53143
53144utils.containsPattern = function(pattern, options) {
53145 var unixify = utils.unixify(options);
53146 options = options || {};
53147
53148 return function(filepath) {
53149 var contains = utils._contains(filepath, unixify(filepath), pattern);
53150 if (contains === true || options.nocase !== true) {
53151 return contains;
53152 }
53153 var lower = filepath.toLowerCase();
53154 return utils._contains(lower, unixify(lower), pattern);
53155 };
53156};
53157
53158/**
53159 * Returns a function that returns true if the given
53160 * regex matches the `filename` of a file path.
53161 *
53162 * @param {RegExp} `re` Matching regex
53163 * @return {Function}
53164 */
53165
53166utils.matchBasename = function(re) {
53167 return function(filepath) {
53168 return re.test(path.basename(filepath));
53169 };
53170};
53171
53172/**
53173 * Determines the filepath to return based on the provided options.
53174 * @return {any}
53175 */
53176
53177utils.value = function(str, unixify, options) {
53178 if (options && options.unixify === false) {
53179 return str;
53180 }
53181 return unixify(str);
53182};
53183
53184/**
53185 * Returns a function that normalizes slashes in a string to forward
53186 * slashes, strips `./` from beginning of paths, and optionally unescapes
53187 * special characters.
53188 * @return {Function}
53189 */
53190
53191utils.unixify = function(options) {
53192 options = options || {};
53193 return function(filepath) {
53194 if (utils.isWindows() || options.unixify === true) {
53195 filepath = utils.toPosixPath(filepath);
53196 }
53197 if (options.stripPrefix !== false) {
53198 filepath = utils.stripPrefix(filepath);
53199 }
53200 if (options.unescape === true) {
53201 filepath = utils.unescape(filepath);
53202 }
53203 return filepath;
53204 };
53205};
53206
53207
53208/***/ }),
53209
53210/***/ 50559:
53211/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
53212
53213"use strict";
53214
53215
53216/**
53217 * Module dependencies
53218 */
53219
53220var toRegex = __webpack_require__(51279);
53221var unique = __webpack_require__(19009);
53222var extend = __webpack_require__(92845);
53223
53224/**
53225 * Local dependencies
53226 */
53227
53228var compilers = __webpack_require__(90808);
53229var parsers = __webpack_require__(46362);
53230var Braces = __webpack_require__(12638);
53231var utils = __webpack_require__(38640);
53232var MAX_LENGTH = 1024 * 64;
53233var cache = {};
53234
53235/**
53236 * Convert the given `braces` pattern into a regex-compatible string. By default, only one string is generated for every input string. Set `options.expand` to true to return an array of patterns (similar to Bash or minimatch. Before using `options.expand`, it's recommended that you read the [performance notes](#performance)).
53237 *
53238 * ```js
53239 * var braces = require('braces');
53240 * console.log(braces('{a,b,c}'));
53241 * //=> ['(a|b|c)']
53242 *
53243 * console.log(braces('{a,b,c}', {expand: true}));
53244 * //=> ['a', 'b', 'c']
53245 * ```
53246 * @param {String} `str`
53247 * @param {Object} `options`
53248 * @return {String}
53249 * @api public
53250 */
53251
53252function braces(pattern, options) {
53253 var key = utils.createKey(String(pattern), options);
53254 var arr = [];
53255
53256 var disabled = options && options.cache === false;
53257 if (!disabled && cache.hasOwnProperty(key)) {
53258 return cache[key];
53259 }
53260
53261 if (Array.isArray(pattern)) {
53262 for (var i = 0; i < pattern.length; i++) {
53263 arr.push.apply(arr, braces.create(pattern[i], options));
53264 }
53265 } else {
53266 arr = braces.create(pattern, options);
53267 }
53268
53269 if (options && options.nodupes === true) {
53270 arr = unique(arr);
53271 }
53272
53273 if (!disabled) {
53274 cache[key] = arr;
53275 }
53276 return arr;
53277}
53278
53279/**
53280 * Expands a brace pattern into an array. This method is called by the main [braces](#braces) function when `options.expand` is true. Before using this method it's recommended that you read the [performance notes](#performance)) and advantages of using [.optimize](#optimize) instead.
53281 *
53282 * ```js
53283 * var braces = require('braces');
53284 * console.log(braces.expand('a/{b,c}/d'));
53285 * //=> ['a/b/d', 'a/c/d'];
53286 * ```
53287 * @param {String} `pattern` Brace pattern
53288 * @param {Object} `options`
53289 * @return {Array} Returns an array of expanded values.
53290 * @api public
53291 */
53292
53293braces.expand = function(pattern, options) {
53294 return braces.create(pattern, extend({}, options, {expand: true}));
53295};
53296
53297/**
53298 * Expands a brace pattern into a regex-compatible, optimized string. This method is called by the main [braces](#braces) function by default.
53299 *
53300 * ```js
53301 * var braces = require('braces');
53302 * console.log(braces.expand('a/{b,c}/d'));
53303 * //=> ['a/(b|c)/d']
53304 * ```
53305 * @param {String} `pattern` Brace pattern
53306 * @param {Object} `options`
53307 * @return {Array} Returns an array of expanded values.
53308 * @api public
53309 */
53310
53311braces.optimize = function(pattern, options) {
53312 return braces.create(pattern, options);
53313};
53314
53315/**
53316 * Processes a brace pattern and returns either an expanded array (if `options.expand` is true), a highly optimized regex-compatible string. This method is called by the main [braces](#braces) function.
53317 *
53318 * ```js
53319 * var braces = require('braces');
53320 * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
53321 * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
53322 * ```
53323 * @param {String} `pattern` Brace pattern
53324 * @param {Object} `options`
53325 * @return {Array} Returns an array of expanded values.
53326 * @api public
53327 */
53328
53329braces.create = function(pattern, options) {
53330 if (typeof pattern !== 'string') {
53331 throw new TypeError('expected a string');
53332 }
53333
53334 var maxLength = (options && options.maxLength) || MAX_LENGTH;
53335 if (pattern.length >= maxLength) {
53336 throw new Error('expected pattern to be less than ' + maxLength + ' characters');
53337 }
53338
53339 function create() {
53340 if (pattern === '' || pattern.length < 3) {
53341 return [pattern];
53342 }
53343
53344 if (utils.isEmptySets(pattern)) {
53345 return [];
53346 }
53347
53348 if (utils.isQuotedString(pattern)) {
53349 return [pattern.slice(1, -1)];
53350 }
53351
53352 var proto = new Braces(options);
53353 var result = !options || options.expand !== true
53354 ? proto.optimize(pattern, options)
53355 : proto.expand(pattern, options);
53356
53357 // get the generated pattern(s)
53358 var arr = result.output;
53359
53360 // filter out empty strings if specified
53361 if (options && options.noempty === true) {
53362 arr = arr.filter(Boolean);
53363 }
53364
53365 // filter out duplicates if specified
53366 if (options && options.nodupes === true) {
53367 arr = unique(arr);
53368 }
53369
53370 Object.defineProperty(arr, 'result', {
53371 enumerable: false,
53372 value: result
53373 });
53374
53375 return arr;
53376 }
53377
53378 return memoize('create', pattern, options, create);
53379};
53380
53381/**
53382 * Create a regular expression from the given string `pattern`.
53383 *
53384 * ```js
53385 * var braces = require('braces');
53386 *
53387 * console.log(braces.makeRe('id-{200..300}'));
53388 * //=> /^(?:id-(20[0-9]|2[1-9][0-9]|300))$/
53389 * ```
53390 * @param {String} `pattern` The pattern to convert to regex.
53391 * @param {Object} `options`
53392 * @return {RegExp}
53393 * @api public
53394 */
53395
53396braces.makeRe = function(pattern, options) {
53397 if (typeof pattern !== 'string') {
53398 throw new TypeError('expected a string');
53399 }
53400
53401 var maxLength = (options && options.maxLength) || MAX_LENGTH;
53402 if (pattern.length >= maxLength) {
53403 throw new Error('expected pattern to be less than ' + maxLength + ' characters');
53404 }
53405
53406 function makeRe() {
53407 var arr = braces(pattern, options);
53408 var opts = extend({strictErrors: false}, options);
53409 return toRegex(arr, opts);
53410 }
53411
53412 return memoize('makeRe', pattern, options, makeRe);
53413};
53414
53415/**
53416 * Parse the given `str` with the given `options`.
53417 *
53418 * ```js
53419 * var braces = require('braces');
53420 * var ast = braces.parse('a/{b,c}/d');
53421 * console.log(ast);
53422 * // { type: 'root',
53423 * // errors: [],
53424 * // input: 'a/{b,c}/d',
53425 * // nodes:
53426 * // [ { type: 'bos', val: '' },
53427 * // { type: 'text', val: 'a/' },
53428 * // { type: 'brace',
53429 * // nodes:
53430 * // [ { type: 'brace.open', val: '{' },
53431 * // { type: 'text', val: 'b,c' },
53432 * // { type: 'brace.close', val: '}' } ] },
53433 * // { type: 'text', val: '/d' },
53434 * // { type: 'eos', val: '' } ] }
53435 * ```
53436 * @param {String} `pattern` Brace pattern to parse
53437 * @param {Object} `options`
53438 * @return {Object} Returns an AST
53439 * @api public
53440 */
53441
53442braces.parse = function(pattern, options) {
53443 var proto = new Braces(options);
53444 return proto.parse(pattern, options);
53445};
53446
53447/**
53448 * Compile the given `ast` or string with the given `options`.
53449 *
53450 * ```js
53451 * var braces = require('braces');
53452 * var ast = braces.parse('a/{b,c}/d');
53453 * console.log(braces.compile(ast));
53454 * // { options: { source: 'string' },
53455 * // state: {},
53456 * // compilers:
53457 * // { eos: [Function],
53458 * // noop: [Function],
53459 * // bos: [Function],
53460 * // brace: [Function],
53461 * // 'brace.open': [Function],
53462 * // text: [Function],
53463 * // 'brace.close': [Function] },
53464 * // output: [ 'a/(b|c)/d' ],
53465 * // ast:
53466 * // { ... },
53467 * // parsingErrors: [] }
53468 * ```
53469 * @param {Object|String} `ast` AST from [.parse](#parse). If a string is passed it will be parsed first.
53470 * @param {Object} `options`
53471 * @return {Object} Returns an object that has an `output` property with the compiled string.
53472 * @api public
53473 */
53474
53475braces.compile = function(ast, options) {
53476 var proto = new Braces(options);
53477 return proto.compile(ast, options);
53478};
53479
53480/**
53481 * Clear the regex cache.
53482 *
53483 * ```js
53484 * braces.clearCache();
53485 * ```
53486 * @api public
53487 */
53488
53489braces.clearCache = function() {
53490 cache = braces.cache = {};
53491};
53492
53493/**
53494 * Memoize a generated regex or function. A unique key is generated
53495 * from the method name, pattern, and user-defined options. Set
53496 * options.memoize to false to disable.
53497 */
53498
53499function memoize(type, pattern, options, fn) {
53500 var key = utils.createKey(type + ':' + pattern, options);
53501 var disabled = options && options.cache === false;
53502 if (disabled) {
53503 braces.clearCache();
53504 return fn(pattern, options);
53505 }
53506
53507 if (cache.hasOwnProperty(key)) {
53508 return cache[key];
53509 }
53510
53511 var res = fn(pattern, options);
53512 cache[key] = res;
53513 return res;
53514}
53515
53516/**
53517 * Expose `Braces` constructor and methods
53518 * @type {Function}
53519 */
53520
53521braces.Braces = Braces;
53522braces.compilers = compilers;
53523braces.parsers = parsers;
53524braces.cache = cache;
53525
53526/**
53527 * Expose `braces`
53528 * @type {Function}
53529 */
53530
53531module.exports = braces;
53532
53533
53534/***/ }),
53535
53536/***/ 12638:
53537/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
53538
53539"use strict";
53540
53541
53542var extend = __webpack_require__(92845);
53543var Snapdragon = __webpack_require__(79285);
53544var compilers = __webpack_require__(90808);
53545var parsers = __webpack_require__(46362);
53546var utils = __webpack_require__(38640);
53547
53548/**
53549 * Customize Snapdragon parser and renderer
53550 */
53551
53552function Braces(options) {
53553 this.options = extend({}, options);
53554}
53555
53556/**
53557 * Initialize braces
53558 */
53559
53560Braces.prototype.init = function(options) {
53561 if (this.isInitialized) return;
53562 this.isInitialized = true;
53563 var opts = utils.createOptions({}, this.options, options);
53564 this.snapdragon = this.options.snapdragon || new Snapdragon(opts);
53565 this.compiler = this.snapdragon.compiler;
53566 this.parser = this.snapdragon.parser;
53567
53568 compilers(this.snapdragon, opts);
53569 parsers(this.snapdragon, opts);
53570
53571 /**
53572 * Call Snapdragon `.parse` method. When AST is returned, we check to
53573 * see if any unclosed braces are left on the stack and, if so, we iterate
53574 * over the stack and correct the AST so that compilers are called in the correct
53575 * order and unbalance braces are properly escaped.
53576 */
53577
53578 utils.define(this.snapdragon, 'parse', function(pattern, options) {
53579 var parsed = Snapdragon.prototype.parse.apply(this, arguments);
53580 this.parser.ast.input = pattern;
53581
53582 var stack = this.parser.stack;
53583 while (stack.length) {
53584 addParent({type: 'brace.close', val: ''}, stack.pop());
53585 }
53586
53587 function addParent(node, parent) {
53588 utils.define(node, 'parent', parent);
53589 parent.nodes.push(node);
53590 }
53591
53592 // add non-enumerable parser reference
53593 utils.define(parsed, 'parser', this.parser);
53594 return parsed;
53595 });
53596};
53597
53598/**
53599 * Decorate `.parse` method
53600 */
53601
53602Braces.prototype.parse = function(ast, options) {
53603 if (ast && typeof ast === 'object' && ast.nodes) return ast;
53604 this.init(options);
53605 return this.snapdragon.parse(ast, options);
53606};
53607
53608/**
53609 * Decorate `.compile` method
53610 */
53611
53612Braces.prototype.compile = function(ast, options) {
53613 if (typeof ast === 'string') {
53614 ast = this.parse(ast, options);
53615 } else {
53616 this.init(options);
53617 }
53618 return this.snapdragon.compile(ast, options);
53619};
53620
53621/**
53622 * Expand
53623 */
53624
53625Braces.prototype.expand = function(pattern) {
53626 var ast = this.parse(pattern, {expand: true});
53627 return this.compile(ast, {expand: true});
53628};
53629
53630/**
53631 * Optimize
53632 */
53633
53634Braces.prototype.optimize = function(pattern) {
53635 var ast = this.parse(pattern, {optimize: true});
53636 return this.compile(ast, {optimize: true});
53637};
53638
53639/**
53640 * Expose `Braces`
53641 */
53642
53643module.exports = Braces;
53644
53645
53646/***/ }),
53647
53648/***/ 90808:
53649/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
53650
53651"use strict";
53652
53653
53654var utils = __webpack_require__(38640);
53655
53656module.exports = function(braces, options) {
53657 braces.compiler
53658
53659 /**
53660 * bos
53661 */
53662
53663 .set('bos', function() {
53664 if (this.output) return;
53665 this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : [];
53666 this.ast.count = 1;
53667 })
53668
53669 /**
53670 * Square brackets
53671 */
53672
53673 .set('bracket', function(node) {
53674 var close = node.close;
53675 var open = !node.escaped ? '[' : '\\[';
53676 var negated = node.negated;
53677 var inner = node.inner;
53678
53679 inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\');
53680 if (inner === ']-') {
53681 inner = '\\]\\-';
53682 }
53683
53684 if (negated && inner.indexOf('.') === -1) {
53685 inner += '.';
53686 }
53687 if (negated && inner.indexOf('/') === -1) {
53688 inner += '/';
53689 }
53690
53691 var val = open + negated + inner + close;
53692 var queue = node.parent.queue;
53693 var last = utils.arrayify(queue.pop());
53694
53695 queue.push(utils.join(last, val));
53696 queue.push.apply(queue, []);
53697 })
53698
53699 /**
53700 * Brace
53701 */
53702
53703 .set('brace', function(node) {
53704 node.queue = isEscaped(node) ? [node.val] : [];
53705 node.count = 1;
53706 return this.mapVisit(node.nodes);
53707 })
53708
53709 /**
53710 * Open
53711 */
53712
53713 .set('brace.open', function(node) {
53714 node.parent.open = node.val;
53715 })
53716
53717 /**
53718 * Inner
53719 */
53720
53721 .set('text', function(node) {
53722 var queue = node.parent.queue;
53723 var escaped = node.escaped;
53724 var segs = [node.val];
53725
53726 if (node.optimize === false) {
53727 options = utils.extend({}, options, {optimize: false});
53728 }
53729
53730 if (node.multiplier > 1) {
53731 node.parent.count *= node.multiplier;
53732 }
53733
53734 if (options.quantifiers === true && utils.isQuantifier(node.val)) {
53735 escaped = true;
53736
53737 } else if (node.val.length > 1) {
53738 if (isType(node.parent, 'brace') && !isEscaped(node)) {
53739 var expanded = utils.expand(node.val, options);
53740 segs = expanded.segs;
53741
53742 if (expanded.isOptimized) {
53743 node.parent.isOptimized = true;
53744 }
53745
53746 // if nothing was expanded, we probably have a literal brace
53747 if (!segs.length) {
53748 var val = (expanded.val || node.val);
53749 if (options.unescape !== false) {
53750 // unescape unexpanded brace sequence/set separators
53751 val = val.replace(/\\([,.])/g, '$1');
53752 // strip quotes
53753 val = val.replace(/["'`]/g, '');
53754 }
53755
53756 segs = [val];
53757 escaped = true;
53758 }
53759 }
53760
53761 } else if (node.val === ',') {
53762 if (options.expand) {
53763 node.parent.queue.push(['']);
53764 segs = [''];
53765 } else {
53766 segs = ['|'];
53767 }
53768 } else {
53769 escaped = true;
53770 }
53771
53772 if (escaped && isType(node.parent, 'brace')) {
53773 if (node.parent.nodes.length <= 4 && node.parent.count === 1) {
53774 node.parent.escaped = true;
53775 } else if (node.parent.length <= 3) {
53776 node.parent.escaped = true;
53777 }
53778 }
53779
53780 if (!hasQueue(node.parent)) {
53781 node.parent.queue = segs;
53782 return;
53783 }
53784
53785 var last = utils.arrayify(queue.pop());
53786 if (node.parent.count > 1 && options.expand) {
53787 last = multiply(last, node.parent.count);
53788 node.parent.count = 1;
53789 }
53790
53791 queue.push(utils.join(utils.flatten(last), segs.shift()));
53792 queue.push.apply(queue, segs);
53793 })
53794
53795 /**
53796 * Close
53797 */
53798
53799 .set('brace.close', function(node) {
53800 var queue = node.parent.queue;
53801 var prev = node.parent.parent;
53802 var last = prev.queue.pop();
53803 var open = node.parent.open;
53804 var close = node.val;
53805
53806 if (open && close && isOptimized(node, options)) {
53807 open = '(';
53808 close = ')';
53809 }
53810
53811 // if a close brace exists, and the previous segment is one character
53812 // don't wrap the result in braces or parens
53813 var ele = utils.last(queue);
53814 if (node.parent.count > 1 && options.expand) {
53815 ele = multiply(queue.pop(), node.parent.count);
53816 node.parent.count = 1;
53817 queue.push(ele);
53818 }
53819
53820 if (close && typeof ele === 'string' && ele.length === 1) {
53821 open = '';
53822 close = '';
53823 }
53824
53825 if ((isLiteralBrace(node, options) || noInner(node)) && !node.parent.hasEmpty) {
53826 queue.push(utils.join(open, queue.pop() || ''));
53827 queue = utils.flatten(utils.join(queue, close));
53828 }
53829
53830 if (typeof last === 'undefined') {
53831 prev.queue = [queue];
53832 } else {
53833 prev.queue.push(utils.flatten(utils.join(last, queue)));
53834 }
53835 })
53836
53837 /**
53838 * eos
53839 */
53840
53841 .set('eos', function(node) {
53842 if (this.input) return;
53843
53844 if (options.optimize !== false) {
53845 this.output = utils.last(utils.flatten(this.ast.queue));
53846 } else if (Array.isArray(utils.last(this.ast.queue))) {
53847 this.output = utils.flatten(this.ast.queue.pop());
53848 } else {
53849 this.output = utils.flatten(this.ast.queue);
53850 }
53851
53852 if (node.parent.count > 1 && options.expand) {
53853 this.output = multiply(this.output, node.parent.count);
53854 }
53855
53856 this.output = utils.arrayify(this.output);
53857 this.ast.queue = [];
53858 });
53859
53860};
53861
53862/**
53863 * Multiply the segments in the current brace level
53864 */
53865
53866function multiply(queue, n, options) {
53867 return utils.flatten(utils.repeat(utils.arrayify(queue), n));
53868}
53869
53870/**
53871 * Return true if `node` is escaped
53872 */
53873
53874function isEscaped(node) {
53875 return node.escaped === true;
53876}
53877
53878/**
53879 * Returns true if regex parens should be used for sets. If the parent `type`
53880 * is not `brace`, then we're on a root node, which means we should never
53881 * expand segments and open/close braces should be `{}` (since this indicates
53882 * a brace is missing from the set)
53883 */
53884
53885function isOptimized(node, options) {
53886 if (node.parent.isOptimized) return true;
53887 return isType(node.parent, 'brace')
53888 && !isEscaped(node.parent)
53889 && options.expand !== true;
53890}
53891
53892/**
53893 * Returns true if the value in `node` should be wrapped in a literal brace.
53894 * @return {Boolean}
53895 */
53896
53897function isLiteralBrace(node, options) {
53898 return isEscaped(node.parent) || options.optimize !== false;
53899}
53900
53901/**
53902 * Returns true if the given `node` does not have an inner value.
53903 * @return {Boolean}
53904 */
53905
53906function noInner(node, type) {
53907 if (node.parent.queue.length === 1) {
53908 return true;
53909 }
53910 var nodes = node.parent.nodes;
53911 return nodes.length === 3
53912 && isType(nodes[0], 'brace.open')
53913 && !isType(nodes[1], 'text')
53914 && isType(nodes[2], 'brace.close');
53915}
53916
53917/**
53918 * Returns true if the given `node` is the given `type`
53919 * @return {Boolean}
53920 */
53921
53922function isType(node, type) {
53923 return typeof node !== 'undefined' && node.type === type;
53924}
53925
53926/**
53927 * Returns true if the given `node` has a non-empty queue.
53928 * @return {Boolean}
53929 */
53930
53931function hasQueue(node) {
53932 return Array.isArray(node.queue) && node.queue.length;
53933}
53934
53935
53936/***/ }),
53937
53938/***/ 46362:
53939/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
53940
53941"use strict";
53942
53943
53944var Node = __webpack_require__(12579);
53945var utils = __webpack_require__(38640);
53946
53947/**
53948 * Braces parsers
53949 */
53950
53951module.exports = function(braces, options) {
53952 braces.parser
53953 .set('bos', function() {
53954 if (!this.parsed) {
53955 this.ast = this.nodes[0] = new Node(this.ast);
53956 }
53957 })
53958
53959 /**
53960 * Character parsers
53961 */
53962
53963 .set('escape', function() {
53964 var pos = this.position();
53965 var m = this.match(/^(?:\\(.)|\$\{)/);
53966 if (!m) return;
53967
53968 var prev = this.prev();
53969 var last = utils.last(prev.nodes);
53970
53971 var node = pos(new Node({
53972 type: 'text',
53973 multiplier: 1,
53974 val: m[0]
53975 }));
53976
53977 if (node.val === '\\\\') {
53978 return node;
53979 }
53980
53981 if (node.val === '${') {
53982 var str = this.input;
53983 var idx = -1;
53984 var ch;
53985
53986 while ((ch = str[++idx])) {
53987 this.consume(1);
53988 node.val += ch;
53989 if (ch === '\\') {
53990 node.val += str[++idx];
53991 continue;
53992 }
53993 if (ch === '}') {
53994 break;
53995 }
53996 }
53997 }
53998
53999 if (this.options.unescape !== false) {
54000 node.val = node.val.replace(/\\([{}])/g, '$1');
54001 }
54002
54003 if (last.val === '"' && this.input.charAt(0) === '"') {
54004 last.val = node.val;
54005 this.consume(1);
54006 return;
54007 }
54008
54009 return concatNodes.call(this, pos, node, prev, options);
54010 })
54011
54012 /**
54013 * Brackets: "[...]" (basic, this is overridden by
54014 * other parsers in more advanced implementations)
54015 */
54016
54017 .set('bracket', function() {
54018 var isInside = this.isInside('brace');
54019 var pos = this.position();
54020 var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]-)(\]|[^*+?]+)|\[)/);
54021 if (!m) return;
54022
54023 var prev = this.prev();
54024 var val = m[0];
54025 var negated = m[1] ? '^' : '';
54026 var inner = m[2] || '';
54027 var close = m[3] || '';
54028
54029 if (isInside && prev.type === 'brace') {
54030 prev.text = prev.text || '';
54031 prev.text += val;
54032 }
54033
54034 var esc = this.input.slice(0, 2);
54035 if (inner === '' && esc === '\\]') {
54036 inner += esc;
54037 this.consume(2);
54038
54039 var str = this.input;
54040 var idx = -1;
54041 var ch;
54042
54043 while ((ch = str[++idx])) {
54044 this.consume(1);
54045 if (ch === ']') {
54046 close = ch;
54047 break;
54048 }
54049 inner += ch;
54050 }
54051 }
54052
54053 return pos(new Node({
54054 type: 'bracket',
54055 val: val,
54056 escaped: close !== ']',
54057 negated: negated,
54058 inner: inner,
54059 close: close
54060 }));
54061 })
54062
54063 /**
54064 * Empty braces (we capture these early to
54065 * speed up processing in the compiler)
54066 */
54067
54068 .set('multiplier', function() {
54069 var isInside = this.isInside('brace');
54070 var pos = this.position();
54071 var m = this.match(/^\{((?:,|\{,+\})+)\}/);
54072 if (!m) return;
54073
54074 this.multiplier = true;
54075 var prev = this.prev();
54076 var val = m[0];
54077
54078 if (isInside && prev.type === 'brace') {
54079 prev.text = prev.text || '';
54080 prev.text += val;
54081 }
54082
54083 var node = pos(new Node({
54084 type: 'text',
54085 multiplier: 1,
54086 match: m,
54087 val: val
54088 }));
54089
54090 return concatNodes.call(this, pos, node, prev, options);
54091 })
54092
54093 /**
54094 * Open
54095 */
54096
54097 .set('brace.open', function() {
54098 var pos = this.position();
54099 var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/);
54100 if (!m) return;
54101
54102 var prev = this.prev();
54103 var last = utils.last(prev.nodes);
54104
54105 // if the last parsed character was an extglob character
54106 // we need to _not optimize_ the brace pattern because
54107 // it might be mistaken for an extglob by a downstream parser
54108 if (last && last.val && isExtglobChar(last.val.slice(-1))) {
54109 last.optimize = false;
54110 }
54111
54112 var open = pos(new Node({
54113 type: 'brace.open',
54114 val: m[0]
54115 }));
54116
54117 var node = pos(new Node({
54118 type: 'brace',
54119 nodes: []
54120 }));
54121
54122 node.push(open);
54123 prev.push(node);
54124 this.push('brace', node);
54125 })
54126
54127 /**
54128 * Close
54129 */
54130
54131 .set('brace.close', function() {
54132 var pos = this.position();
54133 var m = this.match(/^\}/);
54134 if (!m || !m[0]) return;
54135
54136 var brace = this.pop('brace');
54137 var node = pos(new Node({
54138 type: 'brace.close',
54139 val: m[0]
54140 }));
54141
54142 if (!this.isType(brace, 'brace')) {
54143 if (this.options.strict) {
54144 throw new Error('missing opening "{"');
54145 }
54146 node.type = 'text';
54147 node.multiplier = 0;
54148 node.escaped = true;
54149 return node;
54150 }
54151
54152 var prev = this.prev();
54153 var last = utils.last(prev.nodes);
54154 if (last.text) {
54155 var lastNode = utils.last(last.nodes);
54156 if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) {
54157 var open = last.nodes[0];
54158 var text = last.nodes[1];
54159 if (open.type === 'brace.open' && text && text.type === 'text') {
54160 text.optimize = false;
54161 }
54162 }
54163 }
54164
54165 if (brace.nodes.length > 2) {
54166 var first = brace.nodes[1];
54167 if (first.type === 'text' && first.val === ',') {
54168 brace.nodes.splice(1, 1);
54169 brace.nodes.push(first);
54170 }
54171 }
54172
54173 brace.push(node);
54174 })
54175
54176 /**
54177 * Capture boundary characters
54178 */
54179
54180 .set('boundary', function() {
54181 var pos = this.position();
54182 var m = this.match(/^[$^](?!\{)/);
54183 if (!m) return;
54184 return pos(new Node({
54185 type: 'text',
54186 val: m[0]
54187 }));
54188 })
54189
54190 /**
54191 * One or zero, non-comma characters wrapped in braces
54192 */
54193
54194 .set('nobrace', function() {
54195 var isInside = this.isInside('brace');
54196 var pos = this.position();
54197 var m = this.match(/^\{[^,]?\}/);
54198 if (!m) return;
54199
54200 var prev = this.prev();
54201 var val = m[0];
54202
54203 if (isInside && prev.type === 'brace') {
54204 prev.text = prev.text || '';
54205 prev.text += val;
54206 }
54207
54208 return pos(new Node({
54209 type: 'text',
54210 multiplier: 0,
54211 val: val
54212 }));
54213 })
54214
54215 /**
54216 * Text
54217 */
54218
54219 .set('text', function() {
54220 var isInside = this.isInside('brace');
54221 var pos = this.position();
54222 var m = this.match(/^((?!\\)[^${}[\]])+/);
54223 if (!m) return;
54224
54225 var prev = this.prev();
54226 var val = m[0];
54227
54228 if (isInside && prev.type === 'brace') {
54229 prev.text = prev.text || '';
54230 prev.text += val;
54231 }
54232
54233 var node = pos(new Node({
54234 type: 'text',
54235 multiplier: 1,
54236 val: val
54237 }));
54238
54239 return concatNodes.call(this, pos, node, prev, options);
54240 });
54241};
54242
54243/**
54244 * Returns true if the character is an extglob character.
54245 */
54246
54247function isExtglobChar(ch) {
54248 return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+';
54249}
54250
54251/**
54252 * Combine text nodes, and calculate empty sets (`{,,}`)
54253 * @param {Function} `pos` Function to calculate node position
54254 * @param {Object} `node` AST node
54255 * @return {Object}
54256 */
54257
54258function concatNodes(pos, node, parent, options) {
54259 node.orig = node.val;
54260 var prev = this.prev();
54261 var last = utils.last(prev.nodes);
54262 var isEscaped = false;
54263
54264 if (node.val.length > 1) {
54265 var a = node.val.charAt(0);
54266 var b = node.val.slice(-1);
54267
54268 isEscaped = (a === '"' && b === '"')
54269 || (a === "'" && b === "'")
54270 || (a === '`' && b === '`');
54271 }
54272
54273 if (isEscaped && options.unescape !== false) {
54274 node.val = node.val.slice(1, node.val.length - 1);
54275 node.escaped = true;
54276 }
54277
54278 if (node.match) {
54279 var match = node.match[1];
54280 if (!match || match.indexOf('}') === -1) {
54281 match = node.match[0];
54282 }
54283
54284 // replace each set with a single ","
54285 var val = match.replace(/\{/g, ',').replace(/\}/g, '');
54286 node.multiplier *= val.length;
54287 node.val = '';
54288 }
54289
54290 var simpleText = last.type === 'text'
54291 && last.multiplier === 1
54292 && node.multiplier === 1
54293 && node.val;
54294
54295 if (simpleText) {
54296 last.val += node.val;
54297 return;
54298 }
54299
54300 prev.push(node);
54301}
54302
54303
54304/***/ }),
54305
54306/***/ 38640:
54307/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
54308
54309"use strict";
54310
54311
54312var splitString = __webpack_require__(33218);
54313var utils = module.exports;
54314
54315/**
54316 * Module dependencies
54317 */
54318
54319utils.extend = __webpack_require__(92845);
54320utils.flatten = __webpack_require__(27299);
54321utils.isObject = __webpack_require__(96667);
54322utils.fillRange = __webpack_require__(82593);
54323utils.repeat = __webpack_require__(69523);
54324utils.unique = __webpack_require__(19009);
54325
54326utils.define = function(obj, key, val) {
54327 Object.defineProperty(obj, key, {
54328 writable: true,
54329 configurable: true,
54330 enumerable: false,
54331 value: val
54332 });
54333};
54334
54335/**
54336 * Returns true if the given string contains only empty brace sets.
54337 */
54338
54339utils.isEmptySets = function(str) {
54340 return /^(?:\{,\})+$/.test(str);
54341};
54342
54343/**
54344 * Returns true if the given string contains only empty brace sets.
54345 */
54346
54347utils.isQuotedString = function(str) {
54348 var open = str.charAt(0);
54349 if (open === '\'' || open === '"' || open === '`') {
54350 return str.slice(-1) === open;
54351 }
54352 return false;
54353};
54354
54355/**
54356 * Create the key to use for memoization. The unique key is generated
54357 * by iterating over the options and concatenating key-value pairs
54358 * to the pattern string.
54359 */
54360
54361utils.createKey = function(pattern, options) {
54362 var id = pattern;
54363 if (typeof options === 'undefined') {
54364 return id;
54365 }
54366 var keys = Object.keys(options);
54367 for (var i = 0; i < keys.length; i++) {
54368 var key = keys[i];
54369 id += ';' + key + '=' + String(options[key]);
54370 }
54371 return id;
54372};
54373
54374/**
54375 * Normalize options
54376 */
54377
54378utils.createOptions = function(options) {
54379 var opts = utils.extend.apply(null, arguments);
54380 if (typeof opts.expand === 'boolean') {
54381 opts.optimize = !opts.expand;
54382 }
54383 if (typeof opts.optimize === 'boolean') {
54384 opts.expand = !opts.optimize;
54385 }
54386 if (opts.optimize === true) {
54387 opts.makeRe = true;
54388 }
54389 return opts;
54390};
54391
54392/**
54393 * Join patterns in `a` to patterns in `b`
54394 */
54395
54396utils.join = function(a, b, options) {
54397 options = options || {};
54398 a = utils.arrayify(a);
54399 b = utils.arrayify(b);
54400
54401 if (!a.length) return b;
54402 if (!b.length) return a;
54403
54404 var len = a.length;
54405 var idx = -1;
54406 var arr = [];
54407
54408 while (++idx < len) {
54409 var val = a[idx];
54410 if (Array.isArray(val)) {
54411 for (var i = 0; i < val.length; i++) {
54412 val[i] = utils.join(val[i], b, options);
54413 }
54414 arr.push(val);
54415 continue;
54416 }
54417
54418 for (var j = 0; j < b.length; j++) {
54419 var bval = b[j];
54420
54421 if (Array.isArray(bval)) {
54422 arr.push(utils.join(val, bval, options));
54423 } else {
54424 arr.push(val + bval);
54425 }
54426 }
54427 }
54428 return arr;
54429};
54430
54431/**
54432 * Split the given string on `,` if not escaped.
54433 */
54434
54435utils.split = function(str, options) {
54436 var opts = utils.extend({sep: ','}, options);
54437 if (typeof opts.keepQuotes !== 'boolean') {
54438 opts.keepQuotes = true;
54439 }
54440 if (opts.unescape === false) {
54441 opts.keepEscaping = true;
54442 }
54443 return splitString(str, opts, utils.escapeBrackets(opts));
54444};
54445
54446/**
54447 * Expand ranges or sets in the given `pattern`.
54448 *
54449 * @param {String} `str`
54450 * @param {Object} `options`
54451 * @return {Object}
54452 */
54453
54454utils.expand = function(str, options) {
54455 var opts = utils.extend({rangeLimit: 10000}, options);
54456 var segs = utils.split(str, opts);
54457 var tok = { segs: segs };
54458
54459 if (utils.isQuotedString(str)) {
54460 return tok;
54461 }
54462
54463 if (opts.rangeLimit === true) {
54464 opts.rangeLimit = 10000;
54465 }
54466
54467 if (segs.length > 1) {
54468 if (opts.optimize === false) {
54469 tok.val = segs[0];
54470 return tok;
54471 }
54472
54473 tok.segs = utils.stringifyArray(tok.segs);
54474 } else if (segs.length === 1) {
54475 var arr = str.split('..');
54476
54477 if (arr.length === 1) {
54478 tok.val = tok.segs[tok.segs.length - 1] || tok.val || str;
54479 tok.segs = [];
54480 return tok;
54481 }
54482
54483 if (arr.length === 2 && arr[0] === arr[1]) {
54484 tok.escaped = true;
54485 tok.val = arr[0];
54486 tok.segs = [];
54487 return tok;
54488 }
54489
54490 if (arr.length > 1) {
54491 if (opts.optimize !== false) {
54492 opts.optimize = true;
54493 delete opts.expand;
54494 }
54495
54496 if (opts.optimize !== true) {
54497 var min = Math.min(arr[0], arr[1]);
54498 var max = Math.max(arr[0], arr[1]);
54499 var step = arr[2] || 1;
54500
54501 if (opts.rangeLimit !== false && ((max - min) / step >= opts.rangeLimit)) {
54502 throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
54503 }
54504 }
54505
54506 arr.push(opts);
54507 tok.segs = utils.fillRange.apply(null, arr);
54508
54509 if (!tok.segs.length) {
54510 tok.escaped = true;
54511 tok.val = str;
54512 return tok;
54513 }
54514
54515 if (opts.optimize === true) {
54516 tok.segs = utils.stringifyArray(tok.segs);
54517 }
54518
54519 if (tok.segs === '') {
54520 tok.val = str;
54521 } else {
54522 tok.val = tok.segs[0];
54523 }
54524 return tok;
54525 }
54526 } else {
54527 tok.val = str;
54528 }
54529 return tok;
54530};
54531
54532/**
54533 * Ensure commas inside brackets and parens are not split.
54534 * @param {Object} `tok` Token from the `split-string` module
54535 * @return {undefined}
54536 */
54537
54538utils.escapeBrackets = function(options) {
54539 return function(tok) {
54540 if (tok.escaped && tok.val === 'b') {
54541 tok.val = '\\b';
54542 return;
54543 }
54544
54545 if (tok.val !== '(' && tok.val !== '[') return;
54546 var opts = utils.extend({}, options);
54547 var brackets = [];
54548 var parens = [];
54549 var stack = [];
54550 var val = tok.val;
54551 var str = tok.str;
54552 var i = tok.idx - 1;
54553
54554 while (++i < str.length) {
54555 var ch = str[i];
54556
54557 if (ch === '\\') {
54558 val += (opts.keepEscaping === false ? '' : ch) + str[++i];
54559 continue;
54560 }
54561
54562 if (ch === '(') {
54563 parens.push(ch);
54564 stack.push(ch);
54565 }
54566
54567 if (ch === '[') {
54568 brackets.push(ch);
54569 stack.push(ch);
54570 }
54571
54572 if (ch === ')') {
54573 parens.pop();
54574 stack.pop();
54575 if (!stack.length) {
54576 val += ch;
54577 break;
54578 }
54579 }
54580
54581 if (ch === ']') {
54582 brackets.pop();
54583 stack.pop();
54584 if (!stack.length) {
54585 val += ch;
54586 break;
54587 }
54588 }
54589 val += ch;
54590 }
54591
54592 tok.split = false;
54593 tok.val = val.slice(1);
54594 tok.idx = i;
54595 };
54596};
54597
54598/**
54599 * Returns true if the given string looks like a regex quantifier
54600 * @return {Boolean}
54601 */
54602
54603utils.isQuantifier = function(str) {
54604 return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str);
54605};
54606
54607/**
54608 * Cast `val` to an array.
54609 * @param {*} `val`
54610 */
54611
54612utils.stringifyArray = function(arr) {
54613 return [utils.arrayify(arr).join('|')];
54614};
54615
54616/**
54617 * Cast `val` to an array.
54618 * @param {*} `val`
54619 */
54620
54621utils.arrayify = function(arr) {
54622 if (typeof arr === 'undefined') {
54623 return [];
54624 }
54625 if (typeof arr === 'string') {
54626 return [arr];
54627 }
54628 return arr;
54629};
54630
54631/**
54632 * Returns true if the given `str` is a non-empty string
54633 * @return {Boolean}
54634 */
54635
54636utils.isString = function(str) {
54637 return str != null && typeof str === 'string';
54638};
54639
54640/**
54641 * Get the last element from `array`
54642 * @param {Array} `array`
54643 * @return {*}
54644 */
54645
54646utils.last = function(arr, n) {
54647 return arr[arr.length - (n || 1)];
54648};
54649
54650utils.escapeRegex = function(str) {
54651 return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1');
54652};
54653
54654
54655/***/ }),
54656
54657/***/ 92845:
54658/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
54659
54660"use strict";
54661
54662
54663var isObject = __webpack_require__(4585);
54664
54665module.exports = function extend(o/*, objects*/) {
54666 if (!isObject(o)) { o = {}; }
54667
54668 var len = arguments.length;
54669 for (var i = 1; i < len; i++) {
54670 var obj = arguments[i];
54671
54672 if (isObject(obj)) {
54673 assign(o, obj);
54674 }
54675 }
54676 return o;
54677};
54678
54679function assign(a, b) {
54680 for (var key in b) {
54681 if (hasOwn(b, key)) {
54682 a[key] = b[key];
54683 }
54684 }
54685}
54686
54687/**
54688 * Returns true if the given `key` is an own property of `obj`.
54689 */
54690
54691function hasOwn(obj, key) {
54692 return Object.prototype.hasOwnProperty.call(obj, key);
54693}
54694
54695
54696/***/ }),
54697
54698/***/ 4585:
54699/***/ (function(module) {
54700
54701"use strict";
54702/*!
54703 * is-extendable <https://github.com/jonschlinkert/is-extendable>
54704 *
54705 * Copyright (c) 2015, Jon Schlinkert.
54706 * Licensed under the MIT License.
54707 */
54708
54709
54710
54711module.exports = function isExtendable(val) {
54712 return typeof val !== 'undefined' && val !== null
54713 && (typeof val === 'object' || typeof val === 'function');
54714};
54715
54716
54717/***/ }),
54718
54719/***/ 35851:
54720/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
54721
54722"use strict";
54723/*!
54724 * define-property <https://github.com/jonschlinkert/define-property>
54725 *
54726 * Copyright (c) 2015-2018, Jon Schlinkert.
54727 * Released under the MIT License.
54728 */
54729
54730
54731
54732var isobject = __webpack_require__(96667);
54733var isDescriptor = __webpack_require__(44133);
54734var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
54735 ? Reflect.defineProperty
54736 : Object.defineProperty;
54737
54738module.exports = function defineProperty(obj, key, val) {
54739 if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
54740 throw new TypeError('expected an object, function, or array');
54741 }
54742
54743 if (typeof key !== 'string') {
54744 throw new TypeError('expected "key" to be a string');
54745 }
54746
54747 if (isDescriptor(val)) {
54748 define(obj, key, val);
54749 return obj;
54750 }
54751
54752 define(obj, key, {
54753 configurable: true,
54754 enumerable: false,
54755 writable: true,
54756 value: val
54757 });
54758
54759 return obj;
54760};
54761
54762
54763/***/ }),
54764
54765/***/ 3767:
54766/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
54767
54768"use strict";
54769
54770
54771var isExtendable = __webpack_require__(98775);
54772var assignSymbols = __webpack_require__(64353);
54773
54774module.exports = Object.assign || function(obj/*, objects*/) {
54775 if (obj === null || typeof obj === 'undefined') {
54776 throw new TypeError('Cannot convert undefined or null to object');
54777 }
54778 if (!isObject(obj)) {
54779 obj = {};
54780 }
54781 for (var i = 1; i < arguments.length; i++) {
54782 var val = arguments[i];
54783 if (isString(val)) {
54784 val = toObject(val);
54785 }
54786 if (isObject(val)) {
54787 assign(obj, val);
54788 assignSymbols(obj, val);
54789 }
54790 }
54791 return obj;
54792};
54793
54794function assign(a, b) {
54795 for (var key in b) {
54796 if (hasOwn(b, key)) {
54797 a[key] = b[key];
54798 }
54799 }
54800}
54801
54802function isString(val) {
54803 return (val && typeof val === 'string');
54804}
54805
54806function toObject(str) {
54807 var obj = {};
54808 for (var i in str) {
54809 obj[i] = str[i];
54810 }
54811 return obj;
54812}
54813
54814function isObject(val) {
54815 return (val && typeof val === 'object') || isExtendable(val);
54816}
54817
54818/**
54819 * Returns true if the given `key` is an own property of `obj`.
54820 */
54821
54822function hasOwn(obj, key) {
54823 return Object.prototype.hasOwnProperty.call(obj, key);
54824}
54825
54826function isEnum(obj, key) {
54827 return Object.prototype.propertyIsEnumerable.call(obj, key);
54828}
54829
54830
54831/***/ }),
54832
54833/***/ 82593:
54834/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
54835
54836"use strict";
54837/*!
54838 * fill-range <https://github.com/jonschlinkert/fill-range>
54839 *
54840 * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
54841 * Released under the MIT License.
54842 */
54843
54844
54845
54846var util = __webpack_require__(31669);
54847var isNumber = __webpack_require__(87218);
54848var extend = __webpack_require__(13342);
54849var repeat = __webpack_require__(6332);
54850var toRegex = __webpack_require__(11846);
54851
54852/**
54853 * Return a range of numbers or letters.
54854 *
54855 * @param {String} `start` Start of the range
54856 * @param {String} `stop` End of the range
54857 * @param {String} `step` Increment or decrement to use.
54858 * @param {Function} `fn` Custom function to modify each element in the range.
54859 * @return {Array}
54860 */
54861
54862function fillRange(start, stop, step, options) {
54863 if (typeof start === 'undefined') {
54864 return [];
54865 }
54866
54867 if (typeof stop === 'undefined' || start === stop) {
54868 // special case, for handling negative zero
54869 var isString = typeof start === 'string';
54870 if (isNumber(start) && !toNumber(start)) {
54871 return [isString ? '0' : 0];
54872 }
54873 return [start];
54874 }
54875
54876 if (typeof step !== 'number' && typeof step !== 'string') {
54877 options = step;
54878 step = undefined;
54879 }
54880
54881 if (typeof options === 'function') {
54882 options = { transform: options };
54883 }
54884
54885 var opts = extend({step: step}, options);
54886 if (opts.step && !isValidNumber(opts.step)) {
54887 if (opts.strictRanges === true) {
54888 throw new TypeError('expected options.step to be a number');
54889 }
54890 return [];
54891 }
54892
54893 opts.isNumber = isValidNumber(start) && isValidNumber(stop);
54894 if (!opts.isNumber && !isValid(start, stop)) {
54895 if (opts.strictRanges === true) {
54896 throw new RangeError('invalid range arguments: ' + util.inspect([start, stop]));
54897 }
54898 return [];
54899 }
54900
54901 opts.isPadded = isPadded(start) || isPadded(stop);
54902 opts.toString = opts.stringify
54903 || typeof opts.step === 'string'
54904 || typeof start === 'string'
54905 || typeof stop === 'string'
54906 || !opts.isNumber;
54907
54908 if (opts.isPadded) {
54909 opts.maxLength = Math.max(String(start).length, String(stop).length);
54910 }
54911
54912 // support legacy minimatch/fill-range options
54913 if (typeof opts.optimize === 'boolean') opts.toRegex = opts.optimize;
54914 if (typeof opts.makeRe === 'boolean') opts.toRegex = opts.makeRe;
54915 return expand(start, stop, opts);
54916}
54917
54918function expand(start, stop, options) {
54919 var a = options.isNumber ? toNumber(start) : start.charCodeAt(0);
54920 var b = options.isNumber ? toNumber(stop) : stop.charCodeAt(0);
54921
54922 var step = Math.abs(toNumber(options.step)) || 1;
54923 if (options.toRegex && step === 1) {
54924 return toRange(a, b, start, stop, options);
54925 }
54926
54927 var zero = {greater: [], lesser: []};
54928 var asc = a < b;
54929 var arr = new Array(Math.round((asc ? b - a : a - b) / step));
54930 var idx = 0;
54931
54932 while (asc ? a <= b : a >= b) {
54933 var val = options.isNumber ? a : String.fromCharCode(a);
54934 if (options.toRegex && (val >= 0 || !options.isNumber)) {
54935 zero.greater.push(val);
54936 } else {
54937 zero.lesser.push(Math.abs(val));
54938 }
54939
54940 if (options.isPadded) {
54941 val = zeros(val, options);
54942 }
54943
54944 if (options.toString) {
54945 val = String(val);
54946 }
54947
54948 if (typeof options.transform === 'function') {
54949 arr[idx++] = options.transform(val, a, b, step, idx, arr, options);
54950 } else {
54951 arr[idx++] = val;
54952 }
54953
54954 if (asc) {
54955 a += step;
54956 } else {
54957 a -= step;
54958 }
54959 }
54960
54961 if (options.toRegex === true) {
54962 return toSequence(arr, zero, options);
54963 }
54964 return arr;
54965}
54966
54967function toRange(a, b, start, stop, options) {
54968 if (options.isPadded) {
54969 return toRegex(start, stop, options);
54970 }
54971
54972 if (options.isNumber) {
54973 return toRegex(Math.min(a, b), Math.max(a, b), options);
54974 }
54975
54976 var start = String.fromCharCode(Math.min(a, b));
54977 var stop = String.fromCharCode(Math.max(a, b));
54978 return '[' + start + '-' + stop + ']';
54979}
54980
54981function toSequence(arr, zeros, options) {
54982 var greater = '', lesser = '';
54983 if (zeros.greater.length) {
54984 greater = zeros.greater.join('|');
54985 }
54986 if (zeros.lesser.length) {
54987 lesser = '-(' + zeros.lesser.join('|') + ')';
54988 }
54989 var res = greater && lesser
54990 ? greater + '|' + lesser
54991 : greater || lesser;
54992
54993 if (options.capture) {
54994 return '(' + res + ')';
54995 }
54996 return res;
54997}
54998
54999function zeros(val, options) {
55000 if (options.isPadded) {
55001 var str = String(val);
55002 var len = str.length;
55003 var dash = '';
55004 if (str.charAt(0) === '-') {
55005 dash = '-';
55006 str = str.slice(1);
55007 }
55008 var diff = options.maxLength - len;
55009 var pad = repeat('0', diff);
55010 val = (dash + pad + str);
55011 }
55012 if (options.stringify) {
55013 return String(val);
55014 }
55015 return val;
55016}
55017
55018function toNumber(val) {
55019 return Number(val) || 0;
55020}
55021
55022function isPadded(str) {
55023 return /^-?0\d/.test(str);
55024}
55025
55026function isValid(min, max) {
55027 return (isValidNumber(min) || isValidLetter(min))
55028 && (isValidNumber(max) || isValidLetter(max));
55029}
55030
55031function isValidLetter(ch) {
55032 return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch);
55033}
55034
55035function isValidNumber(n) {
55036 return isNumber(n) && !/\./.test(n);
55037}
55038
55039/**
55040 * Expose `fillRange`
55041 * @type {Function}
55042 */
55043
55044module.exports = fillRange;
55045
55046
55047/***/ }),
55048
55049/***/ 13342:
55050/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55051
55052"use strict";
55053
55054
55055var isObject = __webpack_require__(27244);
55056
55057module.exports = function extend(o/*, objects*/) {
55058 if (!isObject(o)) { o = {}; }
55059
55060 var len = arguments.length;
55061 for (var i = 1; i < len; i++) {
55062 var obj = arguments[i];
55063
55064 if (isObject(obj)) {
55065 assign(o, obj);
55066 }
55067 }
55068 return o;
55069};
55070
55071function assign(a, b) {
55072 for (var key in b) {
55073 if (hasOwn(b, key)) {
55074 a[key] = b[key];
55075 }
55076 }
55077}
55078
55079/**
55080 * Returns true if the given `key` is an own property of `obj`.
55081 */
55082
55083function hasOwn(obj, key) {
55084 return Object.prototype.hasOwnProperty.call(obj, key);
55085}
55086
55087
55088/***/ }),
55089
55090/***/ 27244:
55091/***/ (function(module) {
55092
55093"use strict";
55094/*!
55095 * is-extendable <https://github.com/jonschlinkert/is-extendable>
55096 *
55097 * Copyright (c) 2015, Jon Schlinkert.
55098 * Licensed under the MIT License.
55099 */
55100
55101
55102
55103module.exports = function isExtendable(val) {
55104 return typeof val !== 'undefined' && val !== null
55105 && (typeof val === 'object' || typeof val === 'function');
55106};
55107
55108
55109/***/ }),
55110
55111/***/ 98775:
55112/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55113
55114"use strict";
55115/*!
55116 * is-extendable <https://github.com/jonschlinkert/is-extendable>
55117 *
55118 * Copyright (c) 2015-2017, Jon Schlinkert.
55119 * Released under the MIT License.
55120 */
55121
55122
55123
55124var isPlainObject = __webpack_require__(81064);
55125
55126module.exports = function isExtendable(val) {
55127 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
55128};
55129
55130
55131/***/ }),
55132
55133/***/ 19613:
55134/***/ (function(module) {
55135
55136var toString = Object.prototype.toString;
55137
55138module.exports = function kindOf(val) {
55139 if (val === void 0) return 'undefined';
55140 if (val === null) return 'null';
55141
55142 var type = typeof val;
55143 if (type === 'boolean') return 'boolean';
55144 if (type === 'string') return 'string';
55145 if (type === 'number') return 'number';
55146 if (type === 'symbol') return 'symbol';
55147 if (type === 'function') {
55148 return isGeneratorFn(val) ? 'generatorfunction' : 'function';
55149 }
55150
55151 if (isArray(val)) return 'array';
55152 if (isBuffer(val)) return 'buffer';
55153 if (isArguments(val)) return 'arguments';
55154 if (isDate(val)) return 'date';
55155 if (isError(val)) return 'error';
55156 if (isRegexp(val)) return 'regexp';
55157
55158 switch (ctorName(val)) {
55159 case 'Symbol': return 'symbol';
55160 case 'Promise': return 'promise';
55161
55162 // Set, Map, WeakSet, WeakMap
55163 case 'WeakMap': return 'weakmap';
55164 case 'WeakSet': return 'weakset';
55165 case 'Map': return 'map';
55166 case 'Set': return 'set';
55167
55168 // 8-bit typed arrays
55169 case 'Int8Array': return 'int8array';
55170 case 'Uint8Array': return 'uint8array';
55171 case 'Uint8ClampedArray': return 'uint8clampedarray';
55172
55173 // 16-bit typed arrays
55174 case 'Int16Array': return 'int16array';
55175 case 'Uint16Array': return 'uint16array';
55176
55177 // 32-bit typed arrays
55178 case 'Int32Array': return 'int32array';
55179 case 'Uint32Array': return 'uint32array';
55180 case 'Float32Array': return 'float32array';
55181 case 'Float64Array': return 'float64array';
55182 }
55183
55184 if (isGeneratorObj(val)) {
55185 return 'generator';
55186 }
55187
55188 // Non-plain objects
55189 type = toString.call(val);
55190 switch (type) {
55191 case '[object Object]': return 'object';
55192 // iterators
55193 case '[object Map Iterator]': return 'mapiterator';
55194 case '[object Set Iterator]': return 'setiterator';
55195 case '[object String Iterator]': return 'stringiterator';
55196 case '[object Array Iterator]': return 'arrayiterator';
55197 }
55198
55199 // other
55200 return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
55201};
55202
55203function ctorName(val) {
55204 return typeof val.constructor === 'function' ? val.constructor.name : null;
55205}
55206
55207function isArray(val) {
55208 if (Array.isArray) return Array.isArray(val);
55209 return val instanceof Array;
55210}
55211
55212function isError(val) {
55213 return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
55214}
55215
55216function isDate(val) {
55217 if (val instanceof Date) return true;
55218 return typeof val.toDateString === 'function'
55219 && typeof val.getDate === 'function'
55220 && typeof val.setDate === 'function';
55221}
55222
55223function isRegexp(val) {
55224 if (val instanceof RegExp) return true;
55225 return typeof val.flags === 'string'
55226 && typeof val.ignoreCase === 'boolean'
55227 && typeof val.multiline === 'boolean'
55228 && typeof val.global === 'boolean';
55229}
55230
55231function isGeneratorFn(name, val) {
55232 return ctorName(name) === 'GeneratorFunction';
55233}
55234
55235function isGeneratorObj(val) {
55236 return typeof val.throw === 'function'
55237 && typeof val.return === 'function'
55238 && typeof val.next === 'function';
55239}
55240
55241function isArguments(val) {
55242 try {
55243 if (typeof val.length === 'number' && typeof val.callee === 'function') {
55244 return true;
55245 }
55246 } catch (err) {
55247 if (err.message.indexOf('callee') !== -1) {
55248 return true;
55249 }
55250 }
55251 return false;
55252}
55253
55254/**
55255 * If you need to support Safari 5-7 (8-10 yr-old browser),
55256 * take a look at https://github.com/feross/is-buffer
55257 */
55258
55259function isBuffer(val) {
55260 if (val.constructor && typeof val.constructor.isBuffer === 'function') {
55261 return val.constructor.isBuffer(val);
55262 }
55263 return false;
55264}
55265
55266
55267/***/ }),
55268
55269/***/ 11846:
55270/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55271
55272"use strict";
55273/*!
55274 * to-regex-range <https://github.com/jonschlinkert/to-regex-range>
55275 *
55276 * Copyright (c) 2015, 2017, Jon Schlinkert.
55277 * Released under the MIT License.
55278 */
55279
55280
55281
55282var repeat = __webpack_require__(6332);
55283var isNumber = __webpack_require__(87218);
55284var cache = {};
55285
55286function toRegexRange(min, max, options) {
55287 if (isNumber(min) === false) {
55288 throw new RangeError('toRegexRange: first argument is invalid.');
55289 }
55290
55291 if (typeof max === 'undefined' || min === max) {
55292 return String(min);
55293 }
55294
55295 if (isNumber(max) === false) {
55296 throw new RangeError('toRegexRange: second argument is invalid.');
55297 }
55298
55299 options = options || {};
55300 var relax = String(options.relaxZeros);
55301 var shorthand = String(options.shorthand);
55302 var capture = String(options.capture);
55303 var key = min + ':' + max + '=' + relax + shorthand + capture;
55304 if (cache.hasOwnProperty(key)) {
55305 return cache[key].result;
55306 }
55307
55308 var a = Math.min(min, max);
55309 var b = Math.max(min, max);
55310
55311 if (Math.abs(a - b) === 1) {
55312 var result = min + '|' + max;
55313 if (options.capture) {
55314 return '(' + result + ')';
55315 }
55316 return result;
55317 }
55318
55319 var isPadded = padding(min) || padding(max);
55320 var positives = [];
55321 var negatives = [];
55322
55323 var tok = {min: min, max: max, a: a, b: b};
55324 if (isPadded) {
55325 tok.isPadded = isPadded;
55326 tok.maxLen = String(tok.max).length;
55327 }
55328
55329 if (a < 0) {
55330 var newMin = b < 0 ? Math.abs(b) : 1;
55331 var newMax = Math.abs(a);
55332 negatives = splitToPatterns(newMin, newMax, tok, options);
55333 a = tok.a = 0;
55334 }
55335
55336 if (b >= 0) {
55337 positives = splitToPatterns(a, b, tok, options);
55338 }
55339
55340 tok.negatives = negatives;
55341 tok.positives = positives;
55342 tok.result = siftPatterns(negatives, positives, options);
55343
55344 if (options.capture && (positives.length + negatives.length) > 1) {
55345 tok.result = '(' + tok.result + ')';
55346 }
55347
55348 cache[key] = tok;
55349 return tok.result;
55350}
55351
55352function siftPatterns(neg, pos, options) {
55353 var onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
55354 var onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
55355 var intersected = filterPatterns(neg, pos, '-?', true, options) || [];
55356 var subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
55357 return subpatterns.join('|');
55358}
55359
55360function splitToRanges(min, max) {
55361 min = Number(min);
55362 max = Number(max);
55363
55364 var nines = 1;
55365 var stops = [max];
55366 var stop = +countNines(min, nines);
55367
55368 while (min <= stop && stop <= max) {
55369 stops = push(stops, stop);
55370 nines += 1;
55371 stop = +countNines(min, nines);
55372 }
55373
55374 var zeros = 1;
55375 stop = countZeros(max + 1, zeros) - 1;
55376
55377 while (min < stop && stop <= max) {
55378 stops = push(stops, stop);
55379 zeros += 1;
55380 stop = countZeros(max + 1, zeros) - 1;
55381 }
55382
55383 stops.sort(compare);
55384 return stops;
55385}
55386
55387/**
55388 * Convert a range to a regex pattern
55389 * @param {Number} `start`
55390 * @param {Number} `stop`
55391 * @return {String}
55392 */
55393
55394function rangeToPattern(start, stop, options) {
55395 if (start === stop) {
55396 return {pattern: String(start), digits: []};
55397 }
55398
55399 var zipped = zip(String(start), String(stop));
55400 var len = zipped.length, i = -1;
55401
55402 var pattern = '';
55403 var digits = 0;
55404
55405 while (++i < len) {
55406 var numbers = zipped[i];
55407 var startDigit = numbers[0];
55408 var stopDigit = numbers[1];
55409
55410 if (startDigit === stopDigit) {
55411 pattern += startDigit;
55412
55413 } else if (startDigit !== '0' || stopDigit !== '9') {
55414 pattern += toCharacterClass(startDigit, stopDigit);
55415
55416 } else {
55417 digits += 1;
55418 }
55419 }
55420
55421 if (digits) {
55422 pattern += options.shorthand ? '\\d' : '[0-9]';
55423 }
55424
55425 return { pattern: pattern, digits: [digits] };
55426}
55427
55428function splitToPatterns(min, max, tok, options) {
55429 var ranges = splitToRanges(min, max);
55430 var len = ranges.length;
55431 var idx = -1;
55432
55433 var tokens = [];
55434 var start = min;
55435 var prev;
55436
55437 while (++idx < len) {
55438 var range = ranges[idx];
55439 var obj = rangeToPattern(start, range, options);
55440 var zeros = '';
55441
55442 if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
55443 if (prev.digits.length > 1) {
55444 prev.digits.pop();
55445 }
55446 prev.digits.push(obj.digits[0]);
55447 prev.string = prev.pattern + toQuantifier(prev.digits);
55448 start = range + 1;
55449 continue;
55450 }
55451
55452 if (tok.isPadded) {
55453 zeros = padZeros(range, tok);
55454 }
55455
55456 obj.string = zeros + obj.pattern + toQuantifier(obj.digits);
55457 tokens.push(obj);
55458 start = range + 1;
55459 prev = obj;
55460 }
55461
55462 return tokens;
55463}
55464
55465function filterPatterns(arr, comparison, prefix, intersection, options) {
55466 var res = [];
55467
55468 for (var i = 0; i < arr.length; i++) {
55469 var tok = arr[i];
55470 var ele = tok.string;
55471
55472 if (options.relaxZeros !== false) {
55473 if (prefix === '-' && ele.charAt(0) === '0') {
55474 if (ele.charAt(1) === '{') {
55475 ele = '0*' + ele.replace(/^0\{\d+\}/, '');
55476 } else {
55477 ele = '0*' + ele.slice(1);
55478 }
55479 }
55480 }
55481
55482 if (!intersection && !contains(comparison, 'string', ele)) {
55483 res.push(prefix + ele);
55484 }
55485
55486 if (intersection && contains(comparison, 'string', ele)) {
55487 res.push(prefix + ele);
55488 }
55489 }
55490 return res;
55491}
55492
55493/**
55494 * Zip strings (`for in` can be used on string characters)
55495 */
55496
55497function zip(a, b) {
55498 var arr = [];
55499 for (var ch in a) arr.push([a[ch], b[ch]]);
55500 return arr;
55501}
55502
55503function compare(a, b) {
55504 return a > b ? 1 : b > a ? -1 : 0;
55505}
55506
55507function push(arr, ele) {
55508 if (arr.indexOf(ele) === -1) arr.push(ele);
55509 return arr;
55510}
55511
55512function contains(arr, key, val) {
55513 for (var i = 0; i < arr.length; i++) {
55514 if (arr[i][key] === val) {
55515 return true;
55516 }
55517 }
55518 return false;
55519}
55520
55521function countNines(min, len) {
55522 return String(min).slice(0, -len) + repeat('9', len);
55523}
55524
55525function countZeros(integer, zeros) {
55526 return integer - (integer % Math.pow(10, zeros));
55527}
55528
55529function toQuantifier(digits) {
55530 var start = digits[0];
55531 var stop = digits[1] ? (',' + digits[1]) : '';
55532 if (!stop && (!start || start === 1)) {
55533 return '';
55534 }
55535 return '{' + start + stop + '}';
55536}
55537
55538function toCharacterClass(a, b) {
55539 return '[' + a + ((b - a === 1) ? '' : '-') + b + ']';
55540}
55541
55542function padding(str) {
55543 return /^-?(0+)\d/.exec(str);
55544}
55545
55546function padZeros(val, tok) {
55547 if (tok.isPadded) {
55548 var diff = Math.abs(tok.maxLen - String(val).length);
55549 switch (diff) {
55550 case 0:
55551 return '';
55552 case 1:
55553 return '0';
55554 default: {
55555 return '0{' + diff + '}';
55556 }
55557 }
55558 }
55559 return val;
55560}
55561
55562/**
55563 * Expose `toRegexRange`
55564 */
55565
55566module.exports = toRegexRange;
55567
55568
55569/***/ }),
55570
55571/***/ 4870:
55572/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55573
55574"use strict";
55575
55576
55577var isExtendable = __webpack_require__(29502);
55578var forIn = __webpack_require__(43086);
55579
55580function mixinDeep(target, objects) {
55581 var len = arguments.length, i = 0;
55582 while (++i < len) {
55583 var obj = arguments[i];
55584 if (isObject(obj)) {
55585 forIn(obj, copy, target);
55586 }
55587 }
55588 return target;
55589}
55590
55591/**
55592 * Copy properties from the source object to the
55593 * target object.
55594 *
55595 * @param {*} `val`
55596 * @param {String} `key`
55597 */
55598
55599function copy(val, key) {
55600 if (!isValidKey(key)) {
55601 return;
55602 }
55603
55604 var obj = this[key];
55605 if (isObject(val) && isObject(obj)) {
55606 mixinDeep(obj, val);
55607 } else {
55608 this[key] = val;
55609 }
55610}
55611
55612/**
55613 * Returns true if `val` is an object or function.
55614 *
55615 * @param {any} val
55616 * @return {Boolean}
55617 */
55618
55619function isObject(val) {
55620 return isExtendable(val) && !Array.isArray(val);
55621}
55622
55623/**
55624 * Returns true if `key` is a valid key to use when extending objects.
55625 *
55626 * @param {String} `key`
55627 * @return {Boolean}
55628 */
55629
55630function isValidKey(key) {
55631 return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
55632};
55633
55634/**
55635 * Expose `mixinDeep`
55636 */
55637
55638module.exports = mixinDeep;
55639
55640
55641/***/ }),
55642
55643/***/ 29502:
55644/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55645
55646"use strict";
55647/*!
55648 * is-extendable <https://github.com/jonschlinkert/is-extendable>
55649 *
55650 * Copyright (c) 2015-2017, Jon Schlinkert.
55651 * Released under the MIT License.
55652 */
55653
55654
55655
55656var isPlainObject = __webpack_require__(81064);
55657
55658module.exports = function isExtendable(val) {
55659 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
55660};
55661
55662
55663/***/ }),
55664
55665/***/ 50998:
55666/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55667
55668var path = __webpack_require__(85622);
55669var fs = __webpack_require__(35747);
55670var _0777 = parseInt('0777', 8);
55671
55672module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
55673
55674function mkdirP (p, opts, f, made) {
55675 if (typeof opts === 'function') {
55676 f = opts;
55677 opts = {};
55678 }
55679 else if (!opts || typeof opts !== 'object') {
55680 opts = { mode: opts };
55681 }
55682
55683 var mode = opts.mode;
55684 var xfs = opts.fs || fs;
55685
55686 if (mode === undefined) {
55687 mode = _0777
55688 }
55689 if (!made) made = null;
55690
55691 var cb = f || function () {};
55692 p = path.resolve(p);
55693
55694 xfs.mkdir(p, mode, function (er) {
55695 if (!er) {
55696 made = made || p;
55697 return cb(null, made);
55698 }
55699 switch (er.code) {
55700 case 'ENOENT':
55701 if (path.dirname(p) === p) return cb(er);
55702 mkdirP(path.dirname(p), opts, function (er, made) {
55703 if (er) cb(er, made);
55704 else mkdirP(p, opts, cb, made);
55705 });
55706 break;
55707
55708 // In the case of any other error, just see if there's a dir
55709 // there already. If so, then hooray! If not, then something
55710 // is borked.
55711 default:
55712 xfs.stat(p, function (er2, stat) {
55713 // if the stat fails, then that's super weird.
55714 // let the original error be the failure reason.
55715 if (er2 || !stat.isDirectory()) cb(er, made)
55716 else cb(null, made);
55717 });
55718 break;
55719 }
55720 });
55721}
55722
55723mkdirP.sync = function sync (p, opts, made) {
55724 if (!opts || typeof opts !== 'object') {
55725 opts = { mode: opts };
55726 }
55727
55728 var mode = opts.mode;
55729 var xfs = opts.fs || fs;
55730
55731 if (mode === undefined) {
55732 mode = _0777
55733 }
55734 if (!made) made = null;
55735
55736 p = path.resolve(p);
55737
55738 try {
55739 xfs.mkdirSync(p, mode);
55740 made = made || p;
55741 }
55742 catch (err0) {
55743 switch (err0.code) {
55744 case 'ENOENT' :
55745 made = sync(path.dirname(p), opts, made);
55746 sync(p, opts, made);
55747 break;
55748
55749 // In the case of any other error, just see if there's a dir
55750 // there already. If so, then hooray! If not, then something
55751 // is borked.
55752 default:
55753 var stat;
55754 try {
55755 stat = xfs.statSync(p);
55756 }
55757 catch (err1) {
55758 throw err0;
55759 }
55760 if (!stat.isDirectory()) throw err0;
55761 break;
55762 }
55763 }
55764
55765 return made;
55766};
55767
55768
55769/***/ }),
55770
55771/***/ 57925:
55772/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
55773
55774"use strict";
55775
55776
55777/**
55778 * Module dependencies
55779 */
55780
55781var util = __webpack_require__(31669);
55782var toRegex = __webpack_require__(51279);
55783var extend = __webpack_require__(69148);
55784
55785/**
55786 * Local dependencies
55787 */
55788
55789var compilers = __webpack_require__(4756);
55790var parsers = __webpack_require__(5333);
55791var cache = __webpack_require__(58250);
55792var utils = __webpack_require__(41340);
55793var MAX_LENGTH = 1024 * 64;
55794
55795/**
55796 * The main function takes a list of strings and one or more
55797 * glob patterns to use for matching.
55798 *
55799 * ```js
55800 * var nm = require('nanomatch');
55801 * nm(list, patterns[, options]);
55802 *
55803 * console.log(nm(['a.js', 'a.txt'], ['*.js']));
55804 * //=> [ 'a.js' ]
55805 * ```
55806 * @param {Array} `list` A list of strings to match
55807 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
55808 * @param {Object} `options` See available [options](#options) for changing how matches are performed
55809 * @return {Array} Returns an array of matches
55810 * @summary false
55811 * @api public
55812 */
55813
55814function nanomatch(list, patterns, options) {
55815 patterns = utils.arrayify(patterns);
55816 list = utils.arrayify(list);
55817
55818 var len = patterns.length;
55819 if (list.length === 0 || len === 0) {
55820 return [];
55821 }
55822
55823 if (len === 1) {
55824 return nanomatch.match(list, patterns[0], options);
55825 }
55826
55827 var negated = false;
55828 var omit = [];
55829 var keep = [];
55830 var idx = -1;
55831
55832 while (++idx < len) {
55833 var pattern = patterns[idx];
55834
55835 if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) {
55836 omit.push.apply(omit, nanomatch.match(list, pattern.slice(1), options));
55837 negated = true;
55838 } else {
55839 keep.push.apply(keep, nanomatch.match(list, pattern, options));
55840 }
55841 }
55842
55843 // minimatch.match parity
55844 if (negated && keep.length === 0) {
55845 if (options && options.unixify === false) {
55846 keep = list.slice();
55847 } else {
55848 var unixify = utils.unixify(options);
55849 for (var i = 0; i < list.length; i++) {
55850 keep.push(unixify(list[i]));
55851 }
55852 }
55853 }
55854
55855 var matches = utils.diff(keep, omit);
55856 if (!options || options.nodupes !== false) {
55857 return utils.unique(matches);
55858 }
55859
55860 return matches;
55861}
55862
55863/**
55864 * Similar to the main function, but `pattern` must be a string.
55865 *
55866 * ```js
55867 * var nm = require('nanomatch');
55868 * nm.match(list, pattern[, options]);
55869 *
55870 * console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
55871 * //=> ['a.a', 'a.aa']
55872 * ```
55873 * @param {Array} `list` Array of strings to match
55874 * @param {String} `pattern` Glob pattern to use for matching.
55875 * @param {Object} `options` See available [options](#options) for changing how matches are performed
55876 * @return {Array} Returns an array of matches
55877 * @api public
55878 */
55879
55880nanomatch.match = function(list, pattern, options) {
55881 if (Array.isArray(pattern)) {
55882 throw new TypeError('expected pattern to be a string');
55883 }
55884
55885 var unixify = utils.unixify(options);
55886 var isMatch = memoize('match', pattern, options, nanomatch.matcher);
55887 var matches = [];
55888
55889 list = utils.arrayify(list);
55890 var len = list.length;
55891 var idx = -1;
55892
55893 while (++idx < len) {
55894 var ele = list[idx];
55895 if (ele === pattern || isMatch(ele)) {
55896 matches.push(utils.value(ele, unixify, options));
55897 }
55898 }
55899
55900 // if no options were passed, uniquify results and return
55901 if (typeof options === 'undefined') {
55902 return utils.unique(matches);
55903 }
55904
55905 if (matches.length === 0) {
55906 if (options.failglob === true) {
55907 throw new Error('no matches found for "' + pattern + '"');
55908 }
55909 if (options.nonull === true || options.nullglob === true) {
55910 return [options.unescape ? utils.unescape(pattern) : pattern];
55911 }
55912 }
55913
55914 // if `opts.ignore` was defined, diff ignored list
55915 if (options.ignore) {
55916 matches = nanomatch.not(matches, options.ignore, options);
55917 }
55918
55919 return options.nodupes !== false ? utils.unique(matches) : matches;
55920};
55921
55922/**
55923 * Returns true if the specified `string` matches the given glob `pattern`.
55924 *
55925 * ```js
55926 * var nm = require('nanomatch');
55927 * nm.isMatch(string, pattern[, options]);
55928 *
55929 * console.log(nm.isMatch('a.a', '*.a'));
55930 * //=> true
55931 * console.log(nm.isMatch('a.b', '*.a'));
55932 * //=> false
55933 * ```
55934 * @param {String} `string` String to match
55935 * @param {String} `pattern` Glob pattern to use for matching.
55936 * @param {Object} `options` See available [options](#options) for changing how matches are performed
55937 * @return {Boolean} Returns true if the string matches the glob pattern.
55938 * @api public
55939 */
55940
55941nanomatch.isMatch = function(str, pattern, options) {
55942 if (typeof str !== 'string') {
55943 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
55944 }
55945
55946 if (utils.isEmptyString(str) || utils.isEmptyString(pattern)) {
55947 return false;
55948 }
55949
55950 var equals = utils.equalsPattern(options);
55951 if (equals(str)) {
55952 return true;
55953 }
55954
55955 var isMatch = memoize('isMatch', pattern, options, nanomatch.matcher);
55956 return isMatch(str);
55957};
55958
55959/**
55960 * Returns true if some of the elements in the given `list` match any of the
55961 * given glob `patterns`.
55962 *
55963 * ```js
55964 * var nm = require('nanomatch');
55965 * nm.some(list, patterns[, options]);
55966 *
55967 * console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
55968 * // true
55969 * console.log(nm.some(['foo.js'], ['*.js', '!foo.js']));
55970 * // false
55971 * ```
55972 * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
55973 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
55974 * @param {Object} `options` See available [options](#options) for changing how matches are performed
55975 * @return {Boolean} Returns true if any patterns match `str`
55976 * @api public
55977 */
55978
55979nanomatch.some = function(list, patterns, options) {
55980 if (typeof list === 'string') {
55981 list = [list];
55982 }
55983
55984 for (var i = 0; i < list.length; i++) {
55985 if (nanomatch(list[i], patterns, options).length === 1) {
55986 return true;
55987 }
55988 }
55989
55990 return false;
55991};
55992
55993/**
55994 * Returns true if every element in the given `list` matches
55995 * at least one of the given glob `patterns`.
55996 *
55997 * ```js
55998 * var nm = require('nanomatch');
55999 * nm.every(list, patterns[, options]);
56000 *
56001 * console.log(nm.every('foo.js', ['foo.js']));
56002 * // true
56003 * console.log(nm.every(['foo.js', 'bar.js'], ['*.js']));
56004 * // true
56005 * console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
56006 * // false
56007 * console.log(nm.every(['foo.js'], ['*.js', '!foo.js']));
56008 * // false
56009 * ```
56010 * @param {String|Array} `list` The string or array of strings to test.
56011 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
56012 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56013 * @return {Boolean} Returns true if any patterns match `str`
56014 * @api public
56015 */
56016
56017nanomatch.every = function(list, patterns, options) {
56018 if (typeof list === 'string') {
56019 list = [list];
56020 }
56021
56022 for (var i = 0; i < list.length; i++) {
56023 if (nanomatch(list[i], patterns, options).length !== 1) {
56024 return false;
56025 }
56026 }
56027
56028 return true;
56029};
56030
56031/**
56032 * Returns true if **any** of the given glob `patterns`
56033 * match the specified `string`.
56034 *
56035 * ```js
56036 * var nm = require('nanomatch');
56037 * nm.any(string, patterns[, options]);
56038 *
56039 * console.log(nm.any('a.a', ['b.*', '*.a']));
56040 * //=> true
56041 * console.log(nm.any('a.a', 'b.*'));
56042 * //=> false
56043 * ```
56044 * @param {String|Array} `str` The string to test.
56045 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
56046 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56047 * @return {Boolean} Returns true if any patterns match `str`
56048 * @api public
56049 */
56050
56051nanomatch.any = function(str, patterns, options) {
56052 if (typeof str !== 'string') {
56053 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
56054 }
56055
56056 if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
56057 return false;
56058 }
56059
56060 if (typeof patterns === 'string') {
56061 patterns = [patterns];
56062 }
56063
56064 for (var i = 0; i < patterns.length; i++) {
56065 if (nanomatch.isMatch(str, patterns[i], options)) {
56066 return true;
56067 }
56068 }
56069 return false;
56070};
56071
56072/**
56073 * Returns true if **all** of the given `patterns`
56074 * match the specified string.
56075 *
56076 * ```js
56077 * var nm = require('nanomatch');
56078 * nm.all(string, patterns[, options]);
56079 *
56080 * console.log(nm.all('foo.js', ['foo.js']));
56081 * // true
56082 *
56083 * console.log(nm.all('foo.js', ['*.js', '!foo.js']));
56084 * // false
56085 *
56086 * console.log(nm.all('foo.js', ['*.js', 'foo.js']));
56087 * // true
56088 *
56089 * console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
56090 * // true
56091 * ```
56092 * @param {String|Array} `str` The string to test.
56093 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
56094 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56095 * @return {Boolean} Returns true if any patterns match `str`
56096 * @api public
56097 */
56098
56099nanomatch.all = function(str, patterns, options) {
56100 if (typeof str !== 'string') {
56101 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
56102 }
56103
56104 if (typeof patterns === 'string') {
56105 patterns = [patterns];
56106 }
56107
56108 for (var i = 0; i < patterns.length; i++) {
56109 if (!nanomatch.isMatch(str, patterns[i], options)) {
56110 return false;
56111 }
56112 }
56113 return true;
56114};
56115
56116/**
56117 * Returns a list of strings that _**do not match any**_ of the given `patterns`.
56118 *
56119 * ```js
56120 * var nm = require('nanomatch');
56121 * nm.not(list, patterns[, options]);
56122 *
56123 * console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a'));
56124 * //=> ['b.b', 'c.c']
56125 * ```
56126 * @param {Array} `list` Array of strings to match.
56127 * @param {String|Array} `patterns` One or more glob pattern to use for matching.
56128 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56129 * @return {Array} Returns an array of strings that **do not match** the given patterns.
56130 * @api public
56131 */
56132
56133nanomatch.not = function(list, patterns, options) {
56134 var opts = extend({}, options);
56135 var ignore = opts.ignore;
56136 delete opts.ignore;
56137
56138 list = utils.arrayify(list);
56139
56140 var matches = utils.diff(list, nanomatch(list, patterns, opts));
56141 if (ignore) {
56142 matches = utils.diff(matches, nanomatch(list, ignore));
56143 }
56144
56145 return opts.nodupes !== false ? utils.unique(matches) : matches;
56146};
56147
56148/**
56149 * Returns true if the given `string` contains the given pattern. Similar
56150 * to [.isMatch](#isMatch) but the pattern can match any part of the string.
56151 *
56152 * ```js
56153 * var nm = require('nanomatch');
56154 * nm.contains(string, pattern[, options]);
56155 *
56156 * console.log(nm.contains('aa/bb/cc', '*b'));
56157 * //=> true
56158 * console.log(nm.contains('aa/bb/cc', '*d'));
56159 * //=> false
56160 * ```
56161 * @param {String} `str` The string to match.
56162 * @param {String|Array} `patterns` Glob pattern to use for matching.
56163 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56164 * @return {Boolean} Returns true if the patter matches any part of `str`.
56165 * @api public
56166 */
56167
56168nanomatch.contains = function(str, patterns, options) {
56169 if (typeof str !== 'string') {
56170 throw new TypeError('expected a string: "' + util.inspect(str) + '"');
56171 }
56172
56173 if (typeof patterns === 'string') {
56174 if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
56175 return false;
56176 }
56177
56178 var equals = utils.equalsPattern(patterns, options);
56179 if (equals(str)) {
56180 return true;
56181 }
56182 var contains = utils.containsPattern(patterns, options);
56183 if (contains(str)) {
56184 return true;
56185 }
56186 }
56187
56188 var opts = extend({}, options, {contains: true});
56189 return nanomatch.any(str, patterns, opts);
56190};
56191
56192/**
56193 * Returns true if the given pattern and options should enable
56194 * the `matchBase` option.
56195 * @return {Boolean}
56196 * @api private
56197 */
56198
56199nanomatch.matchBase = function(pattern, options) {
56200 if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
56201 return options.basename === true || options.matchBase === true;
56202};
56203
56204/**
56205 * Filter the keys of the given object with the given `glob` pattern
56206 * and `options`. Does not attempt to match nested keys. If you need this feature,
56207 * use [glob-object][] instead.
56208 *
56209 * ```js
56210 * var nm = require('nanomatch');
56211 * nm.matchKeys(object, patterns[, options]);
56212 *
56213 * var obj = { aa: 'a', ab: 'b', ac: 'c' };
56214 * console.log(nm.matchKeys(obj, '*b'));
56215 * //=> { ab: 'b' }
56216 * ```
56217 * @param {Object} `object` The object with keys to filter.
56218 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
56219 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56220 * @return {Object} Returns an object with only keys that match the given patterns.
56221 * @api public
56222 */
56223
56224nanomatch.matchKeys = function(obj, patterns, options) {
56225 if (!utils.isObject(obj)) {
56226 throw new TypeError('expected the first argument to be an object');
56227 }
56228 var keys = nanomatch(Object.keys(obj), patterns, options);
56229 return utils.pick(obj, keys);
56230};
56231
56232/**
56233 * Returns a memoized matcher function from the given glob `pattern` and `options`.
56234 * The returned function takes a string to match as its only argument and returns
56235 * true if the string is a match.
56236 *
56237 * ```js
56238 * var nm = require('nanomatch');
56239 * nm.matcher(pattern[, options]);
56240 *
56241 * var isMatch = nm.matcher('*.!(*a)');
56242 * console.log(isMatch('a.a'));
56243 * //=> false
56244 * console.log(isMatch('a.b'));
56245 * //=> true
56246 * ```
56247 * @param {String} `pattern` Glob pattern
56248 * @param {Object} `options` See available [options](#options) for changing how matches are performed.
56249 * @return {Function} Returns a matcher function.
56250 * @api public
56251 */
56252
56253nanomatch.matcher = function matcher(pattern, options) {
56254 if (utils.isEmptyString(pattern)) {
56255 return function() {
56256 return false;
56257 };
56258 }
56259
56260 if (Array.isArray(pattern)) {
56261 return compose(pattern, options, matcher);
56262 }
56263
56264 // if pattern is a regex
56265 if (pattern instanceof RegExp) {
56266 return test(pattern);
56267 }
56268
56269 // if pattern is invalid
56270 if (!utils.isString(pattern)) {
56271 throw new TypeError('expected pattern to be an array, string or regex');
56272 }
56273
56274 // if pattern is a non-glob string
56275 if (!utils.hasSpecialChars(pattern)) {
56276 if (options && options.nocase === true) {
56277 pattern = pattern.toLowerCase();
56278 }
56279 return utils.matchPath(pattern, options);
56280 }
56281
56282 // if pattern is a glob string
56283 var re = nanomatch.makeRe(pattern, options);
56284
56285 // if `options.matchBase` or `options.basename` is defined
56286 if (nanomatch.matchBase(pattern, options)) {
56287 return utils.matchBasename(re, options);
56288 }
56289
56290 function test(regex) {
56291 var equals = utils.equalsPattern(options);
56292 var unixify = utils.unixify(options);
56293
56294 return function(str) {
56295 if (equals(str)) {
56296 return true;
56297 }
56298
56299 if (regex.test(unixify(str))) {
56300 return true;
56301 }
56302 return false;
56303 };
56304 }
56305
56306 // create matcher function
56307 var matcherFn = test(re);
56308 // set result object from compiler on matcher function,
56309 // as a non-enumerable property. useful for debugging
56310 utils.define(matcherFn, 'result', re.result);
56311 return matcherFn;
56312};
56313
56314/**
56315 * Returns an array of matches captured by `pattern` in `string, or
56316 * `null` if the pattern did not match.
56317 *
56318 * ```js
56319 * var nm = require('nanomatch');
56320 * nm.capture(pattern, string[, options]);
56321 *
56322 * console.log(nm.capture('test/*.js', 'test/foo.js'));
56323 * //=> ['foo']
56324 * console.log(nm.capture('test/*.js', 'foo/bar.css'));
56325 * //=> null
56326 * ```
56327 * @param {String} `pattern` Glob pattern to use for matching.
56328 * @param {String} `string` String to match
56329 * @param {Object} `options` See available [options](#options) for changing how matches are performed
56330 * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
56331 * @api public
56332 */
56333
56334nanomatch.capture = function(pattern, str, options) {
56335 var re = nanomatch.makeRe(pattern, extend({capture: true}, options));
56336 var unixify = utils.unixify(options);
56337
56338 function match() {
56339 return function(string) {
56340 var match = re.exec(unixify(string));
56341 if (!match) {
56342 return null;
56343 }
56344
56345 return match.slice(1);
56346 };
56347 }
56348
56349 var capture = memoize('capture', pattern, options, match);
56350 return capture(str);
56351};
56352
56353/**
56354 * Create a regular expression from the given glob `pattern`.
56355 *
56356 * ```js
56357 * var nm = require('nanomatch');
56358 * nm.makeRe(pattern[, options]);
56359 *
56360 * console.log(nm.makeRe('*.js'));
56361 * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
56362 * ```
56363 * @param {String} `pattern` A glob pattern to convert to regex.
56364 * @param {Object} `options` See available [options](#options) for changing how matches are performed.
56365 * @return {RegExp} Returns a regex created from the given pattern.
56366 * @api public
56367 */
56368
56369nanomatch.makeRe = function(pattern, options) {
56370 if (pattern instanceof RegExp) {
56371 return pattern;
56372 }
56373
56374 if (typeof pattern !== 'string') {
56375 throw new TypeError('expected pattern to be a string');
56376 }
56377
56378 if (pattern.length > MAX_LENGTH) {
56379 throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
56380 }
56381
56382 function makeRe() {
56383 var opts = utils.extend({wrap: false}, options);
56384 var result = nanomatch.create(pattern, opts);
56385 var regex = toRegex(result.output, opts);
56386 utils.define(regex, 'result', result);
56387 return regex;
56388 }
56389
56390 return memoize('makeRe', pattern, options, makeRe);
56391};
56392
56393/**
56394 * Parses the given glob `pattern` and returns an object with the compiled `output`
56395 * and optional source `map`.
56396 *
56397 * ```js
56398 * var nm = require('nanomatch');
56399 * nm.create(pattern[, options]);
56400 *
56401 * console.log(nm.create('abc/*.js'));
56402 * // { options: { source: 'string', sourcemap: true },
56403 * // state: {},
56404 * // compilers:
56405 * // { ... },
56406 * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
56407 * // ast:
56408 * // { type: 'root',
56409 * // errors: [],
56410 * // nodes:
56411 * // [ ... ],
56412 * // dot: false,
56413 * // input: 'abc/*.js' },
56414 * // parsingErrors: [],
56415 * // map:
56416 * // { version: 3,
56417 * // sources: [ 'string' ],
56418 * // names: [],
56419 * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
56420 * // sourcesContent: [ 'abc/*.js' ] },
56421 * // position: { line: 1, column: 28 },
56422 * // content: {},
56423 * // files: {},
56424 * // idx: 6 }
56425 * ```
56426 * @param {String} `pattern` Glob pattern to parse and compile.
56427 * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
56428 * @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
56429 * @api public
56430 */
56431
56432nanomatch.create = function(pattern, options) {
56433 if (typeof pattern !== 'string') {
56434 throw new TypeError('expected a string');
56435 }
56436 function create() {
56437 return nanomatch.compile(nanomatch.parse(pattern, options), options);
56438 }
56439 return memoize('create', pattern, options, create);
56440};
56441
56442/**
56443 * Parse the given `str` with the given `options`.
56444 *
56445 * ```js
56446 * var nm = require('nanomatch');
56447 * nm.parse(pattern[, options]);
56448 *
56449 * var ast = nm.parse('a/{b,c}/d');
56450 * console.log(ast);
56451 * // { type: 'root',
56452 * // errors: [],
56453 * // input: 'a/{b,c}/d',
56454 * // nodes:
56455 * // [ { type: 'bos', val: '' },
56456 * // { type: 'text', val: 'a/' },
56457 * // { type: 'brace',
56458 * // nodes:
56459 * // [ { type: 'brace.open', val: '{' },
56460 * // { type: 'text', val: 'b,c' },
56461 * // { type: 'brace.close', val: '}' } ] },
56462 * // { type: 'text', val: '/d' },
56463 * // { type: 'eos', val: '' } ] }
56464 * ```
56465 * @param {String} `str`
56466 * @param {Object} `options`
56467 * @return {Object} Returns an AST
56468 * @api public
56469 */
56470
56471nanomatch.parse = function(pattern, options) {
56472 if (typeof pattern !== 'string') {
56473 throw new TypeError('expected a string');
56474 }
56475
56476 function parse() {
56477 var snapdragon = utils.instantiate(null, options);
56478 parsers(snapdragon, options);
56479
56480 var ast = snapdragon.parse(pattern, options);
56481 utils.define(ast, 'snapdragon', snapdragon);
56482 ast.input = pattern;
56483 return ast;
56484 }
56485
56486 return memoize('parse', pattern, options, parse);
56487};
56488
56489/**
56490 * Compile the given `ast` or string with the given `options`.
56491 *
56492 * ```js
56493 * var nm = require('nanomatch');
56494 * nm.compile(ast[, options]);
56495 *
56496 * var ast = nm.parse('a/{b,c}/d');
56497 * console.log(nm.compile(ast));
56498 * // { options: { source: 'string' },
56499 * // state: {},
56500 * // compilers:
56501 * // { eos: [Function],
56502 * // noop: [Function],
56503 * // bos: [Function],
56504 * // brace: [Function],
56505 * // 'brace.open': [Function],
56506 * // text: [Function],
56507 * // 'brace.close': [Function] },
56508 * // output: [ 'a/(b|c)/d' ],
56509 * // ast:
56510 * // { ... },
56511 * // parsingErrors: [] }
56512 * ```
56513 * @param {Object|String} `ast`
56514 * @param {Object} `options`
56515 * @return {Object} Returns an object that has an `output` property with the compiled string.
56516 * @api public
56517 */
56518
56519nanomatch.compile = function(ast, options) {
56520 if (typeof ast === 'string') {
56521 ast = nanomatch.parse(ast, options);
56522 }
56523
56524 function compile() {
56525 var snapdragon = utils.instantiate(ast, options);
56526 compilers(snapdragon, options);
56527 return snapdragon.compile(ast, options);
56528 }
56529
56530 return memoize('compile', ast.input, options, compile);
56531};
56532
56533/**
56534 * Clear the regex cache.
56535 *
56536 * ```js
56537 * nm.clearCache();
56538 * ```
56539 * @api public
56540 */
56541
56542nanomatch.clearCache = function() {
56543 nanomatch.cache.__data__ = {};
56544};
56545
56546/**
56547 * Compose a matcher function with the given patterns.
56548 * This allows matcher functions to be compiled once and
56549 * called multiple times.
56550 */
56551
56552function compose(patterns, options, matcher) {
56553 var matchers;
56554
56555 return memoize('compose', String(patterns), options, function() {
56556 return function(file) {
56557 // delay composition until it's invoked the first time,
56558 // after that it won't be called again
56559 if (!matchers) {
56560 matchers = [];
56561 for (var i = 0; i < patterns.length; i++) {
56562 matchers.push(matcher(patterns[i], options));
56563 }
56564 }
56565
56566 var len = matchers.length;
56567 while (len--) {
56568 if (matchers[len](file) === true) {
56569 return true;
56570 }
56571 }
56572 return false;
56573 };
56574 });
56575}
56576
56577/**
56578 * Memoize a generated regex or function. A unique key is generated
56579 * from the `type` (usually method name), the `pattern`, and
56580 * user-defined options.
56581 */
56582
56583function memoize(type, pattern, options, fn) {
56584 var key = utils.createKey(type + '=' + pattern, options);
56585
56586 if (options && options.cache === false) {
56587 return fn(pattern, options);
56588 }
56589
56590 if (cache.has(type, key)) {
56591 return cache.get(type, key);
56592 }
56593
56594 var val = fn(pattern, options);
56595 cache.set(type, key, val);
56596 return val;
56597}
56598
56599/**
56600 * Expose compiler, parser and cache on `nanomatch`
56601 */
56602
56603nanomatch.compilers = compilers;
56604nanomatch.parsers = parsers;
56605nanomatch.cache = cache;
56606
56607/**
56608 * Expose `nanomatch`
56609 * @type {Function}
56610 */
56611
56612module.exports = nanomatch;
56613
56614
56615/***/ }),
56616
56617/***/ 58250:
56618/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
56619
56620module.exports = new (__webpack_require__(49908))();
56621
56622
56623/***/ }),
56624
56625/***/ 4756:
56626/***/ (function(module) {
56627
56628"use strict";
56629
56630
56631/**
56632* Nanomatch compilers
56633*/
56634
56635module.exports = function(nanomatch, options) {
56636 function slash() {
56637 if (options && typeof options.slash === 'string') {
56638 return options.slash;
56639 }
56640 if (options && typeof options.slash === 'function') {
56641 return options.slash.call(nanomatch);
56642 }
56643 return '\\\\/';
56644 }
56645
56646 function star() {
56647 if (options && typeof options.star === 'string') {
56648 return options.star;
56649 }
56650 if (options && typeof options.star === 'function') {
56651 return options.star.call(nanomatch);
56652 }
56653 return '[^' + slash() + ']*?';
56654 }
56655
56656 var ast = nanomatch.ast = nanomatch.parser.ast;
56657 ast.state = nanomatch.parser.state;
56658 nanomatch.compiler.state = ast.state;
56659 nanomatch.compiler
56660
56661 /**
56662 * Negation / escaping
56663 */
56664
56665 .set('not', function(node) {
56666 var prev = this.prev();
56667 if (this.options.nonegate === true || prev.type !== 'bos') {
56668 return this.emit('\\' + node.val, node);
56669 }
56670 return this.emit(node.val, node);
56671 })
56672 .set('escape', function(node) {
56673 if (this.options.unescape && /^[-\w_.]/.test(node.val)) {
56674 return this.emit(node.val, node);
56675 }
56676 return this.emit('\\' + node.val, node);
56677 })
56678 .set('quoted', function(node) {
56679 return this.emit(node.val, node);
56680 })
56681
56682 /**
56683 * Regex
56684 */
56685
56686 .set('dollar', function(node) {
56687 if (node.parent.type === 'bracket') {
56688 return this.emit(node.val, node);
56689 }
56690 return this.emit('\\' + node.val, node);
56691 })
56692
56693 /**
56694 * Dot: "."
56695 */
56696
56697 .set('dot', function(node) {
56698 if (node.dotfiles === true) this.dotfiles = true;
56699 return this.emit('\\' + node.val, node);
56700 })
56701
56702 /**
56703 * Slashes: "/" and "\"
56704 */
56705
56706 .set('backslash', function(node) {
56707 return this.emit(node.val, node);
56708 })
56709 .set('slash', function(node, nodes, i) {
56710 var val = '[' + slash() + ']';
56711 var parent = node.parent;
56712 var prev = this.prev();
56713
56714 // set "node.hasSlash" to true on all ancestor parens nodes
56715 while (parent.type === 'paren' && !parent.hasSlash) {
56716 parent.hasSlash = true;
56717 parent = parent.parent;
56718 }
56719
56720 if (prev.addQmark) {
56721 val += '?';
56722 }
56723
56724 // word boundary
56725 if (node.rest.slice(0, 2) === '\\b') {
56726 return this.emit(val, node);
56727 }
56728
56729 // globstars
56730 if (node.parsed === '**' || node.parsed === './**') {
56731 this.output = '(?:' + this.output;
56732 return this.emit(val + ')?', node);
56733 }
56734
56735 // negation
56736 if (node.parsed === '!**' && this.options.nonegate !== true) {
56737 return this.emit(val + '?\\b', node);
56738 }
56739 return this.emit(val, node);
56740 })
56741
56742 /**
56743 * Square brackets
56744 */
56745
56746 .set('bracket', function(node) {
56747 var close = node.close;
56748 var open = !node.escaped ? '[' : '\\[';
56749 var negated = node.negated;
56750 var inner = node.inner;
56751 var val = node.val;
56752
56753 if (node.escaped === true) {
56754 inner = inner.replace(/\\?(\W)/g, '\\$1');
56755 negated = '';
56756 }
56757
56758 if (inner === ']-') {
56759 inner = '\\]\\-';
56760 }
56761
56762 if (negated && inner.indexOf('.') === -1) {
56763 inner += '.';
56764 }
56765 if (negated && inner.indexOf('/') === -1) {
56766 inner += '/';
56767 }
56768
56769 val = open + negated + inner + close;
56770 return this.emit(val, node);
56771 })
56772
56773 /**
56774 * Square: "[.]" (only matches a single character in brackets)
56775 */
56776
56777 .set('square', function(node) {
56778 var val = (/^\W/.test(node.val) ? '\\' : '') + node.val;
56779 return this.emit(val, node);
56780 })
56781
56782 /**
56783 * Question mark: "?"
56784 */
56785
56786 .set('qmark', function(node) {
56787 var prev = this.prev();
56788 // don't use "slash" variable so that we always avoid
56789 // matching backslashes and slashes with a qmark
56790 var val = '[^.\\\\/]';
56791 if (this.options.dot || (prev.type !== 'bos' && prev.type !== 'slash')) {
56792 val = '[^\\\\/]';
56793 }
56794
56795 if (node.parsed.slice(-1) === '(') {
56796 var ch = node.rest.charAt(0);
56797 if (ch === '!' || ch === '=' || ch === ':') {
56798 return this.emit(node.val, node);
56799 }
56800 }
56801
56802 if (node.val.length > 1) {
56803 val += '{' + node.val.length + '}';
56804 }
56805 return this.emit(val, node);
56806 })
56807
56808 /**
56809 * Plus
56810 */
56811
56812 .set('plus', function(node) {
56813 var prev = node.parsed.slice(-1);
56814 if (prev === ']' || prev === ')') {
56815 return this.emit(node.val, node);
56816 }
56817 if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) {
56818 return this.emit('\\+', node);
56819 }
56820 var ch = this.output.slice(-1);
56821 if (/\w/.test(ch) && !node.inside) {
56822 return this.emit('+\\+?', node);
56823 }
56824 return this.emit('+', node);
56825 })
56826
56827 /**
56828 * globstar: '**'
56829 */
56830
56831 .set('globstar', function(node, nodes, i) {
56832 if (!this.output) {
56833 this.state.leadingGlobstar = true;
56834 }
56835
56836 var prev = this.prev();
56837 var before = this.prev(2);
56838 var next = this.next();
56839 var after = this.next(2);
56840 var type = prev.type;
56841 var val = node.val;
56842
56843 if (prev.type === 'slash' && next.type === 'slash') {
56844 if (before.type === 'text') {
56845 this.output += '?';
56846
56847 if (after.type !== 'text') {
56848 this.output += '\\b';
56849 }
56850 }
56851 }
56852
56853 var parsed = node.parsed;
56854 if (parsed.charAt(0) === '!') {
56855 parsed = parsed.slice(1);
56856 }
56857
56858 var isInside = node.isInside.paren || node.isInside.brace;
56859 if (parsed && type !== 'slash' && type !== 'bos' && !isInside) {
56860 val = star();
56861 } else {
56862 val = this.options.dot !== true
56863 ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?'
56864 : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?';
56865 }
56866
56867 if ((type === 'slash' || type === 'bos') && this.options.dot !== true) {
56868 val = '(?!\\.)' + val;
56869 }
56870
56871 if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') {
56872 if (after.type === 'text' || after.type === 'star') {
56873 node.addQmark = true;
56874 }
56875 }
56876
56877 if (this.options.capture) {
56878 val = '(' + val + ')';
56879 }
56880
56881 return this.emit(val, node);
56882 })
56883
56884 /**
56885 * Star: "*"
56886 */
56887
56888 .set('star', function(node, nodes, i) {
56889 var prior = nodes[i - 2] || {};
56890 var prev = this.prev();
56891 var next = this.next();
56892 var type = prev.type;
56893
56894 function isStart(n) {
56895 return n.type === 'bos' || n.type === 'slash';
56896 }
56897
56898 if (this.output === '' && this.options.contains !== true) {
56899 this.output = '(?![' + slash() + '])';
56900 }
56901
56902 if (type === 'bracket' && this.options.bash === false) {
56903 var str = next && next.type === 'bracket' ? star() : '*?';
56904 if (!prev.nodes || prev.nodes[1].type !== 'posix') {
56905 return this.emit(str, node);
56906 }
56907 }
56908
56909 var prefix = !this.dotfiles && type !== 'text' && type !== 'escape'
56910 ? (this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)')
56911 : '';
56912
56913 if (isStart(prev) || (isStart(prior) && type === 'not')) {
56914 if (prefix !== '(?!\\.)') {
56915 prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)';
56916 } else {
56917 prefix += '(?=.)';
56918 }
56919 } else if (prefix === '(?!\\.)') {
56920 prefix = '';
56921 }
56922
56923 if (prev.type === 'not' && prior.type === 'bos' && this.options.dot === true) {
56924 this.output = '(?!\\.)' + this.output;
56925 }
56926
56927 var output = prefix + star();
56928 if (this.options.capture) {
56929 output = '(' + output + ')';
56930 }
56931
56932 return this.emit(output, node);
56933 })
56934
56935 /**
56936 * Text
56937 */
56938
56939 .set('text', function(node) {
56940 return this.emit(node.val, node);
56941 })
56942
56943 /**
56944 * End-of-string
56945 */
56946
56947 .set('eos', function(node) {
56948 var prev = this.prev();
56949 var val = node.val;
56950
56951 this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output;
56952 if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') {
56953 val += (this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)');
56954 }
56955
56956 return this.emit(val, node);
56957 });
56958
56959 /**
56960 * Allow custom compilers to be passed on options
56961 */
56962
56963 if (options && typeof options.compilers === 'function') {
56964 options.compilers(nanomatch.compiler);
56965 }
56966};
56967
56968
56969
56970/***/ }),
56971
56972/***/ 5333:
56973/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
56974
56975"use strict";
56976
56977
56978var regexNot = __webpack_require__(30931);
56979var toRegex = __webpack_require__(51279);
56980
56981/**
56982 * Characters to use in negation regex (we want to "not" match
56983 * characters that are matched by other parsers)
56984 */
56985
56986var cached;
56987var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+';
56988var not = createTextRegex(NOT_REGEX);
56989
56990/**
56991 * Nanomatch parsers
56992 */
56993
56994module.exports = function(nanomatch, options) {
56995 var parser = nanomatch.parser;
56996 var opts = parser.options;
56997
56998 parser.state = {
56999 slashes: 0,
57000 paths: []
57001 };
57002
57003 parser.ast.state = parser.state;
57004 parser
57005
57006 /**
57007 * Beginning-of-string
57008 */
57009
57010 .capture('prefix', function() {
57011 if (this.parsed) return;
57012 var m = this.match(/^\.[\\/]/);
57013 if (!m) return;
57014 this.state.strictOpen = !!this.options.strictOpen;
57015 this.state.addPrefix = true;
57016 })
57017
57018 /**
57019 * Escape: "\\."
57020 */
57021
57022 .capture('escape', function() {
57023 if (this.isInside('bracket')) return;
57024 var pos = this.position();
57025 var m = this.match(/^(?:\\(.)|([$^]))/);
57026 if (!m) return;
57027
57028 return pos({
57029 type: 'escape',
57030 val: m[2] || m[1]
57031 });
57032 })
57033
57034 /**
57035 * Quoted strings
57036 */
57037
57038 .capture('quoted', function() {
57039 var pos = this.position();
57040 var m = this.match(/^["']/);
57041 if (!m) return;
57042
57043 var quote = m[0];
57044 if (this.input.indexOf(quote) === -1) {
57045 return pos({
57046 type: 'escape',
57047 val: quote
57048 });
57049 }
57050
57051 var tok = advanceTo(this.input, quote);
57052 this.consume(tok.len);
57053
57054 return pos({
57055 type: 'quoted',
57056 val: tok.esc
57057 });
57058 })
57059
57060 /**
57061 * Negations: "!"
57062 */
57063
57064 .capture('not', function() {
57065 var parsed = this.parsed;
57066 var pos = this.position();
57067 var m = this.match(this.notRegex || /^!+/);
57068 if (!m) return;
57069 var val = m[0];
57070
57071 var isNegated = (val.length % 2) === 1;
57072 if (parsed === '' && !isNegated) {
57073 val = '';
57074 }
57075
57076 // if nothing has been parsed, we know `!` is at the start,
57077 // so we need to wrap the result in a negation regex
57078 if (parsed === '' && isNegated && this.options.nonegate !== true) {
57079 this.bos.val = '(?!^(?:';
57080 this.append = ')$).*';
57081 val = '';
57082 }
57083 return pos({
57084 type: 'not',
57085 val: val
57086 });
57087 })
57088
57089 /**
57090 * Dot: "."
57091 */
57092
57093 .capture('dot', function() {
57094 var parsed = this.parsed;
57095 var pos = this.position();
57096 var m = this.match(/^\.+/);
57097 if (!m) return;
57098
57099 var val = m[0];
57100 this.state.dot = val === '.' && (parsed === '' || parsed.slice(-1) === '/');
57101
57102 return pos({
57103 type: 'dot',
57104 dotfiles: this.state.dot,
57105 val: val
57106 });
57107 })
57108
57109 /**
57110 * Plus: "+"
57111 */
57112
57113 .capture('plus', /^\+(?!\()/)
57114
57115 /**
57116 * Question mark: "?"
57117 */
57118
57119 .capture('qmark', function() {
57120 var parsed = this.parsed;
57121 var pos = this.position();
57122 var m = this.match(/^\?+(?!\()/);
57123 if (!m) return;
57124
57125 this.state.metachar = true;
57126 this.state.qmark = true;
57127
57128 return pos({
57129 type: 'qmark',
57130 parsed: parsed,
57131 val: m[0]
57132 });
57133 })
57134
57135 /**
57136 * Globstar: "**"
57137 */
57138
57139 .capture('globstar', function() {
57140 var parsed = this.parsed;
57141 var pos = this.position();
57142 var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/);
57143 if (!m) return;
57144
57145 var type = opts.noglobstar !== true ? 'globstar' : 'star';
57146 var node = pos({type: type, parsed: parsed});
57147 this.state.metachar = true;
57148
57149 while (this.input.slice(0, 4) === '/**/') {
57150 this.input = this.input.slice(3);
57151 }
57152
57153 node.isInside = {
57154 brace: this.isInside('brace'),
57155 paren: this.isInside('paren')
57156 };
57157
57158 if (type === 'globstar') {
57159 this.state.globstar = true;
57160 node.val = '**';
57161
57162 } else {
57163 this.state.star = true;
57164 node.val = '*';
57165 }
57166
57167 return node;
57168 })
57169
57170 /**
57171 * Star: "*"
57172 */
57173
57174 .capture('star', function() {
57175 var pos = this.position();
57176 var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/;
57177 var m = this.match(starRe);
57178 if (!m) return;
57179
57180 this.state.metachar = true;
57181 this.state.star = true;
57182 return pos({
57183 type: 'star',
57184 val: m[0]
57185 });
57186 })
57187
57188 /**
57189 * Slash: "/"
57190 */
57191
57192 .capture('slash', function() {
57193 var pos = this.position();
57194 var m = this.match(/^\//);
57195 if (!m) return;
57196
57197 this.state.slashes++;
57198 return pos({
57199 type: 'slash',
57200 val: m[0]
57201 });
57202 })
57203
57204 /**
57205 * Backslash: "\\"
57206 */
57207
57208 .capture('backslash', function() {
57209 var pos = this.position();
57210 var m = this.match(/^\\(?![*+?(){}[\]'"])/);
57211 if (!m) return;
57212
57213 var val = m[0];
57214
57215 if (this.isInside('bracket')) {
57216 val = '\\';
57217 } else if (val.length > 1) {
57218 val = '\\\\';
57219 }
57220
57221 return pos({
57222 type: 'backslash',
57223 val: val
57224 });
57225 })
57226
57227 /**
57228 * Square: "[.]"
57229 */
57230
57231 .capture('square', function() {
57232 if (this.isInside('bracket')) return;
57233 var pos = this.position();
57234 var m = this.match(/^\[([^!^\\])\]/);
57235 if (!m) return;
57236
57237 return pos({
57238 type: 'square',
57239 val: m[1]
57240 });
57241 })
57242
57243 /**
57244 * Brackets: "[...]" (basic, this can be overridden by other parsers)
57245 */
57246
57247 .capture('bracket', function() {
57248 var pos = this.position();
57249 var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/);
57250 if (!m) return;
57251
57252 var val = m[0];
57253 var negated = m[1] ? '^' : '';
57254 var inner = (m[2] || '').replace(/\\\\+/, '\\\\');
57255 var close = m[3] || '';
57256
57257 if (m[2] && inner.length < m[2].length) {
57258 val = val.replace(/\\\\+/, '\\\\');
57259 }
57260
57261 var esc = this.input.slice(0, 2);
57262 if (inner === '' && esc === '\\]') {
57263 inner += esc;
57264 this.consume(2);
57265
57266 var str = this.input;
57267 var idx = -1;
57268 var ch;
57269
57270 while ((ch = str[++idx])) {
57271 this.consume(1);
57272 if (ch === ']') {
57273 close = ch;
57274 break;
57275 }
57276 inner += ch;
57277 }
57278 }
57279
57280 return pos({
57281 type: 'bracket',
57282 val: val,
57283 escaped: close !== ']',
57284 negated: negated,
57285 inner: inner,
57286 close: close
57287 });
57288 })
57289
57290 /**
57291 * Text
57292 */
57293
57294 .capture('text', function() {
57295 if (this.isInside('bracket')) return;
57296 var pos = this.position();
57297 var m = this.match(not);
57298 if (!m || !m[0]) return;
57299
57300 return pos({
57301 type: 'text',
57302 val: m[0]
57303 });
57304 });
57305
57306 /**
57307 * Allow custom parsers to be passed on options
57308 */
57309
57310 if (options && typeof options.parsers === 'function') {
57311 options.parsers(nanomatch.parser);
57312 }
57313};
57314
57315/**
57316 * Advance to the next non-escaped character
57317 */
57318
57319function advanceTo(input, endChar) {
57320 var ch = input.charAt(0);
57321 var tok = { len: 1, val: '', esc: '' };
57322 var idx = 0;
57323
57324 function advance() {
57325 if (ch !== '\\') {
57326 tok.esc += '\\' + ch;
57327 tok.val += ch;
57328 }
57329
57330 ch = input.charAt(++idx);
57331 tok.len++;
57332
57333 if (ch === '\\') {
57334 advance();
57335 advance();
57336 }
57337 }
57338
57339 while (ch && ch !== endChar) {
57340 advance();
57341 }
57342 return tok;
57343}
57344
57345/**
57346 * Create text regex
57347 */
57348
57349function createTextRegex(pattern) {
57350 if (cached) return cached;
57351 var opts = {contains: true, strictClose: false};
57352 var not = regexNot.create(pattern, opts);
57353 var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts);
57354 return (cached = re);
57355}
57356
57357/**
57358 * Expose negation string
57359 */
57360
57361module.exports.not = NOT_REGEX;
57362
57363
57364/***/ }),
57365
57366/***/ 41340:
57367/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
57368
57369"use strict";
57370
57371
57372var utils = module.exports;
57373var path = __webpack_require__(85622);
57374
57375/**
57376 * Module dependencies
57377 */
57378
57379var isWindows = __webpack_require__(8025)();
57380var Snapdragon = __webpack_require__(79285);
57381utils.define = __webpack_require__(18918);
57382utils.diff = __webpack_require__(9455);
57383utils.extend = __webpack_require__(69148);
57384utils.pick = __webpack_require__(38509);
57385utils.typeOf = __webpack_require__(42556);
57386utils.unique = __webpack_require__(19009);
57387
57388/**
57389 * Returns true if the given value is effectively an empty string
57390 */
57391
57392utils.isEmptyString = function(val) {
57393 return String(val) === '' || String(val) === './';
57394};
57395
57396/**
57397 * Returns true if the platform is windows, or `path.sep` is `\\`.
57398 * This is defined as a function to allow `path.sep` to be set in unit tests,
57399 * or by the user, if there is a reason to do so.
57400 * @return {Boolean}
57401 */
57402
57403utils.isWindows = function() {
57404 return path.sep === '\\' || isWindows === true;
57405};
57406
57407/**
57408 * Return the last element from an array
57409 */
57410
57411utils.last = function(arr, n) {
57412 return arr[arr.length - (n || 1)];
57413};
57414
57415/**
57416 * Get the `Snapdragon` instance to use
57417 */
57418
57419utils.instantiate = function(ast, options) {
57420 var snapdragon;
57421 // if an instance was created by `.parse`, use that instance
57422 if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
57423 snapdragon = ast.snapdragon;
57424 // if the user supplies an instance on options, use that instance
57425 } else if (utils.typeOf(options) === 'object' && options.snapdragon) {
57426 snapdragon = options.snapdragon;
57427 // create a new instance
57428 } else {
57429 snapdragon = new Snapdragon(options);
57430 }
57431
57432 utils.define(snapdragon, 'parse', function(str, options) {
57433 var parsed = Snapdragon.prototype.parse.call(this, str, options);
57434 parsed.input = str;
57435
57436 // escape unmatched brace/bracket/parens
57437 var last = this.parser.stack.pop();
57438 if (last && this.options.strictErrors !== true) {
57439 var open = last.nodes[0];
57440 var inner = last.nodes[1];
57441 if (last.type === 'bracket') {
57442 if (inner.val.charAt(0) === '[') {
57443 inner.val = '\\' + inner.val;
57444 }
57445
57446 } else {
57447 open.val = '\\' + open.val;
57448 var sibling = open.parent.nodes[1];
57449 if (sibling.type === 'star') {
57450 sibling.loose = true;
57451 }
57452 }
57453 }
57454
57455 // add non-enumerable parser reference
57456 utils.define(parsed, 'parser', this.parser);
57457 return parsed;
57458 });
57459
57460 return snapdragon;
57461};
57462
57463/**
57464 * Create the key to use for memoization. The key is generated
57465 * by iterating over the options and concatenating key-value pairs
57466 * to the pattern string.
57467 */
57468
57469utils.createKey = function(pattern, options) {
57470 if (typeof options === 'undefined') {
57471 return pattern;
57472 }
57473 var key = pattern;
57474 for (var prop in options) {
57475 if (options.hasOwnProperty(prop)) {
57476 key += ';' + prop + '=' + String(options[prop]);
57477 }
57478 }
57479 return key;
57480};
57481
57482/**
57483 * Cast `val` to an array
57484 * @return {Array}
57485 */
57486
57487utils.arrayify = function(val) {
57488 if (typeof val === 'string') return [val];
57489 return val ? (Array.isArray(val) ? val : [val]) : [];
57490};
57491
57492/**
57493 * Return true if `val` is a non-empty string
57494 */
57495
57496utils.isString = function(val) {
57497 return typeof val === 'string';
57498};
57499
57500/**
57501 * Return true if `val` is a non-empty string
57502 */
57503
57504utils.isRegex = function(val) {
57505 return utils.typeOf(val) === 'regexp';
57506};
57507
57508/**
57509 * Return true if `val` is a non-empty string
57510 */
57511
57512utils.isObject = function(val) {
57513 return utils.typeOf(val) === 'object';
57514};
57515
57516/**
57517 * Escape regex characters in the given string
57518 */
57519
57520utils.escapeRegex = function(str) {
57521 return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&');
57522};
57523
57524/**
57525 * Combines duplicate characters in the provided `input` string.
57526 * @param {String} `input`
57527 * @returns {String}
57528 */
57529
57530utils.combineDupes = function(input, patterns) {
57531 patterns = utils.arrayify(patterns).join('|').split('|');
57532 patterns = patterns.map(function(s) {
57533 return s.replace(/\\?([+*\\/])/g, '\\$1');
57534 });
57535 var substr = patterns.join('|');
57536 var regex = new RegExp('(' + substr + ')(?=\\1)', 'g');
57537 return input.replace(regex, '');
57538};
57539
57540/**
57541 * Returns true if the given `str` has special characters
57542 */
57543
57544utils.hasSpecialChars = function(str) {
57545 return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str);
57546};
57547
57548/**
57549 * Normalize slashes in the given filepath.
57550 *
57551 * @param {String} `filepath`
57552 * @return {String}
57553 */
57554
57555utils.toPosixPath = function(str) {
57556 return str.replace(/\\+/g, '/');
57557};
57558
57559/**
57560 * Strip backslashes before special characters in a string.
57561 *
57562 * @param {String} `str`
57563 * @return {String}
57564 */
57565
57566utils.unescape = function(str) {
57567 return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
57568};
57569
57570/**
57571 * Strip the drive letter from a windows filepath
57572 * @param {String} `fp`
57573 * @return {String}
57574 */
57575
57576utils.stripDrive = function(fp) {
57577 return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp;
57578};
57579
57580/**
57581 * Strip the prefix from a filepath
57582 * @param {String} `fp`
57583 * @return {String}
57584 */
57585
57586utils.stripPrefix = function(str) {
57587 if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) {
57588 return str.slice(2);
57589 }
57590 return str;
57591};
57592
57593/**
57594 * Returns true if `str` is a common character that doesn't need
57595 * to be processed to be used for matching.
57596 * @param {String} `str`
57597 * @return {Boolean}
57598 */
57599
57600utils.isSimpleChar = function(str) {
57601 return str.trim() === '' || str === '.';
57602};
57603
57604/**
57605 * Returns true if the given str is an escaped or
57606 * unescaped path character
57607 */
57608
57609utils.isSlash = function(str) {
57610 return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
57611};
57612
57613/**
57614 * Returns a function that returns true if the given
57615 * pattern matches or contains a `filepath`
57616 *
57617 * @param {String} `pattern`
57618 * @return {Function}
57619 */
57620
57621utils.matchPath = function(pattern, options) {
57622 return (options && options.contains)
57623 ? utils.containsPattern(pattern, options)
57624 : utils.equalsPattern(pattern, options);
57625};
57626
57627/**
57628 * Returns true if the given (original) filepath or unixified path are equal
57629 * to the given pattern.
57630 */
57631
57632utils._equals = function(filepath, unixPath, pattern) {
57633 return pattern === filepath || pattern === unixPath;
57634};
57635
57636/**
57637 * Returns true if the given (original) filepath or unixified path contain
57638 * the given pattern.
57639 */
57640
57641utils._contains = function(filepath, unixPath, pattern) {
57642 return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
57643};
57644
57645/**
57646 * Returns a function that returns true if the given
57647 * pattern is the same as a given `filepath`
57648 *
57649 * @param {String} `pattern`
57650 * @return {Function}
57651 */
57652
57653utils.equalsPattern = function(pattern, options) {
57654 var unixify = utils.unixify(options);
57655 options = options || {};
57656
57657 return function fn(filepath) {
57658 var equal = utils._equals(filepath, unixify(filepath), pattern);
57659 if (equal === true || options.nocase !== true) {
57660 return equal;
57661 }
57662 var lower = filepath.toLowerCase();
57663 return utils._equals(lower, unixify(lower), pattern);
57664 };
57665};
57666
57667/**
57668 * Returns a function that returns true if the given
57669 * pattern contains a `filepath`
57670 *
57671 * @param {String} `pattern`
57672 * @return {Function}
57673 */
57674
57675utils.containsPattern = function(pattern, options) {
57676 var unixify = utils.unixify(options);
57677 options = options || {};
57678
57679 return function(filepath) {
57680 var contains = utils._contains(filepath, unixify(filepath), pattern);
57681 if (contains === true || options.nocase !== true) {
57682 return contains;
57683 }
57684 var lower = filepath.toLowerCase();
57685 return utils._contains(lower, unixify(lower), pattern);
57686 };
57687};
57688
57689/**
57690 * Returns a function that returns true if the given
57691 * regex matches the `filename` of a file path.
57692 *
57693 * @param {RegExp} `re` Matching regex
57694 * @return {Function}
57695 */
57696
57697utils.matchBasename = function(re) {
57698 return function(filepath) {
57699 return re.test(filepath) || re.test(path.basename(filepath));
57700 };
57701};
57702
57703/**
57704 * Returns the given value unchanced.
57705 * @return {any}
57706 */
57707
57708utils.identity = function(val) {
57709 return val;
57710};
57711
57712/**
57713 * Determines the filepath to return based on the provided options.
57714 * @return {any}
57715 */
57716
57717utils.value = function(str, unixify, options) {
57718 if (options && options.unixify === false) {
57719 return str;
57720 }
57721 if (options && typeof options.unixify === 'function') {
57722 return options.unixify(str);
57723 }
57724 return unixify(str);
57725};
57726
57727/**
57728 * Returns a function that normalizes slashes in a string to forward
57729 * slashes, strips `./` from beginning of paths, and optionally unescapes
57730 * special characters.
57731 * @return {Function}
57732 */
57733
57734utils.unixify = function(options) {
57735 var opts = options || {};
57736 return function(filepath) {
57737 if (opts.stripPrefix !== false) {
57738 filepath = utils.stripPrefix(filepath);
57739 }
57740 if (opts.unescape === true) {
57741 filepath = utils.unescape(filepath);
57742 }
57743 if (opts.unixify === true || utils.isWindows()) {
57744 filepath = utils.toPosixPath(filepath);
57745 }
57746 return filepath;
57747 };
57748};
57749
57750
57751/***/ }),
57752
57753/***/ 18918:
57754/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
57755
57756"use strict";
57757/*!
57758 * define-property <https://github.com/jonschlinkert/define-property>
57759 *
57760 * Copyright (c) 2015-2018, Jon Schlinkert.
57761 * Released under the MIT License.
57762 */
57763
57764
57765
57766var isobject = __webpack_require__(96667);
57767var isDescriptor = __webpack_require__(44133);
57768var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
57769 ? Reflect.defineProperty
57770 : Object.defineProperty;
57771
57772module.exports = function defineProperty(obj, key, val) {
57773 if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
57774 throw new TypeError('expected an object, function, or array');
57775 }
57776
57777 if (typeof key !== 'string') {
57778 throw new TypeError('expected "key" to be a string');
57779 }
57780
57781 if (isDescriptor(val)) {
57782 define(obj, key, val);
57783 return obj;
57784 }
57785
57786 define(obj, key, {
57787 configurable: true,
57788 enumerable: false,
57789 writable: true,
57790 value: val
57791 });
57792
57793 return obj;
57794};
57795
57796
57797/***/ }),
57798
57799/***/ 69148:
57800/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
57801
57802"use strict";
57803
57804
57805var isExtendable = __webpack_require__(61781);
57806var assignSymbols = __webpack_require__(64353);
57807
57808module.exports = Object.assign || function(obj/*, objects*/) {
57809 if (obj === null || typeof obj === 'undefined') {
57810 throw new TypeError('Cannot convert undefined or null to object');
57811 }
57812 if (!isObject(obj)) {
57813 obj = {};
57814 }
57815 for (var i = 1; i < arguments.length; i++) {
57816 var val = arguments[i];
57817 if (isString(val)) {
57818 val = toObject(val);
57819 }
57820 if (isObject(val)) {
57821 assign(obj, val);
57822 assignSymbols(obj, val);
57823 }
57824 }
57825 return obj;
57826};
57827
57828function assign(a, b) {
57829 for (var key in b) {
57830 if (hasOwn(b, key)) {
57831 a[key] = b[key];
57832 }
57833 }
57834}
57835
57836function isString(val) {
57837 return (val && typeof val === 'string');
57838}
57839
57840function toObject(str) {
57841 var obj = {};
57842 for (var i in str) {
57843 obj[i] = str[i];
57844 }
57845 return obj;
57846}
57847
57848function isObject(val) {
57849 return (val && typeof val === 'object') || isExtendable(val);
57850}
57851
57852/**
57853 * Returns true if the given `key` is an own property of `obj`.
57854 */
57855
57856function hasOwn(obj, key) {
57857 return Object.prototype.hasOwnProperty.call(obj, key);
57858}
57859
57860function isEnum(obj, key) {
57861 return Object.prototype.propertyIsEnumerable.call(obj, key);
57862}
57863
57864
57865/***/ }),
57866
57867/***/ 61781:
57868/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
57869
57870"use strict";
57871/*!
57872 * is-extendable <https://github.com/jonschlinkert/is-extendable>
57873 *
57874 * Copyright (c) 2015-2017, Jon Schlinkert.
57875 * Released under the MIT License.
57876 */
57877
57878
57879
57880var isPlainObject = __webpack_require__(81064);
57881
57882module.exports = function isExtendable(val) {
57883 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
57884};
57885
57886
57887/***/ }),
57888
57889/***/ 8025:
57890/***/ (function(module, exports) {
57891
57892/*!
57893 * is-windows <https://github.com/jonschlinkert/is-windows>
57894 *
57895 * Copyright © 2015-2018, Jon Schlinkert.
57896 * Released under the MIT License.
57897 */
57898
57899(function(factory) {
57900 if (exports && typeof exports === 'object' && "object" !== 'undefined') {
57901 module.exports = factory();
57902 } else if (typeof define === 'function' && define.amd) {
57903 define([], factory);
57904 } else if (typeof window !== 'undefined') {
57905 window.isWindows = factory();
57906 } else if (typeof global !== 'undefined') {
57907 global.isWindows = factory();
57908 } else if (typeof self !== 'undefined') {
57909 self.isWindows = factory();
57910 } else {
57911 this.isWindows = factory();
57912 }
57913})(function() {
57914 'use strict';
57915 return function isWindows() {
57916 return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE));
57917 };
57918});
57919
57920
57921/***/ }),
57922
57923/***/ 42556:
57924/***/ (function(module) {
57925
57926var toString = Object.prototype.toString;
57927
57928module.exports = function kindOf(val) {
57929 if (val === void 0) return 'undefined';
57930 if (val === null) return 'null';
57931
57932 var type = typeof val;
57933 if (type === 'boolean') return 'boolean';
57934 if (type === 'string') return 'string';
57935 if (type === 'number') return 'number';
57936 if (type === 'symbol') return 'symbol';
57937 if (type === 'function') {
57938 return isGeneratorFn(val) ? 'generatorfunction' : 'function';
57939 }
57940
57941 if (isArray(val)) return 'array';
57942 if (isBuffer(val)) return 'buffer';
57943 if (isArguments(val)) return 'arguments';
57944 if (isDate(val)) return 'date';
57945 if (isError(val)) return 'error';
57946 if (isRegexp(val)) return 'regexp';
57947
57948 switch (ctorName(val)) {
57949 case 'Symbol': return 'symbol';
57950 case 'Promise': return 'promise';
57951
57952 // Set, Map, WeakSet, WeakMap
57953 case 'WeakMap': return 'weakmap';
57954 case 'WeakSet': return 'weakset';
57955 case 'Map': return 'map';
57956 case 'Set': return 'set';
57957
57958 // 8-bit typed arrays
57959 case 'Int8Array': return 'int8array';
57960 case 'Uint8Array': return 'uint8array';
57961 case 'Uint8ClampedArray': return 'uint8clampedarray';
57962
57963 // 16-bit typed arrays
57964 case 'Int16Array': return 'int16array';
57965 case 'Uint16Array': return 'uint16array';
57966
57967 // 32-bit typed arrays
57968 case 'Int32Array': return 'int32array';
57969 case 'Uint32Array': return 'uint32array';
57970 case 'Float32Array': return 'float32array';
57971 case 'Float64Array': return 'float64array';
57972 }
57973
57974 if (isGeneratorObj(val)) {
57975 return 'generator';
57976 }
57977
57978 // Non-plain objects
57979 type = toString.call(val);
57980 switch (type) {
57981 case '[object Object]': return 'object';
57982 // iterators
57983 case '[object Map Iterator]': return 'mapiterator';
57984 case '[object Set Iterator]': return 'setiterator';
57985 case '[object String Iterator]': return 'stringiterator';
57986 case '[object Array Iterator]': return 'arrayiterator';
57987 }
57988
57989 // other
57990 return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
57991};
57992
57993function ctorName(val) {
57994 return typeof val.constructor === 'function' ? val.constructor.name : null;
57995}
57996
57997function isArray(val) {
57998 if (Array.isArray) return Array.isArray(val);
57999 return val instanceof Array;
58000}
58001
58002function isError(val) {
58003 return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
58004}
58005
58006function isDate(val) {
58007 if (val instanceof Date) return true;
58008 return typeof val.toDateString === 'function'
58009 && typeof val.getDate === 'function'
58010 && typeof val.setDate === 'function';
58011}
58012
58013function isRegexp(val) {
58014 if (val instanceof RegExp) return true;
58015 return typeof val.flags === 'string'
58016 && typeof val.ignoreCase === 'boolean'
58017 && typeof val.multiline === 'boolean'
58018 && typeof val.global === 'boolean';
58019}
58020
58021function isGeneratorFn(name, val) {
58022 return ctorName(name) === 'GeneratorFunction';
58023}
58024
58025function isGeneratorObj(val) {
58026 return typeof val.throw === 'function'
58027 && typeof val.return === 'function'
58028 && typeof val.next === 'function';
58029}
58030
58031function isArguments(val) {
58032 try {
58033 if (typeof val.length === 'number' && typeof val.callee === 'function') {
58034 return true;
58035 }
58036 } catch (err) {
58037 if (err.message.indexOf('callee') !== -1) {
58038 return true;
58039 }
58040 }
58041 return false;
58042}
58043
58044/**
58045 * If you need to support Safari 5-7 (8-10 yr-old browser),
58046 * take a look at https://github.com/feross/is-buffer
58047 */
58048
58049function isBuffer(val) {
58050 if (val.constructor && typeof val.constructor.isBuffer === 'function') {
58051 return val.constructor.isBuffer(val);
58052 }
58053 return false;
58054}
58055
58056
58057/***/ }),
58058
58059/***/ 31368:
58060/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58061
58062"use strict";
58063
58064
58065var typeOf = __webpack_require__(48865);
58066var copyDescriptor = __webpack_require__(3605);
58067var define = __webpack_require__(5477);
58068
58069/**
58070 * Copy static properties, prototype properties, and descriptors from one object to another.
58071 *
58072 * ```js
58073 * function App() {}
58074 * var proto = App.prototype;
58075 * App.prototype.set = function() {};
58076 * App.prototype.get = function() {};
58077 *
58078 * var obj = {};
58079 * copy(obj, proto);
58080 * ```
58081 * @param {Object} `receiver`
58082 * @param {Object} `provider`
58083 * @param {String|Array} `omit` One or more properties to omit
58084 * @return {Object}
58085 * @api public
58086 */
58087
58088function copy(receiver, provider, omit) {
58089 if (!isObject(receiver)) {
58090 throw new TypeError('expected receiving object to be an object.');
58091 }
58092 if (!isObject(provider)) {
58093 throw new TypeError('expected providing object to be an object.');
58094 }
58095
58096 var props = nativeKeys(provider);
58097 var keys = Object.keys(provider);
58098 var len = props.length;
58099 omit = arrayify(omit);
58100
58101 while (len--) {
58102 var key = props[len];
58103
58104 if (has(keys, key)) {
58105 define(receiver, key, provider[key]);
58106 } else if (!(key in receiver) && !has(omit, key)) {
58107 copyDescriptor(receiver, provider, key);
58108 }
58109 }
58110};
58111
58112/**
58113 * Return true if the given value is an object or function
58114 */
58115
58116function isObject(val) {
58117 return typeOf(val) === 'object' || typeof val === 'function';
58118}
58119
58120/**
58121 * Returns true if an array has any of the given elements, or an
58122 * object has any of the give keys.
58123 *
58124 * ```js
58125 * has(['a', 'b', 'c'], 'c');
58126 * //=> true
58127 *
58128 * has(['a', 'b', 'c'], ['c', 'z']);
58129 * //=> true
58130 *
58131 * has({a: 'b', c: 'd'}, ['c', 'z']);
58132 * //=> true
58133 * ```
58134 * @param {Object} `obj`
58135 * @param {String|Array} `val`
58136 * @return {Boolean}
58137 */
58138
58139function has(obj, val) {
58140 val = arrayify(val);
58141 var len = val.length;
58142
58143 if (isObject(obj)) {
58144 for (var key in obj) {
58145 if (val.indexOf(key) > -1) {
58146 return true;
58147 }
58148 }
58149
58150 var keys = nativeKeys(obj);
58151 return has(keys, val);
58152 }
58153
58154 if (Array.isArray(obj)) {
58155 var arr = obj;
58156 while (len--) {
58157 if (arr.indexOf(val[len]) > -1) {
58158 return true;
58159 }
58160 }
58161 return false;
58162 }
58163
58164 throw new TypeError('expected an array or object.');
58165}
58166
58167/**
58168 * Cast the given value to an array.
58169 *
58170 * ```js
58171 * arrayify('foo');
58172 * //=> ['foo']
58173 *
58174 * arrayify(['foo']);
58175 * //=> ['foo']
58176 * ```
58177 *
58178 * @param {String|Array} `val`
58179 * @return {Array}
58180 */
58181
58182function arrayify(val) {
58183 return val ? (Array.isArray(val) ? val : [val]) : [];
58184}
58185
58186/**
58187 * Returns true if a value has a `contructor`
58188 *
58189 * ```js
58190 * hasConstructor({});
58191 * //=> true
58192 *
58193 * hasConstructor(Object.create(null));
58194 * //=> false
58195 * ```
58196 * @param {Object} `value`
58197 * @return {Boolean}
58198 */
58199
58200function hasConstructor(val) {
58201 return isObject(val) && typeof val.constructor !== 'undefined';
58202}
58203
58204/**
58205 * Get the native `ownPropertyNames` from the constructor of the
58206 * given `object`. An empty array is returned if the object does
58207 * not have a constructor.
58208 *
58209 * ```js
58210 * nativeKeys({a: 'b', b: 'c', c: 'd'})
58211 * //=> ['a', 'b', 'c']
58212 *
58213 * nativeKeys(function(){})
58214 * //=> ['length', 'caller']
58215 * ```
58216 *
58217 * @param {Object} `obj` Object that has a `constructor`.
58218 * @return {Array} Array of keys.
58219 */
58220
58221function nativeKeys(val) {
58222 if (!hasConstructor(val)) return [];
58223 return Object.getOwnPropertyNames(val);
58224}
58225
58226/**
58227 * Expose `copy`
58228 */
58229
58230module.exports = copy;
58231
58232/**
58233 * Expose `copy.has` for tests
58234 */
58235
58236module.exports.has = has;
58237
58238
58239/***/ }),
58240
58241/***/ 59248:
58242/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58243
58244"use strict";
58245/*!
58246 * object-visit <https://github.com/jonschlinkert/object-visit>
58247 *
58248 * Copyright (c) 2015, 2017, Jon Schlinkert.
58249 * Released under the MIT License.
58250 */
58251
58252
58253
58254var isObject = __webpack_require__(96667);
58255
58256module.exports = function visit(thisArg, method, target, val) {
58257 if (!isObject(thisArg) && typeof thisArg !== 'function') {
58258 throw new Error('object-visit expects `thisArg` to be an object.');
58259 }
58260
58261 if (typeof method !== 'string') {
58262 throw new Error('object-visit expects `method` name to be a string');
58263 }
58264
58265 if (typeof thisArg[method] !== 'function') {
58266 return thisArg;
58267 }
58268
58269 var args = [].slice.call(arguments, 3);
58270 target = target || {};
58271
58272 for (var key in target) {
58273 var arr = [key, target[key]].concat(args);
58274 thisArg[method].apply(thisArg, arr);
58275 }
58276 return thisArg;
58277};
58278
58279
58280/***/ }),
58281
58282/***/ 38509:
58283/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58284
58285"use strict";
58286/*!
58287 * object.pick <https://github.com/jonschlinkert/object.pick>
58288 *
58289 * Copyright (c) 2014-2015 Jon Schlinkert, contributors.
58290 * Licensed under the MIT License
58291 */
58292
58293
58294
58295var isObject = __webpack_require__(96667);
58296
58297module.exports = function pick(obj, keys) {
58298 if (!isObject(obj) && typeof obj !== 'function') {
58299 return {};
58300 }
58301
58302 var res = {};
58303 if (typeof keys === 'string') {
58304 if (keys in obj) {
58305 res[keys] = obj[keys];
58306 }
58307 return res;
58308 }
58309
58310 var len = keys.length;
58311 var idx = -1;
58312
58313 while (++idx < len) {
58314 var key = keys[idx];
58315 if (key in obj) {
58316 res[key] = obj[key];
58317 }
58318 }
58319 return res;
58320};
58321
58322
58323/***/ }),
58324
58325/***/ 27255:
58326/***/ (function(module) {
58327
58328/*!
58329 * pascalcase <https://github.com/jonschlinkert/pascalcase>
58330 *
58331 * Copyright (c) 2015, Jon Schlinkert.
58332 * Licensed under the MIT License.
58333 */
58334
58335function pascalcase(str) {
58336 if (typeof str !== 'string') {
58337 throw new TypeError('expected a string.');
58338 }
58339 str = str.replace(/([A-Z])/g, ' $1');
58340 if (str.length === 1) { return str.toUpperCase(); }
58341 str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
58342 str = str.charAt(0).toUpperCase() + str.slice(1);
58343 return str.replace(/[\W_]+(\w|$)/g, function (_, ch) {
58344 return ch.toUpperCase();
58345 });
58346}
58347
58348module.exports = pascalcase;
58349
58350
58351/***/ }),
58352
58353/***/ 88412:
58354/***/ (function(module) {
58355
58356"use strict";
58357
58358
58359/**
58360 * POSIX character classes
58361 */
58362
58363module.exports = {
58364 alnum: 'a-zA-Z0-9',
58365 alpha: 'a-zA-Z',
58366 ascii: '\\x00-\\x7F',
58367 blank: ' \\t',
58368 cntrl: '\\x00-\\x1F\\x7F',
58369 digit: '0-9',
58370 graph: '\\x21-\\x7E',
58371 lower: 'a-z',
58372 print: '\\x20-\\x7E ',
58373 punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
58374 space: ' \\t\\r\\n\\v\\f',
58375 upper: 'A-Z',
58376 word: 'A-Za-z0-9_',
58377 xdigit: 'A-Fa-f0-9'
58378};
58379
58380
58381/***/ }),
58382
58383/***/ 58404:
58384/***/ (function(module) {
58385
58386"use strict";
58387
58388
58389if (typeof process === 'undefined' ||
58390 !process.version ||
58391 process.version.indexOf('v0.') === 0 ||
58392 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
58393 module.exports = { nextTick: nextTick };
58394} else {
58395 module.exports = process
58396}
58397
58398function nextTick(fn, arg1, arg2, arg3) {
58399 if (typeof fn !== 'function') {
58400 throw new TypeError('"callback" argument must be a function');
58401 }
58402 var len = arguments.length;
58403 var args, i;
58404 switch (len) {
58405 case 0:
58406 case 1:
58407 return process.nextTick(fn);
58408 case 2:
58409 return process.nextTick(function afterTickOne() {
58410 fn.call(null, arg1);
58411 });
58412 case 3:
58413 return process.nextTick(function afterTickTwo() {
58414 fn.call(null, arg1, arg2);
58415 });
58416 case 4:
58417 return process.nextTick(function afterTickThree() {
58418 fn.call(null, arg1, arg2, arg3);
58419 });
58420 default:
58421 args = new Array(len - 1);
58422 i = 0;
58423 while (i < args.length) {
58424 args[i++] = arguments[i];
58425 }
58426 return process.nextTick(function afterTick() {
58427 fn.apply(null, args);
58428 });
58429 }
58430}
58431
58432
58433
58434/***/ }),
58435
58436/***/ 59570:
58437/***/ (function(module) {
58438
58439/*!
58440 * prr
58441 * (c) 2013 Rod Vagg <rod@vagg.org>
58442 * https://github.com/rvagg/prr
58443 * License: MIT
58444 */
58445
58446(function (name, context, definition) {
58447 if ( true && module.exports)
58448 module.exports = definition()
58449 else
58450 context[name] = definition()
58451})('prr', this, function() {
58452
58453 var setProperty = typeof Object.defineProperty == 'function'
58454 ? function (obj, key, options) {
58455 Object.defineProperty(obj, key, options)
58456 return obj
58457 }
58458 : function (obj, key, options) { // < es5
58459 obj[key] = options.value
58460 return obj
58461 }
58462
58463 , makeOptions = function (value, options) {
58464 var oo = typeof options == 'object'
58465 , os = !oo && typeof options == 'string'
58466 , op = function (p) {
58467 return oo
58468 ? !!options[p]
58469 : os
58470 ? options.indexOf(p[0]) > -1
58471 : false
58472 }
58473
58474 return {
58475 enumerable : op('enumerable')
58476 , configurable : op('configurable')
58477 , writable : op('writable')
58478 , value : value
58479 }
58480 }
58481
58482 , prr = function (obj, key, value, options) {
58483 var k
58484
58485 options = makeOptions(value, options)
58486
58487 if (typeof key == 'object') {
58488 for (k in key) {
58489 if (Object.hasOwnProperty.call(key, k)) {
58490 options.value = key[k]
58491 setProperty(obj, k, options)
58492 }
58493 }
58494 return obj
58495 }
58496
58497 return setProperty(obj, key, options)
58498 }
58499
58500 return prr
58501})
58502
58503/***/ }),
58504
58505/***/ 79822:
58506/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58507
58508module.exports = __webpack_require__(76417).randomBytes
58509
58510
58511/***/ }),
58512
58513/***/ 42770:
58514/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58515
58516"use strict";
58517// Copyright Joyent, Inc. and other Node contributors.
58518//
58519// Permission is hereby granted, free of charge, to any person obtaining a
58520// copy of this software and associated documentation files (the
58521// "Software"), to deal in the Software without restriction, including
58522// without limitation the rights to use, copy, modify, merge, publish,
58523// distribute, sublicense, and/or sell copies of the Software, and to permit
58524// persons to whom the Software is furnished to do so, subject to the
58525// following conditions:
58526//
58527// The above copyright notice and this permission notice shall be included
58528// in all copies or substantial portions of the Software.
58529//
58530// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
58531// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58532// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
58533// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
58534// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
58535// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
58536// USE OR OTHER DEALINGS IN THE SOFTWARE.
58537
58538// a duplex stream is just a stream that is both readable and writable.
58539// Since JS doesn't have multiple prototypal inheritance, this class
58540// prototypally inherits from Readable, and then parasitically from
58541// Writable.
58542
58543
58544
58545/*<replacement>*/
58546
58547var pna = __webpack_require__(58404);
58548/*</replacement>*/
58549
58550/*<replacement>*/
58551var objectKeys = Object.keys || function (obj) {
58552 var keys = [];
58553 for (var key in obj) {
58554 keys.push(key);
58555 }return keys;
58556};
58557/*</replacement>*/
58558
58559module.exports = Duplex;
58560
58561/*<replacement>*/
58562var util = Object.create(__webpack_require__(78334));
58563util.inherits = __webpack_require__(2989);
58564/*</replacement>*/
58565
58566var Readable = __webpack_require__(79341);
58567var Writable = __webpack_require__(78063);
58568
58569util.inherits(Duplex, Readable);
58570
58571{
58572 // avoid scope creep, the keys array can then be collected
58573 var keys = objectKeys(Writable.prototype);
58574 for (var v = 0; v < keys.length; v++) {
58575 var method = keys[v];
58576 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
58577 }
58578}
58579
58580function Duplex(options) {
58581 if (!(this instanceof Duplex)) return new Duplex(options);
58582
58583 Readable.call(this, options);
58584 Writable.call(this, options);
58585
58586 if (options && options.readable === false) this.readable = false;
58587
58588 if (options && options.writable === false) this.writable = false;
58589
58590 this.allowHalfOpen = true;
58591 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
58592
58593 this.once('end', onend);
58594}
58595
58596Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
58597 // making it explicit this property is not enumerable
58598 // because otherwise some prototype manipulation in
58599 // userland will fail
58600 enumerable: false,
58601 get: function () {
58602 return this._writableState.highWaterMark;
58603 }
58604});
58605
58606// the no-half-open enforcer
58607function onend() {
58608 // if we allow half-open state, or if the writable side ended,
58609 // then we're ok.
58610 if (this.allowHalfOpen || this._writableState.ended) return;
58611
58612 // no more data can be written.
58613 // But allow more writes to happen in this tick.
58614 pna.nextTick(onEndNT, this);
58615}
58616
58617function onEndNT(self) {
58618 self.end();
58619}
58620
58621Object.defineProperty(Duplex.prototype, 'destroyed', {
58622 get: function () {
58623 if (this._readableState === undefined || this._writableState === undefined) {
58624 return false;
58625 }
58626 return this._readableState.destroyed && this._writableState.destroyed;
58627 },
58628 set: function (value) {
58629 // we ignore the value if the stream
58630 // has not been initialized yet
58631 if (this._readableState === undefined || this._writableState === undefined) {
58632 return;
58633 }
58634
58635 // backward compatibility, the user is explicitly
58636 // managing destroyed
58637 this._readableState.destroyed = value;
58638 this._writableState.destroyed = value;
58639 }
58640});
58641
58642Duplex.prototype._destroy = function (err, cb) {
58643 this.push(null);
58644 this.end();
58645
58646 pna.nextTick(cb, err);
58647};
58648
58649/***/ }),
58650
58651/***/ 60143:
58652/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58653
58654"use strict";
58655// Copyright Joyent, Inc. and other Node contributors.
58656//
58657// Permission is hereby granted, free of charge, to any person obtaining a
58658// copy of this software and associated documentation files (the
58659// "Software"), to deal in the Software without restriction, including
58660// without limitation the rights to use, copy, modify, merge, publish,
58661// distribute, sublicense, and/or sell copies of the Software, and to permit
58662// persons to whom the Software is furnished to do so, subject to the
58663// following conditions:
58664//
58665// The above copyright notice and this permission notice shall be included
58666// in all copies or substantial portions of the Software.
58667//
58668// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
58669// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58670// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
58671// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
58672// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
58673// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
58674// USE OR OTHER DEALINGS IN THE SOFTWARE.
58675
58676// a passthrough stream.
58677// basically just the most minimal sort of Transform stream.
58678// Every written chunk gets output as-is.
58679
58680
58681
58682module.exports = PassThrough;
58683
58684var Transform = __webpack_require__(62826);
58685
58686/*<replacement>*/
58687var util = Object.create(__webpack_require__(78334));
58688util.inherits = __webpack_require__(2989);
58689/*</replacement>*/
58690
58691util.inherits(PassThrough, Transform);
58692
58693function PassThrough(options) {
58694 if (!(this instanceof PassThrough)) return new PassThrough(options);
58695
58696 Transform.call(this, options);
58697}
58698
58699PassThrough.prototype._transform = function (chunk, encoding, cb) {
58700 cb(null, chunk);
58701};
58702
58703/***/ }),
58704
58705/***/ 79341:
58706/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
58707
58708"use strict";
58709// Copyright Joyent, Inc. and other Node contributors.
58710//
58711// Permission is hereby granted, free of charge, to any person obtaining a
58712// copy of this software and associated documentation files (the
58713// "Software"), to deal in the Software without restriction, including
58714// without limitation the rights to use, copy, modify, merge, publish,
58715// distribute, sublicense, and/or sell copies of the Software, and to permit
58716// persons to whom the Software is furnished to do so, subject to the
58717// following conditions:
58718//
58719// The above copyright notice and this permission notice shall be included
58720// in all copies or substantial portions of the Software.
58721//
58722// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
58723// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58724// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
58725// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
58726// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
58727// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
58728// USE OR OTHER DEALINGS IN THE SOFTWARE.
58729
58730
58731
58732/*<replacement>*/
58733
58734var pna = __webpack_require__(58404);
58735/*</replacement>*/
58736
58737module.exports = Readable;
58738
58739/*<replacement>*/
58740var isArray = __webpack_require__(21352);
58741/*</replacement>*/
58742
58743/*<replacement>*/
58744var Duplex;
58745/*</replacement>*/
58746
58747Readable.ReadableState = ReadableState;
58748
58749/*<replacement>*/
58750var EE = __webpack_require__(28614).EventEmitter;
58751
58752var EElistenerCount = function (emitter, type) {
58753 return emitter.listeners(type).length;
58754};
58755/*</replacement>*/
58756
58757/*<replacement>*/
58758var Stream = __webpack_require__(1065);
58759/*</replacement>*/
58760
58761/*<replacement>*/
58762
58763var Buffer = __webpack_require__(96788).Buffer;
58764var OurUint8Array = global.Uint8Array || function () {};
58765function _uint8ArrayToBuffer(chunk) {
58766 return Buffer.from(chunk);
58767}
58768function _isUint8Array(obj) {
58769 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
58770}
58771
58772/*</replacement>*/
58773
58774/*<replacement>*/
58775var util = Object.create(__webpack_require__(78334));
58776util.inherits = __webpack_require__(2989);
58777/*</replacement>*/
58778
58779/*<replacement>*/
58780var debugUtil = __webpack_require__(31669);
58781var debug = void 0;
58782if (debugUtil && debugUtil.debuglog) {
58783 debug = debugUtil.debuglog('stream');
58784} else {
58785 debug = function () {};
58786}
58787/*</replacement>*/
58788
58789var BufferList = __webpack_require__(28878);
58790var destroyImpl = __webpack_require__(87915);
58791var StringDecoder;
58792
58793util.inherits(Readable, Stream);
58794
58795var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
58796
58797function prependListener(emitter, event, fn) {
58798 // Sadly this is not cacheable as some libraries bundle their own
58799 // event emitter implementation with them.
58800 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
58801
58802 // This is a hack to make sure that our error handler is attached before any
58803 // userland ones. NEVER DO THIS. This is here only because this code needs
58804 // to continue to work with older versions of Node.js that do not include
58805 // the prependListener() method. The goal is to eventually remove this hack.
58806 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
58807}
58808
58809function ReadableState(options, stream) {
58810 Duplex = Duplex || __webpack_require__(42770);
58811
58812 options = options || {};
58813
58814 // Duplex streams are both readable and writable, but share
58815 // the same options object.
58816 // However, some cases require setting options to different
58817 // values for the readable and the writable sides of the duplex stream.
58818 // These options can be provided separately as readableXXX and writableXXX.
58819 var isDuplex = stream instanceof Duplex;
58820
58821 // object stream flag. Used to make read(n) ignore n and to
58822 // make all the buffer merging and length checks go away
58823 this.objectMode = !!options.objectMode;
58824
58825 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
58826
58827 // the point at which it stops calling _read() to fill the buffer
58828 // Note: 0 is a valid value, means "don't call _read preemptively ever"
58829 var hwm = options.highWaterMark;
58830 var readableHwm = options.readableHighWaterMark;
58831 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
58832
58833 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
58834
58835 // cast to ints.
58836 this.highWaterMark = Math.floor(this.highWaterMark);
58837
58838 // A linked list is used to store data chunks instead of an array because the
58839 // linked list can remove elements from the beginning faster than
58840 // array.shift()
58841 this.buffer = new BufferList();
58842 this.length = 0;
58843 this.pipes = null;
58844 this.pipesCount = 0;
58845 this.flowing = null;
58846 this.ended = false;
58847 this.endEmitted = false;
58848 this.reading = false;
58849
58850 // a flag to be able to tell if the event 'readable'/'data' is emitted
58851 // immediately, or on a later tick. We set this to true at first, because
58852 // any actions that shouldn't happen until "later" should generally also
58853 // not happen before the first read call.
58854 this.sync = true;
58855
58856 // whenever we return null, then we set a flag to say
58857 // that we're awaiting a 'readable' event emission.
58858 this.needReadable = false;
58859 this.emittedReadable = false;
58860 this.readableListening = false;
58861 this.resumeScheduled = false;
58862
58863 // has it been destroyed
58864 this.destroyed = false;
58865
58866 // Crypto is kind of old and crusty. Historically, its default string
58867 // encoding is 'binary' so we have to make this configurable.
58868 // Everything else in the universe uses 'utf8', though.
58869 this.defaultEncoding = options.defaultEncoding || 'utf8';
58870
58871 // the number of writers that are awaiting a drain event in .pipe()s
58872 this.awaitDrain = 0;
58873
58874 // if true, a maybeReadMore has been scheduled
58875 this.readingMore = false;
58876
58877 this.decoder = null;
58878 this.encoding = null;
58879 if (options.encoding) {
58880 if (!StringDecoder) StringDecoder = __webpack_require__(7395)/* .StringDecoder */ .s;
58881 this.decoder = new StringDecoder(options.encoding);
58882 this.encoding = options.encoding;
58883 }
58884}
58885
58886function Readable(options) {
58887 Duplex = Duplex || __webpack_require__(42770);
58888
58889 if (!(this instanceof Readable)) return new Readable(options);
58890
58891 this._readableState = new ReadableState(options, this);
58892
58893 // legacy
58894 this.readable = true;
58895
58896 if (options) {
58897 if (typeof options.read === 'function') this._read = options.read;
58898
58899 if (typeof options.destroy === 'function') this._destroy = options.destroy;
58900 }
58901
58902 Stream.call(this);
58903}
58904
58905Object.defineProperty(Readable.prototype, 'destroyed', {
58906 get: function () {
58907 if (this._readableState === undefined) {
58908 return false;
58909 }
58910 return this._readableState.destroyed;
58911 },
58912 set: function (value) {
58913 // we ignore the value if the stream
58914 // has not been initialized yet
58915 if (!this._readableState) {
58916 return;
58917 }
58918
58919 // backward compatibility, the user is explicitly
58920 // managing destroyed
58921 this._readableState.destroyed = value;
58922 }
58923});
58924
58925Readable.prototype.destroy = destroyImpl.destroy;
58926Readable.prototype._undestroy = destroyImpl.undestroy;
58927Readable.prototype._destroy = function (err, cb) {
58928 this.push(null);
58929 cb(err);
58930};
58931
58932// Manually shove something into the read() buffer.
58933// This returns true if the highWaterMark has not been hit yet,
58934// similar to how Writable.write() returns true if you should
58935// write() some more.
58936Readable.prototype.push = function (chunk, encoding) {
58937 var state = this._readableState;
58938 var skipChunkCheck;
58939
58940 if (!state.objectMode) {
58941 if (typeof chunk === 'string') {
58942 encoding = encoding || state.defaultEncoding;
58943 if (encoding !== state.encoding) {
58944 chunk = Buffer.from(chunk, encoding);
58945 encoding = '';
58946 }
58947 skipChunkCheck = true;
58948 }
58949 } else {
58950 skipChunkCheck = true;
58951 }
58952
58953 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
58954};
58955
58956// Unshift should *always* be something directly out of read()
58957Readable.prototype.unshift = function (chunk) {
58958 return readableAddChunk(this, chunk, null, true, false);
58959};
58960
58961function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
58962 var state = stream._readableState;
58963 if (chunk === null) {
58964 state.reading = false;
58965 onEofChunk(stream, state);
58966 } else {
58967 var er;
58968 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
58969 if (er) {
58970 stream.emit('error', er);
58971 } else if (state.objectMode || chunk && chunk.length > 0) {
58972 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
58973 chunk = _uint8ArrayToBuffer(chunk);
58974 }
58975
58976 if (addToFront) {
58977 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
58978 } else if (state.ended) {
58979 stream.emit('error', new Error('stream.push() after EOF'));
58980 } else {
58981 state.reading = false;
58982 if (state.decoder && !encoding) {
58983 chunk = state.decoder.write(chunk);
58984 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
58985 } else {
58986 addChunk(stream, state, chunk, false);
58987 }
58988 }
58989 } else if (!addToFront) {
58990 state.reading = false;
58991 }
58992 }
58993
58994 return needMoreData(state);
58995}
58996
58997function addChunk(stream, state, chunk, addToFront) {
58998 if (state.flowing && state.length === 0 && !state.sync) {
58999 stream.emit('data', chunk);
59000 stream.read(0);
59001 } else {
59002 // update the buffer info.
59003 state.length += state.objectMode ? 1 : chunk.length;
59004 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
59005
59006 if (state.needReadable) emitReadable(stream);
59007 }
59008 maybeReadMore(stream, state);
59009}
59010
59011function chunkInvalid(state, chunk) {
59012 var er;
59013 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
59014 er = new TypeError('Invalid non-string/buffer chunk');
59015 }
59016 return er;
59017}
59018
59019// if it's past the high water mark, we can push in some more.
59020// Also, if we have no data yet, we can stand some
59021// more bytes. This is to work around cases where hwm=0,
59022// such as the repl. Also, if the push() triggered a
59023// readable event, and the user called read(largeNumber) such that
59024// needReadable was set, then we ought to push more, so that another
59025// 'readable' event will be triggered.
59026function needMoreData(state) {
59027 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
59028}
59029
59030Readable.prototype.isPaused = function () {
59031 return this._readableState.flowing === false;
59032};
59033
59034// backwards compatibility.
59035Readable.prototype.setEncoding = function (enc) {
59036 if (!StringDecoder) StringDecoder = __webpack_require__(7395)/* .StringDecoder */ .s;
59037 this._readableState.decoder = new StringDecoder(enc);
59038 this._readableState.encoding = enc;
59039 return this;
59040};
59041
59042// Don't raise the hwm > 8MB
59043var MAX_HWM = 0x800000;
59044function computeNewHighWaterMark(n) {
59045 if (n >= MAX_HWM) {
59046 n = MAX_HWM;
59047 } else {
59048 // Get the next highest power of 2 to prevent increasing hwm excessively in
59049 // tiny amounts
59050 n--;
59051 n |= n >>> 1;
59052 n |= n >>> 2;
59053 n |= n >>> 4;
59054 n |= n >>> 8;
59055 n |= n >>> 16;
59056 n++;
59057 }
59058 return n;
59059}
59060
59061// This function is designed to be inlinable, so please take care when making
59062// changes to the function body.
59063function howMuchToRead(n, state) {
59064 if (n <= 0 || state.length === 0 && state.ended) return 0;
59065 if (state.objectMode) return 1;
59066 if (n !== n) {
59067 // Only flow one buffer at a time
59068 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
59069 }
59070 // If we're asking for more than the current hwm, then raise the hwm.
59071 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
59072 if (n <= state.length) return n;
59073 // Don't have enough
59074 if (!state.ended) {
59075 state.needReadable = true;
59076 return 0;
59077 }
59078 return state.length;
59079}
59080
59081// you can override either this method, or the async _read(n) below.
59082Readable.prototype.read = function (n) {
59083 debug('read', n);
59084 n = parseInt(n, 10);
59085 var state = this._readableState;
59086 var nOrig = n;
59087
59088 if (n !== 0) state.emittedReadable = false;
59089
59090 // if we're doing read(0) to trigger a readable event, but we
59091 // already have a bunch of data in the buffer, then just trigger
59092 // the 'readable' event and move on.
59093 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
59094 debug('read: emitReadable', state.length, state.ended);
59095 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
59096 return null;
59097 }
59098
59099 n = howMuchToRead(n, state);
59100
59101 // if we've ended, and we're now clear, then finish it up.
59102 if (n === 0 && state.ended) {
59103 if (state.length === 0) endReadable(this);
59104 return null;
59105 }
59106
59107 // All the actual chunk generation logic needs to be
59108 // *below* the call to _read. The reason is that in certain
59109 // synthetic stream cases, such as passthrough streams, _read
59110 // may be a completely synchronous operation which may change
59111 // the state of the read buffer, providing enough data when
59112 // before there was *not* enough.
59113 //
59114 // So, the steps are:
59115 // 1. Figure out what the state of things will be after we do
59116 // a read from the buffer.
59117 //
59118 // 2. If that resulting state will trigger a _read, then call _read.
59119 // Note that this may be asynchronous, or synchronous. Yes, it is
59120 // deeply ugly to write APIs this way, but that still doesn't mean
59121 // that the Readable class should behave improperly, as streams are
59122 // designed to be sync/async agnostic.
59123 // Take note if the _read call is sync or async (ie, if the read call
59124 // has returned yet), so that we know whether or not it's safe to emit
59125 // 'readable' etc.
59126 //
59127 // 3. Actually pull the requested chunks out of the buffer and return.
59128
59129 // if we need a readable event, then we need to do some reading.
59130 var doRead = state.needReadable;
59131 debug('need readable', doRead);
59132
59133 // if we currently have less than the highWaterMark, then also read some
59134 if (state.length === 0 || state.length - n < state.highWaterMark) {
59135 doRead = true;
59136 debug('length less than watermark', doRead);
59137 }
59138
59139 // however, if we've ended, then there's no point, and if we're already
59140 // reading, then it's unnecessary.
59141 if (state.ended || state.reading) {
59142 doRead = false;
59143 debug('reading or ended', doRead);
59144 } else if (doRead) {
59145 debug('do read');
59146 state.reading = true;
59147 state.sync = true;
59148 // if the length is currently zero, then we *need* a readable event.
59149 if (state.length === 0) state.needReadable = true;
59150 // call internal read method
59151 this._read(state.highWaterMark);
59152 state.sync = false;
59153 // If _read pushed data synchronously, then `reading` will be false,
59154 // and we need to re-evaluate how much data we can return to the user.
59155 if (!state.reading) n = howMuchToRead(nOrig, state);
59156 }
59157
59158 var ret;
59159 if (n > 0) ret = fromList(n, state);else ret = null;
59160
59161 if (ret === null) {
59162 state.needReadable = true;
59163 n = 0;
59164 } else {
59165 state.length -= n;
59166 }
59167
59168 if (state.length === 0) {
59169 // If we have nothing in the buffer, then we want to know
59170 // as soon as we *do* get something into the buffer.
59171 if (!state.ended) state.needReadable = true;
59172
59173 // If we tried to read() past the EOF, then emit end on the next tick.
59174 if (nOrig !== n && state.ended) endReadable(this);
59175 }
59176
59177 if (ret !== null) this.emit('data', ret);
59178
59179 return ret;
59180};
59181
59182function onEofChunk(stream, state) {
59183 if (state.ended) return;
59184 if (state.decoder) {
59185 var chunk = state.decoder.end();
59186 if (chunk && chunk.length) {
59187 state.buffer.push(chunk);
59188 state.length += state.objectMode ? 1 : chunk.length;
59189 }
59190 }
59191 state.ended = true;
59192
59193 // emit 'readable' now to make sure it gets picked up.
59194 emitReadable(stream);
59195}
59196
59197// Don't emit readable right away in sync mode, because this can trigger
59198// another read() call => stack overflow. This way, it might trigger
59199// a nextTick recursion warning, but that's not so bad.
59200function emitReadable(stream) {
59201 var state = stream._readableState;
59202 state.needReadable = false;
59203 if (!state.emittedReadable) {
59204 debug('emitReadable', state.flowing);
59205 state.emittedReadable = true;
59206 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
59207 }
59208}
59209
59210function emitReadable_(stream) {
59211 debug('emit readable');
59212 stream.emit('readable');
59213 flow(stream);
59214}
59215
59216// at this point, the user has presumably seen the 'readable' event,
59217// and called read() to consume some data. that may have triggered
59218// in turn another _read(n) call, in which case reading = true if
59219// it's in progress.
59220// However, if we're not ended, or reading, and the length < hwm,
59221// then go ahead and try to read some more preemptively.
59222function maybeReadMore(stream, state) {
59223 if (!state.readingMore) {
59224 state.readingMore = true;
59225 pna.nextTick(maybeReadMore_, stream, state);
59226 }
59227}
59228
59229function maybeReadMore_(stream, state) {
59230 var len = state.length;
59231 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
59232 debug('maybeReadMore read 0');
59233 stream.read(0);
59234 if (len === state.length)
59235 // didn't get any data, stop spinning.
59236 break;else len = state.length;
59237 }
59238 state.readingMore = false;
59239}
59240
59241// abstract method. to be overridden in specific implementation classes.
59242// call cb(er, data) where data is <= n in length.
59243// for virtual (non-string, non-buffer) streams, "length" is somewhat
59244// arbitrary, and perhaps not very meaningful.
59245Readable.prototype._read = function (n) {
59246 this.emit('error', new Error('_read() is not implemented'));
59247};
59248
59249Readable.prototype.pipe = function (dest, pipeOpts) {
59250 var src = this;
59251 var state = this._readableState;
59252
59253 switch (state.pipesCount) {
59254 case 0:
59255 state.pipes = dest;
59256 break;
59257 case 1:
59258 state.pipes = [state.pipes, dest];
59259 break;
59260 default:
59261 state.pipes.push(dest);
59262 break;
59263 }
59264 state.pipesCount += 1;
59265 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
59266
59267 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
59268
59269 var endFn = doEnd ? onend : unpipe;
59270 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
59271
59272 dest.on('unpipe', onunpipe);
59273 function onunpipe(readable, unpipeInfo) {
59274 debug('onunpipe');
59275 if (readable === src) {
59276 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
59277 unpipeInfo.hasUnpiped = true;
59278 cleanup();
59279 }
59280 }
59281 }
59282
59283 function onend() {
59284 debug('onend');
59285 dest.end();
59286 }
59287
59288 // when the dest drains, it reduces the awaitDrain counter
59289 // on the source. This would be more elegant with a .once()
59290 // handler in flow(), but adding and removing repeatedly is
59291 // too slow.
59292 var ondrain = pipeOnDrain(src);
59293 dest.on('drain', ondrain);
59294
59295 var cleanedUp = false;
59296 function cleanup() {
59297 debug('cleanup');
59298 // cleanup event handlers once the pipe is broken
59299 dest.removeListener('close', onclose);
59300 dest.removeListener('finish', onfinish);
59301 dest.removeListener('drain', ondrain);
59302 dest.removeListener('error', onerror);
59303 dest.removeListener('unpipe', onunpipe);
59304 src.removeListener('end', onend);
59305 src.removeListener('end', unpipe);
59306 src.removeListener('data', ondata);
59307
59308 cleanedUp = true;
59309
59310 // if the reader is waiting for a drain event from this
59311 // specific writer, then it would cause it to never start
59312 // flowing again.
59313 // So, if this is awaiting a drain, then we just call it now.
59314 // If we don't know, then assume that we are waiting for one.
59315 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
59316 }
59317
59318 // If the user pushes more data while we're writing to dest then we'll end up
59319 // in ondata again. However, we only want to increase awaitDrain once because
59320 // dest will only emit one 'drain' event for the multiple writes.
59321 // => Introduce a guard on increasing awaitDrain.
59322 var increasedAwaitDrain = false;
59323 src.on('data', ondata);
59324 function ondata(chunk) {
59325 debug('ondata');
59326 increasedAwaitDrain = false;
59327 var ret = dest.write(chunk);
59328 if (false === ret && !increasedAwaitDrain) {
59329 // If the user unpiped during `dest.write()`, it is possible
59330 // to get stuck in a permanently paused state if that write
59331 // also returned false.
59332 // => Check whether `dest` is still a piping destination.
59333 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
59334 debug('false write response, pause', src._readableState.awaitDrain);
59335 src._readableState.awaitDrain++;
59336 increasedAwaitDrain = true;
59337 }
59338 src.pause();
59339 }
59340 }
59341
59342 // if the dest has an error, then stop piping into it.
59343 // however, don't suppress the throwing behavior for this.
59344 function onerror(er) {
59345 debug('onerror', er);
59346 unpipe();
59347 dest.removeListener('error', onerror);
59348 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
59349 }
59350
59351 // Make sure our error handler is attached before userland ones.
59352 prependListener(dest, 'error', onerror);
59353
59354 // Both close and finish should trigger unpipe, but only once.
59355 function onclose() {
59356 dest.removeListener('finish', onfinish);
59357 unpipe();
59358 }
59359 dest.once('close', onclose);
59360 function onfinish() {
59361 debug('onfinish');
59362 dest.removeListener('close', onclose);
59363 unpipe();
59364 }
59365 dest.once('finish', onfinish);
59366
59367 function unpipe() {
59368 debug('unpipe');
59369 src.unpipe(dest);
59370 }
59371
59372 // tell the dest that it's being piped to
59373 dest.emit('pipe', src);
59374
59375 // start the flow if it hasn't been started already.
59376 if (!state.flowing) {
59377 debug('pipe resume');
59378 src.resume();
59379 }
59380
59381 return dest;
59382};
59383
59384function pipeOnDrain(src) {
59385 return function () {
59386 var state = src._readableState;
59387 debug('pipeOnDrain', state.awaitDrain);
59388 if (state.awaitDrain) state.awaitDrain--;
59389 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
59390 state.flowing = true;
59391 flow(src);
59392 }
59393 };
59394}
59395
59396Readable.prototype.unpipe = function (dest) {
59397 var state = this._readableState;
59398 var unpipeInfo = { hasUnpiped: false };
59399
59400 // if we're not piping anywhere, then do nothing.
59401 if (state.pipesCount === 0) return this;
59402
59403 // just one destination. most common case.
59404 if (state.pipesCount === 1) {
59405 // passed in one, but it's not the right one.
59406 if (dest && dest !== state.pipes) return this;
59407
59408 if (!dest) dest = state.pipes;
59409
59410 // got a match.
59411 state.pipes = null;
59412 state.pipesCount = 0;
59413 state.flowing = false;
59414 if (dest) dest.emit('unpipe', this, unpipeInfo);
59415 return this;
59416 }
59417
59418 // slow case. multiple pipe destinations.
59419
59420 if (!dest) {
59421 // remove all.
59422 var dests = state.pipes;
59423 var len = state.pipesCount;
59424 state.pipes = null;
59425 state.pipesCount = 0;
59426 state.flowing = false;
59427
59428 for (var i = 0; i < len; i++) {
59429 dests[i].emit('unpipe', this, unpipeInfo);
59430 }return this;
59431 }
59432
59433 // try to find the right one.
59434 var index = indexOf(state.pipes, dest);
59435 if (index === -1) return this;
59436
59437 state.pipes.splice(index, 1);
59438 state.pipesCount -= 1;
59439 if (state.pipesCount === 1) state.pipes = state.pipes[0];
59440
59441 dest.emit('unpipe', this, unpipeInfo);
59442
59443 return this;
59444};
59445
59446// set up data events if they are asked for
59447// Ensure readable listeners eventually get something
59448Readable.prototype.on = function (ev, fn) {
59449 var res = Stream.prototype.on.call(this, ev, fn);
59450
59451 if (ev === 'data') {
59452 // Start flowing on next tick if stream isn't explicitly paused
59453 if (this._readableState.flowing !== false) this.resume();
59454 } else if (ev === 'readable') {
59455 var state = this._readableState;
59456 if (!state.endEmitted && !state.readableListening) {
59457 state.readableListening = state.needReadable = true;
59458 state.emittedReadable = false;
59459 if (!state.reading) {
59460 pna.nextTick(nReadingNextTick, this);
59461 } else if (state.length) {
59462 emitReadable(this);
59463 }
59464 }
59465 }
59466
59467 return res;
59468};
59469Readable.prototype.addListener = Readable.prototype.on;
59470
59471function nReadingNextTick(self) {
59472 debug('readable nexttick read 0');
59473 self.read(0);
59474}
59475
59476// pause() and resume() are remnants of the legacy readable stream API
59477// If the user uses them, then switch into old mode.
59478Readable.prototype.resume = function () {
59479 var state = this._readableState;
59480 if (!state.flowing) {
59481 debug('resume');
59482 state.flowing = true;
59483 resume(this, state);
59484 }
59485 return this;
59486};
59487
59488function resume(stream, state) {
59489 if (!state.resumeScheduled) {
59490 state.resumeScheduled = true;
59491 pna.nextTick(resume_, stream, state);
59492 }
59493}
59494
59495function resume_(stream, state) {
59496 if (!state.reading) {
59497 debug('resume read 0');
59498 stream.read(0);
59499 }
59500
59501 state.resumeScheduled = false;
59502 state.awaitDrain = 0;
59503 stream.emit('resume');
59504 flow(stream);
59505 if (state.flowing && !state.reading) stream.read(0);
59506}
59507
59508Readable.prototype.pause = function () {
59509 debug('call pause flowing=%j', this._readableState.flowing);
59510 if (false !== this._readableState.flowing) {
59511 debug('pause');
59512 this._readableState.flowing = false;
59513 this.emit('pause');
59514 }
59515 return this;
59516};
59517
59518function flow(stream) {
59519 var state = stream._readableState;
59520 debug('flow', state.flowing);
59521 while (state.flowing && stream.read() !== null) {}
59522}
59523
59524// wrap an old-style stream as the async data source.
59525// This is *not* part of the readable stream interface.
59526// It is an ugly unfortunate mess of history.
59527Readable.prototype.wrap = function (stream) {
59528 var _this = this;
59529
59530 var state = this._readableState;
59531 var paused = false;
59532
59533 stream.on('end', function () {
59534 debug('wrapped end');
59535 if (state.decoder && !state.ended) {
59536 var chunk = state.decoder.end();
59537 if (chunk && chunk.length) _this.push(chunk);
59538 }
59539
59540 _this.push(null);
59541 });
59542
59543 stream.on('data', function (chunk) {
59544 debug('wrapped data');
59545 if (state.decoder) chunk = state.decoder.write(chunk);
59546
59547 // don't skip over falsy values in objectMode
59548 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
59549
59550 var ret = _this.push(chunk);
59551 if (!ret) {
59552 paused = true;
59553 stream.pause();
59554 }
59555 });
59556
59557 // proxy all the other methods.
59558 // important when wrapping filters and duplexes.
59559 for (var i in stream) {
59560 if (this[i] === undefined && typeof stream[i] === 'function') {
59561 this[i] = function (method) {
59562 return function () {
59563 return stream[method].apply(stream, arguments);
59564 };
59565 }(i);
59566 }
59567 }
59568
59569 // proxy certain important events.
59570 for (var n = 0; n < kProxyEvents.length; n++) {
59571 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
59572 }
59573
59574 // when we try to consume some more bytes, simply unpause the
59575 // underlying stream.
59576 this._read = function (n) {
59577 debug('wrapped _read', n);
59578 if (paused) {
59579 paused = false;
59580 stream.resume();
59581 }
59582 };
59583
59584 return this;
59585};
59586
59587Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
59588 // making it explicit this property is not enumerable
59589 // because otherwise some prototype manipulation in
59590 // userland will fail
59591 enumerable: false,
59592 get: function () {
59593 return this._readableState.highWaterMark;
59594 }
59595});
59596
59597// exposed for testing purposes only.
59598Readable._fromList = fromList;
59599
59600// Pluck off n bytes from an array of buffers.
59601// Length is the combined lengths of all the buffers in the list.
59602// This function is designed to be inlinable, so please take care when making
59603// changes to the function body.
59604function fromList(n, state) {
59605 // nothing buffered
59606 if (state.length === 0) return null;
59607
59608 var ret;
59609 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
59610 // read it all, truncate the list
59611 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
59612 state.buffer.clear();
59613 } else {
59614 // read part of list
59615 ret = fromListPartial(n, state.buffer, state.decoder);
59616 }
59617
59618 return ret;
59619}
59620
59621// Extracts only enough buffered data to satisfy the amount requested.
59622// This function is designed to be inlinable, so please take care when making
59623// changes to the function body.
59624function fromListPartial(n, list, hasStrings) {
59625 var ret;
59626 if (n < list.head.data.length) {
59627 // slice is the same for buffers and strings
59628 ret = list.head.data.slice(0, n);
59629 list.head.data = list.head.data.slice(n);
59630 } else if (n === list.head.data.length) {
59631 // first chunk is a perfect match
59632 ret = list.shift();
59633 } else {
59634 // result spans more than one buffer
59635 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
59636 }
59637 return ret;
59638}
59639
59640// Copies a specified amount of characters from the list of buffered data
59641// chunks.
59642// This function is designed to be inlinable, so please take care when making
59643// changes to the function body.
59644function copyFromBufferString(n, list) {
59645 var p = list.head;
59646 var c = 1;
59647 var ret = p.data;
59648 n -= ret.length;
59649 while (p = p.next) {
59650 var str = p.data;
59651 var nb = n > str.length ? str.length : n;
59652 if (nb === str.length) ret += str;else ret += str.slice(0, n);
59653 n -= nb;
59654 if (n === 0) {
59655 if (nb === str.length) {
59656 ++c;
59657 if (p.next) list.head = p.next;else list.head = list.tail = null;
59658 } else {
59659 list.head = p;
59660 p.data = str.slice(nb);
59661 }
59662 break;
59663 }
59664 ++c;
59665 }
59666 list.length -= c;
59667 return ret;
59668}
59669
59670// Copies a specified amount of bytes from the list of buffered data chunks.
59671// This function is designed to be inlinable, so please take care when making
59672// changes to the function body.
59673function copyFromBuffer(n, list) {
59674 var ret = Buffer.allocUnsafe(n);
59675 var p = list.head;
59676 var c = 1;
59677 p.data.copy(ret);
59678 n -= p.data.length;
59679 while (p = p.next) {
59680 var buf = p.data;
59681 var nb = n > buf.length ? buf.length : n;
59682 buf.copy(ret, ret.length - n, 0, nb);
59683 n -= nb;
59684 if (n === 0) {
59685 if (nb === buf.length) {
59686 ++c;
59687 if (p.next) list.head = p.next;else list.head = list.tail = null;
59688 } else {
59689 list.head = p;
59690 p.data = buf.slice(nb);
59691 }
59692 break;
59693 }
59694 ++c;
59695 }
59696 list.length -= c;
59697 return ret;
59698}
59699
59700function endReadable(stream) {
59701 var state = stream._readableState;
59702
59703 // If we get here before consuming all the bytes, then that is a
59704 // bug in node. Should never happen.
59705 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
59706
59707 if (!state.endEmitted) {
59708 state.ended = true;
59709 pna.nextTick(endReadableNT, state, stream);
59710 }
59711}
59712
59713function endReadableNT(state, stream) {
59714 // Check that we didn't get one last unshift.
59715 if (!state.endEmitted && state.length === 0) {
59716 state.endEmitted = true;
59717 stream.readable = false;
59718 stream.emit('end');
59719 }
59720}
59721
59722function indexOf(xs, x) {
59723 for (var i = 0, l = xs.length; i < l; i++) {
59724 if (xs[i] === x) return i;
59725 }
59726 return -1;
59727}
59728
59729/***/ }),
59730
59731/***/ 62826:
59732/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
59733
59734"use strict";
59735// Copyright Joyent, Inc. and other Node contributors.
59736//
59737// Permission is hereby granted, free of charge, to any person obtaining a
59738// copy of this software and associated documentation files (the
59739// "Software"), to deal in the Software without restriction, including
59740// without limitation the rights to use, copy, modify, merge, publish,
59741// distribute, sublicense, and/or sell copies of the Software, and to permit
59742// persons to whom the Software is furnished to do so, subject to the
59743// following conditions:
59744//
59745// The above copyright notice and this permission notice shall be included
59746// in all copies or substantial portions of the Software.
59747//
59748// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
59749// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59750// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
59751// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
59752// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
59753// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
59754// USE OR OTHER DEALINGS IN THE SOFTWARE.
59755
59756// a transform stream is a readable/writable stream where you do
59757// something with the data. Sometimes it's called a "filter",
59758// but that's not a great name for it, since that implies a thing where
59759// some bits pass through, and others are simply ignored. (That would
59760// be a valid example of a transform, of course.)
59761//
59762// While the output is causally related to the input, it's not a
59763// necessarily symmetric or synchronous transformation. For example,
59764// a zlib stream might take multiple plain-text writes(), and then
59765// emit a single compressed chunk some time in the future.
59766//
59767// Here's how this works:
59768//
59769// The Transform stream has all the aspects of the readable and writable
59770// stream classes. When you write(chunk), that calls _write(chunk,cb)
59771// internally, and returns false if there's a lot of pending writes
59772// buffered up. When you call read(), that calls _read(n) until
59773// there's enough pending readable data buffered up.
59774//
59775// In a transform stream, the written data is placed in a buffer. When
59776// _read(n) is called, it transforms the queued up data, calling the
59777// buffered _write cb's as it consumes chunks. If consuming a single
59778// written chunk would result in multiple output chunks, then the first
59779// outputted bit calls the readcb, and subsequent chunks just go into
59780// the read buffer, and will cause it to emit 'readable' if necessary.
59781//
59782// This way, back-pressure is actually determined by the reading side,
59783// since _read has to be called to start processing a new chunk. However,
59784// a pathological inflate type of transform can cause excessive buffering
59785// here. For example, imagine a stream where every byte of input is
59786// interpreted as an integer from 0-255, and then results in that many
59787// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
59788// 1kb of data being output. In this case, you could write a very small
59789// amount of input, and end up with a very large amount of output. In
59790// such a pathological inflating mechanism, there'd be no way to tell
59791// the system to stop doing the transform. A single 4MB write could
59792// cause the system to run out of memory.
59793//
59794// However, even in such a pathological case, only a single written chunk
59795// would be consumed, and then the rest would wait (un-transformed) until
59796// the results of the previous transformed chunk were consumed.
59797
59798
59799
59800module.exports = Transform;
59801
59802var Duplex = __webpack_require__(42770);
59803
59804/*<replacement>*/
59805var util = Object.create(__webpack_require__(78334));
59806util.inherits = __webpack_require__(2989);
59807/*</replacement>*/
59808
59809util.inherits(Transform, Duplex);
59810
59811function afterTransform(er, data) {
59812 var ts = this._transformState;
59813 ts.transforming = false;
59814
59815 var cb = ts.writecb;
59816
59817 if (!cb) {
59818 return this.emit('error', new Error('write callback called multiple times'));
59819 }
59820
59821 ts.writechunk = null;
59822 ts.writecb = null;
59823
59824 if (data != null) // single equals check for both `null` and `undefined`
59825 this.push(data);
59826
59827 cb(er);
59828
59829 var rs = this._readableState;
59830 rs.reading = false;
59831 if (rs.needReadable || rs.length < rs.highWaterMark) {
59832 this._read(rs.highWaterMark);
59833 }
59834}
59835
59836function Transform(options) {
59837 if (!(this instanceof Transform)) return new Transform(options);
59838
59839 Duplex.call(this, options);
59840
59841 this._transformState = {
59842 afterTransform: afterTransform.bind(this),
59843 needTransform: false,
59844 transforming: false,
59845 writecb: null,
59846 writechunk: null,
59847 writeencoding: null
59848 };
59849
59850 // start out asking for a readable event once data is transformed.
59851 this._readableState.needReadable = true;
59852
59853 // we have implemented the _read method, and done the other things
59854 // that Readable wants before the first _read call, so unset the
59855 // sync guard flag.
59856 this._readableState.sync = false;
59857
59858 if (options) {
59859 if (typeof options.transform === 'function') this._transform = options.transform;
59860
59861 if (typeof options.flush === 'function') this._flush = options.flush;
59862 }
59863
59864 // When the writable side finishes, then flush out anything remaining.
59865 this.on('prefinish', prefinish);
59866}
59867
59868function prefinish() {
59869 var _this = this;
59870
59871 if (typeof this._flush === 'function') {
59872 this._flush(function (er, data) {
59873 done(_this, er, data);
59874 });
59875 } else {
59876 done(this, null, null);
59877 }
59878}
59879
59880Transform.prototype.push = function (chunk, encoding) {
59881 this._transformState.needTransform = false;
59882 return Duplex.prototype.push.call(this, chunk, encoding);
59883};
59884
59885// This is the part where you do stuff!
59886// override this function in implementation classes.
59887// 'chunk' is an input chunk.
59888//
59889// Call `push(newChunk)` to pass along transformed output
59890// to the readable side. You may call 'push' zero or more times.
59891//
59892// Call `cb(err)` when you are done with this chunk. If you pass
59893// an error, then that'll put the hurt on the whole operation. If you
59894// never call cb(), then you'll never get another chunk.
59895Transform.prototype._transform = function (chunk, encoding, cb) {
59896 throw new Error('_transform() is not implemented');
59897};
59898
59899Transform.prototype._write = function (chunk, encoding, cb) {
59900 var ts = this._transformState;
59901 ts.writecb = cb;
59902 ts.writechunk = chunk;
59903 ts.writeencoding = encoding;
59904 if (!ts.transforming) {
59905 var rs = this._readableState;
59906 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
59907 }
59908};
59909
59910// Doesn't matter what the args are here.
59911// _transform does all the work.
59912// That we got here means that the readable side wants more data.
59913Transform.prototype._read = function (n) {
59914 var ts = this._transformState;
59915
59916 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
59917 ts.transforming = true;
59918 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
59919 } else {
59920 // mark that we need a transform, so that any data that comes in
59921 // will get processed, now that we've asked for it.
59922 ts.needTransform = true;
59923 }
59924};
59925
59926Transform.prototype._destroy = function (err, cb) {
59927 var _this2 = this;
59928
59929 Duplex.prototype._destroy.call(this, err, function (err2) {
59930 cb(err2);
59931 _this2.emit('close');
59932 });
59933};
59934
59935function done(stream, er, data) {
59936 if (er) return stream.emit('error', er);
59937
59938 if (data != null) // single equals check for both `null` and `undefined`
59939 stream.push(data);
59940
59941 // if there's nothing in the write buffer, then that means
59942 // that nothing more will ever be provided
59943 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
59944
59945 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
59946
59947 return stream.push(null);
59948}
59949
59950/***/ }),
59951
59952/***/ 78063:
59953/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
59954
59955"use strict";
59956// Copyright Joyent, Inc. and other Node contributors.
59957//
59958// Permission is hereby granted, free of charge, to any person obtaining a
59959// copy of this software and associated documentation files (the
59960// "Software"), to deal in the Software without restriction, including
59961// without limitation the rights to use, copy, modify, merge, publish,
59962// distribute, sublicense, and/or sell copies of the Software, and to permit
59963// persons to whom the Software is furnished to do so, subject to the
59964// following conditions:
59965//
59966// The above copyright notice and this permission notice shall be included
59967// in all copies or substantial portions of the Software.
59968//
59969// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
59970// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59971// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
59972// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
59973// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
59974// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
59975// USE OR OTHER DEALINGS IN THE SOFTWARE.
59976
59977// A bit simpler than readable streams.
59978// Implement an async ._write(chunk, encoding, cb), and it'll handle all
59979// the drain event emission and buffering.
59980
59981
59982
59983/*<replacement>*/
59984
59985var pna = __webpack_require__(58404);
59986/*</replacement>*/
59987
59988module.exports = Writable;
59989
59990/* <replacement> */
59991function WriteReq(chunk, encoding, cb) {
59992 this.chunk = chunk;
59993 this.encoding = encoding;
59994 this.callback = cb;
59995 this.next = null;
59996}
59997
59998// It seems a linked list but it is not
59999// there will be only 2 of these for each stream
60000function CorkedRequest(state) {
60001 var _this = this;
60002
60003 this.next = null;
60004 this.entry = null;
60005 this.finish = function () {
60006 onCorkedFinish(_this, state);
60007 };
60008}
60009/* </replacement> */
60010
60011/*<replacement>*/
60012var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
60013/*</replacement>*/
60014
60015/*<replacement>*/
60016var Duplex;
60017/*</replacement>*/
60018
60019Writable.WritableState = WritableState;
60020
60021/*<replacement>*/
60022var util = Object.create(__webpack_require__(78334));
60023util.inherits = __webpack_require__(2989);
60024/*</replacement>*/
60025
60026/*<replacement>*/
60027var internalUtil = {
60028 deprecate: __webpack_require__(92262)
60029};
60030/*</replacement>*/
60031
60032/*<replacement>*/
60033var Stream = __webpack_require__(1065);
60034/*</replacement>*/
60035
60036/*<replacement>*/
60037
60038var Buffer = __webpack_require__(96788).Buffer;
60039var OurUint8Array = global.Uint8Array || function () {};
60040function _uint8ArrayToBuffer(chunk) {
60041 return Buffer.from(chunk);
60042}
60043function _isUint8Array(obj) {
60044 return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
60045}
60046
60047/*</replacement>*/
60048
60049var destroyImpl = __webpack_require__(87915);
60050
60051util.inherits(Writable, Stream);
60052
60053function nop() {}
60054
60055function WritableState(options, stream) {
60056 Duplex = Duplex || __webpack_require__(42770);
60057
60058 options = options || {};
60059
60060 // Duplex streams are both readable and writable, but share
60061 // the same options object.
60062 // However, some cases require setting options to different
60063 // values for the readable and the writable sides of the duplex stream.
60064 // These options can be provided separately as readableXXX and writableXXX.
60065 var isDuplex = stream instanceof Duplex;
60066
60067 // object stream flag to indicate whether or not this stream
60068 // contains buffers or objects.
60069 this.objectMode = !!options.objectMode;
60070
60071 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
60072
60073 // the point at which write() starts returning false
60074 // Note: 0 is a valid value, means that we always return false if
60075 // the entire buffer is not flushed immediately on write()
60076 var hwm = options.highWaterMark;
60077 var writableHwm = options.writableHighWaterMark;
60078 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
60079
60080 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
60081
60082 // cast to ints.
60083 this.highWaterMark = Math.floor(this.highWaterMark);
60084
60085 // if _final has been called
60086 this.finalCalled = false;
60087
60088 // drain event flag.
60089 this.needDrain = false;
60090 // at the start of calling end()
60091 this.ending = false;
60092 // when end() has been called, and returned
60093 this.ended = false;
60094 // when 'finish' is emitted
60095 this.finished = false;
60096
60097 // has it been destroyed
60098 this.destroyed = false;
60099
60100 // should we decode strings into buffers before passing to _write?
60101 // this is here so that some node-core streams can optimize string
60102 // handling at a lower level.
60103 var noDecode = options.decodeStrings === false;
60104 this.decodeStrings = !noDecode;
60105
60106 // Crypto is kind of old and crusty. Historically, its default string
60107 // encoding is 'binary' so we have to make this configurable.
60108 // Everything else in the universe uses 'utf8', though.
60109 this.defaultEncoding = options.defaultEncoding || 'utf8';
60110
60111 // not an actual buffer we keep track of, but a measurement
60112 // of how much we're waiting to get pushed to some underlying
60113 // socket or file.
60114 this.length = 0;
60115
60116 // a flag to see when we're in the middle of a write.
60117 this.writing = false;
60118
60119 // when true all writes will be buffered until .uncork() call
60120 this.corked = 0;
60121
60122 // a flag to be able to tell if the onwrite cb is called immediately,
60123 // or on a later tick. We set this to true at first, because any
60124 // actions that shouldn't happen until "later" should generally also
60125 // not happen before the first write call.
60126 this.sync = true;
60127
60128 // a flag to know if we're processing previously buffered items, which
60129 // may call the _write() callback in the same tick, so that we don't
60130 // end up in an overlapped onwrite situation.
60131 this.bufferProcessing = false;
60132
60133 // the callback that's passed to _write(chunk,cb)
60134 this.onwrite = function (er) {
60135 onwrite(stream, er);
60136 };
60137
60138 // the callback that the user supplies to write(chunk,encoding,cb)
60139 this.writecb = null;
60140
60141 // the amount that is being written when _write is called.
60142 this.writelen = 0;
60143
60144 this.bufferedRequest = null;
60145 this.lastBufferedRequest = null;
60146
60147 // number of pending user-supplied write callbacks
60148 // this must be 0 before 'finish' can be emitted
60149 this.pendingcb = 0;
60150
60151 // emit prefinish if the only thing we're waiting for is _write cbs
60152 // This is relevant for synchronous Transform streams
60153 this.prefinished = false;
60154
60155 // True if the error was already emitted and should not be thrown again
60156 this.errorEmitted = false;
60157
60158 // count buffered requests
60159 this.bufferedRequestCount = 0;
60160
60161 // allocate the first CorkedRequest, there is always
60162 // one allocated and free to use, and we maintain at most two
60163 this.corkedRequestsFree = new CorkedRequest(this);
60164}
60165
60166WritableState.prototype.getBuffer = function getBuffer() {
60167 var current = this.bufferedRequest;
60168 var out = [];
60169 while (current) {
60170 out.push(current);
60171 current = current.next;
60172 }
60173 return out;
60174};
60175
60176(function () {
60177 try {
60178 Object.defineProperty(WritableState.prototype, 'buffer', {
60179 get: internalUtil.deprecate(function () {
60180 return this.getBuffer();
60181 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
60182 });
60183 } catch (_) {}
60184})();
60185
60186// Test _writableState for inheritance to account for Duplex streams,
60187// whose prototype chain only points to Readable.
60188var realHasInstance;
60189if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
60190 realHasInstance = Function.prototype[Symbol.hasInstance];
60191 Object.defineProperty(Writable, Symbol.hasInstance, {
60192 value: function (object) {
60193 if (realHasInstance.call(this, object)) return true;
60194 if (this !== Writable) return false;
60195
60196 return object && object._writableState instanceof WritableState;
60197 }
60198 });
60199} else {
60200 realHasInstance = function (object) {
60201 return object instanceof this;
60202 };
60203}
60204
60205function Writable(options) {
60206 Duplex = Duplex || __webpack_require__(42770);
60207
60208 // Writable ctor is applied to Duplexes, too.
60209 // `realHasInstance` is necessary because using plain `instanceof`
60210 // would return false, as no `_writableState` property is attached.
60211
60212 // Trying to use the custom `instanceof` for Writable here will also break the
60213 // Node.js LazyTransform implementation, which has a non-trivial getter for
60214 // `_writableState` that would lead to infinite recursion.
60215 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
60216 return new Writable(options);
60217 }
60218
60219 this._writableState = new WritableState(options, this);
60220
60221 // legacy.
60222 this.writable = true;
60223
60224 if (options) {
60225 if (typeof options.write === 'function') this._write = options.write;
60226
60227 if (typeof options.writev === 'function') this._writev = options.writev;
60228
60229 if (typeof options.destroy === 'function') this._destroy = options.destroy;
60230
60231 if (typeof options.final === 'function') this._final = options.final;
60232 }
60233
60234 Stream.call(this);
60235}
60236
60237// Otherwise people can pipe Writable streams, which is just wrong.
60238Writable.prototype.pipe = function () {
60239 this.emit('error', new Error('Cannot pipe, not readable'));
60240};
60241
60242function writeAfterEnd(stream, cb) {
60243 var er = new Error('write after end');
60244 // TODO: defer error events consistently everywhere, not just the cb
60245 stream.emit('error', er);
60246 pna.nextTick(cb, er);
60247}
60248
60249// Checks that a user-supplied chunk is valid, especially for the particular
60250// mode the stream is in. Currently this means that `null` is never accepted
60251// and undefined/non-string values are only allowed in object mode.
60252function validChunk(stream, state, chunk, cb) {
60253 var valid = true;
60254 var er = false;
60255
60256 if (chunk === null) {
60257 er = new TypeError('May not write null values to stream');
60258 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
60259 er = new TypeError('Invalid non-string/buffer chunk');
60260 }
60261 if (er) {
60262 stream.emit('error', er);
60263 pna.nextTick(cb, er);
60264 valid = false;
60265 }
60266 return valid;
60267}
60268
60269Writable.prototype.write = function (chunk, encoding, cb) {
60270 var state = this._writableState;
60271 var ret = false;
60272 var isBuf = !state.objectMode && _isUint8Array(chunk);
60273
60274 if (isBuf && !Buffer.isBuffer(chunk)) {
60275 chunk = _uint8ArrayToBuffer(chunk);
60276 }
60277
60278 if (typeof encoding === 'function') {
60279 cb = encoding;
60280 encoding = null;
60281 }
60282
60283 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
60284
60285 if (typeof cb !== 'function') cb = nop;
60286
60287 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
60288 state.pendingcb++;
60289 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
60290 }
60291
60292 return ret;
60293};
60294
60295Writable.prototype.cork = function () {
60296 var state = this._writableState;
60297
60298 state.corked++;
60299};
60300
60301Writable.prototype.uncork = function () {
60302 var state = this._writableState;
60303
60304 if (state.corked) {
60305 state.corked--;
60306
60307 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
60308 }
60309};
60310
60311Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
60312 // node::ParseEncoding() requires lower case.
60313 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
60314 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
60315 this._writableState.defaultEncoding = encoding;
60316 return this;
60317};
60318
60319function decodeChunk(state, chunk, encoding) {
60320 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
60321 chunk = Buffer.from(chunk, encoding);
60322 }
60323 return chunk;
60324}
60325
60326Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
60327 // making it explicit this property is not enumerable
60328 // because otherwise some prototype manipulation in
60329 // userland will fail
60330 enumerable: false,
60331 get: function () {
60332 return this._writableState.highWaterMark;
60333 }
60334});
60335
60336// if we're already writing something, then just put this
60337// in the queue, and wait our turn. Otherwise, call _write
60338// If we return false, then we need a drain event, so set that flag.
60339function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
60340 if (!isBuf) {
60341 var newChunk = decodeChunk(state, chunk, encoding);
60342 if (chunk !== newChunk) {
60343 isBuf = true;
60344 encoding = 'buffer';
60345 chunk = newChunk;
60346 }
60347 }
60348 var len = state.objectMode ? 1 : chunk.length;
60349
60350 state.length += len;
60351
60352 var ret = state.length < state.highWaterMark;
60353 // we must ensure that previous needDrain will not be reset to false.
60354 if (!ret) state.needDrain = true;
60355
60356 if (state.writing || state.corked) {
60357 var last = state.lastBufferedRequest;
60358 state.lastBufferedRequest = {
60359 chunk: chunk,
60360 encoding: encoding,
60361 isBuf: isBuf,
60362 callback: cb,
60363 next: null
60364 };
60365 if (last) {
60366 last.next = state.lastBufferedRequest;
60367 } else {
60368 state.bufferedRequest = state.lastBufferedRequest;
60369 }
60370 state.bufferedRequestCount += 1;
60371 } else {
60372 doWrite(stream, state, false, len, chunk, encoding, cb);
60373 }
60374
60375 return ret;
60376}
60377
60378function doWrite(stream, state, writev, len, chunk, encoding, cb) {
60379 state.writelen = len;
60380 state.writecb = cb;
60381 state.writing = true;
60382 state.sync = true;
60383 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
60384 state.sync = false;
60385}
60386
60387function onwriteError(stream, state, sync, er, cb) {
60388 --state.pendingcb;
60389
60390 if (sync) {
60391 // defer the callback if we are being called synchronously
60392 // to avoid piling up things on the stack
60393 pna.nextTick(cb, er);
60394 // this can emit finish, and it will always happen
60395 // after error
60396 pna.nextTick(finishMaybe, stream, state);
60397 stream._writableState.errorEmitted = true;
60398 stream.emit('error', er);
60399 } else {
60400 // the caller expect this to happen before if
60401 // it is async
60402 cb(er);
60403 stream._writableState.errorEmitted = true;
60404 stream.emit('error', er);
60405 // this can emit finish, but finish must
60406 // always follow error
60407 finishMaybe(stream, state);
60408 }
60409}
60410
60411function onwriteStateUpdate(state) {
60412 state.writing = false;
60413 state.writecb = null;
60414 state.length -= state.writelen;
60415 state.writelen = 0;
60416}
60417
60418function onwrite(stream, er) {
60419 var state = stream._writableState;
60420 var sync = state.sync;
60421 var cb = state.writecb;
60422
60423 onwriteStateUpdate(state);
60424
60425 if (er) onwriteError(stream, state, sync, er, cb);else {
60426 // Check if we're actually ready to finish, but don't emit yet
60427 var finished = needFinish(state);
60428
60429 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
60430 clearBuffer(stream, state);
60431 }
60432
60433 if (sync) {
60434 /*<replacement>*/
60435 asyncWrite(afterWrite, stream, state, finished, cb);
60436 /*</replacement>*/
60437 } else {
60438 afterWrite(stream, state, finished, cb);
60439 }
60440 }
60441}
60442
60443function afterWrite(stream, state, finished, cb) {
60444 if (!finished) onwriteDrain(stream, state);
60445 state.pendingcb--;
60446 cb();
60447 finishMaybe(stream, state);
60448}
60449
60450// Must force callback to be called on nextTick, so that we don't
60451// emit 'drain' before the write() consumer gets the 'false' return
60452// value, and has a chance to attach a 'drain' listener.
60453function onwriteDrain(stream, state) {
60454 if (state.length === 0 && state.needDrain) {
60455 state.needDrain = false;
60456 stream.emit('drain');
60457 }
60458}
60459
60460// if there's something in the buffer waiting, then process it
60461function clearBuffer(stream, state) {
60462 state.bufferProcessing = true;
60463 var entry = state.bufferedRequest;
60464
60465 if (stream._writev && entry && entry.next) {
60466 // Fast case, write everything using _writev()
60467 var l = state.bufferedRequestCount;
60468 var buffer = new Array(l);
60469 var holder = state.corkedRequestsFree;
60470 holder.entry = entry;
60471
60472 var count = 0;
60473 var allBuffers = true;
60474 while (entry) {
60475 buffer[count] = entry;
60476 if (!entry.isBuf) allBuffers = false;
60477 entry = entry.next;
60478 count += 1;
60479 }
60480 buffer.allBuffers = allBuffers;
60481
60482 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
60483
60484 // doWrite is almost always async, defer these to save a bit of time
60485 // as the hot path ends with doWrite
60486 state.pendingcb++;
60487 state.lastBufferedRequest = null;
60488 if (holder.next) {
60489 state.corkedRequestsFree = holder.next;
60490 holder.next = null;
60491 } else {
60492 state.corkedRequestsFree = new CorkedRequest(state);
60493 }
60494 state.bufferedRequestCount = 0;
60495 } else {
60496 // Slow case, write chunks one-by-one
60497 while (entry) {
60498 var chunk = entry.chunk;
60499 var encoding = entry.encoding;
60500 var cb = entry.callback;
60501 var len = state.objectMode ? 1 : chunk.length;
60502
60503 doWrite(stream, state, false, len, chunk, encoding, cb);
60504 entry = entry.next;
60505 state.bufferedRequestCount--;
60506 // if we didn't call the onwrite immediately, then
60507 // it means that we need to wait until it does.
60508 // also, that means that the chunk and cb are currently
60509 // being processed, so move the buffer counter past them.
60510 if (state.writing) {
60511 break;
60512 }
60513 }
60514
60515 if (entry === null) state.lastBufferedRequest = null;
60516 }
60517
60518 state.bufferedRequest = entry;
60519 state.bufferProcessing = false;
60520}
60521
60522Writable.prototype._write = function (chunk, encoding, cb) {
60523 cb(new Error('_write() is not implemented'));
60524};
60525
60526Writable.prototype._writev = null;
60527
60528Writable.prototype.end = function (chunk, encoding, cb) {
60529 var state = this._writableState;
60530
60531 if (typeof chunk === 'function') {
60532 cb = chunk;
60533 chunk = null;
60534 encoding = null;
60535 } else if (typeof encoding === 'function') {
60536 cb = encoding;
60537 encoding = null;
60538 }
60539
60540 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
60541
60542 // .end() fully uncorks
60543 if (state.corked) {
60544 state.corked = 1;
60545 this.uncork();
60546 }
60547
60548 // ignore unnecessary end() calls.
60549 if (!state.ending && !state.finished) endWritable(this, state, cb);
60550};
60551
60552function needFinish(state) {
60553 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
60554}
60555function callFinal(stream, state) {
60556 stream._final(function (err) {
60557 state.pendingcb--;
60558 if (err) {
60559 stream.emit('error', err);
60560 }
60561 state.prefinished = true;
60562 stream.emit('prefinish');
60563 finishMaybe(stream, state);
60564 });
60565}
60566function prefinish(stream, state) {
60567 if (!state.prefinished && !state.finalCalled) {
60568 if (typeof stream._final === 'function') {
60569 state.pendingcb++;
60570 state.finalCalled = true;
60571 pna.nextTick(callFinal, stream, state);
60572 } else {
60573 state.prefinished = true;
60574 stream.emit('prefinish');
60575 }
60576 }
60577}
60578
60579function finishMaybe(stream, state) {
60580 var need = needFinish(state);
60581 if (need) {
60582 prefinish(stream, state);
60583 if (state.pendingcb === 0) {
60584 state.finished = true;
60585 stream.emit('finish');
60586 }
60587 }
60588 return need;
60589}
60590
60591function endWritable(stream, state, cb) {
60592 state.ending = true;
60593 finishMaybe(stream, state);
60594 if (cb) {
60595 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
60596 }
60597 state.ended = true;
60598 stream.writable = false;
60599}
60600
60601function onCorkedFinish(corkReq, state, err) {
60602 var entry = corkReq.entry;
60603 corkReq.entry = null;
60604 while (entry) {
60605 var cb = entry.callback;
60606 state.pendingcb--;
60607 cb(err);
60608 entry = entry.next;
60609 }
60610 if (state.corkedRequestsFree) {
60611 state.corkedRequestsFree.next = corkReq;
60612 } else {
60613 state.corkedRequestsFree = corkReq;
60614 }
60615}
60616
60617Object.defineProperty(Writable.prototype, 'destroyed', {
60618 get: function () {
60619 if (this._writableState === undefined) {
60620 return false;
60621 }
60622 return this._writableState.destroyed;
60623 },
60624 set: function (value) {
60625 // we ignore the value if the stream
60626 // has not been initialized yet
60627 if (!this._writableState) {
60628 return;
60629 }
60630
60631 // backward compatibility, the user is explicitly
60632 // managing destroyed
60633 this._writableState.destroyed = value;
60634 }
60635});
60636
60637Writable.prototype.destroy = destroyImpl.destroy;
60638Writable.prototype._undestroy = destroyImpl.undestroy;
60639Writable.prototype._destroy = function (err, cb) {
60640 this.end();
60641 cb(err);
60642};
60643
60644/***/ }),
60645
60646/***/ 28878:
60647/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
60648
60649"use strict";
60650
60651
60652function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
60653
60654var Buffer = __webpack_require__(96788).Buffer;
60655var util = __webpack_require__(31669);
60656
60657function copyBuffer(src, target, offset) {
60658 src.copy(target, offset);
60659}
60660
60661module.exports = function () {
60662 function BufferList() {
60663 _classCallCheck(this, BufferList);
60664
60665 this.head = null;
60666 this.tail = null;
60667 this.length = 0;
60668 }
60669
60670 BufferList.prototype.push = function push(v) {
60671 var entry = { data: v, next: null };
60672 if (this.length > 0) this.tail.next = entry;else this.head = entry;
60673 this.tail = entry;
60674 ++this.length;
60675 };
60676
60677 BufferList.prototype.unshift = function unshift(v) {
60678 var entry = { data: v, next: this.head };
60679 if (this.length === 0) this.tail = entry;
60680 this.head = entry;
60681 ++this.length;
60682 };
60683
60684 BufferList.prototype.shift = function shift() {
60685 if (this.length === 0) return;
60686 var ret = this.head.data;
60687 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
60688 --this.length;
60689 return ret;
60690 };
60691
60692 BufferList.prototype.clear = function clear() {
60693 this.head = this.tail = null;
60694 this.length = 0;
60695 };
60696
60697 BufferList.prototype.join = function join(s) {
60698 if (this.length === 0) return '';
60699 var p = this.head;
60700 var ret = '' + p.data;
60701 while (p = p.next) {
60702 ret += s + p.data;
60703 }return ret;
60704 };
60705
60706 BufferList.prototype.concat = function concat(n) {
60707 if (this.length === 0) return Buffer.alloc(0);
60708 if (this.length === 1) return this.head.data;
60709 var ret = Buffer.allocUnsafe(n >>> 0);
60710 var p = this.head;
60711 var i = 0;
60712 while (p) {
60713 copyBuffer(p.data, ret, i);
60714 i += p.data.length;
60715 p = p.next;
60716 }
60717 return ret;
60718 };
60719
60720 return BufferList;
60721}();
60722
60723if (util && util.inspect && util.inspect.custom) {
60724 module.exports.prototype[util.inspect.custom] = function () {
60725 var obj = util.inspect({ length: this.length });
60726 return this.constructor.name + ' ' + obj;
60727 };
60728}
60729
60730/***/ }),
60731
60732/***/ 87915:
60733/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
60734
60735"use strict";
60736
60737
60738/*<replacement>*/
60739
60740var pna = __webpack_require__(58404);
60741/*</replacement>*/
60742
60743// undocumented cb() API, needed for core, not for public API
60744function destroy(err, cb) {
60745 var _this = this;
60746
60747 var readableDestroyed = this._readableState && this._readableState.destroyed;
60748 var writableDestroyed = this._writableState && this._writableState.destroyed;
60749
60750 if (readableDestroyed || writableDestroyed) {
60751 if (cb) {
60752 cb(err);
60753 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
60754 pna.nextTick(emitErrorNT, this, err);
60755 }
60756 return this;
60757 }
60758
60759 // we set destroyed to true before firing error callbacks in order
60760 // to make it re-entrance safe in case destroy() is called within callbacks
60761
60762 if (this._readableState) {
60763 this._readableState.destroyed = true;
60764 }
60765
60766 // if this is a duplex stream mark the writable part as destroyed as well
60767 if (this._writableState) {
60768 this._writableState.destroyed = true;
60769 }
60770
60771 this._destroy(err || null, function (err) {
60772 if (!cb && err) {
60773 pna.nextTick(emitErrorNT, _this, err);
60774 if (_this._writableState) {
60775 _this._writableState.errorEmitted = true;
60776 }
60777 } else if (cb) {
60778 cb(err);
60779 }
60780 });
60781
60782 return this;
60783}
60784
60785function undestroy() {
60786 if (this._readableState) {
60787 this._readableState.destroyed = false;
60788 this._readableState.reading = false;
60789 this._readableState.ended = false;
60790 this._readableState.endEmitted = false;
60791 }
60792
60793 if (this._writableState) {
60794 this._writableState.destroyed = false;
60795 this._writableState.ended = false;
60796 this._writableState.ending = false;
60797 this._writableState.finished = false;
60798 this._writableState.errorEmitted = false;
60799 }
60800}
60801
60802function emitErrorNT(self, err) {
60803 self.emit('error', err);
60804}
60805
60806module.exports = {
60807 destroy: destroy,
60808 undestroy: undestroy
60809};
60810
60811/***/ }),
60812
60813/***/ 1065:
60814/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
60815
60816module.exports = __webpack_require__(92413);
60817
60818
60819/***/ }),
60820
60821/***/ 96788:
60822/***/ (function(module, exports, __webpack_require__) {
60823
60824/* eslint-disable node/no-deprecated-api */
60825var buffer = __webpack_require__(64293)
60826var Buffer = buffer.Buffer
60827
60828// alternative to using Object.keys for old browsers
60829function copyProps (src, dst) {
60830 for (var key in src) {
60831 dst[key] = src[key]
60832 }
60833}
60834if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
60835 module.exports = buffer
60836} else {
60837 // Copy properties from require('buffer')
60838 copyProps(buffer, exports)
60839 exports.Buffer = SafeBuffer
60840}
60841
60842function SafeBuffer (arg, encodingOrOffset, length) {
60843 return Buffer(arg, encodingOrOffset, length)
60844}
60845
60846// Copy static methods from Buffer
60847copyProps(Buffer, SafeBuffer)
60848
60849SafeBuffer.from = function (arg, encodingOrOffset, length) {
60850 if (typeof arg === 'number') {
60851 throw new TypeError('Argument must not be a number')
60852 }
60853 return Buffer(arg, encodingOrOffset, length)
60854}
60855
60856SafeBuffer.alloc = function (size, fill, encoding) {
60857 if (typeof size !== 'number') {
60858 throw new TypeError('Argument must be a number')
60859 }
60860 var buf = Buffer(size)
60861 if (fill !== undefined) {
60862 if (typeof encoding === 'string') {
60863 buf.fill(fill, encoding)
60864 } else {
60865 buf.fill(fill)
60866 }
60867 } else {
60868 buf.fill(0)
60869 }
60870 return buf
60871}
60872
60873SafeBuffer.allocUnsafe = function (size) {
60874 if (typeof size !== 'number') {
60875 throw new TypeError('Argument must be a number')
60876 }
60877 return Buffer(size)
60878}
60879
60880SafeBuffer.allocUnsafeSlow = function (size) {
60881 if (typeof size !== 'number') {
60882 throw new TypeError('Argument must be a number')
60883 }
60884 return buffer.SlowBuffer(size)
60885}
60886
60887
60888/***/ }),
60889
60890/***/ 7395:
60891/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
60892
60893"use strict";
60894// Copyright Joyent, Inc. and other Node contributors.
60895//
60896// Permission is hereby granted, free of charge, to any person obtaining a
60897// copy of this software and associated documentation files (the
60898// "Software"), to deal in the Software without restriction, including
60899// without limitation the rights to use, copy, modify, merge, publish,
60900// distribute, sublicense, and/or sell copies of the Software, and to permit
60901// persons to whom the Software is furnished to do so, subject to the
60902// following conditions:
60903//
60904// The above copyright notice and this permission notice shall be included
60905// in all copies or substantial portions of the Software.
60906//
60907// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
60908// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60909// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
60910// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
60911// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
60912// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
60913// USE OR OTHER DEALINGS IN THE SOFTWARE.
60914
60915
60916
60917/*<replacement>*/
60918
60919var Buffer = __webpack_require__(96788).Buffer;
60920/*</replacement>*/
60921
60922var isEncoding = Buffer.isEncoding || function (encoding) {
60923 encoding = '' + encoding;
60924 switch (encoding && encoding.toLowerCase()) {
60925 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
60926 return true;
60927 default:
60928 return false;
60929 }
60930};
60931
60932function _normalizeEncoding(enc) {
60933 if (!enc) return 'utf8';
60934 var retried;
60935 while (true) {
60936 switch (enc) {
60937 case 'utf8':
60938 case 'utf-8':
60939 return 'utf8';
60940 case 'ucs2':
60941 case 'ucs-2':
60942 case 'utf16le':
60943 case 'utf-16le':
60944 return 'utf16le';
60945 case 'latin1':
60946 case 'binary':
60947 return 'latin1';
60948 case 'base64':
60949 case 'ascii':
60950 case 'hex':
60951 return enc;
60952 default:
60953 if (retried) return; // undefined
60954 enc = ('' + enc).toLowerCase();
60955 retried = true;
60956 }
60957 }
60958};
60959
60960// Do not cache `Buffer.isEncoding` when checking encoding names as some
60961// modules monkey-patch it to support additional encodings
60962function normalizeEncoding(enc) {
60963 var nenc = _normalizeEncoding(enc);
60964 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
60965 return nenc || enc;
60966}
60967
60968// StringDecoder provides an interface for efficiently splitting a series of
60969// buffers into a series of JS strings without breaking apart multi-byte
60970// characters.
60971exports.s = StringDecoder;
60972function StringDecoder(encoding) {
60973 this.encoding = normalizeEncoding(encoding);
60974 var nb;
60975 switch (this.encoding) {
60976 case 'utf16le':
60977 this.text = utf16Text;
60978 this.end = utf16End;
60979 nb = 4;
60980 break;
60981 case 'utf8':
60982 this.fillLast = utf8FillLast;
60983 nb = 4;
60984 break;
60985 case 'base64':
60986 this.text = base64Text;
60987 this.end = base64End;
60988 nb = 3;
60989 break;
60990 default:
60991 this.write = simpleWrite;
60992 this.end = simpleEnd;
60993 return;
60994 }
60995 this.lastNeed = 0;
60996 this.lastTotal = 0;
60997 this.lastChar = Buffer.allocUnsafe(nb);
60998}
60999
61000StringDecoder.prototype.write = function (buf) {
61001 if (buf.length === 0) return '';
61002 var r;
61003 var i;
61004 if (this.lastNeed) {
61005 r = this.fillLast(buf);
61006 if (r === undefined) return '';
61007 i = this.lastNeed;
61008 this.lastNeed = 0;
61009 } else {
61010 i = 0;
61011 }
61012 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
61013 return r || '';
61014};
61015
61016StringDecoder.prototype.end = utf8End;
61017
61018// Returns only complete characters in a Buffer
61019StringDecoder.prototype.text = utf8Text;
61020
61021// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
61022StringDecoder.prototype.fillLast = function (buf) {
61023 if (this.lastNeed <= buf.length) {
61024 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
61025 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
61026 }
61027 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
61028 this.lastNeed -= buf.length;
61029};
61030
61031// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
61032// continuation byte. If an invalid byte is detected, -2 is returned.
61033function utf8CheckByte(byte) {
61034 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
61035 return byte >> 6 === 0x02 ? -1 : -2;
61036}
61037
61038// Checks at most 3 bytes at the end of a Buffer in order to detect an
61039// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
61040// needed to complete the UTF-8 character (if applicable) are returned.
61041function utf8CheckIncomplete(self, buf, i) {
61042 var j = buf.length - 1;
61043 if (j < i) return 0;
61044 var nb = utf8CheckByte(buf[j]);
61045 if (nb >= 0) {
61046 if (nb > 0) self.lastNeed = nb - 1;
61047 return nb;
61048 }
61049 if (--j < i || nb === -2) return 0;
61050 nb = utf8CheckByte(buf[j]);
61051 if (nb >= 0) {
61052 if (nb > 0) self.lastNeed = nb - 2;
61053 return nb;
61054 }
61055 if (--j < i || nb === -2) return 0;
61056 nb = utf8CheckByte(buf[j]);
61057 if (nb >= 0) {
61058 if (nb > 0) {
61059 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
61060 }
61061 return nb;
61062 }
61063 return 0;
61064}
61065
61066// Validates as many continuation bytes for a multi-byte UTF-8 character as
61067// needed or are available. If we see a non-continuation byte where we expect
61068// one, we "replace" the validated continuation bytes we've seen so far with
61069// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
61070// behavior. The continuation byte check is included three times in the case
61071// where all of the continuation bytes for a character exist in the same buffer.
61072// It is also done this way as a slight performance increase instead of using a
61073// loop.
61074function utf8CheckExtraBytes(self, buf, p) {
61075 if ((buf[0] & 0xC0) !== 0x80) {
61076 self.lastNeed = 0;
61077 return '\ufffd';
61078 }
61079 if (self.lastNeed > 1 && buf.length > 1) {
61080 if ((buf[1] & 0xC0) !== 0x80) {
61081 self.lastNeed = 1;
61082 return '\ufffd';
61083 }
61084 if (self.lastNeed > 2 && buf.length > 2) {
61085 if ((buf[2] & 0xC0) !== 0x80) {
61086 self.lastNeed = 2;
61087 return '\ufffd';
61088 }
61089 }
61090 }
61091}
61092
61093// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
61094function utf8FillLast(buf) {
61095 var p = this.lastTotal - this.lastNeed;
61096 var r = utf8CheckExtraBytes(this, buf, p);
61097 if (r !== undefined) return r;
61098 if (this.lastNeed <= buf.length) {
61099 buf.copy(this.lastChar, p, 0, this.lastNeed);
61100 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
61101 }
61102 buf.copy(this.lastChar, p, 0, buf.length);
61103 this.lastNeed -= buf.length;
61104}
61105
61106// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
61107// partial character, the character's bytes are buffered until the required
61108// number of bytes are available.
61109function utf8Text(buf, i) {
61110 var total = utf8CheckIncomplete(this, buf, i);
61111 if (!this.lastNeed) return buf.toString('utf8', i);
61112 this.lastTotal = total;
61113 var end = buf.length - (total - this.lastNeed);
61114 buf.copy(this.lastChar, 0, end);
61115 return buf.toString('utf8', i, end);
61116}
61117
61118// For UTF-8, a replacement character is added when ending on a partial
61119// character.
61120function utf8End(buf) {
61121 var r = buf && buf.length ? this.write(buf) : '';
61122 if (this.lastNeed) return r + '\ufffd';
61123 return r;
61124}
61125
61126// UTF-16LE typically needs two bytes per character, but even if we have an even
61127// number of bytes available, we need to check if we end on a leading/high
61128// surrogate. In that case, we need to wait for the next two bytes in order to
61129// decode the last character properly.
61130function utf16Text(buf, i) {
61131 if ((buf.length - i) % 2 === 0) {
61132 var r = buf.toString('utf16le', i);
61133 if (r) {
61134 var c = r.charCodeAt(r.length - 1);
61135 if (c >= 0xD800 && c <= 0xDBFF) {
61136 this.lastNeed = 2;
61137 this.lastTotal = 4;
61138 this.lastChar[0] = buf[buf.length - 2];
61139 this.lastChar[1] = buf[buf.length - 1];
61140 return r.slice(0, -1);
61141 }
61142 }
61143 return r;
61144 }
61145 this.lastNeed = 1;
61146 this.lastTotal = 2;
61147 this.lastChar[0] = buf[buf.length - 1];
61148 return buf.toString('utf16le', i, buf.length - 1);
61149}
61150
61151// For UTF-16LE we do not explicitly append special replacement characters if we
61152// end on a partial character, we simply let v8 handle that.
61153function utf16End(buf) {
61154 var r = buf && buf.length ? this.write(buf) : '';
61155 if (this.lastNeed) {
61156 var end = this.lastTotal - this.lastNeed;
61157 return r + this.lastChar.toString('utf16le', 0, end);
61158 }
61159 return r;
61160}
61161
61162function base64Text(buf, i) {
61163 var n = (buf.length - i) % 3;
61164 if (n === 0) return buf.toString('base64', i);
61165 this.lastNeed = 3 - n;
61166 this.lastTotal = 3;
61167 if (n === 1) {
61168 this.lastChar[0] = buf[buf.length - 1];
61169 } else {
61170 this.lastChar[0] = buf[buf.length - 2];
61171 this.lastChar[1] = buf[buf.length - 1];
61172 }
61173 return buf.toString('base64', i, buf.length - n);
61174}
61175
61176function base64End(buf) {
61177 var r = buf && buf.length ? this.write(buf) : '';
61178 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
61179 return r;
61180}
61181
61182// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
61183function simpleWrite(buf) {
61184 return buf.toString(this.encoding);
61185}
61186
61187function simpleEnd(buf) {
61188 return buf && buf.length ? this.write(buf) : '';
61189}
61190
61191/***/ }),
61192
61193/***/ 68193:
61194/***/ (function(module, exports, __webpack_require__) {
61195
61196var Stream = __webpack_require__(92413);
61197if (process.env.READABLE_STREAM === 'disable' && Stream) {
61198 module.exports = Stream;
61199 exports = module.exports = Stream.Readable;
61200 exports.Readable = Stream.Readable;
61201 exports.Writable = Stream.Writable;
61202 exports.Duplex = Stream.Duplex;
61203 exports.Transform = Stream.Transform;
61204 exports.PassThrough = Stream.PassThrough;
61205 exports.Stream = Stream;
61206} else {
61207 exports = module.exports = __webpack_require__(79341);
61208 exports.Stream = Stream || exports;
61209 exports.Readable = exports;
61210 exports.Writable = __webpack_require__(78063);
61211 exports.Duplex = __webpack_require__(42770);
61212 exports.Transform = __webpack_require__(62826);
61213 exports.PassThrough = __webpack_require__(60143);
61214}
61215
61216
61217/***/ }),
61218
61219/***/ 30931:
61220/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
61221
61222"use strict";
61223
61224
61225var extend = __webpack_require__(39700);
61226var safe = __webpack_require__(71217);
61227
61228/**
61229 * The main export is a function that takes a `pattern` string and an `options` object.
61230 *
61231 * ```js
61232 & var not = require('regex-not');
61233 & console.log(not('foo'));
61234 & //=> /^(?:(?!^(?:foo)$).)*$/
61235 * ```
61236 *
61237 * @param {String} `pattern`
61238 * @param {Object} `options`
61239 * @return {RegExp} Converts the given `pattern` to a regex using the specified `options`.
61240 * @api public
61241 */
61242
61243function toRegex(pattern, options) {
61244 return new RegExp(toRegex.create(pattern, options));
61245}
61246
61247/**
61248 * Create a regex-compatible string from the given `pattern` and `options`.
61249 *
61250 * ```js
61251 & var not = require('regex-not');
61252 & console.log(not.create('foo'));
61253 & //=> '^(?:(?!^(?:foo)$).)*$'
61254 * ```
61255 * @param {String} `pattern`
61256 * @param {Object} `options`
61257 * @return {String}
61258 * @api public
61259 */
61260
61261toRegex.create = function(pattern, options) {
61262 if (typeof pattern !== 'string') {
61263 throw new TypeError('expected a string');
61264 }
61265
61266 var opts = extend({}, options);
61267 if (opts.contains === true) {
61268 opts.strictNegate = false;
61269 }
61270
61271 var open = opts.strictOpen !== false ? '^' : '';
61272 var close = opts.strictClose !== false ? '$' : '';
61273 var endChar = opts.endChar ? opts.endChar : '+';
61274 var str = pattern;
61275
61276 if (opts.strictNegate === false) {
61277 str = '(?:(?!(?:' + pattern + ')).)' + endChar;
61278 } else {
61279 str = '(?:(?!^(?:' + pattern + ')$).)' + endChar;
61280 }
61281
61282 var res = open + str + close;
61283 if (opts.safe === true && safe(res) === false) {
61284 throw new Error('potentially unsafe regular expression: ' + res);
61285 }
61286
61287 return res;
61288};
61289
61290/**
61291 * Expose `toRegex`
61292 */
61293
61294module.exports = toRegex;
61295
61296
61297/***/ }),
61298
61299/***/ 39700:
61300/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
61301
61302"use strict";
61303
61304
61305var isExtendable = __webpack_require__(93295);
61306var assignSymbols = __webpack_require__(64353);
61307
61308module.exports = Object.assign || function(obj/*, objects*/) {
61309 if (obj === null || typeof obj === 'undefined') {
61310 throw new TypeError('Cannot convert undefined or null to object');
61311 }
61312 if (!isObject(obj)) {
61313 obj = {};
61314 }
61315 for (var i = 1; i < arguments.length; i++) {
61316 var val = arguments[i];
61317 if (isString(val)) {
61318 val = toObject(val);
61319 }
61320 if (isObject(val)) {
61321 assign(obj, val);
61322 assignSymbols(obj, val);
61323 }
61324 }
61325 return obj;
61326};
61327
61328function assign(a, b) {
61329 for (var key in b) {
61330 if (hasOwn(b, key)) {
61331 a[key] = b[key];
61332 }
61333 }
61334}
61335
61336function isString(val) {
61337 return (val && typeof val === 'string');
61338}
61339
61340function toObject(str) {
61341 var obj = {};
61342 for (var i in str) {
61343 obj[i] = str[i];
61344 }
61345 return obj;
61346}
61347
61348function isObject(val) {
61349 return (val && typeof val === 'object') || isExtendable(val);
61350}
61351
61352/**
61353 * Returns true if the given `key` is an own property of `obj`.
61354 */
61355
61356function hasOwn(obj, key) {
61357 return Object.prototype.hasOwnProperty.call(obj, key);
61358}
61359
61360function isEnum(obj, key) {
61361 return Object.prototype.propertyIsEnumerable.call(obj, key);
61362}
61363
61364
61365/***/ }),
61366
61367/***/ 93295:
61368/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
61369
61370"use strict";
61371/*!
61372 * is-extendable <https://github.com/jonschlinkert/is-extendable>
61373 *
61374 * Copyright (c) 2015-2017, Jon Schlinkert.
61375 * Released under the MIT License.
61376 */
61377
61378
61379
61380var isPlainObject = __webpack_require__(81064);
61381
61382module.exports = function isExtendable(val) {
61383 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
61384};
61385
61386
61387/***/ }),
61388
61389/***/ 69523:
61390/***/ (function(module) {
61391
61392"use strict";
61393/*!
61394 * repeat-element <https://github.com/jonschlinkert/repeat-element>
61395 *
61396 * Copyright (c) 2015-present, Jon Schlinkert.
61397 * Licensed under the MIT license.
61398 */
61399
61400
61401
61402module.exports = function repeat(ele, num) {
61403 var arr = new Array(num);
61404
61405 for (var i = 0; i < num; i++) {
61406 arr[i] = ele;
61407 }
61408
61409 return arr;
61410};
61411
61412
61413/***/ }),
61414
61415/***/ 6332:
61416/***/ (function(module) {
61417
61418"use strict";
61419/*!
61420 * repeat-string <https://github.com/jonschlinkert/repeat-string>
61421 *
61422 * Copyright (c) 2014-2015, Jon Schlinkert.
61423 * Licensed under the MIT License.
61424 */
61425
61426
61427
61428/**
61429 * Results cache
61430 */
61431
61432var res = '';
61433var cache;
61434
61435/**
61436 * Expose `repeat`
61437 */
61438
61439module.exports = repeat;
61440
61441/**
61442 * Repeat the given `string` the specified `number`
61443 * of times.
61444 *
61445 * **Example:**
61446 *
61447 * ```js
61448 * var repeat = require('repeat-string');
61449 * repeat('A', 5);
61450 * //=> AAAAA
61451 * ```
61452 *
61453 * @param {String} `string` The string to repeat
61454 * @param {Number} `number` The number of times to repeat the string
61455 * @return {String} Repeated string
61456 * @api public
61457 */
61458
61459function repeat(str, num) {
61460 if (typeof str !== 'string') {
61461 throw new TypeError('expected a string');
61462 }
61463
61464 // cover common, quick use cases
61465 if (num === 1) return str;
61466 if (num === 2) return str + str;
61467
61468 var max = str.length * num;
61469 if (cache !== str || typeof cache === 'undefined') {
61470 cache = str;
61471 res = '';
61472 } else if (res.length >= max) {
61473 return res.substr(0, max);
61474 }
61475
61476 while (max > res.length && num > 1) {
61477 if (num & 1) {
61478 res += str;
61479 }
61480
61481 num >>= 1;
61482 str += str;
61483 }
61484
61485 res += str;
61486 res = res.substr(0, max);
61487 return res;
61488}
61489
61490
61491/***/ }),
61492
61493/***/ 25622:
61494/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
61495
61496var util = __webpack_require__(10265);
61497var types = __webpack_require__(40432);
61498var sets = __webpack_require__(28135);
61499var positions = __webpack_require__(54771);
61500
61501
61502module.exports = function(regexpStr) {
61503 var i = 0, l, c,
61504 start = { type: types.ROOT, stack: []},
61505
61506 // Keep track of last clause/group and stack.
61507 lastGroup = start,
61508 last = start.stack,
61509 groupStack = [];
61510
61511
61512 var repeatErr = function(i) {
61513 util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1));
61514 };
61515
61516 // Decode a few escaped characters.
61517 var str = util.strToChars(regexpStr);
61518 l = str.length;
61519
61520 // Iterate through each character in string.
61521 while (i < l) {
61522 c = str[i++];
61523
61524 switch (c) {
61525 // Handle escaped characters, inclues a few sets.
61526 case '\\':
61527 c = str[i++];
61528
61529 switch (c) {
61530 case 'b':
61531 last.push(positions.wordBoundary());
61532 break;
61533
61534 case 'B':
61535 last.push(positions.nonWordBoundary());
61536 break;
61537
61538 case 'w':
61539 last.push(sets.words());
61540 break;
61541
61542 case 'W':
61543 last.push(sets.notWords());
61544 break;
61545
61546 case 'd':
61547 last.push(sets.ints());
61548 break;
61549
61550 case 'D':
61551 last.push(sets.notInts());
61552 break;
61553
61554 case 's':
61555 last.push(sets.whitespace());
61556 break;
61557
61558 case 'S':
61559 last.push(sets.notWhitespace());
61560 break;
61561
61562 default:
61563 // Check if c is integer.
61564 // In which case it's a reference.
61565 if (/\d/.test(c)) {
61566 last.push({ type: types.REFERENCE, value: parseInt(c, 10) });
61567
61568 // Escaped character.
61569 } else {
61570 last.push({ type: types.CHAR, value: c.charCodeAt(0) });
61571 }
61572 }
61573
61574 break;
61575
61576
61577 // Positionals.
61578 case '^':
61579 last.push(positions.begin());
61580 break;
61581
61582 case '$':
61583 last.push(positions.end());
61584 break;
61585
61586
61587 // Handle custom sets.
61588 case '[':
61589 // Check if this class is 'anti' i.e. [^abc].
61590 var not;
61591 if (str[i] === '^') {
61592 not = true;
61593 i++;
61594 } else {
61595 not = false;
61596 }
61597
61598 // Get all the characters in class.
61599 var classTokens = util.tokenizeClass(str.slice(i), regexpStr);
61600
61601 // Increase index by length of class.
61602 i += classTokens[1];
61603 last.push({
61604 type: types.SET,
61605 set: classTokens[0],
61606 not: not,
61607 });
61608
61609 break;
61610
61611
61612 // Class of any character except \n.
61613 case '.':
61614 last.push(sets.anyChar());
61615 break;
61616
61617
61618 // Push group onto stack.
61619 case '(':
61620 // Create group.
61621 var group = {
61622 type: types.GROUP,
61623 stack: [],
61624 remember: true,
61625 };
61626
61627 c = str[i];
61628
61629 // If if this is a special kind of group.
61630 if (c === '?') {
61631 c = str[i + 1];
61632 i += 2;
61633
61634 // Match if followed by.
61635 if (c === '=') {
61636 group.followedBy = true;
61637
61638 // Match if not followed by.
61639 } else if (c === '!') {
61640 group.notFollowedBy = true;
61641
61642 } else if (c !== ':') {
61643 util.error(regexpStr,
61644 'Invalid group, character \'' + c +
61645 '\' after \'?\' at column ' + (i - 1));
61646 }
61647
61648 group.remember = false;
61649 }
61650
61651 // Insert subgroup into current group stack.
61652 last.push(group);
61653
61654 // Remember the current group for when the group closes.
61655 groupStack.push(lastGroup);
61656
61657 // Make this new group the current group.
61658 lastGroup = group;
61659 last = group.stack;
61660 break;
61661
61662
61663 // Pop group out of stack.
61664 case ')':
61665 if (groupStack.length === 0) {
61666 util.error(regexpStr, 'Unmatched ) at column ' + (i - 1));
61667 }
61668 lastGroup = groupStack.pop();
61669
61670 // Check if this group has a PIPE.
61671 // To get back the correct last stack.
61672 last = lastGroup.options ?
61673 lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;
61674 break;
61675
61676
61677 // Use pipe character to give more choices.
61678 case '|':
61679 // Create array where options are if this is the first PIPE
61680 // in this clause.
61681 if (!lastGroup.options) {
61682 lastGroup.options = [lastGroup.stack];
61683 delete lastGroup.stack;
61684 }
61685
61686 // Create a new stack and add to options for rest of clause.
61687 var stack = [];
61688 lastGroup.options.push(stack);
61689 last = stack;
61690 break;
61691
61692
61693 // Repetition.
61694 // For every repetition, remove last element from last stack
61695 // then insert back a RANGE object.
61696 // This design is chosen because there could be more than
61697 // one repetition symbols in a regex i.e. `a?+{2,3}`.
61698 case '{':
61699 var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)), min, max;
61700 if (rs !== null) {
61701 if (last.length === 0) {
61702 repeatErr(i);
61703 }
61704 min = parseInt(rs[1], 10);
61705 max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;
61706 i += rs[0].length;
61707
61708 last.push({
61709 type: types.REPETITION,
61710 min: min,
61711 max: max,
61712 value: last.pop(),
61713 });
61714 } else {
61715 last.push({
61716 type: types.CHAR,
61717 value: 123,
61718 });
61719 }
61720 break;
61721
61722 case '?':
61723 if (last.length === 0) {
61724 repeatErr(i);
61725 }
61726 last.push({
61727 type: types.REPETITION,
61728 min: 0,
61729 max: 1,
61730 value: last.pop(),
61731 });
61732 break;
61733
61734 case '+':
61735 if (last.length === 0) {
61736 repeatErr(i);
61737 }
61738 last.push({
61739 type: types.REPETITION,
61740 min: 1,
61741 max: Infinity,
61742 value: last.pop(),
61743 });
61744 break;
61745
61746 case '*':
61747 if (last.length === 0) {
61748 repeatErr(i);
61749 }
61750 last.push({
61751 type: types.REPETITION,
61752 min: 0,
61753 max: Infinity,
61754 value: last.pop(),
61755 });
61756 break;
61757
61758
61759 // Default is a character that is not `\[](){}?+*^$`.
61760 default:
61761 last.push({
61762 type: types.CHAR,
61763 value: c.charCodeAt(0),
61764 });
61765 }
61766
61767 }
61768
61769 // Check if any groups have not been closed.
61770 if (groupStack.length !== 0) {
61771 util.error(regexpStr, 'Unterminated group');
61772 }
61773
61774 return start;
61775};
61776
61777module.exports.types = types;
61778
61779
61780/***/ }),
61781
61782/***/ 54771:
61783/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
61784
61785var types = __webpack_require__(40432);
61786
61787exports.wordBoundary = function() {
61788 return { type: types.POSITION, value: 'b' };
61789};
61790
61791exports.nonWordBoundary = function() {
61792 return { type: types.POSITION, value: 'B' };
61793};
61794
61795exports.begin = function() {
61796 return { type: types.POSITION, value: '^' };
61797};
61798
61799exports.end = function() {
61800 return { type: types.POSITION, value: '$' };
61801};
61802
61803
61804/***/ }),
61805
61806/***/ 28135:
61807/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
61808
61809var types = __webpack_require__(40432);
61810
61811var INTS = function() {
61812 return [{ type: types.RANGE , from: 48, to: 57 }];
61813};
61814
61815var WORDS = function() {
61816 return [
61817 { type: types.CHAR, value: 95 },
61818 { type: types.RANGE, from: 97, to: 122 },
61819 { type: types.RANGE, from: 65, to: 90 }
61820 ].concat(INTS());
61821};
61822
61823var WHITESPACE = function() {
61824 return [
61825 { type: types.CHAR, value: 9 },
61826 { type: types.CHAR, value: 10 },
61827 { type: types.CHAR, value: 11 },
61828 { type: types.CHAR, value: 12 },
61829 { type: types.CHAR, value: 13 },
61830 { type: types.CHAR, value: 32 },
61831 { type: types.CHAR, value: 160 },
61832 { type: types.CHAR, value: 5760 },
61833 { type: types.CHAR, value: 6158 },
61834 { type: types.CHAR, value: 8192 },
61835 { type: types.CHAR, value: 8193 },
61836 { type: types.CHAR, value: 8194 },
61837 { type: types.CHAR, value: 8195 },
61838 { type: types.CHAR, value: 8196 },
61839 { type: types.CHAR, value: 8197 },
61840 { type: types.CHAR, value: 8198 },
61841 { type: types.CHAR, value: 8199 },
61842 { type: types.CHAR, value: 8200 },
61843 { type: types.CHAR, value: 8201 },
61844 { type: types.CHAR, value: 8202 },
61845 { type: types.CHAR, value: 8232 },
61846 { type: types.CHAR, value: 8233 },
61847 { type: types.CHAR, value: 8239 },
61848 { type: types.CHAR, value: 8287 },
61849 { type: types.CHAR, value: 12288 },
61850 { type: types.CHAR, value: 65279 }
61851 ];
61852};
61853
61854var NOTANYCHAR = function() {
61855 return [
61856 { type: types.CHAR, value: 10 },
61857 { type: types.CHAR, value: 13 },
61858 { type: types.CHAR, value: 8232 },
61859 { type: types.CHAR, value: 8233 },
61860 ];
61861};
61862
61863// Predefined class objects.
61864exports.words = function() {
61865 return { type: types.SET, set: WORDS(), not: false };
61866};
61867
61868exports.notWords = function() {
61869 return { type: types.SET, set: WORDS(), not: true };
61870};
61871
61872exports.ints = function() {
61873 return { type: types.SET, set: INTS(), not: false };
61874};
61875
61876exports.notInts = function() {
61877 return { type: types.SET, set: INTS(), not: true };
61878};
61879
61880exports.whitespace = function() {
61881 return { type: types.SET, set: WHITESPACE(), not: false };
61882};
61883
61884exports.notWhitespace = function() {
61885 return { type: types.SET, set: WHITESPACE(), not: true };
61886};
61887
61888exports.anyChar = function() {
61889 return { type: types.SET, set: NOTANYCHAR(), not: true };
61890};
61891
61892
61893/***/ }),
61894
61895/***/ 40432:
61896/***/ (function(module) {
61897
61898module.exports = {
61899 ROOT : 0,
61900 GROUP : 1,
61901 POSITION : 2,
61902 SET : 3,
61903 RANGE : 4,
61904 REPETITION : 5,
61905 REFERENCE : 6,
61906 CHAR : 7,
61907};
61908
61909
61910/***/ }),
61911
61912/***/ 10265:
61913/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
61914
61915var types = __webpack_require__(40432);
61916var sets = __webpack_require__(28135);
61917
61918
61919// All of these are private and only used by randexp.
61920// It's assumed that they will always be called with the correct input.
61921
61922var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
61923var SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 };
61924
61925/**
61926 * Finds character representations in str and convert all to
61927 * their respective characters
61928 *
61929 * @param {String} str
61930 * @return {String}
61931 */
61932exports.strToChars = function(str) {
61933 /* jshint maxlen: false */
61934 var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g;
61935 str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) {
61936 if (lbs) {
61937 return s;
61938 }
61939
61940 var code = b ? 8 :
61941 a16 ? parseInt(a16, 16) :
61942 b16 ? parseInt(b16, 16) :
61943 c8 ? parseInt(c8, 8) :
61944 dctrl ? CTRL.indexOf(dctrl) :
61945 SLSH[eslsh];
61946
61947 var c = String.fromCharCode(code);
61948
61949 // Escape special regex characters.
61950 if (/[\[\]{}\^$.|?*+()]/.test(c)) {
61951 c = '\\' + c;
61952 }
61953
61954 return c;
61955 });
61956
61957 return str;
61958};
61959
61960
61961/**
61962 * turns class into tokens
61963 * reads str until it encounters a ] not preceeded by a \
61964 *
61965 * @param {String} str
61966 * @param {String} regexpStr
61967 * @return {Array.<Array.<Object>, Number>}
61968 */
61969exports.tokenizeClass = function(str, regexpStr) {
61970 /* jshint maxlen: false */
61971 var tokens = [];
61972 var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g;
61973 var rs, c;
61974
61975
61976 while ((rs = regexp.exec(str)) != null) {
61977 if (rs[1]) {
61978 tokens.push(sets.words());
61979
61980 } else if (rs[2]) {
61981 tokens.push(sets.ints());
61982
61983 } else if (rs[3]) {
61984 tokens.push(sets.whitespace());
61985
61986 } else if (rs[4]) {
61987 tokens.push(sets.notWords());
61988
61989 } else if (rs[5]) {
61990 tokens.push(sets.notInts());
61991
61992 } else if (rs[6]) {
61993 tokens.push(sets.notWhitespace());
61994
61995 } else if (rs[7]) {
61996 tokens.push({
61997 type: types.RANGE,
61998 from: (rs[8] || rs[9]).charCodeAt(0),
61999 to: rs[10].charCodeAt(0),
62000 });
62001
62002 } else if (c = rs[12]) {
62003 tokens.push({
62004 type: types.CHAR,
62005 value: c.charCodeAt(0),
62006 });
62007
62008 } else {
62009 return [tokens, regexp.lastIndex];
62010 }
62011 }
62012
62013 exports.error(regexpStr, 'Unterminated character class');
62014};
62015
62016
62017/**
62018 * Shortcut to throw errors.
62019 *
62020 * @param {String} regexp
62021 * @param {String} msg
62022 */
62023exports.error = function(regexp, msg) {
62024 throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
62025};
62026
62027
62028/***/ }),
62029
62030/***/ 71217:
62031/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
62032
62033var parse = __webpack_require__(25622);
62034var types = parse.types;
62035
62036module.exports = function (re, opts) {
62037 if (!opts) opts = {};
62038 var replimit = opts.limit === undefined ? 25 : opts.limit;
62039
62040 if (isRegExp(re)) re = re.source;
62041 else if (typeof re !== 'string') re = String(re);
62042
62043 try { re = parse(re) }
62044 catch (err) { return false }
62045
62046 var reps = 0;
62047 return (function walk (node, starHeight) {
62048 if (node.type === types.REPETITION) {
62049 starHeight ++;
62050 reps ++;
62051 if (starHeight > 1) return false;
62052 if (reps > replimit) return false;
62053 }
62054
62055 if (node.options) {
62056 for (var i = 0, len = node.options.length; i < len; i++) {
62057 var ok = walk({ stack: node.options[i] }, starHeight);
62058 if (!ok) return false;
62059 }
62060 }
62061 var stack = node.stack || (node.value && node.value.stack);
62062 if (!stack) return true;
62063
62064 for (var i = 0; i < stack.length; i++) {
62065 var ok = walk(stack[i], starHeight);
62066 if (!ok) return false;
62067 }
62068
62069 return true;
62070 })(re, 0);
62071};
62072
62073function isRegExp (x) {
62074 return {}.toString.call(x) === '[object RegExp]';
62075}
62076
62077
62078/***/ }),
62079
62080/***/ 85841:
62081/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
62082
62083"use strict";
62084/*
62085Copyright (c) 2014, Yahoo! Inc. All rights reserved.
62086Copyrights licensed under the New BSD License.
62087See the accompanying LICENSE file for terms.
62088*/
62089
62090
62091
62092var randomBytes = __webpack_require__(79822);
62093
62094// Generate an internal UID to make the regexp pattern harder to guess.
62095var UID_LENGTH = 16;
62096var UID = generateUID();
62097var PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|U|I)-' + UID + '-(\\d+)__@"', 'g');
62098
62099var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g;
62100var IS_PURE_FUNCTION = /function.*?\(/;
62101var IS_ARROW_FUNCTION = /.*?=>.*?/;
62102var UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
62103
62104var RESERVED_SYMBOLS = ['*', 'async'];
62105
62106// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their
62107// Unicode char counterparts which are safe to use in JavaScript strings.
62108var ESCAPED_CHARS = {
62109 '<' : '\\u003C',
62110 '>' : '\\u003E',
62111 '/' : '\\u002F',
62112 '\u2028': '\\u2028',
62113 '\u2029': '\\u2029'
62114};
62115
62116function escapeUnsafeChars(unsafeChar) {
62117 return ESCAPED_CHARS[unsafeChar];
62118}
62119
62120function generateUID() {
62121 var bytes = randomBytes(UID_LENGTH);
62122 var result = '';
62123 for(var i=0; i<UID_LENGTH; ++i) {
62124 result += bytes[i].toString(16);
62125 }
62126 return result;
62127}
62128
62129function deleteFunctions(obj){
62130 var functionKeys = [];
62131 for (var key in obj) {
62132 if (typeof obj[key] === "function") {
62133 functionKeys.push(key);
62134 }
62135 }
62136 for (var i = 0; i < functionKeys.length; i++) {
62137 delete obj[functionKeys[i]];
62138 }
62139}
62140
62141module.exports = function serialize(obj, options) {
62142 options || (options = {});
62143
62144 // Backwards-compatibility for `space` as the second argument.
62145 if (typeof options === 'number' || typeof options === 'string') {
62146 options = {space: options};
62147 }
62148
62149 var functions = [];
62150 var regexps = [];
62151 var dates = [];
62152 var maps = [];
62153 var sets = [];
62154 var undefs = [];
62155 var infinities= [];
62156
62157 // Returns placeholders for functions and regexps (identified by index)
62158 // which are later replaced by their string representation.
62159 function replacer(key, value) {
62160
62161 // For nested function
62162 if(options.ignoreFunction){
62163 deleteFunctions(value);
62164 }
62165
62166 if (!value && value !== undefined) {
62167 return value;
62168 }
62169
62170 // If the value is an object w/ a toJSON method, toJSON is called before
62171 // the replacer runs, so we use this[key] to get the non-toJSONed value.
62172 var origValue = this[key];
62173 var type = typeof origValue;
62174
62175 if (type === 'object') {
62176 if(origValue instanceof RegExp) {
62177 return '@__R-' + UID + '-' + (regexps.push(origValue) - 1) + '__@';
62178 }
62179
62180 if(origValue instanceof Date) {
62181 return '@__D-' + UID + '-' + (dates.push(origValue) - 1) + '__@';
62182 }
62183
62184 if(origValue instanceof Map) {
62185 return '@__M-' + UID + '-' + (maps.push(origValue) - 1) + '__@';
62186 }
62187
62188 if(origValue instanceof Set) {
62189 return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@';
62190 }
62191 }
62192
62193 if (type === 'function') {
62194 return '@__F-' + UID + '-' + (functions.push(origValue) - 1) + '__@';
62195 }
62196
62197 if (type === 'undefined') {
62198 return '@__U-' + UID + '-' + (undefs.push(origValue) - 1) + '__@';
62199 }
62200
62201 if (type === 'number' && !isNaN(origValue) && !isFinite(origValue)) {
62202 return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@';
62203 }
62204
62205 return value;
62206 }
62207
62208 function serializeFunc(fn) {
62209 var serializedFn = fn.toString();
62210 if (IS_NATIVE_CODE_REGEXP.test(serializedFn)) {
62211 throw new TypeError('Serializing native function: ' + fn.name);
62212 }
62213
62214 // pure functions, example: {key: function() {}}
62215 if(IS_PURE_FUNCTION.test(serializedFn)) {
62216 return serializedFn;
62217 }
62218
62219 // arrow functions, example: arg1 => arg1+5
62220 if(IS_ARROW_FUNCTION.test(serializedFn)) {
62221 return serializedFn;
62222 }
62223
62224 var argsStartsAt = serializedFn.indexOf('(');
62225 var def = serializedFn.substr(0, argsStartsAt)
62226 .trim()
62227 .split(' ')
62228 .filter(function(val) { return val.length > 0 });
62229
62230 var nonReservedSymbols = def.filter(function(val) {
62231 return RESERVED_SYMBOLS.indexOf(val) === -1
62232 });
62233
62234 // enhanced literal objects, example: {key() {}}
62235 if(nonReservedSymbols.length > 0) {
62236 return (def.indexOf('async') > -1 ? 'async ' : '') + 'function'
62237 + (def.join('').indexOf('*') > -1 ? '*' : '')
62238 + serializedFn.substr(argsStartsAt);
62239 }
62240
62241 // arrow functions
62242 return serializedFn;
62243 }
62244
62245 // Check if the parameter is function
62246 if (options.ignoreFunction && typeof obj === "function") {
62247 obj = undefined;
62248 }
62249 // Protects against `JSON.stringify()` returning `undefined`, by serializing
62250 // to the literal string: "undefined".
62251 if (obj === undefined) {
62252 return String(obj);
62253 }
62254
62255 var str;
62256
62257 // Creates a JSON string representation of the value.
62258 // NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args.
62259 if (options.isJSON && !options.space) {
62260 str = JSON.stringify(obj);
62261 } else {
62262 str = JSON.stringify(obj, options.isJSON ? null : replacer, options.space);
62263 }
62264
62265 // Protects against `JSON.stringify()` returning `undefined`, by serializing
62266 // to the literal string: "undefined".
62267 if (typeof str !== 'string') {
62268 return String(str);
62269 }
62270
62271 // Replace unsafe HTML and invalid JavaScript line terminator chars with
62272 // their safe Unicode char counterpart. This _must_ happen before the
62273 // regexps and functions are serialized and added back to the string.
62274 if (options.unsafe !== true) {
62275 str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars);
62276 }
62277
62278 if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && undefs.length === 0 && infinities.length === 0) {
62279 return str;
62280 }
62281
62282 // Replaces all occurrences of function, regexp, date, map and set placeholders in the
62283 // JSON string with their string representations. If the original value can
62284 // not be found, then `undefined` is used.
62285 return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) {
62286 // The placeholder may not be preceded by a backslash. This is to prevent
62287 // replacing things like `"a\"@__R-<UID>-0__@"` and thus outputting
62288 // invalid JS.
62289 if (backSlash) {
62290 return match;
62291 }
62292
62293 if (type === 'D') {
62294 return "new Date(\"" + dates[valueIndex].toISOString() + "\")";
62295 }
62296
62297 if (type === 'R') {
62298 return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")";
62299 }
62300
62301 if (type === 'M') {
62302 return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")";
62303 }
62304
62305 if (type === 'S') {
62306 return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")";
62307 }
62308
62309 if (type === 'U') {
62310 return 'undefined'
62311 }
62312
62313 if (type === 'I') {
62314 return infinities[valueIndex];
62315 }
62316
62317 var fn = functions[valueIndex];
62318
62319 return serializeFunc(fn);
62320 });
62321}
62322
62323
62324/***/ }),
62325
62326/***/ 34857:
62327/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
62328
62329"use strict";
62330/*!
62331 * set-value <https://github.com/jonschlinkert/set-value>
62332 *
62333 * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
62334 * Released under the MIT License.
62335 */
62336
62337
62338
62339var split = __webpack_require__(33218);
62340var extend = __webpack_require__(28727);
62341var isPlainObject = __webpack_require__(81064);
62342var isObject = __webpack_require__(18493);
62343
62344module.exports = function(obj, prop, val) {
62345 if (!isObject(obj)) {
62346 return obj;
62347 }
62348
62349 if (Array.isArray(prop)) {
62350 prop = [].concat.apply([], prop).join('.');
62351 }
62352
62353 if (typeof prop !== 'string') {
62354 return obj;
62355 }
62356
62357 var keys = split(prop, {sep: '.', brackets: true}).filter(isValidKey);
62358 var len = keys.length;
62359 var idx = -1;
62360 var current = obj;
62361
62362 while (++idx < len) {
62363 var key = keys[idx];
62364 if (idx !== len - 1) {
62365 if (!isObject(current[key])) {
62366 current[key] = {};
62367 }
62368 current = current[key];
62369 continue;
62370 }
62371
62372 if (isPlainObject(current[key]) && isPlainObject(val)) {
62373 current[key] = extend({}, current[key], val);
62374 } else {
62375 current[key] = val;
62376 }
62377 }
62378
62379 return obj;
62380};
62381
62382function isValidKey(key) {
62383 return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
62384}
62385
62386
62387/***/ }),
62388
62389/***/ 12579:
62390/***/ (function(module, exports, __webpack_require__) {
62391
62392"use strict";
62393
62394
62395var isObject = __webpack_require__(96667);
62396var define = __webpack_require__(88599);
62397var utils = __webpack_require__(82071);
62398var ownNames;
62399
62400/**
62401 * Create a new AST `Node` with the given `val` and `type`.
62402 *
62403 * ```js
62404 * var node = new Node('*', 'Star');
62405 * var node = new Node({type: 'star', val: '*'});
62406 * ```
62407 * @name Node
62408 * @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node.
62409 * @param {String} `type` The node type to use when `val` is a string.
62410 * @return {Object} node instance
62411 * @api public
62412 */
62413
62414function Node(val, type, parent) {
62415 if (typeof type !== 'string') {
62416 parent = type;
62417 type = null;
62418 }
62419
62420 define(this, 'parent', parent);
62421 define(this, 'isNode', true);
62422 define(this, 'expect', null);
62423
62424 if (typeof type !== 'string' && isObject(val)) {
62425 lazyKeys();
62426 var keys = Object.keys(val);
62427 for (var i = 0; i < keys.length; i++) {
62428 var key = keys[i];
62429 if (ownNames.indexOf(key) === -1) {
62430 this[key] = val[key];
62431 }
62432 }
62433 } else {
62434 this.type = type;
62435 this.val = val;
62436 }
62437}
62438
62439/**
62440 * Returns true if the given value is a node.
62441 *
62442 * ```js
62443 * var Node = require('snapdragon-node');
62444 * var node = new Node({type: 'foo'});
62445 * console.log(Node.isNode(node)); //=> true
62446 * console.log(Node.isNode({})); //=> false
62447 * ```
62448 * @param {Object} `node`
62449 * @returns {Boolean}
62450 * @api public
62451 */
62452
62453Node.isNode = function(node) {
62454 return utils.isNode(node);
62455};
62456
62457/**
62458 * Define a non-enumberable property on the node instance.
62459 * Useful for adding properties that shouldn't be extended
62460 * or visible during debugging.
62461 *
62462 * ```js
62463 * var node = new Node();
62464 * node.define('foo', 'something non-enumerable');
62465 * ```
62466 * @param {String} `name`
62467 * @param {any} `val`
62468 * @return {Object} returns the node instance
62469 * @api public
62470 */
62471
62472Node.prototype.define = function(name, val) {
62473 define(this, name, val);
62474 return this;
62475};
62476
62477/**
62478 * Returns true if `node.val` is an empty string, or `node.nodes` does
62479 * not contain any non-empty text nodes.
62480 *
62481 * ```js
62482 * var node = new Node({type: 'text'});
62483 * node.isEmpty(); //=> true
62484 * node.val = 'foo';
62485 * node.isEmpty(); //=> false
62486 * ```
62487 * @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes.
62488 * @return {Boolean}
62489 * @api public
62490 */
62491
62492Node.prototype.isEmpty = function(fn) {
62493 return utils.isEmpty(this, fn);
62494};
62495
62496/**
62497 * Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and
62498 * set `foo` as `bar.parent`.
62499 *
62500 * ```js
62501 * var foo = new Node({type: 'foo'});
62502 * var bar = new Node({type: 'bar'});
62503 * foo.push(bar);
62504 * ```
62505 * @param {Object} `node`
62506 * @return {Number} Returns the length of `node.nodes`
62507 * @api public
62508 */
62509
62510Node.prototype.push = function(node) {
62511 assert(Node.isNode(node), 'expected node to be an instance of Node');
62512 define(node, 'parent', this);
62513
62514 this.nodes = this.nodes || [];
62515 return this.nodes.push(node);
62516};
62517
62518/**
62519 * Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and
62520 * set `foo` as `bar.parent`.
62521 *
62522 * ```js
62523 * var foo = new Node({type: 'foo'});
62524 * var bar = new Node({type: 'bar'});
62525 * foo.unshift(bar);
62526 * ```
62527 * @param {Object} `node`
62528 * @return {Number} Returns the length of `node.nodes`
62529 * @api public
62530 */
62531
62532Node.prototype.unshift = function(node) {
62533 assert(Node.isNode(node), 'expected node to be an instance of Node');
62534 define(node, 'parent', this);
62535
62536 this.nodes = this.nodes || [];
62537 return this.nodes.unshift(node);
62538};
62539
62540/**
62541 * Pop a node from `node.nodes`.
62542 *
62543 * ```js
62544 * var node = new Node({type: 'foo'});
62545 * node.push(new Node({type: 'a'}));
62546 * node.push(new Node({type: 'b'}));
62547 * node.push(new Node({type: 'c'}));
62548 * node.push(new Node({type: 'd'}));
62549 * console.log(node.nodes.length);
62550 * //=> 4
62551 * node.pop();
62552 * console.log(node.nodes.length);
62553 * //=> 3
62554 * ```
62555 * @return {Number} Returns the popped `node`
62556 * @api public
62557 */
62558
62559Node.prototype.pop = function() {
62560 return this.nodes && this.nodes.pop();
62561};
62562
62563/**
62564 * Shift a node from `node.nodes`.
62565 *
62566 * ```js
62567 * var node = new Node({type: 'foo'});
62568 * node.push(new Node({type: 'a'}));
62569 * node.push(new Node({type: 'b'}));
62570 * node.push(new Node({type: 'c'}));
62571 * node.push(new Node({type: 'd'}));
62572 * console.log(node.nodes.length);
62573 * //=> 4
62574 * node.shift();
62575 * console.log(node.nodes.length);
62576 * //=> 3
62577 * ```
62578 * @return {Object} Returns the shifted `node`
62579 * @api public
62580 */
62581
62582Node.prototype.shift = function() {
62583 return this.nodes && this.nodes.shift();
62584};
62585
62586/**
62587 * Remove `node` from `node.nodes`.
62588 *
62589 * ```js
62590 * node.remove(childNode);
62591 * ```
62592 * @param {Object} `node`
62593 * @return {Object} Returns the removed node.
62594 * @api public
62595 */
62596
62597Node.prototype.remove = function(node) {
62598 assert(Node.isNode(node), 'expected node to be an instance of Node');
62599 this.nodes = this.nodes || [];
62600 var idx = node.index;
62601 if (idx !== -1) {
62602 node.index = -1;
62603 return this.nodes.splice(idx, 1);
62604 }
62605 return null;
62606};
62607
62608/**
62609 * Get the first child node from `node.nodes` that matches the given `type`.
62610 * If `type` is a number, the child node at that index is returned.
62611 *
62612 * ```js
62613 * var child = node.find(1); //<= index of the node to get
62614 * var child = node.find('foo'); //<= node.type of a child node
62615 * var child = node.find(/^(foo|bar)$/); //<= regex to match node.type
62616 * var child = node.find(['foo', 'bar']); //<= array of node.type(s)
62617 * ```
62618 * @param {String} `type`
62619 * @return {Object} Returns a child node or undefined.
62620 * @api public
62621 */
62622
62623Node.prototype.find = function(type) {
62624 return utils.findNode(this.nodes, type);
62625};
62626
62627/**
62628 * Return true if the node is the given `type`.
62629 *
62630 * ```js
62631 * var node = new Node({type: 'bar'});
62632 * cosole.log(node.isType('foo')); // false
62633 * cosole.log(node.isType(/^(foo|bar)$/)); // true
62634 * cosole.log(node.isType(['foo', 'bar'])); // true
62635 * ```
62636 * @param {String} `type`
62637 * @return {Boolean}
62638 * @api public
62639 */
62640
62641Node.prototype.isType = function(type) {
62642 return utils.isType(this, type);
62643};
62644
62645/**
62646 * Return true if the `node.nodes` has the given `type`.
62647 *
62648 * ```js
62649 * var foo = new Node({type: 'foo'});
62650 * var bar = new Node({type: 'bar'});
62651 * foo.push(bar);
62652 *
62653 * cosole.log(foo.hasType('qux')); // false
62654 * cosole.log(foo.hasType(/^(qux|bar)$/)); // true
62655 * cosole.log(foo.hasType(['qux', 'bar'])); // true
62656 * ```
62657 * @param {String} `type`
62658 * @return {Boolean}
62659 * @api public
62660 */
62661
62662Node.prototype.hasType = function(type) {
62663 return utils.hasType(this, type);
62664};
62665
62666/**
62667 * Get the siblings array, or `null` if it doesn't exist.
62668 *
62669 * ```js
62670 * var foo = new Node({type: 'foo'});
62671 * var bar = new Node({type: 'bar'});
62672 * var baz = new Node({type: 'baz'});
62673 * foo.push(bar);
62674 * foo.push(baz);
62675 *
62676 * console.log(bar.siblings.length) // 2
62677 * console.log(baz.siblings.length) // 2
62678 * ```
62679 * @return {Array}
62680 * @api public
62681 */
62682
62683Object.defineProperty(Node.prototype, 'siblings', {
62684 set: function() {
62685 throw new Error('node.siblings is a getter and cannot be defined');
62686 },
62687 get: function() {
62688 return this.parent ? this.parent.nodes : null;
62689 }
62690});
62691
62692/**
62693 * Get the node's current index from `node.parent.nodes`.
62694 * This should always be correct, even when the parent adds nodes.
62695 *
62696 * ```js
62697 * var foo = new Node({type: 'foo'});
62698 * var bar = new Node({type: 'bar'});
62699 * var baz = new Node({type: 'baz'});
62700 * var qux = new Node({type: 'qux'});
62701 * foo.push(bar);
62702 * foo.push(baz);
62703 * foo.unshift(qux);
62704 *
62705 * console.log(bar.index) // 1
62706 * console.log(baz.index) // 2
62707 * console.log(qux.index) // 0
62708 * ```
62709 * @return {Number}
62710 * @api public
62711 */
62712
62713Object.defineProperty(Node.prototype, 'index', {
62714 set: function(index) {
62715 define(this, 'idx', index);
62716 },
62717 get: function() {
62718 if (!Array.isArray(this.siblings)) {
62719 return -1;
62720 }
62721 var tok = this.idx !== -1 ? this.siblings[this.idx] : null;
62722 if (tok !== this) {
62723 this.idx = this.siblings.indexOf(this);
62724 }
62725 return this.idx;
62726 }
62727});
62728
62729/**
62730 * Get the previous node from the siblings array or `null`.
62731 *
62732 * ```js
62733 * var foo = new Node({type: 'foo'});
62734 * var bar = new Node({type: 'bar'});
62735 * var baz = new Node({type: 'baz'});
62736 * foo.push(bar);
62737 * foo.push(baz);
62738 *
62739 * console.log(baz.prev.type) // 'bar'
62740 * ```
62741 * @return {Object}
62742 * @api public
62743 */
62744
62745Object.defineProperty(Node.prototype, 'prev', {
62746 set: function() {
62747 throw new Error('node.prev is a getter and cannot be defined');
62748 },
62749 get: function() {
62750 if (Array.isArray(this.siblings)) {
62751 return this.siblings[this.index - 1] || this.parent.prev;
62752 }
62753 return null;
62754 }
62755});
62756
62757/**
62758 * Get the siblings array, or `null` if it doesn't exist.
62759 *
62760 * ```js
62761 * var foo = new Node({type: 'foo'});
62762 * var bar = new Node({type: 'bar'});
62763 * var baz = new Node({type: 'baz'});
62764 * foo.push(bar);
62765 * foo.push(baz);
62766 *
62767 * console.log(bar.siblings.length) // 2
62768 * console.log(baz.siblings.length) // 2
62769 * ```
62770 * @return {Object}
62771 * @api public
62772 */
62773
62774Object.defineProperty(Node.prototype, 'next', {
62775 set: function() {
62776 throw new Error('node.next is a getter and cannot be defined');
62777 },
62778 get: function() {
62779 if (Array.isArray(this.siblings)) {
62780 return this.siblings[this.index + 1] || this.parent.next;
62781 }
62782 return null;
62783 }
62784});
62785
62786/**
62787 * Get the first node from `node.nodes`.
62788 *
62789 * ```js
62790 * var foo = new Node({type: 'foo'});
62791 * var bar = new Node({type: 'bar'});
62792 * var baz = new Node({type: 'baz'});
62793 * var qux = new Node({type: 'qux'});
62794 * foo.push(bar);
62795 * foo.push(baz);
62796 * foo.push(qux);
62797 *
62798 * console.log(foo.first.type) // 'bar'
62799 * ```
62800 * @return {Object} The first node, or undefiend
62801 * @api public
62802 */
62803
62804Object.defineProperty(Node.prototype, 'first', {
62805 get: function() {
62806 return this.nodes ? this.nodes[0] : null;
62807 }
62808});
62809
62810/**
62811 * Get the last node from `node.nodes`.
62812 *
62813 * ```js
62814 * var foo = new Node({type: 'foo'});
62815 * var bar = new Node({type: 'bar'});
62816 * var baz = new Node({type: 'baz'});
62817 * var qux = new Node({type: 'qux'});
62818 * foo.push(bar);
62819 * foo.push(baz);
62820 * foo.push(qux);
62821 *
62822 * console.log(foo.last.type) // 'qux'
62823 * ```
62824 * @return {Object} The last node, or undefiend
62825 * @api public
62826 */
62827
62828Object.defineProperty(Node.prototype, 'last', {
62829 get: function() {
62830 return this.nodes ? utils.last(this.nodes) : null;
62831 }
62832});
62833
62834/**
62835 * Get the last node from `node.nodes`.
62836 *
62837 * ```js
62838 * var foo = new Node({type: 'foo'});
62839 * var bar = new Node({type: 'bar'});
62840 * var baz = new Node({type: 'baz'});
62841 * var qux = new Node({type: 'qux'});
62842 * foo.push(bar);
62843 * foo.push(baz);
62844 * foo.push(qux);
62845 *
62846 * console.log(foo.last.type) // 'qux'
62847 * ```
62848 * @return {Object} The last node, or undefiend
62849 * @api public
62850 */
62851
62852Object.defineProperty(Node.prototype, 'scope', {
62853 get: function() {
62854 if (this.isScope !== true) {
62855 return this.parent ? this.parent.scope : this;
62856 }
62857 return this;
62858 }
62859});
62860
62861/**
62862 * Get own property names from Node prototype, but only the
62863 * first time `Node` is instantiated
62864 */
62865
62866function lazyKeys() {
62867 if (!ownNames) {
62868 ownNames = Object.getOwnPropertyNames(Node.prototype);
62869 }
62870}
62871
62872/**
62873 * Simplified assertion. Throws an error is `val` is falsey.
62874 */
62875
62876function assert(val, message) {
62877 if (!val) throw new Error(message);
62878}
62879
62880/**
62881 * Expose `Node`
62882 */
62883
62884exports = module.exports = Node;
62885
62886
62887/***/ }),
62888
62889/***/ 88599:
62890/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
62891
62892"use strict";
62893/*!
62894 * define-property <https://github.com/jonschlinkert/define-property>
62895 *
62896 * Copyright (c) 2015, 2017, Jon Schlinkert.
62897 * Released under the MIT License.
62898 */
62899
62900
62901
62902var isDescriptor = __webpack_require__(44133);
62903
62904module.exports = function defineProperty(obj, prop, val) {
62905 if (typeof obj !== 'object' && typeof obj !== 'function') {
62906 throw new TypeError('expected an object or function.');
62907 }
62908
62909 if (typeof prop !== 'string') {
62910 throw new TypeError('expected `prop` to be a string.');
62911 }
62912
62913 if (isDescriptor(val) && ('set' in val || 'get' in val)) {
62914 return Object.defineProperty(obj, prop, val);
62915 }
62916
62917 return Object.defineProperty(obj, prop, {
62918 configurable: true,
62919 enumerable: false,
62920 writable: true,
62921 value: val
62922 });
62923};
62924
62925
62926/***/ }),
62927
62928/***/ 82071:
62929/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
62930
62931"use strict";
62932
62933
62934var typeOf = __webpack_require__(48865);
62935var utils = module.exports;
62936
62937/**
62938 * Returns true if the given value is a node.
62939 *
62940 * ```js
62941 * var Node = require('snapdragon-node');
62942 * var node = new Node({type: 'foo'});
62943 * console.log(utils.isNode(node)); //=> true
62944 * console.log(utils.isNode({})); //=> false
62945 * ```
62946 * @param {Object} `node` Instance of [snapdragon-node][]
62947 * @returns {Boolean}
62948 * @api public
62949 */
62950
62951utils.isNode = function(node) {
62952 return typeOf(node) === 'object' && node.isNode === true;
62953};
62954
62955/**
62956 * Emit an empty string for the given `node`.
62957 *
62958 * ```js
62959 * // do nothing for beginning-of-string
62960 * snapdragon.compiler.set('bos', utils.noop);
62961 * ```
62962 * @param {Object} `node` Instance of [snapdragon-node][]
62963 * @returns {undefined}
62964 * @api public
62965 */
62966
62967utils.noop = function(node) {
62968 append(this, '', node);
62969};
62970
62971/**
62972 * Appdend `node.val` to `compiler.output`, exactly as it was created
62973 * by the parser.
62974 *
62975 * ```js
62976 * snapdragon.compiler.set('text', utils.identity);
62977 * ```
62978 * @param {Object} `node` Instance of [snapdragon-node][]
62979 * @returns {undefined}
62980 * @api public
62981 */
62982
62983utils.identity = function(node) {
62984 append(this, node.val, node);
62985};
62986
62987/**
62988 * Previously named `.emit`, this method appends the given `val`
62989 * to `compiler.output` for the given node. Useful when you know
62990 * what value should be appended advance, regardless of the actual
62991 * value of `node.val`.
62992 *
62993 * ```js
62994 * snapdragon.compiler
62995 * .set('i', function(node) {
62996 * this.mapVisit(node);
62997 * })
62998 * .set('i.open', utils.append('<i>'))
62999 * .set('i.close', utils.append('</i>'))
63000 * ```
63001 * @param {Object} `node` Instance of [snapdragon-node][]
63002 * @returns {Function} Returns a compiler middleware function.
63003 * @api public
63004 */
63005
63006utils.append = function(val) {
63007 return function(node) {
63008 append(this, val, node);
63009 };
63010};
63011
63012/**
63013 * Used in compiler middleware, this onverts an AST node into
63014 * an empty `text` node and deletes `node.nodes` if it exists.
63015 * The advantage of this method is that, as opposed to completely
63016 * removing the node, indices will not need to be re-calculated
63017 * in sibling nodes, and nothing is appended to the output.
63018 *
63019 * ```js
63020 * utils.toNoop(node);
63021 * // convert `node.nodes` to the given value instead of deleting it
63022 * utils.toNoop(node, []);
63023 * ```
63024 * @param {Object} `node` Instance of [snapdragon-node][]
63025 * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array.
63026 * @api public
63027 */
63028
63029utils.toNoop = function(node, nodes) {
63030 if (nodes) {
63031 node.nodes = nodes;
63032 } else {
63033 delete node.nodes;
63034 node.type = 'text';
63035 node.val = '';
63036 }
63037};
63038
63039/**
63040 * Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon
63041 * automatically calls registered compilers, this allows you to pass a visitor
63042 * function.
63043 *
63044 * ```js
63045 * snapdragon.compiler.set('i', function(node) {
63046 * utils.visit(node, function(childNode) {
63047 * // do stuff with "childNode"
63048 * return childNode;
63049 * });
63050 * });
63051 * ```
63052 * @param {Object} `node` Instance of [snapdragon-node][]
63053 * @param {Function} `fn`
63054 * @return {Object} returns the node after recursively visiting all child nodes.
63055 * @api public
63056 */
63057
63058utils.visit = function(node, fn) {
63059 assert(utils.isNode(node), 'expected node to be an instance of Node');
63060 assert(isFunction(fn), 'expected a visitor function');
63061 fn(node);
63062 return node.nodes ? utils.mapVisit(node, fn) : node;
63063};
63064
63065/**
63066 * Map [visit](#visit) the given `fn` over `node.nodes`. This is called by
63067 * [visit](#visit), use this method if you do not want `fn` to be called on
63068 * the first node.
63069 *
63070 * ```js
63071 * snapdragon.compiler.set('i', function(node) {
63072 * utils.mapVisit(node, function(childNode) {
63073 * // do stuff with "childNode"
63074 * return childNode;
63075 * });
63076 * });
63077 * ```
63078 * @param {Object} `node` Instance of [snapdragon-node][]
63079 * @param {Object} `options`
63080 * @param {Function} `fn`
63081 * @return {Object} returns the node
63082 * @api public
63083 */
63084
63085utils.mapVisit = function(node, fn) {
63086 assert(utils.isNode(node), 'expected node to be an instance of Node');
63087 assert(isArray(node.nodes), 'expected node.nodes to be an array');
63088 assert(isFunction(fn), 'expected a visitor function');
63089
63090 for (var i = 0; i < node.nodes.length; i++) {
63091 utils.visit(node.nodes[i], fn);
63092 }
63093 return node;
63094};
63095
63096/**
63097 * Unshift an `*.open` node onto `node.nodes`.
63098 *
63099 * ```js
63100 * var Node = require('snapdragon-node');
63101 * snapdragon.parser.set('brace', function(node) {
63102 * var match = this.match(/^{/);
63103 * if (match) {
63104 * var parent = new Node({type: 'brace'});
63105 * utils.addOpen(parent, Node);
63106 * console.log(parent.nodes[0]):
63107 * // { type: 'brace.open', val: '' };
63108 *
63109 * // push the parent "brace" node onto the stack
63110 * this.push(parent);
63111 *
63112 * // return the parent node, so it's also added to the AST
63113 * return brace;
63114 * }
63115 * });
63116 * ```
63117 * @param {Object} `node` Instance of [snapdragon-node][]
63118 * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
63119 * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
63120 * @return {Object} Returns the created opening node.
63121 * @api public
63122 */
63123
63124utils.addOpen = function(node, Node, val, filter) {
63125 assert(utils.isNode(node), 'expected node to be an instance of Node');
63126 assert(isFunction(Node), 'expected Node to be a constructor function');
63127
63128 if (typeof val === 'function') {
63129 filter = val;
63130 val = '';
63131 }
63132
63133 if (typeof filter === 'function' && !filter(node)) return;
63134 var open = new Node({ type: node.type + '.open', val: val});
63135 var unshift = node.unshift || node.unshiftNode;
63136 if (typeof unshift === 'function') {
63137 unshift.call(node, open);
63138 } else {
63139 utils.unshiftNode(node, open);
63140 }
63141 return open;
63142};
63143
63144/**
63145 * Push a `*.close` node onto `node.nodes`.
63146 *
63147 * ```js
63148 * var Node = require('snapdragon-node');
63149 * snapdragon.parser.set('brace', function(node) {
63150 * var match = this.match(/^}/);
63151 * if (match) {
63152 * var parent = this.parent();
63153 * if (parent.type !== 'brace') {
63154 * throw new Error('missing opening: ' + '}');
63155 * }
63156 *
63157 * utils.addClose(parent, Node);
63158 * console.log(parent.nodes[parent.nodes.length - 1]):
63159 * // { type: 'brace.close', val: '' };
63160 *
63161 * // no need to return a node, since the parent
63162 * // was already added to the AST
63163 * return;
63164 * }
63165 * });
63166 * ```
63167 * @param {Object} `node` Instance of [snapdragon-node][]
63168 * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
63169 * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
63170 * @return {Object} Returns the created closing node.
63171 * @api public
63172 */
63173
63174utils.addClose = function(node, Node, val, filter) {
63175 assert(utils.isNode(node), 'expected node to be an instance of Node');
63176 assert(isFunction(Node), 'expected Node to be a constructor function');
63177
63178 if (typeof val === 'function') {
63179 filter = val;
63180 val = '';
63181 }
63182
63183 if (typeof filter === 'function' && !filter(node)) return;
63184 var close = new Node({ type: node.type + '.close', val: val});
63185 var push = node.push || node.pushNode;
63186 if (typeof push === 'function') {
63187 push.call(node, close);
63188 } else {
63189 utils.pushNode(node, close);
63190 }
63191 return close;
63192};
63193
63194/**
63195 * Wraps the given `node` with `*.open` and `*.close` nodes.
63196 *
63197 * @param {Object} `node` Instance of [snapdragon-node][]
63198 * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
63199 * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
63200 * @return {Object} Returns the node
63201 * @api public
63202 */
63203
63204utils.wrapNodes = function(node, Node, filter) {
63205 assert(utils.isNode(node), 'expected node to be an instance of Node');
63206 assert(isFunction(Node), 'expected Node to be a constructor function');
63207
63208 utils.addOpen(node, Node, filter);
63209 utils.addClose(node, Node, filter);
63210 return node;
63211};
63212
63213/**
63214 * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent.
63215 *
63216 * ```js
63217 * var parent = new Node({type: 'foo'});
63218 * var node = new Node({type: 'bar'});
63219 * utils.pushNode(parent, node);
63220 * console.log(parent.nodes[0].type) // 'bar'
63221 * console.log(node.parent.type) // 'foo'
63222 * ```
63223 * @param {Object} `parent`
63224 * @param {Object} `node` Instance of [snapdragon-node][]
63225 * @return {Object} Returns the child node
63226 * @api public
63227 */
63228
63229utils.pushNode = function(parent, node) {
63230 assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
63231 assert(utils.isNode(node), 'expected node to be an instance of Node');
63232
63233 node.define('parent', parent);
63234 parent.nodes = parent.nodes || [];
63235 parent.nodes.push(node);
63236 return node;
63237};
63238
63239/**
63240 * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent.
63241 *
63242 * ```js
63243 * var parent = new Node({type: 'foo'});
63244 * var node = new Node({type: 'bar'});
63245 * utils.unshiftNode(parent, node);
63246 * console.log(parent.nodes[0].type) // 'bar'
63247 * console.log(node.parent.type) // 'foo'
63248 * ```
63249 * @param {Object} `parent`
63250 * @param {Object} `node` Instance of [snapdragon-node][]
63251 * @return {undefined}
63252 * @api public
63253 */
63254
63255utils.unshiftNode = function(parent, node) {
63256 assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
63257 assert(utils.isNode(node), 'expected node to be an instance of Node');
63258
63259 node.define('parent', parent);
63260 parent.nodes = parent.nodes || [];
63261 parent.nodes.unshift(node);
63262};
63263
63264/**
63265 * Pop the last `node` off of `parent.nodes`. The advantage of
63266 * using this method is that it checks for `node.nodes` and works
63267 * with any version of `snapdragon-node`.
63268 *
63269 * ```js
63270 * var parent = new Node({type: 'foo'});
63271 * utils.pushNode(parent, new Node({type: 'foo'}));
63272 * utils.pushNode(parent, new Node({type: 'bar'}));
63273 * utils.pushNode(parent, new Node({type: 'baz'}));
63274 * console.log(parent.nodes.length); //=> 3
63275 * utils.popNode(parent);
63276 * console.log(parent.nodes.length); //=> 2
63277 * ```
63278 * @param {Object} `parent`
63279 * @param {Object} `node` Instance of [snapdragon-node][]
63280 * @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
63281 * @api public
63282 */
63283
63284utils.popNode = function(node) {
63285 assert(utils.isNode(node), 'expected node to be an instance of Node');
63286 if (typeof node.pop === 'function') {
63287 return node.pop();
63288 }
63289 return node.nodes && node.nodes.pop();
63290};
63291
63292/**
63293 * Shift the first `node` off of `parent.nodes`. The advantage of
63294 * using this method is that it checks for `node.nodes` and works
63295 * with any version of `snapdragon-node`.
63296 *
63297 * ```js
63298 * var parent = new Node({type: 'foo'});
63299 * utils.pushNode(parent, new Node({type: 'foo'}));
63300 * utils.pushNode(parent, new Node({type: 'bar'}));
63301 * utils.pushNode(parent, new Node({type: 'baz'}));
63302 * console.log(parent.nodes.length); //=> 3
63303 * utils.shiftNode(parent);
63304 * console.log(parent.nodes.length); //=> 2
63305 * ```
63306 * @param {Object} `parent`
63307 * @param {Object} `node` Instance of [snapdragon-node][]
63308 * @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
63309 * @api public
63310 */
63311
63312utils.shiftNode = function(node) {
63313 assert(utils.isNode(node), 'expected node to be an instance of Node');
63314 if (typeof node.shift === 'function') {
63315 return node.shift();
63316 }
63317 return node.nodes && node.nodes.shift();
63318};
63319
63320/**
63321 * Remove the specified `node` from `parent.nodes`.
63322 *
63323 * ```js
63324 * var parent = new Node({type: 'abc'});
63325 * var foo = new Node({type: 'foo'});
63326 * utils.pushNode(parent, foo);
63327 * utils.pushNode(parent, new Node({type: 'bar'}));
63328 * utils.pushNode(parent, new Node({type: 'baz'}));
63329 * console.log(parent.nodes.length); //=> 3
63330 * utils.removeNode(parent, foo);
63331 * console.log(parent.nodes.length); //=> 2
63332 * ```
63333 * @param {Object} `parent`
63334 * @param {Object} `node` Instance of [snapdragon-node][]
63335 * @return {Object|undefined} Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`.
63336 * @api public
63337 */
63338
63339utils.removeNode = function(parent, node) {
63340 assert(utils.isNode(parent), 'expected parent.node to be an instance of Node');
63341 assert(utils.isNode(node), 'expected node to be an instance of Node');
63342
63343 if (!parent.nodes) {
63344 return null;
63345 }
63346
63347 if (typeof parent.remove === 'function') {
63348 return parent.remove(node);
63349 }
63350
63351 var idx = parent.nodes.indexOf(node);
63352 if (idx !== -1) {
63353 return parent.nodes.splice(idx, 1);
63354 }
63355};
63356
63357/**
63358 * Returns true if `node.type` matches the given `type`. Throws a
63359 * `TypeError` if `node` is not an instance of `Node`.
63360 *
63361 * ```js
63362 * var Node = require('snapdragon-node');
63363 * var node = new Node({type: 'foo'});
63364 * console.log(utils.isType(node, 'foo')); // false
63365 * console.log(utils.isType(node, 'bar')); // true
63366 * ```
63367 * @param {Object} `node` Instance of [snapdragon-node][]
63368 * @param {String} `type`
63369 * @return {Boolean}
63370 * @api public
63371 */
63372
63373utils.isType = function(node, type) {
63374 assert(utils.isNode(node), 'expected node to be an instance of Node');
63375 switch (typeOf(type)) {
63376 case 'array':
63377 var types = type.slice();
63378 for (var i = 0; i < types.length; i++) {
63379 if (utils.isType(node, types[i])) {
63380 return true;
63381 }
63382 }
63383 return false;
63384 case 'string':
63385 return node.type === type;
63386 case 'regexp':
63387 return type.test(node.type);
63388 default: {
63389 throw new TypeError('expected "type" to be an array, string or regexp');
63390 }
63391 }
63392};
63393
63394/**
63395 * Returns true if the given `node` has the given `type` in `node.nodes`.
63396 * Throws a `TypeError` if `node` is not an instance of `Node`.
63397 *
63398 * ```js
63399 * var Node = require('snapdragon-node');
63400 * var node = new Node({
63401 * type: 'foo',
63402 * nodes: [
63403 * new Node({type: 'bar'}),
63404 * new Node({type: 'baz'})
63405 * ]
63406 * });
63407 * console.log(utils.hasType(node, 'xyz')); // false
63408 * console.log(utils.hasType(node, 'baz')); // true
63409 * ```
63410 * @param {Object} `node` Instance of [snapdragon-node][]
63411 * @param {String} `type`
63412 * @return {Boolean}
63413 * @api public
63414 */
63415
63416utils.hasType = function(node, type) {
63417 assert(utils.isNode(node), 'expected node to be an instance of Node');
63418 if (!Array.isArray(node.nodes)) return false;
63419 for (var i = 0; i < node.nodes.length; i++) {
63420 if (utils.isType(node.nodes[i], type)) {
63421 return true;
63422 }
63423 }
63424 return false;
63425};
63426
63427/**
63428 * Returns the first node from `node.nodes` of the given `type`
63429 *
63430 * ```js
63431 * var node = new Node({
63432 * type: 'foo',
63433 * nodes: [
63434 * new Node({type: 'text', val: 'abc'}),
63435 * new Node({type: 'text', val: 'xyz'})
63436 * ]
63437 * });
63438 *
63439 * var textNode = utils.firstOfType(node.nodes, 'text');
63440 * console.log(textNode.val);
63441 * //=> 'abc'
63442 * ```
63443 * @param {Array} `nodes`
63444 * @param {String} `type`
63445 * @return {Object|undefined} Returns the first matching node or undefined.
63446 * @api public
63447 */
63448
63449utils.firstOfType = function(nodes, type) {
63450 for (var i = 0; i < nodes.length; i++) {
63451 var node = nodes[i];
63452 if (utils.isType(node, type)) {
63453 return node;
63454 }
63455 }
63456};
63457
63458/**
63459 * Returns the node at the specified index, or the first node of the
63460 * given `type` from `node.nodes`.
63461 *
63462 * ```js
63463 * var node = new Node({
63464 * type: 'foo',
63465 * nodes: [
63466 * new Node({type: 'text', val: 'abc'}),
63467 * new Node({type: 'text', val: 'xyz'})
63468 * ]
63469 * });
63470 *
63471 * var nodeOne = utils.findNode(node.nodes, 'text');
63472 * console.log(nodeOne.val);
63473 * //=> 'abc'
63474 *
63475 * var nodeTwo = utils.findNode(node.nodes, 1);
63476 * console.log(nodeTwo.val);
63477 * //=> 'xyz'
63478 * ```
63479 *
63480 * @param {Array} `nodes`
63481 * @param {String|Number} `type` Node type or index.
63482 * @return {Object} Returns a node or undefined.
63483 * @api public
63484 */
63485
63486utils.findNode = function(nodes, type) {
63487 if (!Array.isArray(nodes)) {
63488 return null;
63489 }
63490 if (typeof type === 'number') {
63491 return nodes[type];
63492 }
63493 return utils.firstOfType(nodes, type);
63494};
63495
63496/**
63497 * Returns true if the given node is an "*.open" node.
63498 *
63499 * ```js
63500 * var Node = require('snapdragon-node');
63501 * var brace = new Node({type: 'brace'});
63502 * var open = new Node({type: 'brace.open'});
63503 * var close = new Node({type: 'brace.close'});
63504 *
63505 * console.log(utils.isOpen(brace)); // false
63506 * console.log(utils.isOpen(open)); // true
63507 * console.log(utils.isOpen(close)); // false
63508 * ```
63509 * @param {Object} `node` Instance of [snapdragon-node][]
63510 * @return {Boolean}
63511 * @api public
63512 */
63513
63514utils.isOpen = function(node) {
63515 assert(utils.isNode(node), 'expected node to be an instance of Node');
63516 return node.type.slice(-5) === '.open';
63517};
63518
63519/**
63520 * Returns true if the given node is a "*.close" node.
63521 *
63522 * ```js
63523 * var Node = require('snapdragon-node');
63524 * var brace = new Node({type: 'brace'});
63525 * var open = new Node({type: 'brace.open'});
63526 * var close = new Node({type: 'brace.close'});
63527 *
63528 * console.log(utils.isClose(brace)); // false
63529 * console.log(utils.isClose(open)); // false
63530 * console.log(utils.isClose(close)); // true
63531 * ```
63532 * @param {Object} `node` Instance of [snapdragon-node][]
63533 * @return {Boolean}
63534 * @api public
63535 */
63536
63537utils.isClose = function(node) {
63538 assert(utils.isNode(node), 'expected node to be an instance of Node');
63539 return node.type.slice(-6) === '.close';
63540};
63541
63542/**
63543 * Returns true if `node.nodes` **has** an `.open` node
63544 *
63545 * ```js
63546 * var Node = require('snapdragon-node');
63547 * var brace = new Node({
63548 * type: 'brace',
63549 * nodes: []
63550 * });
63551 *
63552 * var open = new Node({type: 'brace.open'});
63553 * console.log(utils.hasOpen(brace)); // false
63554 *
63555 * brace.pushNode(open);
63556 * console.log(utils.hasOpen(brace)); // true
63557 * ```
63558 * @param {Object} `node` Instance of [snapdragon-node][]
63559 * @return {Boolean}
63560 * @api public
63561 */
63562
63563utils.hasOpen = function(node) {
63564 assert(utils.isNode(node), 'expected node to be an instance of Node');
63565 var first = node.first || node.nodes ? node.nodes[0] : null;
63566 if (utils.isNode(first)) {
63567 return first.type === node.type + '.open';
63568 }
63569 return false;
63570};
63571
63572/**
63573 * Returns true if `node.nodes` **has** a `.close` node
63574 *
63575 * ```js
63576 * var Node = require('snapdragon-node');
63577 * var brace = new Node({
63578 * type: 'brace',
63579 * nodes: []
63580 * });
63581 *
63582 * var close = new Node({type: 'brace.close'});
63583 * console.log(utils.hasClose(brace)); // false
63584 *
63585 * brace.pushNode(close);
63586 * console.log(utils.hasClose(brace)); // true
63587 * ```
63588 * @param {Object} `node` Instance of [snapdragon-node][]
63589 * @return {Boolean}
63590 * @api public
63591 */
63592
63593utils.hasClose = function(node) {
63594 assert(utils.isNode(node), 'expected node to be an instance of Node');
63595 var last = node.last || node.nodes ? node.nodes[node.nodes.length - 1] : null;
63596 if (utils.isNode(last)) {
63597 return last.type === node.type + '.close';
63598 }
63599 return false;
63600};
63601
63602/**
63603 * Returns true if `node.nodes` has both `.open` and `.close` nodes
63604 *
63605 * ```js
63606 * var Node = require('snapdragon-node');
63607 * var brace = new Node({
63608 * type: 'brace',
63609 * nodes: []
63610 * });
63611 *
63612 * var open = new Node({type: 'brace.open'});
63613 * var close = new Node({type: 'brace.close'});
63614 * console.log(utils.hasOpen(brace)); // false
63615 * console.log(utils.hasClose(brace)); // false
63616 *
63617 * brace.pushNode(open);
63618 * brace.pushNode(close);
63619 * console.log(utils.hasOpen(brace)); // true
63620 * console.log(utils.hasClose(brace)); // true
63621 * ```
63622 * @param {Object} `node` Instance of [snapdragon-node][]
63623 * @return {Boolean}
63624 * @api public
63625 */
63626
63627utils.hasOpenAndClose = function(node) {
63628 return utils.hasOpen(node) && utils.hasClose(node);
63629};
63630
63631/**
63632 * Push the given `node` onto the `state.inside` array for the
63633 * given type. This array is used as a specialized "stack" for
63634 * only the given `node.type`.
63635 *
63636 * ```js
63637 * var state = { inside: {}};
63638 * var node = new Node({type: 'brace'});
63639 * utils.addType(state, node);
63640 * console.log(state.inside);
63641 * //=> { brace: [{type: 'brace'}] }
63642 * ```
63643 * @param {Object} `state` The `compiler.state` object or custom state object.
63644 * @param {Object} `node` Instance of [snapdragon-node][]
63645 * @return {Array} Returns the `state.inside` stack for the given type.
63646 * @api public
63647 */
63648
63649utils.addType = function(state, node) {
63650 assert(utils.isNode(node), 'expected node to be an instance of Node');
63651 assert(isObject(state), 'expected state to be an object');
63652
63653 var type = node.parent
63654 ? node.parent.type
63655 : node.type.replace(/\.open$/, '');
63656
63657 if (!state.hasOwnProperty('inside')) {
63658 state.inside = {};
63659 }
63660 if (!state.inside.hasOwnProperty(type)) {
63661 state.inside[type] = [];
63662 }
63663
63664 var arr = state.inside[type];
63665 arr.push(node);
63666 return arr;
63667};
63668
63669/**
63670 * Remove the given `node` from the `state.inside` array for the
63671 * given type. This array is used as a specialized "stack" for
63672 * only the given `node.type`.
63673 *
63674 * ```js
63675 * var state = { inside: {}};
63676 * var node = new Node({type: 'brace'});
63677 * utils.addType(state, node);
63678 * console.log(state.inside);
63679 * //=> { brace: [{type: 'brace'}] }
63680 * utils.removeType(state, node);
63681 * //=> { brace: [] }
63682 * ```
63683 * @param {Object} `state` The `compiler.state` object or custom state object.
63684 * @param {Object} `node` Instance of [snapdragon-node][]
63685 * @return {Array} Returns the `state.inside` stack for the given type.
63686 * @api public
63687 */
63688
63689utils.removeType = function(state, node) {
63690 assert(utils.isNode(node), 'expected node to be an instance of Node');
63691 assert(isObject(state), 'expected state to be an object');
63692
63693 var type = node.parent
63694 ? node.parent.type
63695 : node.type.replace(/\.close$/, '');
63696
63697 if (state.inside.hasOwnProperty(type)) {
63698 return state.inside[type].pop();
63699 }
63700};
63701
63702/**
63703 * Returns true if `node.val` is an empty string, or `node.nodes` does
63704 * not contain any non-empty text nodes.
63705 *
63706 * ```js
63707 * var node = new Node({type: 'text'});
63708 * utils.isEmpty(node); //=> true
63709 * node.val = 'foo';
63710 * utils.isEmpty(node); //=> false
63711 * ```
63712 * @param {Object} `node` Instance of [snapdragon-node][]
63713 * @param {Function} `fn`
63714 * @return {Boolean}
63715 * @api public
63716 */
63717
63718utils.isEmpty = function(node, fn) {
63719 assert(utils.isNode(node), 'expected node to be an instance of Node');
63720
63721 if (!Array.isArray(node.nodes)) {
63722 if (node.type !== 'text') {
63723 return true;
63724 }
63725 if (typeof fn === 'function') {
63726 return fn(node, node.parent);
63727 }
63728 return !utils.trim(node.val);
63729 }
63730
63731 for (var i = 0; i < node.nodes.length; i++) {
63732 var child = node.nodes[i];
63733 if (utils.isOpen(child) || utils.isClose(child)) {
63734 continue;
63735 }
63736 if (!utils.isEmpty(child, fn)) {
63737 return false;
63738 }
63739 }
63740
63741 return true;
63742};
63743
63744/**
63745 * Returns true if the `state.inside` stack for the given type exists
63746 * and has one or more nodes on it.
63747 *
63748 * ```js
63749 * var state = { inside: {}};
63750 * var node = new Node({type: 'brace'});
63751 * console.log(utils.isInsideType(state, 'brace')); //=> false
63752 * utils.addType(state, node);
63753 * console.log(utils.isInsideType(state, 'brace')); //=> true
63754 * utils.removeType(state, node);
63755 * console.log(utils.isInsideType(state, 'brace')); //=> false
63756 * ```
63757 * @param {Object} `state`
63758 * @param {String} `type`
63759 * @return {Boolean}
63760 * @api public
63761 */
63762
63763utils.isInsideType = function(state, type) {
63764 assert(isObject(state), 'expected state to be an object');
63765 assert(isString(type), 'expected type to be a string');
63766
63767 if (!state.hasOwnProperty('inside')) {
63768 return false;
63769 }
63770
63771 if (!state.inside.hasOwnProperty(type)) {
63772 return false;
63773 }
63774
63775 return state.inside[type].length > 0;
63776};
63777
63778/**
63779 * Returns true if `node` is either a child or grand-child of the given `type`,
63780 * or `state.inside[type]` is a non-empty array.
63781 *
63782 * ```js
63783 * var state = { inside: {}};
63784 * var node = new Node({type: 'brace'});
63785 * var open = new Node({type: 'brace.open'});
63786 * console.log(utils.isInside(state, open, 'brace')); //=> false
63787 * utils.pushNode(node, open);
63788 * console.log(utils.isInside(state, open, 'brace')); //=> true
63789 * ```
63790 * @param {Object} `state` Either the `compiler.state` object, if it exists, or a user-supplied state object.
63791 * @param {Object} `node` Instance of [snapdragon-node][]
63792 * @param {String} `type` The `node.type` to check for.
63793 * @return {Boolean}
63794 * @api public
63795 */
63796
63797utils.isInside = function(state, node, type) {
63798 assert(utils.isNode(node), 'expected node to be an instance of Node');
63799 assert(isObject(state), 'expected state to be an object');
63800
63801 if (Array.isArray(type)) {
63802 for (var i = 0; i < type.length; i++) {
63803 if (utils.isInside(state, node, type[i])) {
63804 return true;
63805 }
63806 }
63807 return false;
63808 }
63809
63810 var parent = node.parent;
63811 if (typeof type === 'string') {
63812 return (parent && parent.type === type) || utils.isInsideType(state, type);
63813 }
63814
63815 if (typeOf(type) === 'regexp') {
63816 if (parent && parent.type && type.test(parent.type)) {
63817 return true;
63818 }
63819
63820 var keys = Object.keys(state.inside);
63821 var len = keys.length;
63822 var idx = -1;
63823 while (++idx < len) {
63824 var key = keys[idx];
63825 var val = state.inside[key];
63826
63827 if (Array.isArray(val) && val.length !== 0 && type.test(key)) {
63828 return true;
63829 }
63830 }
63831 }
63832 return false;
63833};
63834
63835/**
63836 * Get the last `n` element from the given `array`. Used for getting
63837 * a node from `node.nodes.`
63838 *
63839 * @param {Array} `array`
63840 * @param {Number} `n`
63841 * @return {undefined}
63842 * @api public
63843 */
63844
63845utils.last = function(arr, n) {
63846 return arr[arr.length - (n || 1)];
63847};
63848
63849/**
63850 * Cast the given `val` to an array.
63851 *
63852 * ```js
63853 * console.log(utils.arrayify(''));
63854 * //=> []
63855 * console.log(utils.arrayify('foo'));
63856 * //=> ['foo']
63857 * console.log(utils.arrayify(['foo']));
63858 * //=> ['foo']
63859 * ```
63860 * @param {any} `val`
63861 * @return {Array}
63862 * @api public
63863 */
63864
63865utils.arrayify = function(val) {
63866 if (typeof val === 'string' && val !== '') {
63867 return [val];
63868 }
63869 if (!Array.isArray(val)) {
63870 return [];
63871 }
63872 return val;
63873};
63874
63875/**
63876 * Convert the given `val` to a string by joining with `,`. Useful
63877 * for creating a cheerio/CSS/DOM-style selector from a list of strings.
63878 *
63879 * @param {any} `val`
63880 * @return {Array}
63881 * @api public
63882 */
63883
63884utils.stringify = function(val) {
63885 return utils.arrayify(val).join(',');
63886};
63887
63888/**
63889 * Ensure that the given value is a string and call `.trim()` on it,
63890 * or return an empty string.
63891 *
63892 * @param {String} `str`
63893 * @return {String}
63894 * @api public
63895 */
63896
63897utils.trim = function(str) {
63898 return typeof str === 'string' ? str.trim() : '';
63899};
63900
63901/**
63902 * Return true if val is an object
63903 */
63904
63905function isObject(val) {
63906 return typeOf(val) === 'object';
63907}
63908
63909/**
63910 * Return true if val is a string
63911 */
63912
63913function isString(val) {
63914 return typeof val === 'string';
63915}
63916
63917/**
63918 * Return true if val is a function
63919 */
63920
63921function isFunction(val) {
63922 return typeof val === 'function';
63923}
63924
63925/**
63926 * Return true if val is an array
63927 */
63928
63929function isArray(val) {
63930 return Array.isArray(val);
63931}
63932
63933/**
63934 * Shim to ensure the `.append` methods work with any version of snapdragon
63935 */
63936
63937function append(compiler, val, node) {
63938 if (typeof compiler.append !== 'function') {
63939 return compiler.emit(val, node);
63940 }
63941 return compiler.append(val, node);
63942}
63943
63944/**
63945 * Simplified assertion. Throws an error is `val` is falsey.
63946 */
63947
63948function assert(val, message) {
63949 if (!val) throw new Error(message);
63950}
63951
63952
63953/***/ }),
63954
63955/***/ 79285:
63956/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
63957
63958"use strict";
63959
63960
63961var Base = __webpack_require__(87263);
63962var define = __webpack_require__(5477);
63963var Compiler = __webpack_require__(33003);
63964var Parser = __webpack_require__(35573);
63965var utils = __webpack_require__(622);
63966var regexCache = {};
63967var cache = {};
63968
63969/**
63970 * Create a new instance of `Snapdragon` with the given `options`.
63971 *
63972 * ```js
63973 * var snapdragon = new Snapdragon();
63974 * ```
63975 *
63976 * @param {Object} `options`
63977 * @api public
63978 */
63979
63980function Snapdragon(options) {
63981 Base.call(this, null, options);
63982 this.options = utils.extend({source: 'string'}, this.options);
63983 this.compiler = new Compiler(this.options);
63984 this.parser = new Parser(this.options);
63985
63986 Object.defineProperty(this, 'compilers', {
63987 get: function() {
63988 return this.compiler.compilers;
63989 }
63990 });
63991
63992 Object.defineProperty(this, 'parsers', {
63993 get: function() {
63994 return this.parser.parsers;
63995 }
63996 });
63997
63998 Object.defineProperty(this, 'regex', {
63999 get: function() {
64000 return this.parser.regex;
64001 }
64002 });
64003}
64004
64005/**
64006 * Inherit Base
64007 */
64008
64009Base.extend(Snapdragon);
64010
64011/**
64012 * Add a parser to `snapdragon.parsers` for capturing the given `type` using
64013 * the specified regex or parser function. A function is useful if you need
64014 * to customize how the token is created and/or have access to the parser
64015 * instance to check options, etc.
64016 *
64017 * ```js
64018 * snapdragon
64019 * .capture('slash', /^\//)
64020 * .capture('dot', function() {
64021 * var pos = this.position();
64022 * var m = this.match(/^\./);
64023 * if (!m) return;
64024 * return pos({
64025 * type: 'dot',
64026 * val: m[0]
64027 * });
64028 * });
64029 * ```
64030 * @param {String} `type`
64031 * @param {RegExp|Function} `regex`
64032 * @return {Object} Returns the parser instance for chaining
64033 * @api public
64034 */
64035
64036Snapdragon.prototype.capture = function() {
64037 return this.parser.capture.apply(this.parser, arguments);
64038};
64039
64040/**
64041 * Register a plugin `fn`.
64042 *
64043 * ```js
64044 * var snapdragon = new Snapdgragon([options]);
64045 * snapdragon.use(function() {
64046 * console.log(this); //<= snapdragon instance
64047 * console.log(this.parser); //<= parser instance
64048 * console.log(this.compiler); //<= compiler instance
64049 * });
64050 * ```
64051 * @param {Object} `fn`
64052 * @api public
64053 */
64054
64055Snapdragon.prototype.use = function(fn) {
64056 fn.call(this, this);
64057 return this;
64058};
64059
64060/**
64061 * Parse the given `str`.
64062 *
64063 * ```js
64064 * var snapdragon = new Snapdgragon([options]);
64065 * // register parsers
64066 * snapdragon.parser.use(function() {});
64067 *
64068 * // parse
64069 * var ast = snapdragon.parse('foo/bar');
64070 * console.log(ast);
64071 * ```
64072 * @param {String} `str`
64073 * @param {Object} `options` Set `options.sourcemap` to true to enable source maps.
64074 * @return {Object} Returns an AST.
64075 * @api public
64076 */
64077
64078Snapdragon.prototype.parse = function(str, options) {
64079 this.options = utils.extend({}, this.options, options);
64080 var parsed = this.parser.parse(str, this.options);
64081
64082 // add non-enumerable parser reference
64083 define(parsed, 'parser', this.parser);
64084 return parsed;
64085};
64086
64087/**
64088 * Compile the given `AST`.
64089 *
64090 * ```js
64091 * var snapdragon = new Snapdgragon([options]);
64092 * // register plugins
64093 * snapdragon.use(function() {});
64094 * // register parser plugins
64095 * snapdragon.parser.use(function() {});
64096 * // register compiler plugins
64097 * snapdragon.compiler.use(function() {});
64098 *
64099 * // parse
64100 * var ast = snapdragon.parse('foo/bar');
64101 *
64102 * // compile
64103 * var res = snapdragon.compile(ast);
64104 * console.log(res.output);
64105 * ```
64106 * @param {Object} `ast`
64107 * @param {Object} `options`
64108 * @return {Object} Returns an object with an `output` property with the rendered string.
64109 * @api public
64110 */
64111
64112Snapdragon.prototype.compile = function(ast, options) {
64113 this.options = utils.extend({}, this.options, options);
64114 var compiled = this.compiler.compile(ast, this.options);
64115
64116 // add non-enumerable compiler reference
64117 define(compiled, 'compiler', this.compiler);
64118 return compiled;
64119};
64120
64121/**
64122 * Expose `Snapdragon`
64123 */
64124
64125module.exports = Snapdragon;
64126
64127/**
64128 * Expose `Parser` and `Compiler`
64129 */
64130
64131module.exports.Compiler = Compiler;
64132module.exports.Parser = Parser;
64133
64134
64135/***/ }),
64136
64137/***/ 33003:
64138/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
64139
64140"use strict";
64141
64142
64143var use = __webpack_require__(77709);
64144var define = __webpack_require__(5477);
64145var debug = __webpack_require__(31185)('snapdragon:compiler');
64146var utils = __webpack_require__(622);
64147
64148/**
64149 * Create a new `Compiler` with the given `options`.
64150 * @param {Object} `options`
64151 */
64152
64153function Compiler(options, state) {
64154 debug('initializing', __filename);
64155 this.options = utils.extend({source: 'string'}, options);
64156 this.state = state || {};
64157 this.compilers = {};
64158 this.output = '';
64159 this.set('eos', function(node) {
64160 return this.emit(node.val, node);
64161 });
64162 this.set('noop', function(node) {
64163 return this.emit(node.val, node);
64164 });
64165 this.set('bos', function(node) {
64166 return this.emit(node.val, node);
64167 });
64168 use(this);
64169}
64170
64171/**
64172 * Prototype methods
64173 */
64174
64175Compiler.prototype = {
64176
64177 /**
64178 * Throw an error message with details including the cursor position.
64179 * @param {String} `msg` Message to use in the Error.
64180 */
64181
64182 error: function(msg, node) {
64183 var pos = node.position || {start: {column: 0}};
64184 var message = this.options.source + ' column:' + pos.start.column + ': ' + msg;
64185
64186 var err = new Error(message);
64187 err.reason = msg;
64188 err.column = pos.start.column;
64189 err.source = this.pattern;
64190
64191 if (this.options.silent) {
64192 this.errors.push(err);
64193 } else {
64194 throw err;
64195 }
64196 },
64197
64198 /**
64199 * Define a non-enumberable property on the `Compiler` instance.
64200 *
64201 * ```js
64202 * compiler.define('foo', 'bar');
64203 * ```
64204 * @name .define
64205 * @param {String} `key` propery name
64206 * @param {any} `val` property value
64207 * @return {Object} Returns the Compiler instance for chaining.
64208 * @api public
64209 */
64210
64211 define: function(key, val) {
64212 define(this, key, val);
64213 return this;
64214 },
64215
64216 /**
64217 * Emit `node.val`
64218 */
64219
64220 emit: function(str, node) {
64221 this.output += str;
64222 return str;
64223 },
64224
64225 /**
64226 * Add a compiler `fn` with the given `name`
64227 */
64228
64229 set: function(name, fn) {
64230 this.compilers[name] = fn;
64231 return this;
64232 },
64233
64234 /**
64235 * Get compiler `name`.
64236 */
64237
64238 get: function(name) {
64239 return this.compilers[name];
64240 },
64241
64242 /**
64243 * Get the previous AST node.
64244 */
64245
64246 prev: function(n) {
64247 return this.ast.nodes[this.idx - (n || 1)] || { type: 'bos', val: '' };
64248 },
64249
64250 /**
64251 * Get the next AST node.
64252 */
64253
64254 next: function(n) {
64255 return this.ast.nodes[this.idx + (n || 1)] || { type: 'eos', val: '' };
64256 },
64257
64258 /**
64259 * Visit `node`.
64260 */
64261
64262 visit: function(node, nodes, i) {
64263 var fn = this.compilers[node.type];
64264 this.idx = i;
64265
64266 if (typeof fn !== 'function') {
64267 throw this.error('compiler "' + node.type + '" is not registered', node);
64268 }
64269 return fn.call(this, node, nodes, i);
64270 },
64271
64272 /**
64273 * Map visit over array of `nodes`.
64274 */
64275
64276 mapVisit: function(nodes) {
64277 if (!Array.isArray(nodes)) {
64278 throw new TypeError('expected an array');
64279 }
64280 var len = nodes.length;
64281 var idx = -1;
64282 while (++idx < len) {
64283 this.visit(nodes[idx], nodes, idx);
64284 }
64285 return this;
64286 },
64287
64288 /**
64289 * Compile `ast`.
64290 */
64291
64292 compile: function(ast, options) {
64293 var opts = utils.extend({}, this.options, options);
64294 this.ast = ast;
64295 this.parsingErrors = this.ast.errors;
64296 this.output = '';
64297
64298 // source map support
64299 if (opts.sourcemap) {
64300 var sourcemaps = __webpack_require__(59657);
64301 sourcemaps(this);
64302 this.mapVisit(this.ast.nodes);
64303 this.applySourceMaps();
64304 this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON();
64305 return this;
64306 }
64307
64308 this.mapVisit(this.ast.nodes);
64309 return this;
64310 }
64311};
64312
64313/**
64314 * Expose `Compiler`
64315 */
64316
64317module.exports = Compiler;
64318
64319
64320/***/ }),
64321
64322/***/ 35573:
64323/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
64324
64325"use strict";
64326
64327
64328var use = __webpack_require__(77709);
64329var util = __webpack_require__(31669);
64330var Cache = __webpack_require__(4337);
64331var define = __webpack_require__(5477);
64332var debug = __webpack_require__(31185)('snapdragon:parser');
64333var Position = __webpack_require__(7974);
64334var utils = __webpack_require__(622);
64335
64336/**
64337 * Create a new `Parser` with the given `input` and `options`.
64338 * @param {String} `input`
64339 * @param {Object} `options`
64340 * @api public
64341 */
64342
64343function Parser(options) {
64344 debug('initializing', __filename);
64345 this.options = utils.extend({source: 'string'}, options);
64346 this.init(this.options);
64347 use(this);
64348}
64349
64350/**
64351 * Prototype methods
64352 */
64353
64354Parser.prototype = {
64355 constructor: Parser,
64356
64357 init: function(options) {
64358 this.orig = '';
64359 this.input = '';
64360 this.parsed = '';
64361
64362 this.column = 1;
64363 this.line = 1;
64364
64365 this.regex = new Cache();
64366 this.errors = this.errors || [];
64367 this.parsers = this.parsers || {};
64368 this.types = this.types || [];
64369 this.sets = this.sets || {};
64370 this.fns = this.fns || [];
64371 this.currentType = 'root';
64372
64373 var pos = this.position();
64374 this.bos = pos({type: 'bos', val: ''});
64375
64376 this.ast = {
64377 type: 'root',
64378 errors: this.errors,
64379 nodes: [this.bos]
64380 };
64381
64382 define(this.bos, 'parent', this.ast);
64383 this.nodes = [this.ast];
64384
64385 this.count = 0;
64386 this.setCount = 0;
64387 this.stack = [];
64388 },
64389
64390 /**
64391 * Throw a formatted error with the cursor column and `msg`.
64392 * @param {String} `msg` Message to use in the Error.
64393 */
64394
64395 error: function(msg, node) {
64396 var pos = node.position || {start: {column: 0, line: 0}};
64397 var line = pos.start.line;
64398 var column = pos.start.column;
64399 var source = this.options.source;
64400
64401 var message = source + ' <line:' + line + ' column:' + column + '>: ' + msg;
64402 var err = new Error(message);
64403 err.source = source;
64404 err.reason = msg;
64405 err.pos = pos;
64406
64407 if (this.options.silent) {
64408 this.errors.push(err);
64409 } else {
64410 throw err;
64411 }
64412 },
64413
64414 /**
64415 * Define a non-enumberable property on the `Parser` instance.
64416 *
64417 * ```js
64418 * parser.define('foo', 'bar');
64419 * ```
64420 * @name .define
64421 * @param {String} `key` propery name
64422 * @param {any} `val` property value
64423 * @return {Object} Returns the Parser instance for chaining.
64424 * @api public
64425 */
64426
64427 define: function(key, val) {
64428 define(this, key, val);
64429 return this;
64430 },
64431
64432 /**
64433 * Mark position and patch `node.position`.
64434 */
64435
64436 position: function() {
64437 var start = { line: this.line, column: this.column };
64438 var self = this;
64439
64440 return function(node) {
64441 define(node, 'position', new Position(start, self));
64442 return node;
64443 };
64444 },
64445
64446 /**
64447 * Set parser `name` with the given `fn`
64448 * @param {String} `name`
64449 * @param {Function} `fn`
64450 * @api public
64451 */
64452
64453 set: function(type, fn) {
64454 if (this.types.indexOf(type) === -1) {
64455 this.types.push(type);
64456 }
64457 this.parsers[type] = fn.bind(this);
64458 return this;
64459 },
64460
64461 /**
64462 * Get parser `name`
64463 * @param {String} `name`
64464 * @api public
64465 */
64466
64467 get: function(name) {
64468 return this.parsers[name];
64469 },
64470
64471 /**
64472 * Push a `token` onto the `type` stack.
64473 *
64474 * @param {String} `type`
64475 * @return {Object} `token`
64476 * @api public
64477 */
64478
64479 push: function(type, token) {
64480 this.sets[type] = this.sets[type] || [];
64481 this.count++;
64482 this.stack.push(token);
64483 return this.sets[type].push(token);
64484 },
64485
64486 /**
64487 * Pop a token off of the `type` stack
64488 * @param {String} `type`
64489 * @returns {Object} Returns a token
64490 * @api public
64491 */
64492
64493 pop: function(type) {
64494 this.sets[type] = this.sets[type] || [];
64495 this.count--;
64496 this.stack.pop();
64497 return this.sets[type].pop();
64498 },
64499
64500 /**
64501 * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`.
64502 *
64503 * @param {String} `type`
64504 * @return {Boolean}
64505 * @api public
64506 */
64507
64508 isInside: function(type) {
64509 this.sets[type] = this.sets[type] || [];
64510 return this.sets[type].length > 0;
64511 },
64512
64513 /**
64514 * Return true if `node` is the given `type`.
64515 *
64516 * ```js
64517 * parser.isType(node, 'brace');
64518 * ```
64519 * @param {Object} `node`
64520 * @param {String} `type`
64521 * @return {Boolean}
64522 * @api public
64523 */
64524
64525 isType: function(node, type) {
64526 return node && node.type === type;
64527 },
64528
64529 /**
64530 * Get the previous AST node
64531 * @return {Object}
64532 */
64533
64534 prev: function(n) {
64535 return this.stack.length > 0
64536 ? utils.last(this.stack, n)
64537 : utils.last(this.nodes, n);
64538 },
64539
64540 /**
64541 * Update line and column based on `str`.
64542 */
64543
64544 consume: function(len) {
64545 this.input = this.input.substr(len);
64546 },
64547
64548 /**
64549 * Update column based on `str`.
64550 */
64551
64552 updatePosition: function(str, len) {
64553 var lines = str.match(/\n/g);
64554 if (lines) this.line += lines.length;
64555 var i = str.lastIndexOf('\n');
64556 this.column = ~i ? len - i : this.column + len;
64557 this.parsed += str;
64558 this.consume(len);
64559 },
64560
64561 /**
64562 * Match `regex`, return captures, and update the cursor position by `match[0]` length.
64563 * @param {RegExp} `regex`
64564 * @return {Object}
64565 */
64566
64567 match: function(regex) {
64568 var m = regex.exec(this.input);
64569 if (m) {
64570 this.updatePosition(m[0], m[0].length);
64571 return m;
64572 }
64573 },
64574
64575 /**
64576 * Capture `type` with the given regex.
64577 * @param {String} `type`
64578 * @param {RegExp} `regex`
64579 * @return {Function}
64580 */
64581
64582 capture: function(type, regex) {
64583 if (typeof regex === 'function') {
64584 return this.set.apply(this, arguments);
64585 }
64586
64587 this.regex.set(type, regex);
64588 this.set(type, function() {
64589 var parsed = this.parsed;
64590 var pos = this.position();
64591 var m = this.match(regex);
64592 if (!m || !m[0]) return;
64593
64594 var prev = this.prev();
64595 var node = pos({
64596 type: type,
64597 val: m[0],
64598 parsed: parsed,
64599 rest: this.input
64600 });
64601
64602 if (m[1]) {
64603 node.inner = m[1];
64604 }
64605
64606 define(node, 'inside', this.stack.length > 0);
64607 define(node, 'parent', prev);
64608 prev.nodes.push(node);
64609 }.bind(this));
64610 return this;
64611 },
64612
64613 /**
64614 * Create a parser with open and close for parens,
64615 * brackets or braces
64616 */
64617
64618 capturePair: function(type, openRegex, closeRegex, fn) {
64619 this.sets[type] = this.sets[type] || [];
64620
64621 /**
64622 * Open
64623 */
64624
64625 this.set(type + '.open', function() {
64626 var parsed = this.parsed;
64627 var pos = this.position();
64628 var m = this.match(openRegex);
64629 if (!m || !m[0]) return;
64630
64631 var val = m[0];
64632 this.setCount++;
64633 this.specialChars = true;
64634 var open = pos({
64635 type: type + '.open',
64636 val: val,
64637 rest: this.input
64638 });
64639
64640 if (typeof m[1] !== 'undefined') {
64641 open.inner = m[1];
64642 }
64643
64644 var prev = this.prev();
64645 var node = pos({
64646 type: type,
64647 nodes: [open]
64648 });
64649
64650 define(node, 'rest', this.input);
64651 define(node, 'parsed', parsed);
64652 define(node, 'prefix', m[1]);
64653 define(node, 'parent', prev);
64654 define(open, 'parent', node);
64655
64656 if (typeof fn === 'function') {
64657 fn.call(this, open, node);
64658 }
64659
64660 this.push(type, node);
64661 prev.nodes.push(node);
64662 });
64663
64664 /**
64665 * Close
64666 */
64667
64668 this.set(type + '.close', function() {
64669 var pos = this.position();
64670 var m = this.match(closeRegex);
64671 if (!m || !m[0]) return;
64672
64673 var parent = this.pop(type);
64674 var node = pos({
64675 type: type + '.close',
64676 rest: this.input,
64677 suffix: m[1],
64678 val: m[0]
64679 });
64680
64681 if (!this.isType(parent, type)) {
64682 if (this.options.strict) {
64683 throw new Error('missing opening "' + type + '"');
64684 }
64685
64686 this.setCount--;
64687 node.escaped = true;
64688 return node;
64689 }
64690
64691 if (node.suffix === '\\') {
64692 parent.escaped = true;
64693 node.escaped = true;
64694 }
64695
64696 parent.nodes.push(node);
64697 define(node, 'parent', parent);
64698 });
64699
64700 return this;
64701 },
64702
64703 /**
64704 * Capture end-of-string
64705 */
64706
64707 eos: function() {
64708 var pos = this.position();
64709 if (this.input) return;
64710 var prev = this.prev();
64711
64712 while (prev.type !== 'root' && !prev.visited) {
64713 if (this.options.strict === true) {
64714 throw new SyntaxError('invalid syntax:' + util.inspect(prev, null, 2));
64715 }
64716
64717 if (!hasDelims(prev)) {
64718 prev.parent.escaped = true;
64719 prev.escaped = true;
64720 }
64721
64722 visit(prev, function(node) {
64723 if (!hasDelims(node.parent)) {
64724 node.parent.escaped = true;
64725 node.escaped = true;
64726 }
64727 });
64728
64729 prev = prev.parent;
64730 }
64731
64732 var tok = pos({
64733 type: 'eos',
64734 val: this.append || ''
64735 });
64736
64737 define(tok, 'parent', this.ast);
64738 return tok;
64739 },
64740
64741 /**
64742 * Run parsers to advance the cursor position
64743 */
64744
64745 next: function() {
64746 var parsed = this.parsed;
64747 var len = this.types.length;
64748 var idx = -1;
64749 var tok;
64750
64751 while (++idx < len) {
64752 if ((tok = this.parsers[this.types[idx]].call(this))) {
64753 define(tok, 'rest', this.input);
64754 define(tok, 'parsed', parsed);
64755 this.last = tok;
64756 return tok;
64757 }
64758 }
64759 },
64760
64761 /**
64762 * Parse the given string.
64763 * @return {Array}
64764 */
64765
64766 parse: function(input) {
64767 if (typeof input !== 'string') {
64768 throw new TypeError('expected a string');
64769 }
64770
64771 this.init(this.options);
64772 this.orig = input;
64773 this.input = input;
64774 var self = this;
64775
64776 function parse() {
64777 // check input before calling `.next()`
64778 input = self.input;
64779
64780 // get the next AST ndoe
64781 var node = self.next();
64782 if (node) {
64783 var prev = self.prev();
64784 if (prev) {
64785 define(node, 'parent', prev);
64786 if (prev.nodes) {
64787 prev.nodes.push(node);
64788 }
64789 }
64790
64791 if (self.sets.hasOwnProperty(prev.type)) {
64792 self.currentType = prev.type;
64793 }
64794 }
64795
64796 // if we got here but input is not changed, throw an error
64797 if (self.input && input === self.input) {
64798 throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
64799 }
64800 }
64801
64802 while (this.input) parse();
64803 if (this.stack.length && this.options.strict) {
64804 var node = this.stack.pop();
64805 throw this.error('missing opening ' + node.type + ': "' + this.orig + '"');
64806 }
64807
64808 var eos = this.eos();
64809 var tok = this.prev();
64810 if (tok.type !== 'eos') {
64811 this.ast.nodes.push(eos);
64812 }
64813
64814 return this.ast;
64815 }
64816};
64817
64818/**
64819 * Visit `node` with the given `fn`
64820 */
64821
64822function visit(node, fn) {
64823 if (!node.visited) {
64824 define(node, 'visited', true);
64825 return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
64826 }
64827 return node;
64828}
64829
64830/**
64831 * Map visit over array of `nodes`.
64832 */
64833
64834function mapVisit(nodes, fn) {
64835 var len = nodes.length;
64836 var idx = -1;
64837 while (++idx < len) {
64838 visit(nodes[idx], fn);
64839 }
64840}
64841
64842function hasOpen(node) {
64843 return node.nodes && node.nodes[0].type === (node.type + '.open');
64844}
64845
64846function hasClose(node) {
64847 return node.nodes && utils.last(node.nodes).type === (node.type + '.close');
64848}
64849
64850function hasDelims(node) {
64851 return hasOpen(node) && hasClose(node);
64852}
64853
64854/**
64855 * Expose `Parser`
64856 */
64857
64858module.exports = Parser;
64859
64860
64861/***/ }),
64862
64863/***/ 7974:
64864/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
64865
64866"use strict";
64867
64868
64869var define = __webpack_require__(5477);
64870
64871/**
64872 * Store position for a node
64873 */
64874
64875module.exports = function Position(start, parser) {
64876 this.start = start;
64877 this.end = { line: parser.line, column: parser.column };
64878 define(this, 'content', parser.orig);
64879 define(this, 'source', parser.options.source);
64880};
64881
64882
64883/***/ }),
64884
64885/***/ 59657:
64886/***/ (function(module, exports, __webpack_require__) {
64887
64888"use strict";
64889
64890
64891var fs = __webpack_require__(35747);
64892var path = __webpack_require__(85622);
64893var define = __webpack_require__(5477);
64894var utils = __webpack_require__(622);
64895
64896/**
64897 * Expose `mixin()`.
64898 * This code is based on `source-maps-support.js` in reworkcss/css
64899 * https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js
64900 * Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
64901 */
64902
64903module.exports = mixin;
64904
64905/**
64906 * Mixin source map support into `compiler`.
64907 *
64908 * @param {Object} `compiler`
64909 * @api public
64910 */
64911
64912function mixin(compiler) {
64913 define(compiler, '_comment', compiler.comment);
64914 compiler.map = new utils.SourceMap.SourceMapGenerator();
64915 compiler.position = { line: 1, column: 1 };
64916 compiler.content = {};
64917 compiler.files = {};
64918
64919 for (var key in exports) {
64920 define(compiler, key, exports[key]);
64921 }
64922}
64923
64924/**
64925 * Update position.
64926 *
64927 * @param {String} str
64928 */
64929
64930exports.updatePosition = function(str) {
64931 var lines = str.match(/\n/g);
64932 if (lines) this.position.line += lines.length;
64933 var i = str.lastIndexOf('\n');
64934 this.position.column = ~i ? str.length - i : this.position.column + str.length;
64935};
64936
64937/**
64938 * Emit `str` with `position`.
64939 *
64940 * @param {String} str
64941 * @param {Object} [pos]
64942 * @return {String}
64943 */
64944
64945exports.emit = function(str, node) {
64946 var position = node.position || {};
64947 var source = position.source;
64948 if (source) {
64949 if (position.filepath) {
64950 source = utils.unixify(position.filepath);
64951 }
64952
64953 this.map.addMapping({
64954 source: source,
64955 generated: {
64956 line: this.position.line,
64957 column: Math.max(this.position.column - 1, 0)
64958 },
64959 original: {
64960 line: position.start.line,
64961 column: position.start.column - 1
64962 }
64963 });
64964
64965 if (position.content) {
64966 this.addContent(source, position);
64967 }
64968 if (position.filepath) {
64969 this.addFile(source, position);
64970 }
64971
64972 this.updatePosition(str);
64973 this.output += str;
64974 }
64975 return str;
64976};
64977
64978/**
64979 * Adds a file to the source map output if it has not already been added
64980 * @param {String} `file`
64981 * @param {Object} `pos`
64982 */
64983
64984exports.addFile = function(file, position) {
64985 if (typeof position.content !== 'string') return;
64986 if (Object.prototype.hasOwnProperty.call(this.files, file)) return;
64987 this.files[file] = position.content;
64988};
64989
64990/**
64991 * Adds a content source to the source map output if it has not already been added
64992 * @param {String} `source`
64993 * @param {Object} `position`
64994 */
64995
64996exports.addContent = function(source, position) {
64997 if (typeof position.content !== 'string') return;
64998 if (Object.prototype.hasOwnProperty.call(this.content, source)) return;
64999 this.map.setSourceContent(source, position.content);
65000};
65001
65002/**
65003 * Applies any original source maps to the output and embeds the source file
65004 * contents in the source map.
65005 */
65006
65007exports.applySourceMaps = function() {
65008 Object.keys(this.files).forEach(function(file) {
65009 var content = this.files[file];
65010 this.map.setSourceContent(file, content);
65011
65012 if (this.options.inputSourcemaps === true) {
65013 var originalMap = utils.sourceMapResolve.resolveSync(content, file, fs.readFileSync);
65014 if (originalMap) {
65015 var map = new utils.SourceMap.SourceMapConsumer(originalMap.map);
65016 var relativeTo = originalMap.sourcesRelativeTo;
65017 this.map.applySourceMap(map, file, utils.unixify(path.dirname(relativeTo)));
65018 }
65019 }
65020 }, this);
65021};
65022
65023/**
65024 * Process comments, drops sourceMap comments.
65025 * @param {Object} node
65026 */
65027
65028exports.comment = function(node) {
65029 if (/^# sourceMappingURL=/.test(node.comment)) {
65030 return this.emit('', node.position);
65031 }
65032 return this._comment(node);
65033};
65034
65035
65036/***/ }),
65037
65038/***/ 622:
65039/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
65040
65041"use strict";
65042
65043
65044/**
65045 * Module dependencies
65046 */
65047
65048exports.extend = __webpack_require__(28727);
65049exports.SourceMap = __webpack_require__(96241);
65050exports.sourceMapResolve = __webpack_require__(10227);
65051
65052/**
65053 * Convert backslash in the given string to forward slashes
65054 */
65055
65056exports.unixify = function(fp) {
65057 return fp.split(/\\+/).join('/');
65058};
65059
65060/**
65061 * Return true if `val` is a non-empty string
65062 *
65063 * @param {String} `str`
65064 * @return {Boolean}
65065 */
65066
65067exports.isString = function(str) {
65068 return str && typeof str === 'string';
65069};
65070
65071/**
65072 * Cast `val` to an array
65073 * @return {Array}
65074 */
65075
65076exports.arrayify = function(val) {
65077 if (typeof val === 'string') return [val];
65078 return val ? (Array.isArray(val) ? val : [val]) : [];
65079};
65080
65081/**
65082 * Get the last `n` element from the given `array`
65083 * @param {Array} `array`
65084 * @return {*}
65085 */
65086
65087exports.last = function(arr, n) {
65088 return arr[arr.length - (n || 1)];
65089};
65090
65091
65092/***/ }),
65093
65094/***/ 56609:
65095/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65096
65097var decodeUriComponent = __webpack_require__(95748)
65098
65099function customDecodeUriComponent(string) {
65100 // `decodeUriComponent` turns `+` into ` `, but that's not wanted.
65101 return decodeUriComponent(string.replace(/\+/g, "%2B"))
65102}
65103
65104module.exports = customDecodeUriComponent
65105
65106
65107/***/ }),
65108
65109/***/ 89825:
65110/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65111
65112var url = __webpack_require__(78835)
65113
65114function resolveUrl(/* ...urls */) {
65115 return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) {
65116 return url.resolve(resolved, nextUrl)
65117 })
65118}
65119
65120module.exports = resolveUrl
65121
65122
65123/***/ }),
65124
65125/***/ 10227:
65126/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65127
65128var sourceMappingURL = __webpack_require__(21707)
65129
65130var resolveUrl = __webpack_require__(89825)
65131var decodeUriComponent = __webpack_require__(56609)
65132var urix = __webpack_require__(67806)
65133var atob = __webpack_require__(83327)
65134
65135
65136
65137function callbackAsync(callback, error, result) {
65138 setImmediate(function() { callback(error, result) })
65139}
65140
65141function parseMapToJSON(string, data) {
65142 try {
65143 return JSON.parse(string.replace(/^\)\]\}'/, ""))
65144 } catch (error) {
65145 error.sourceMapData = data
65146 throw error
65147 }
65148}
65149
65150function readSync(read, url, data) {
65151 var readUrl = decodeUriComponent(url)
65152 try {
65153 return String(read(readUrl))
65154 } catch (error) {
65155 error.sourceMapData = data
65156 throw error
65157 }
65158}
65159
65160
65161
65162function resolveSourceMap(code, codeUrl, read, callback) {
65163 var mapData
65164 try {
65165 mapData = resolveSourceMapHelper(code, codeUrl)
65166 } catch (error) {
65167 return callbackAsync(callback, error)
65168 }
65169 if (!mapData || mapData.map) {
65170 return callbackAsync(callback, null, mapData)
65171 }
65172 var readUrl = decodeUriComponent(mapData.url)
65173 read(readUrl, function(error, result) {
65174 if (error) {
65175 error.sourceMapData = mapData
65176 return callback(error)
65177 }
65178 mapData.map = String(result)
65179 try {
65180 mapData.map = parseMapToJSON(mapData.map, mapData)
65181 } catch (error) {
65182 return callback(error)
65183 }
65184 callback(null, mapData)
65185 })
65186}
65187
65188function resolveSourceMapSync(code, codeUrl, read) {
65189 var mapData = resolveSourceMapHelper(code, codeUrl)
65190 if (!mapData || mapData.map) {
65191 return mapData
65192 }
65193 mapData.map = readSync(read, mapData.url, mapData)
65194 mapData.map = parseMapToJSON(mapData.map, mapData)
65195 return mapData
65196}
65197
65198var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/
65199
65200/**
65201 * The media type for JSON text is application/json.
65202 *
65203 * {@link https://tools.ietf.org/html/rfc8259#section-11 | IANA Considerations }
65204 *
65205 * `text/json` is non-standard media type
65206 */
65207var jsonMimeTypeRegex = /^(?:application|text)\/json$/
65208
65209/**
65210 * JSON text exchanged between systems that are not part of a closed ecosystem
65211 * MUST be encoded using UTF-8.
65212 *
65213 * {@link https://tools.ietf.org/html/rfc8259#section-8.1 | Character Encoding}
65214 */
65215var jsonCharacterEncoding = "utf-8"
65216
65217function base64ToBuf(b64) {
65218 var binStr = atob(b64)
65219 var len = binStr.length
65220 var arr = new Uint8Array(len)
65221 for (var i = 0; i < len; i++) {
65222 arr[i] = binStr.charCodeAt(i)
65223 }
65224 return arr
65225}
65226
65227function decodeBase64String(b64) {
65228 if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") {
65229 return atob(b64)
65230 }
65231 var buf = base64ToBuf(b64);
65232 // Note: `decoder.decode` method will throw a `DOMException` with the
65233 // `"EncodingError"` value when an coding error is found.
65234 var decoder = new TextDecoder(jsonCharacterEncoding, {fatal: true})
65235 return decoder.decode(buf);
65236}
65237
65238function resolveSourceMapHelper(code, codeUrl) {
65239 codeUrl = urix(codeUrl)
65240
65241 var url = sourceMappingURL.getFrom(code)
65242 if (!url) {
65243 return null
65244 }
65245
65246 var dataUri = url.match(dataUriRegex)
65247 if (dataUri) {
65248 var mimeType = dataUri[1] || "text/plain"
65249 var lastParameter = dataUri[2] || ""
65250 var encoded = dataUri[3] || ""
65251 var data = {
65252 sourceMappingURL: url,
65253 url: null,
65254 sourcesRelativeTo: codeUrl,
65255 map: encoded
65256 }
65257 if (!jsonMimeTypeRegex.test(mimeType)) {
65258 var error = new Error("Unuseful data uri mime type: " + mimeType)
65259 error.sourceMapData = data
65260 throw error
65261 }
65262 try {
65263 data.map = parseMapToJSON(
65264 lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded),
65265 data
65266 )
65267 } catch (error) {
65268 error.sourceMapData = data
65269 throw error
65270 }
65271 return data
65272 }
65273
65274 var mapUrl = resolveUrl(codeUrl, url)
65275 return {
65276 sourceMappingURL: url,
65277 url: mapUrl,
65278 sourcesRelativeTo: mapUrl,
65279 map: null
65280 }
65281}
65282
65283
65284
65285function resolveSources(map, mapUrl, read, options, callback) {
65286 if (typeof options === "function") {
65287 callback = options
65288 options = {}
65289 }
65290 var pending = map.sources ? map.sources.length : 0
65291 var result = {
65292 sourcesResolved: [],
65293 sourcesContent: []
65294 }
65295
65296 if (pending === 0) {
65297 callbackAsync(callback, null, result)
65298 return
65299 }
65300
65301 var done = function() {
65302 pending--
65303 if (pending === 0) {
65304 callback(null, result)
65305 }
65306 }
65307
65308 resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) {
65309 result.sourcesResolved[index] = fullUrl
65310 if (typeof sourceContent === "string") {
65311 result.sourcesContent[index] = sourceContent
65312 callbackAsync(done, null)
65313 } else {
65314 var readUrl = decodeUriComponent(fullUrl)
65315 read(readUrl, function(error, source) {
65316 result.sourcesContent[index] = error ? error : String(source)
65317 done()
65318 })
65319 }
65320 })
65321}
65322
65323function resolveSourcesSync(map, mapUrl, read, options) {
65324 var result = {
65325 sourcesResolved: [],
65326 sourcesContent: []
65327 }
65328
65329 if (!map.sources || map.sources.length === 0) {
65330 return result
65331 }
65332
65333 resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) {
65334 result.sourcesResolved[index] = fullUrl
65335 if (read !== null) {
65336 if (typeof sourceContent === "string") {
65337 result.sourcesContent[index] = sourceContent
65338 } else {
65339 var readUrl = decodeUriComponent(fullUrl)
65340 try {
65341 result.sourcesContent[index] = String(read(readUrl))
65342 } catch (error) {
65343 result.sourcesContent[index] = error
65344 }
65345 }
65346 }
65347 })
65348
65349 return result
65350}
65351
65352var endingSlash = /\/?$/
65353
65354function resolveSourcesHelper(map, mapUrl, options, fn) {
65355 options = options || {}
65356 mapUrl = urix(mapUrl)
65357 var fullUrl
65358 var sourceContent
65359 var sourceRoot
65360 for (var index = 0, len = map.sources.length; index < len; index++) {
65361 sourceRoot = null
65362 if (typeof options.sourceRoot === "string") {
65363 sourceRoot = options.sourceRoot
65364 } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) {
65365 sourceRoot = map.sourceRoot
65366 }
65367 // If the sourceRoot is the empty string, it is equivalent to not setting
65368 // the property at all.
65369 if (sourceRoot === null || sourceRoot === '') {
65370 fullUrl = resolveUrl(mapUrl, map.sources[index])
65371 } else {
65372 // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes
65373 // `/scripts/subdir/<source>`, not `/scripts/<source>`. Pointing to a file as source root
65374 // does not make sense.
65375 fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index])
65376 }
65377 sourceContent = (map.sourcesContent || [])[index]
65378 fn(fullUrl, sourceContent, index)
65379 }
65380}
65381
65382
65383
65384function resolve(code, codeUrl, read, options, callback) {
65385 if (typeof options === "function") {
65386 callback = options
65387 options = {}
65388 }
65389 if (code === null) {
65390 var mapUrl = codeUrl
65391 var data = {
65392 sourceMappingURL: null,
65393 url: mapUrl,
65394 sourcesRelativeTo: mapUrl,
65395 map: null
65396 }
65397 var readUrl = decodeUriComponent(mapUrl)
65398 read(readUrl, function(error, result) {
65399 if (error) {
65400 error.sourceMapData = data
65401 return callback(error)
65402 }
65403 data.map = String(result)
65404 try {
65405 data.map = parseMapToJSON(data.map, data)
65406 } catch (error) {
65407 return callback(error)
65408 }
65409 _resolveSources(data)
65410 })
65411 } else {
65412 resolveSourceMap(code, codeUrl, read, function(error, mapData) {
65413 if (error) {
65414 return callback(error)
65415 }
65416 if (!mapData) {
65417 return callback(null, null)
65418 }
65419 _resolveSources(mapData)
65420 })
65421 }
65422
65423 function _resolveSources(mapData) {
65424 resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function(error, result) {
65425 if (error) {
65426 return callback(error)
65427 }
65428 mapData.sourcesResolved = result.sourcesResolved
65429 mapData.sourcesContent = result.sourcesContent
65430 callback(null, mapData)
65431 })
65432 }
65433}
65434
65435function resolveSync(code, codeUrl, read, options) {
65436 var mapData
65437 if (code === null) {
65438 var mapUrl = codeUrl
65439 mapData = {
65440 sourceMappingURL: null,
65441 url: mapUrl,
65442 sourcesRelativeTo: mapUrl,
65443 map: null
65444 }
65445 mapData.map = readSync(read, mapUrl, mapData)
65446 mapData.map = parseMapToJSON(mapData.map, mapData)
65447 } else {
65448 mapData = resolveSourceMapSync(code, codeUrl, read)
65449 if (!mapData) {
65450 return null
65451 }
65452 }
65453 var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options)
65454 mapData.sourcesResolved = result.sourcesResolved
65455 mapData.sourcesContent = result.sourcesContent
65456 return mapData
65457}
65458
65459
65460
65461module.exports = {
65462 resolveSourceMap: resolveSourceMap,
65463 resolveSourceMapSync: resolveSourceMapSync,
65464 resolveSources: resolveSources,
65465 resolveSourcesSync: resolveSourcesSync,
65466 resolve: resolve,
65467 resolveSync: resolveSync,
65468 parseMapToJSON: parseMapToJSON
65469}
65470
65471
65472/***/ }),
65473
65474/***/ 21707:
65475/***/ (function(module) {
65476
65477// Copyright 2014 Simon Lydell
65478// X11 (“MIT”) Licensed. (See LICENSE.)
65479
65480void (function(root, factory) {
65481 if (typeof define === "function" && define.amd) {
65482 define(factory)
65483 } else if (true) {
65484 module.exports = factory()
65485 } else {}
65486}(this, function() {
65487
65488 var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/
65489
65490 var regex = RegExp(
65491 "(?:" +
65492 "/\\*" +
65493 "(?:\\s*\r?\n(?://)?)?" +
65494 "(?:" + innerRegex.source + ")" +
65495 "\\s*" +
65496 "\\*/" +
65497 "|" +
65498 "//(?:" + innerRegex.source + ")" +
65499 ")" +
65500 "\\s*"
65501 )
65502
65503 return {
65504
65505 regex: regex,
65506 _innerRegex: innerRegex,
65507
65508 getFrom: function(code) {
65509 var match = code.match(regex)
65510 return (match ? match[1] || match[2] || "" : null)
65511 },
65512
65513 existsIn: function(code) {
65514 return regex.test(code)
65515 },
65516
65517 removeFrom: function(code) {
65518 return code.replace(regex, "")
65519 },
65520
65521 insertBefore: function(code, string) {
65522 var match = code.match(regex)
65523 if (match) {
65524 return code.slice(0, match.index) + string + code.slice(match.index)
65525 } else {
65526 return code + string
65527 }
65528 }
65529 }
65530
65531}));
65532
65533
65534/***/ }),
65535
65536/***/ 33218:
65537/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65538
65539"use strict";
65540/*!
65541 * split-string <https://github.com/jonschlinkert/split-string>
65542 *
65543 * Copyright (c) 2015-2017, Jon Schlinkert.
65544 * Released under the MIT License.
65545 */
65546
65547
65548
65549var extend = __webpack_require__(66889);
65550
65551module.exports = function(str, options, fn) {
65552 if (typeof str !== 'string') {
65553 throw new TypeError('expected a string');
65554 }
65555
65556 if (typeof options === 'function') {
65557 fn = options;
65558 options = null;
65559 }
65560
65561 // allow separator to be defined as a string
65562 if (typeof options === 'string') {
65563 options = { sep: options };
65564 }
65565
65566 var opts = extend({sep: '.'}, options);
65567 var quotes = opts.quotes || ['"', "'", '`'];
65568 var brackets;
65569
65570 if (opts.brackets === true) {
65571 brackets = {
65572 '<': '>',
65573 '(': ')',
65574 '[': ']',
65575 '{': '}'
65576 };
65577 } else if (opts.brackets) {
65578 brackets = opts.brackets;
65579 }
65580
65581 var tokens = [];
65582 var stack = [];
65583 var arr = [''];
65584 var sep = opts.sep;
65585 var len = str.length;
65586 var idx = -1;
65587 var closeIdx;
65588
65589 function expected() {
65590 if (brackets && stack.length) {
65591 return brackets[stack[stack.length - 1]];
65592 }
65593 }
65594
65595 while (++idx < len) {
65596 var ch = str[idx];
65597 var next = str[idx + 1];
65598 var tok = { val: ch, idx: idx, arr: arr, str: str };
65599 tokens.push(tok);
65600
65601 if (ch === '\\') {
65602 tok.val = keepEscaping(opts, str, idx) === true ? (ch + next) : next;
65603 tok.escaped = true;
65604 if (typeof fn === 'function') {
65605 fn(tok);
65606 }
65607 arr[arr.length - 1] += tok.val;
65608 idx++;
65609 continue;
65610 }
65611
65612 if (brackets && brackets[ch]) {
65613 stack.push(ch);
65614 var e = expected();
65615 var i = idx + 1;
65616
65617 if (str.indexOf(e, i + 1) !== -1) {
65618 while (stack.length && i < len) {
65619 var s = str[++i];
65620 if (s === '\\') {
65621 s++;
65622 continue;
65623 }
65624
65625 if (quotes.indexOf(s) !== -1) {
65626 i = getClosingQuote(str, s, i + 1);
65627 continue;
65628 }
65629
65630 e = expected();
65631 if (stack.length && str.indexOf(e, i + 1) === -1) {
65632 break;
65633 }
65634
65635 if (brackets[s]) {
65636 stack.push(s);
65637 continue;
65638 }
65639
65640 if (e === s) {
65641 stack.pop();
65642 }
65643 }
65644 }
65645
65646 closeIdx = i;
65647 if (closeIdx === -1) {
65648 arr[arr.length - 1] += ch;
65649 continue;
65650 }
65651
65652 ch = str.slice(idx, closeIdx + 1);
65653 tok.val = ch;
65654 tok.idx = idx = closeIdx;
65655 }
65656
65657 if (quotes.indexOf(ch) !== -1) {
65658 closeIdx = getClosingQuote(str, ch, idx + 1);
65659 if (closeIdx === -1) {
65660 arr[arr.length - 1] += ch;
65661 continue;
65662 }
65663
65664 if (keepQuotes(ch, opts) === true) {
65665 ch = str.slice(idx, closeIdx + 1);
65666 } else {
65667 ch = str.slice(idx + 1, closeIdx);
65668 }
65669
65670 tok.val = ch;
65671 tok.idx = idx = closeIdx;
65672 }
65673
65674 if (typeof fn === 'function') {
65675 fn(tok, tokens);
65676 ch = tok.val;
65677 idx = tok.idx;
65678 }
65679
65680 if (tok.val === sep && tok.split !== false) {
65681 arr.push('');
65682 continue;
65683 }
65684
65685 arr[arr.length - 1] += tok.val;
65686 }
65687
65688 return arr;
65689};
65690
65691function getClosingQuote(str, ch, i, brackets) {
65692 var idx = str.indexOf(ch, i);
65693 if (str.charAt(idx - 1) === '\\') {
65694 return getClosingQuote(str, ch, idx + 1);
65695 }
65696 return idx;
65697}
65698
65699function keepQuotes(ch, opts) {
65700 if (opts.keepDoubleQuotes === true && ch === '"') return true;
65701 if (opts.keepSingleQuotes === true && ch === "'") return true;
65702 return opts.keepQuotes;
65703}
65704
65705function keepEscaping(opts, str, idx) {
65706 if (typeof opts.keepEscaping === 'function') {
65707 return opts.keepEscaping(str, idx);
65708 }
65709 return opts.keepEscaping === true || str[idx + 1] === '\\';
65710}
65711
65712
65713/***/ }),
65714
65715/***/ 66889:
65716/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65717
65718"use strict";
65719
65720
65721var isExtendable = __webpack_require__(28730);
65722var assignSymbols = __webpack_require__(64353);
65723
65724module.exports = Object.assign || function(obj/*, objects*/) {
65725 if (obj === null || typeof obj === 'undefined') {
65726 throw new TypeError('Cannot convert undefined or null to object');
65727 }
65728 if (!isObject(obj)) {
65729 obj = {};
65730 }
65731 for (var i = 1; i < arguments.length; i++) {
65732 var val = arguments[i];
65733 if (isString(val)) {
65734 val = toObject(val);
65735 }
65736 if (isObject(val)) {
65737 assign(obj, val);
65738 assignSymbols(obj, val);
65739 }
65740 }
65741 return obj;
65742};
65743
65744function assign(a, b) {
65745 for (var key in b) {
65746 if (hasOwn(b, key)) {
65747 a[key] = b[key];
65748 }
65749 }
65750}
65751
65752function isString(val) {
65753 return (val && typeof val === 'string');
65754}
65755
65756function toObject(str) {
65757 var obj = {};
65758 for (var i in str) {
65759 obj[i] = str[i];
65760 }
65761 return obj;
65762}
65763
65764function isObject(val) {
65765 return (val && typeof val === 'object') || isExtendable(val);
65766}
65767
65768/**
65769 * Returns true if the given `key` is an own property of `obj`.
65770 */
65771
65772function hasOwn(obj, key) {
65773 return Object.prototype.hasOwnProperty.call(obj, key);
65774}
65775
65776function isEnum(obj, key) {
65777 return Object.prototype.propertyIsEnumerable.call(obj, key);
65778}
65779
65780
65781/***/ }),
65782
65783/***/ 28730:
65784/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65785
65786"use strict";
65787/*!
65788 * is-extendable <https://github.com/jonschlinkert/is-extendable>
65789 *
65790 * Copyright (c) 2015-2017, Jon Schlinkert.
65791 * Released under the MIT License.
65792 */
65793
65794
65795
65796var isPlainObject = __webpack_require__(81064);
65797
65798module.exports = function isExtendable(val) {
65799 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
65800};
65801
65802
65803/***/ }),
65804
65805/***/ 69457:
65806/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
65807
65808"use strict";
65809/*!
65810 * static-extend <https://github.com/jonschlinkert/static-extend>
65811 *
65812 * Copyright (c) 2016, Jon Schlinkert.
65813 * Licensed under the MIT License.
65814 */
65815
65816
65817
65818var copy = __webpack_require__(31368);
65819var define = __webpack_require__(5477);
65820var util = __webpack_require__(31669);
65821
65822/**
65823 * Returns a function for extending the static properties,
65824 * prototype properties, and descriptors from the `Parent`
65825 * constructor onto `Child` constructors.
65826 *
65827 * ```js
65828 * var extend = require('static-extend');
65829 * Parent.extend = extend(Parent);
65830 *
65831 * // optionally pass a custom merge function as the second arg
65832 * Parent.extend = extend(Parent, function(Child) {
65833 * Child.prototype.mixin = function(key, val) {
65834 * Child.prototype[key] = val;
65835 * };
65836 * });
65837 *
65838 * // extend "child" constructors
65839 * Parent.extend(Child);
65840 *
65841 * // optionally define prototype methods as the second arg
65842 * Parent.extend(Child, {
65843 * foo: function() {},
65844 * bar: function() {}
65845 * });
65846 * ```
65847 * @param {Function} `Parent` Parent ctor
65848 * @param {Function} `extendFn` Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype.
65849 * @param {Function} `Child` Child ctor
65850 * @param {Object} `proto` Optionally pass additional prototype properties to inherit.
65851 * @return {Object}
65852 * @api public
65853 */
65854
65855function extend(Parent, extendFn) {
65856 if (typeof Parent !== 'function') {
65857 throw new TypeError('expected Parent to be a function.');
65858 }
65859
65860 return function(Ctor, proto) {
65861 if (typeof Ctor !== 'function') {
65862 throw new TypeError('expected Ctor to be a function.');
65863 }
65864
65865 util.inherits(Ctor, Parent);
65866 copy(Ctor, Parent);
65867
65868 // proto can be null or a plain object
65869 if (typeof proto === 'object') {
65870 var obj = Object.create(proto);
65871
65872 for (var k in obj) {
65873 Ctor.prototype[k] = obj[k];
65874 }
65875 }
65876
65877 // keep a reference to the parent prototype
65878 define(Ctor.prototype, '_parent_', {
65879 configurable: true,
65880 set: function() {},
65881 get: function() {
65882 return Parent.prototype;
65883 }
65884 });
65885
65886 if (typeof extendFn === 'function') {
65887 extendFn(Ctor, Parent);
65888 }
65889
65890 Ctor.extend = extend(Ctor, extendFn);
65891 };
65892};
65893
65894/**
65895 * Expose `extend`
65896 */
65897
65898module.exports = extend;
65899
65900
65901/***/ }),
65902
65903/***/ 16326:
65904/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
65905
65906"use strict";
65907
65908
65909Object.defineProperty(exports, "__esModule", ({
65910 value: true
65911}));
65912exports.default = void 0;
65913
65914var _os = _interopRequireDefault(__webpack_require__(12087));
65915
65916var _cacache = _interopRequireDefault(__webpack_require__(36801));
65917
65918var _findCacheDir = _interopRequireDefault(__webpack_require__(61844));
65919
65920var _workerFarm = _interopRequireDefault(__webpack_require__(18921));
65921
65922var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841));
65923
65924var _isWsl = _interopRequireDefault(__webpack_require__(47543));
65925
65926var _minify = _interopRequireDefault(__webpack_require__(30787));
65927
65928function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65929
65930const worker = __webpack_require__.ab + "worker.js";
65931
65932class TaskRunner {
65933 constructor(options = {}) {
65934 const {
65935 cache,
65936 parallel
65937 } = options;
65938 this.cacheDir = cache === true ? (0, _findCacheDir.default)({
65939 name: 'terser-webpack-plugin'
65940 }) || _os.default.tmpdir() : cache; // In some cases cpus() returns undefined
65941 // https://github.com/nodejs/node/issues/19022
65942
65943 const cpus = _os.default.cpus() || {
65944 length: 1
65945 }; // WSL sometimes freezes, error seems to be on the WSL side
65946 // https://github.com/webpack-contrib/terser-webpack-plugin/issues/21
65947
65948 this.maxConcurrentWorkers = _isWsl.default ? 1 : parallel === true ? cpus.length - 1 : Math.min(Number(parallel) || 0, cpus.length - 1);
65949 }
65950
65951 run(tasks, callback) {
65952 /* istanbul ignore if */
65953 if (!tasks.length) {
65954 callback(null, []);
65955 return;
65956 }
65957
65958 if (this.maxConcurrentWorkers > 1) {
65959 const workerOptions = process.platform === 'win32' ? {
65960 maxConcurrentWorkers: this.maxConcurrentWorkers,
65961 maxConcurrentCallsPerWorker: 1
65962 } : {
65963 maxConcurrentWorkers: this.maxConcurrentWorkers
65964 };
65965 this.workers = (0, _workerFarm.default)(workerOptions, __webpack_require__.ab + "worker.js");
65966
65967 this.boundWorkers = (options, cb) => {
65968 try {
65969 this.workers((0, _serializeJavascript.default)(options), cb);
65970 } catch (error) {
65971 // worker-farm can fail with ENOMEM or something else
65972 cb(error);
65973 }
65974 };
65975 } else {
65976 this.boundWorkers = (options, cb) => {
65977 try {
65978 cb(null, (0, _minify.default)(options));
65979 } catch (error) {
65980 cb(error);
65981 }
65982 };
65983 }
65984
65985 let toRun = tasks.length;
65986 const results = [];
65987
65988 const step = (index, data) => {
65989 toRun -= 1;
65990 results[index] = data;
65991
65992 if (!toRun) {
65993 callback(null, results);
65994 }
65995 };
65996
65997 tasks.forEach((task, index) => {
65998 const enqueue = () => {
65999 this.boundWorkers(task, (error, data) => {
66000 const result = error ? {
66001 error
66002 } : data;
66003
66004 const done = () => step(index, result);
66005
66006 if (this.cacheDir && !result.error) {
66007 _cacache.default.put(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys), JSON.stringify(data)).then(done, done);
66008 } else {
66009 done();
66010 }
66011 });
66012 };
66013
66014 if (this.cacheDir) {
66015 _cacache.default.get(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys)).then(({
66016 data
66017 }) => step(index, JSON.parse(data)), enqueue);
66018 } else {
66019 enqueue();
66020 }
66021 });
66022 }
66023
66024 exit() {
66025 if (this.workers) {
66026 _workerFarm.default.end(this.workers);
66027 }
66028 }
66029
66030}
66031
66032exports.default = TaskRunner;
66033
66034/***/ }),
66035
66036/***/ 89301:
66037/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66038
66039"use strict";
66040
66041
66042const plugin = __webpack_require__(43884);
66043
66044module.exports = plugin.default;
66045
66046/***/ }),
66047
66048/***/ 43884:
66049/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
66050
66051"use strict";
66052
66053
66054Object.defineProperty(exports, "__esModule", ({
66055 value: true
66056}));
66057exports.default = void 0;
66058
66059var _crypto = _interopRequireDefault(__webpack_require__(76417));
66060
66061var _path = _interopRequireDefault(__webpack_require__(85622));
66062
66063var _sourceMap = __webpack_require__(96241);
66064
66065var _webpackSources = __webpack_require__(53665);
66066
66067var _RequestShortener = _interopRequireDefault(__webpack_require__(54254));
66068
66069var _ModuleFilenameHelpers = _interopRequireDefault(__webpack_require__(71474));
66070
66071var _schemaUtils = _interopRequireDefault(__webpack_require__(33225));
66072
66073var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841));
66074
66075var _package = _interopRequireDefault(__webpack_require__(92203));
66076
66077var _options = _interopRequireDefault(__webpack_require__(11840));
66078
66079var _TaskRunner = _interopRequireDefault(__webpack_require__(16326));
66080
66081function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
66082
66083function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
66084
66085function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
66086
66087function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
66088
66089const warningRegex = /\[.+:([0-9]+),([0-9]+)\]/;
66090
66091class TerserPlugin {
66092 constructor(options = {}) {
66093 (0, _schemaUtils.default)(_options.default, options, 'Terser Plugin');
66094 const {
66095 minify,
66096 terserOptions = {},
66097 test = /\.m?js(\?.*)?$/i,
66098 chunkFilter = () => true,
66099 warningsFilter = () => true,
66100 extractComments = false,
66101 sourceMap = false,
66102 cache = false,
66103 cacheKeys = defaultCacheKeys => defaultCacheKeys,
66104 parallel = false,
66105 include,
66106 exclude
66107 } = options;
66108 this.options = {
66109 test,
66110 chunkFilter,
66111 warningsFilter,
66112 extractComments,
66113 sourceMap,
66114 cache,
66115 cacheKeys,
66116 parallel,
66117 include,
66118 exclude,
66119 minify,
66120 terserOptions: _objectSpread({
66121 output: {
66122 comments: extractComments ? false : /^\**!|@preserve|@license|@cc_on/i
66123 }
66124 }, terserOptions)
66125 };
66126 }
66127
66128 static isSourceMap(input) {
66129 // All required options for `new SourceMapConsumer(...options)`
66130 // https://github.com/mozilla/source-map#new-sourcemapconsumerrawsourcemap
66131 return Boolean(input && input.version && input.sources && Array.isArray(input.sources) && typeof input.mappings === 'string');
66132 }
66133
66134 static buildSourceMap(inputSourceMap) {
66135 if (!inputSourceMap || !TerserPlugin.isSourceMap(inputSourceMap)) {
66136 return null;
66137 }
66138
66139 return new _sourceMap.SourceMapConsumer(inputSourceMap);
66140 }
66141
66142 static buildError(err, file, sourceMap, requestShortener) {
66143 // Handling error which should have line, col, filename and message
66144 if (err.line) {
66145 const original = sourceMap && sourceMap.originalPositionFor({
66146 line: err.line,
66147 column: err.col
66148 });
66149
66150 if (original && original.source && requestShortener) {
66151 return new Error(`${file} from Terser\n${err.message} [${requestShortener.shorten(original.source)}:${original.line},${original.column}][${file}:${err.line},${err.col}]`);
66152 }
66153
66154 return new Error(`${file} from Terser\n${err.message} [${file}:${err.line},${err.col}]`);
66155 } else if (err.stack) {
66156 return new Error(`${file} from Terser\n${err.stack}`);
66157 }
66158
66159 return new Error(`${file} from Terser\n${err.message}`);
66160 }
66161
66162 static buildWarning(warning, file, sourceMap, requestShortener, warningsFilter) {
66163 let warningMessage = warning;
66164 let locationMessage = '';
66165 let source = null;
66166
66167 if (sourceMap) {
66168 const match = warningRegex.exec(warning);
66169
66170 if (match) {
66171 const line = +match[1];
66172 const column = +match[2];
66173 const original = sourceMap.originalPositionFor({
66174 line,
66175 column
66176 });
66177
66178 if (original && original.source && original.source !== file && requestShortener) {
66179 ({
66180 source
66181 } = original);
66182 warningMessage = `${warningMessage.replace(warningRegex, '')}`;
66183 locationMessage = `[${requestShortener.shorten(original.source)}:${original.line},${original.column}]`;
66184 }
66185 }
66186 }
66187
66188 if (warningsFilter && !warningsFilter(warning, source)) {
66189 return null;
66190 }
66191
66192 return `Terser Plugin: ${warningMessage}${locationMessage}`;
66193 }
66194
66195 apply(compiler) {
66196 const buildModuleFn = moduleArg => {
66197 // to get detailed location info about errors
66198 moduleArg.useSourceMap = true;
66199 };
66200
66201 const optimizeFn = (compilation, chunks, callback) => {
66202 const taskRunner = new _TaskRunner.default({
66203 cache: this.options.cache,
66204 parallel: this.options.parallel
66205 });
66206 const processedAssets = new WeakSet();
66207 const tasks = [];
66208 const {
66209 chunkFilter
66210 } = this.options;
66211 Array.from(chunks).filter(chunk => chunkFilter && chunkFilter(chunk)).reduce((acc, chunk) => acc.concat(chunk.files || []), []).concat(compilation.additionalChunkAssets || []).filter(_ModuleFilenameHelpers.default.matchObject.bind(null, this.options)).forEach(file => {
66212 let inputSourceMap;
66213 const asset = compilation.assets[file];
66214
66215 if (processedAssets.has(asset)) {
66216 return;
66217 }
66218
66219 try {
66220 let input;
66221
66222 if (this.options.sourceMap && asset.sourceAndMap) {
66223 const {
66224 source,
66225 map
66226 } = asset.sourceAndMap();
66227 input = source;
66228
66229 if (TerserPlugin.isSourceMap(map)) {
66230 inputSourceMap = map;
66231 } else {
66232 inputSourceMap = map;
66233 compilation.warnings.push(new Error(`${file} contains invalid source map`));
66234 }
66235 } else {
66236 input = asset.source();
66237 inputSourceMap = null;
66238 } // Handling comment extraction
66239
66240
66241 let commentsFile = false;
66242
66243 if (this.options.extractComments) {
66244 commentsFile = this.options.extractComments.filename || `${file}.LICENSE`;
66245
66246 if (typeof commentsFile === 'function') {
66247 commentsFile = commentsFile(file);
66248 }
66249 }
66250
66251 const task = {
66252 file,
66253 input,
66254 inputSourceMap,
66255 commentsFile,
66256 extractComments: this.options.extractComments,
66257 terserOptions: this.options.terserOptions,
66258 minify: this.options.minify
66259 };
66260
66261 if (this.options.cache) {
66262 const defaultCacheKeys = {
66263 terser: _package.default.version,
66264 node_version: process.version,
66265 // eslint-disable-next-line global-require
66266 'terser-webpack-plugin': __webpack_require__(9122)/* .version */ .i8,
66267 'terser-webpack-plugin-options': this.options,
66268 hash: _crypto.default.createHash('md4').update(input).digest('hex')
66269 };
66270 task.cacheKeys = this.options.cacheKeys(defaultCacheKeys, file);
66271 }
66272
66273 tasks.push(task);
66274 } catch (error) {
66275 compilation.errors.push(TerserPlugin.buildError(error, file, TerserPlugin.buildSourceMap(inputSourceMap), new _RequestShortener.default(compiler.context)));
66276 }
66277 });
66278 taskRunner.run(tasks, (tasksError, results) => {
66279 if (tasksError) {
66280 compilation.errors.push(tasksError);
66281 return;
66282 }
66283
66284 results.forEach((data, index) => {
66285 const {
66286 file,
66287 input,
66288 inputSourceMap,
66289 commentsFile
66290 } = tasks[index];
66291 const {
66292 error,
66293 map,
66294 code,
66295 warnings
66296 } = data;
66297 let {
66298 extractedComments
66299 } = data;
66300 let sourceMap = null;
66301
66302 if (error || warnings && warnings.length > 0) {
66303 sourceMap = TerserPlugin.buildSourceMap(inputSourceMap);
66304 } // Handling results
66305 // Error case: add errors, and go to next file
66306
66307
66308 if (error) {
66309 compilation.errors.push(TerserPlugin.buildError(error, file, sourceMap, new _RequestShortener.default(compiler.context)));
66310 return;
66311 }
66312
66313 let outputSource;
66314
66315 if (map) {
66316 outputSource = new _webpackSources.SourceMapSource(code, file, JSON.parse(map), input, inputSourceMap, true);
66317 } else {
66318 outputSource = new _webpackSources.RawSource(code);
66319 } // Write extracted comments to commentsFile
66320
66321
66322 if (commentsFile && extractedComments && extractedComments.length > 0) {
66323 if (commentsFile in compilation.assets) {
66324 const commentsFileSource = compilation.assets[commentsFile].source();
66325 extractedComments = extractedComments.filter(comment => !commentsFileSource.includes(comment));
66326 }
66327
66328 if (extractedComments.length > 0) {
66329 // Add a banner to the original file
66330 if (this.options.extractComments.banner !== false) {
66331 let banner = this.options.extractComments.banner || `For license information please see ${_path.default.posix.basename(commentsFile)}`;
66332
66333 if (typeof banner === 'function') {
66334 banner = banner(commentsFile);
66335 }
66336
66337 if (banner) {
66338 outputSource = new _webpackSources.ConcatSource(`/*! ${banner} */\n`, outputSource);
66339 }
66340 }
66341
66342 const commentsSource = new _webpackSources.RawSource(`${extractedComments.join('\n\n')}\n`);
66343
66344 if (commentsFile in compilation.assets) {
66345 // commentsFile already exists, append new comments...
66346 if (compilation.assets[commentsFile] instanceof _webpackSources.ConcatSource) {
66347 compilation.assets[commentsFile].add('\n');
66348 compilation.assets[commentsFile].add(commentsSource);
66349 } else {
66350 compilation.assets[commentsFile] = new _webpackSources.ConcatSource(compilation.assets[commentsFile], '\n', commentsSource);
66351 }
66352 } else {
66353 compilation.assets[commentsFile] = commentsSource;
66354 }
66355 }
66356 } // Updating assets
66357
66358
66359 processedAssets.add(compilation.assets[file] = outputSource); // Handling warnings
66360
66361 if (warnings && warnings.length > 0) {
66362 warnings.forEach(warning => {
66363 const builtWarning = TerserPlugin.buildWarning(warning, file, sourceMap, new _RequestShortener.default(compiler.context), this.options.warningsFilter);
66364
66365 if (builtWarning) {
66366 compilation.warnings.push(builtWarning);
66367 }
66368 });
66369 }
66370 });
66371 taskRunner.exit();
66372 callback();
66373 });
66374 };
66375
66376 const plugin = {
66377 name: this.constructor.name
66378 };
66379 compiler.hooks.compilation.tap(plugin, compilation => {
66380 if (this.options.sourceMap) {
66381 compilation.hooks.buildModule.tap(plugin, buildModuleFn);
66382 }
66383
66384 const {
66385 mainTemplate,
66386 chunkTemplate
66387 } = compilation; // Regenerate `contenthash` for minified assets
66388
66389 for (const template of [mainTemplate, chunkTemplate]) {
66390 template.hooks.hashForChunk.tap(plugin, hash => {
66391 const data = (0, _serializeJavascript.default)({
66392 terser: _package.default.version,
66393 terserOptions: this.options.terserOptions
66394 });
66395 hash.update('TerserPlugin');
66396 hash.update(data);
66397 });
66398 }
66399
66400 compilation.hooks.optimizeChunkAssets.tapAsync(plugin, optimizeFn.bind(this, compilation));
66401 });
66402 }
66403
66404}
66405
66406var _default = TerserPlugin;
66407exports.default = _default;
66408
66409/***/ }),
66410
66411/***/ 30787:
66412/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
66413
66414"use strict";
66415
66416
66417Object.defineProperty(exports, "__esModule", ({
66418 value: true
66419}));
66420exports.default = void 0;
66421
66422var _terser = __webpack_require__(54775);
66423
66424function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
66425
66426function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
66427
66428function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
66429
66430const buildTerserOptions = ({
66431 ecma,
66432 warnings,
66433 parse = {},
66434 compress = {},
66435 mangle,
66436 module,
66437 output,
66438 toplevel,
66439 nameCache,
66440 ie8,
66441
66442 /* eslint-disable camelcase */
66443 keep_classnames,
66444 keep_fnames,
66445
66446 /* eslint-enable camelcase */
66447 safari10
66448} = {}) => ({
66449 ecma,
66450 warnings,
66451 parse: _objectSpread({}, parse),
66452 compress: typeof compress === 'boolean' ? compress : _objectSpread({}, compress),
66453 // eslint-disable-next-line no-nested-ternary
66454 mangle: mangle == null ? true : typeof mangle === 'boolean' ? mangle : _objectSpread({}, mangle),
66455 output: _objectSpread({
66456 shebang: true,
66457 comments: false,
66458 beautify: false,
66459 semicolons: true
66460 }, output),
66461 module,
66462 // Ignoring sourceMap from options
66463 sourceMap: null,
66464 toplevel,
66465 nameCache,
66466 ie8,
66467 keep_classnames,
66468 keep_fnames,
66469 safari10
66470});
66471
66472const buildComments = (options, terserOptions, extractedComments) => {
66473 const condition = {};
66474 const commentsOpts = terserOptions.output.comments; // Use /^\**!|@preserve|@license|@cc_on/i RegExp
66475
66476 if (typeof options.extractComments === 'boolean') {
66477 condition.preserve = commentsOpts;
66478 condition.extract = /^\**!|@preserve|@license|@cc_on/i;
66479 } else if (typeof options.extractComments === 'string' || options.extractComments instanceof RegExp) {
66480 // extractComments specifies the extract condition and commentsOpts specifies the preserve condition
66481 condition.preserve = commentsOpts;
66482 condition.extract = options.extractComments;
66483 } else if (typeof options.extractComments === 'function') {
66484 condition.preserve = commentsOpts;
66485 condition.extract = options.extractComments;
66486 } else if (Object.prototype.hasOwnProperty.call(options.extractComments, 'condition')) {
66487 // Extract condition is given in extractComments.condition
66488 condition.preserve = commentsOpts;
66489 condition.extract = options.extractComments.condition;
66490 } else {
66491 // No extract condition is given. Extract comments that match commentsOpts instead of preserving them
66492 condition.preserve = false;
66493 condition.extract = commentsOpts;
66494 } // Ensure that both conditions are functions
66495
66496
66497 ['preserve', 'extract'].forEach(key => {
66498 let regexStr;
66499 let regex;
66500
66501 switch (typeof condition[key]) {
66502 case 'boolean':
66503 condition[key] = condition[key] ? () => true : () => false;
66504 break;
66505
66506 case 'function':
66507 break;
66508
66509 case 'string':
66510 if (condition[key] === 'all') {
66511 condition[key] = () => true;
66512
66513 break;
66514 }
66515
66516 if (condition[key] === 'some') {
66517 condition[key] = (astNode, comment) => {
66518 return comment.type === 'comment2' && /^\**!|@preserve|@license|@cc_on/i.test(comment.value);
66519 };
66520
66521 break;
66522 }
66523
66524 regexStr = condition[key];
66525
66526 condition[key] = (astNode, comment) => {
66527 return new RegExp(regexStr).test(comment.value);
66528 };
66529
66530 break;
66531
66532 default:
66533 regex = condition[key];
66534
66535 condition[key] = (astNode, comment) => regex.test(comment.value);
66536
66537 }
66538 }); // Redefine the comments function to extract and preserve
66539 // comments according to the two conditions
66540
66541 return (astNode, comment) => {
66542 if (condition.extract(astNode, comment)) {
66543 const commentText = comment.type === 'comment2' ? `/*${comment.value}*/` : `//${comment.value}`; // Don't include duplicate comments
66544
66545 if (!extractedComments.includes(commentText)) {
66546 extractedComments.push(commentText);
66547 }
66548 }
66549
66550 return condition.preserve(astNode, comment);
66551 };
66552};
66553
66554const minify = options => {
66555 const {
66556 file,
66557 input,
66558 inputSourceMap,
66559 extractComments,
66560 minify: minifyFn
66561 } = options;
66562
66563 if (minifyFn) {
66564 return minifyFn({
66565 [file]: input
66566 }, inputSourceMap);
66567 } // Copy terser options
66568
66569
66570 const terserOptions = buildTerserOptions(options.terserOptions); // Let terser generate a SourceMap
66571
66572 if (inputSourceMap) {
66573 terserOptions.sourceMap = true;
66574 }
66575
66576 const extractedComments = [];
66577
66578 if (extractComments) {
66579 terserOptions.output.comments = buildComments(options, terserOptions, extractedComments);
66580 }
66581
66582 const {
66583 error,
66584 map,
66585 code,
66586 warnings
66587 } = (0, _terser.minify)({
66588 [file]: input
66589 }, terserOptions);
66590 return {
66591 error,
66592 map,
66593 code,
66594 warnings,
66595 extractedComments
66596 };
66597};
66598
66599var _default = minify;
66600exports.default = _default;
66601
66602/***/ }),
66603
66604/***/ 71708:
66605/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66606
66607"use strict";
66608/*!
66609 * to-object-path <https://github.com/jonschlinkert/to-object-path>
66610 *
66611 * Copyright (c) 2015, Jon Schlinkert.
66612 * Licensed under the MIT License.
66613 */
66614
66615
66616
66617var typeOf = __webpack_require__(48865);
66618
66619module.exports = function toPath(args) {
66620 if (typeOf(args) !== 'arguments') {
66621 args = arguments;
66622 }
66623 return filter(args).join('.');
66624};
66625
66626function filter(arr) {
66627 var len = arr.length;
66628 var idx = -1;
66629 var res = [];
66630
66631 while (++idx < len) {
66632 var ele = arr[idx];
66633 if (typeOf(ele) === 'arguments' || Array.isArray(ele)) {
66634 res.push.apply(res, filter(ele));
66635 } else if (typeof ele === 'string') {
66636 res.push(ele);
66637 }
66638 }
66639 return res;
66640}
66641
66642
66643/***/ }),
66644
66645/***/ 51279:
66646/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66647
66648"use strict";
66649
66650
66651var safe = __webpack_require__(71217);
66652var define = __webpack_require__(74998);
66653var extend = __webpack_require__(99793);
66654var not = __webpack_require__(30931);
66655var MAX_LENGTH = 1024 * 64;
66656
66657/**
66658 * Session cache
66659 */
66660
66661var cache = {};
66662
66663/**
66664 * Create a regular expression from the given `pattern` string.
66665 *
66666 * @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
66667 * @param {Object} `options`
66668 * @return {RegExp}
66669 * @api public
66670 */
66671
66672module.exports = function(patterns, options) {
66673 if (!Array.isArray(patterns)) {
66674 return makeRe(patterns, options);
66675 }
66676 return makeRe(patterns.join('|'), options);
66677};
66678
66679/**
66680 * Create a regular expression from the given `pattern` string.
66681 *
66682 * @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
66683 * @param {Object} `options`
66684 * @return {RegExp}
66685 * @api public
66686 */
66687
66688function makeRe(pattern, options) {
66689 if (pattern instanceof RegExp) {
66690 return pattern;
66691 }
66692
66693 if (typeof pattern !== 'string') {
66694 throw new TypeError('expected a string');
66695 }
66696
66697 if (pattern.length > MAX_LENGTH) {
66698 throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
66699 }
66700
66701 var key = pattern;
66702 // do this before shallow cloning options, it's a lot faster
66703 if (!options || (options && options.cache !== false)) {
66704 key = createKey(pattern, options);
66705
66706 if (cache.hasOwnProperty(key)) {
66707 return cache[key];
66708 }
66709 }
66710
66711 var opts = extend({}, options);
66712 if (opts.contains === true) {
66713 if (opts.negate === true) {
66714 opts.strictNegate = false;
66715 } else {
66716 opts.strict = false;
66717 }
66718 }
66719
66720 if (opts.strict === false) {
66721 opts.strictOpen = false;
66722 opts.strictClose = false;
66723 }
66724
66725 var open = opts.strictOpen !== false ? '^' : '';
66726 var close = opts.strictClose !== false ? '$' : '';
66727 var flags = opts.flags || '';
66728 var regex;
66729
66730 if (opts.nocase === true && !/i/.test(flags)) {
66731 flags += 'i';
66732 }
66733
66734 try {
66735 if (opts.negate || typeof opts.strictNegate === 'boolean') {
66736 pattern = not.create(pattern, opts);
66737 }
66738
66739 var str = open + '(?:' + pattern + ')' + close;
66740 regex = new RegExp(str, flags);
66741
66742 if (opts.safe === true && safe(regex) === false) {
66743 throw new Error('potentially unsafe regular expression: ' + regex.source);
66744 }
66745
66746 } catch (err) {
66747 if (opts.strictErrors === true || opts.safe === true) {
66748 err.key = key;
66749 err.pattern = pattern;
66750 err.originalOptions = options;
66751 err.createdOptions = opts;
66752 throw err;
66753 }
66754
66755 try {
66756 regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$');
66757 } catch (err) {
66758 regex = /.^/; //<= match nothing
66759 }
66760 }
66761
66762 if (opts.cache !== false) {
66763 memoize(regex, key, pattern, opts);
66764 }
66765 return regex;
66766}
66767
66768/**
66769 * Memoize generated regex. This can result in dramatic speed improvements
66770 * and simplify debugging by adding options and pattern to the regex. It can be
66771 * disabled by passing setting `options.cache` to false.
66772 */
66773
66774function memoize(regex, key, pattern, options) {
66775 define(regex, 'cached', true);
66776 define(regex, 'pattern', pattern);
66777 define(regex, 'options', options);
66778 define(regex, 'key', key);
66779 cache[key] = regex;
66780}
66781
66782/**
66783 * Create the key to use for memoization. The key is generated
66784 * by iterating over the options and concatenating key-value pairs
66785 * to the pattern string.
66786 */
66787
66788function createKey(pattern, options) {
66789 if (!options) return pattern;
66790 var key = pattern;
66791 for (var prop in options) {
66792 if (options.hasOwnProperty(prop)) {
66793 key += ';' + prop + '=' + String(options[prop]);
66794 }
66795 }
66796 return key;
66797}
66798
66799/**
66800 * Expose `makeRe`
66801 */
66802
66803module.exports.makeRe = makeRe;
66804
66805
66806/***/ }),
66807
66808/***/ 74998:
66809/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66810
66811"use strict";
66812/*!
66813 * define-property <https://github.com/jonschlinkert/define-property>
66814 *
66815 * Copyright (c) 2015-2018, Jon Schlinkert.
66816 * Released under the MIT License.
66817 */
66818
66819
66820
66821var isobject = __webpack_require__(96667);
66822var isDescriptor = __webpack_require__(44133);
66823var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty)
66824 ? Reflect.defineProperty
66825 : Object.defineProperty;
66826
66827module.exports = function defineProperty(obj, key, val) {
66828 if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
66829 throw new TypeError('expected an object, function, or array');
66830 }
66831
66832 if (typeof key !== 'string') {
66833 throw new TypeError('expected "key" to be a string');
66834 }
66835
66836 if (isDescriptor(val)) {
66837 define(obj, key, val);
66838 return obj;
66839 }
66840
66841 define(obj, key, {
66842 configurable: true,
66843 enumerable: false,
66844 writable: true,
66845 value: val
66846 });
66847
66848 return obj;
66849};
66850
66851
66852/***/ }),
66853
66854/***/ 99793:
66855/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66856
66857"use strict";
66858
66859
66860var isExtendable = __webpack_require__(78947);
66861var assignSymbols = __webpack_require__(64353);
66862
66863module.exports = Object.assign || function(obj/*, objects*/) {
66864 if (obj === null || typeof obj === 'undefined') {
66865 throw new TypeError('Cannot convert undefined or null to object');
66866 }
66867 if (!isObject(obj)) {
66868 obj = {};
66869 }
66870 for (var i = 1; i < arguments.length; i++) {
66871 var val = arguments[i];
66872 if (isString(val)) {
66873 val = toObject(val);
66874 }
66875 if (isObject(val)) {
66876 assign(obj, val);
66877 assignSymbols(obj, val);
66878 }
66879 }
66880 return obj;
66881};
66882
66883function assign(a, b) {
66884 for (var key in b) {
66885 if (hasOwn(b, key)) {
66886 a[key] = b[key];
66887 }
66888 }
66889}
66890
66891function isString(val) {
66892 return (val && typeof val === 'string');
66893}
66894
66895function toObject(str) {
66896 var obj = {};
66897 for (var i in str) {
66898 obj[i] = str[i];
66899 }
66900 return obj;
66901}
66902
66903function isObject(val) {
66904 return (val && typeof val === 'object') || isExtendable(val);
66905}
66906
66907/**
66908 * Returns true if the given `key` is an own property of `obj`.
66909 */
66910
66911function hasOwn(obj, key) {
66912 return Object.prototype.hasOwnProperty.call(obj, key);
66913}
66914
66915function isEnum(obj, key) {
66916 return Object.prototype.propertyIsEnumerable.call(obj, key);
66917}
66918
66919
66920/***/ }),
66921
66922/***/ 78947:
66923/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
66924
66925"use strict";
66926/*!
66927 * is-extendable <https://github.com/jonschlinkert/is-extendable>
66928 *
66929 * Copyright (c) 2015-2017, Jon Schlinkert.
66930 * Released under the MIT License.
66931 */
66932
66933
66934
66935var isPlainObject = __webpack_require__(81064);
66936
66937module.exports = function isExtendable(val) {
66938 return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
66939};
66940
66941
66942/***/ }),
66943
66944/***/ 29859:
66945/***/ (function(module) {
66946
66947/*! *****************************************************************************
66948Copyright (c) Microsoft Corporation. All rights reserved.
66949Licensed under the Apache License, Version 2.0 (the "License"); you may not use
66950this file except in compliance with the License. You may obtain a copy of the
66951License at http://www.apache.org/licenses/LICENSE-2.0
66952
66953THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
66954KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
66955WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
66956MERCHANTABLITY OR NON-INFRINGEMENT.
66957
66958See the Apache Version 2.0 License for specific language governing permissions
66959and limitations under the License.
66960***************************************************************************** */
66961/* global global, define, System, Reflect, Promise */
66962var __extends;
66963var __assign;
66964var __rest;
66965var __decorate;
66966var __param;
66967var __metadata;
66968var __awaiter;
66969var __generator;
66970var __exportStar;
66971var __values;
66972var __read;
66973var __spread;
66974var __spreadArrays;
66975var __await;
66976var __asyncGenerator;
66977var __asyncDelegator;
66978var __asyncValues;
66979var __makeTemplateObject;
66980var __importStar;
66981var __importDefault;
66982var __classPrivateFieldGet;
66983var __classPrivateFieldSet;
66984(function (factory) {
66985 var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
66986 if (typeof define === "function" && define.amd) {
66987 define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
66988 }
66989 else if ( true && typeof module.exports === "object") {
66990 factory(createExporter(root, createExporter(module.exports)));
66991 }
66992 else {
66993 factory(createExporter(root));
66994 }
66995 function createExporter(exports, previous) {
66996 if (exports !== root) {
66997 if (typeof Object.create === "function") {
66998 Object.defineProperty(exports, "__esModule", { value: true });
66999 }
67000 else {
67001 exports.__esModule = true;
67002 }
67003 }
67004 return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
67005 }
67006})
67007(function (exporter) {
67008 var extendStatics = Object.setPrototypeOf ||
67009 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
67010 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
67011
67012 __extends = function (d, b) {
67013 extendStatics(d, b);
67014 function __() { this.constructor = d; }
67015 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
67016 };
67017
67018 __assign = Object.assign || function (t) {
67019 for (var s, i = 1, n = arguments.length; i < n; i++) {
67020 s = arguments[i];
67021 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
67022 }
67023 return t;
67024 };
67025
67026 __rest = function (s, e) {
67027 var t = {};
67028 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
67029 t[p] = s[p];
67030 if (s != null && typeof Object.getOwnPropertySymbols === "function")
67031 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
67032 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
67033 t[p[i]] = s[p[i]];
67034 }
67035 return t;
67036 };
67037
67038 __decorate = function (decorators, target, key, desc) {
67039 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67040 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
67041 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67042 return c > 3 && r && Object.defineProperty(target, key, r), r;
67043 };
67044
67045 __param = function (paramIndex, decorator) {
67046 return function (target, key) { decorator(target, key, paramIndex); }
67047 };
67048
67049 __metadata = function (metadataKey, metadataValue) {
67050 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
67051 };
67052
67053 __awaiter = function (thisArg, _arguments, P, generator) {
67054 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
67055 return new (P || (P = Promise))(function (resolve, reject) {
67056 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
67057 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
67058 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
67059 step((generator = generator.apply(thisArg, _arguments || [])).next());
67060 });
67061 };
67062
67063 __generator = function (thisArg, body) {
67064 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
67065 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
67066 function verb(n) { return function (v) { return step([n, v]); }; }
67067 function step(op) {
67068 if (f) throw new TypeError("Generator is already executing.");
67069 while (_) try {
67070 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
67071 if (y = 0, t) op = [op[0] & 2, t.value];
67072 switch (op[0]) {
67073 case 0: case 1: t = op; break;
67074 case 4: _.label++; return { value: op[1], done: false };
67075 case 5: _.label++; y = op[1]; op = [0]; continue;
67076 case 7: op = _.ops.pop(); _.trys.pop(); continue;
67077 default:
67078 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
67079 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
67080 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67081 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67082 if (t[2]) _.ops.pop();
67083 _.trys.pop(); continue;
67084 }
67085 op = body.call(thisArg, _);
67086 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
67087 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67088 }
67089 };
67090
67091 __exportStar = function (m, exports) {
67092 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
67093 };
67094
67095 __values = function (o) {
67096 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
67097 if (m) return m.call(o);
67098 if (o && typeof o.length === "number") return {
67099 next: function () {
67100 if (o && i >= o.length) o = void 0;
67101 return { value: o && o[i++], done: !o };
67102 }
67103 };
67104 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
67105 };
67106
67107 __read = function (o, n) {
67108 var m = typeof Symbol === "function" && o[Symbol.iterator];
67109 if (!m) return o;
67110 var i = m.call(o), r, ar = [], e;
67111 try {
67112 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
67113 }
67114 catch (error) { e = { error: error }; }
67115 finally {
67116 try {
67117 if (r && !r.done && (m = i["return"])) m.call(i);
67118 }
67119 finally { if (e) throw e.error; }
67120 }
67121 return ar;
67122 };
67123
67124 __spread = function () {
67125 for (var ar = [], i = 0; i < arguments.length; i++)
67126 ar = ar.concat(__read(arguments[i]));
67127 return ar;
67128 };
67129
67130 __spreadArrays = function () {
67131 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
67132 for (var r = Array(s), k = 0, i = 0; i < il; i++)
67133 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
67134 r[k] = a[j];
67135 return r;
67136 };
67137
67138 __await = function (v) {
67139 return this instanceof __await ? (this.v = v, this) : new __await(v);
67140 };
67141
67142 __asyncGenerator = function (thisArg, _arguments, generator) {
67143 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
67144 var g = generator.apply(thisArg, _arguments || []), i, q = [];
67145 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
67146 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
67147 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
67148 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
67149 function fulfill(value) { resume("next", value); }
67150 function reject(value) { resume("throw", value); }
67151 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
67152 };
67153
67154 __asyncDelegator = function (o) {
67155 var i, p;
67156 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
67157 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
67158 };
67159
67160 __asyncValues = function (o) {
67161 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
67162 var m = o[Symbol.asyncIterator], i;
67163 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
67164 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
67165 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
67166 };
67167
67168 __makeTemplateObject = function (cooked, raw) {
67169 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
67170 return cooked;
67171 };
67172
67173 __importStar = function (mod) {
67174 if (mod && mod.__esModule) return mod;
67175 var result = {};
67176 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
67177 result["default"] = mod;
67178 return result;
67179 };
67180
67181 __importDefault = function (mod) {
67182 return (mod && mod.__esModule) ? mod : { "default": mod };
67183 };
67184
67185 __classPrivateFieldGet = function (receiver, privateMap) {
67186 if (!privateMap.has(receiver)) {
67187 throw new TypeError("attempted to get private field on non-instance");
67188 }
67189 return privateMap.get(receiver);
67190 };
67191
67192 __classPrivateFieldSet = function (receiver, privateMap, value) {
67193 if (!privateMap.has(receiver)) {
67194 throw new TypeError("attempted to set private field on non-instance");
67195 }
67196 privateMap.set(receiver, value);
67197 return value;
67198 }
67199
67200 exporter("__extends", __extends);
67201 exporter("__assign", __assign);
67202 exporter("__rest", __rest);
67203 exporter("__decorate", __decorate);
67204 exporter("__param", __param);
67205 exporter("__metadata", __metadata);
67206 exporter("__awaiter", __awaiter);
67207 exporter("__generator", __generator);
67208 exporter("__exportStar", __exportStar);
67209 exporter("__values", __values);
67210 exporter("__read", __read);
67211 exporter("__spread", __spread);
67212 exporter("__spreadArrays", __spreadArrays);
67213 exporter("__await", __await);
67214 exporter("__asyncGenerator", __asyncGenerator);
67215 exporter("__asyncDelegator", __asyncDelegator);
67216 exporter("__asyncValues", __asyncValues);
67217 exporter("__makeTemplateObject", __makeTemplateObject);
67218 exporter("__importStar", __importStar);
67219 exporter("__importDefault", __importDefault);
67220 exporter("__classPrivateFieldGet", __classPrivateFieldGet);
67221 exporter("__classPrivateFieldSet", __classPrivateFieldSet);
67222});
67223
67224
67225/***/ }),
67226
67227/***/ 7716:
67228/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
67229
67230"use strict";
67231
67232
67233var isObject = __webpack_require__(18493);
67234var union = __webpack_require__(69123);
67235var get = __webpack_require__(89304);
67236var set = __webpack_require__(34857);
67237
67238module.exports = function unionValue(obj, prop, value) {
67239 if (!isObject(obj)) {
67240 throw new TypeError('union-value expects the first argument to be an object.');
67241 }
67242
67243 if (typeof prop !== 'string') {
67244 throw new TypeError('union-value expects `prop` to be a string.');
67245 }
67246
67247 var arr = arrayify(get(obj, prop));
67248 set(obj, prop, union(arr, arrayify(value)));
67249 return obj;
67250};
67251
67252function arrayify(val) {
67253 if (val === null || typeof val === 'undefined') {
67254 return [];
67255 }
67256 if (Array.isArray(val)) {
67257 return val;
67258 }
67259 return [val];
67260}
67261
67262
67263/***/ }),
67264
67265/***/ 5834:
67266/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
67267
67268"use strict";
67269/*!
67270 * unset-value <https://github.com/jonschlinkert/unset-value>
67271 *
67272 * Copyright (c) 2015, 2017, Jon Schlinkert.
67273 * Released under the MIT License.
67274 */
67275
67276
67277
67278var isObject = __webpack_require__(96667);
67279var has = __webpack_require__(77735);
67280
67281module.exports = function unset(obj, prop) {
67282 if (!isObject(obj)) {
67283 throw new TypeError('expected an object.');
67284 }
67285 if (obj.hasOwnProperty(prop)) {
67286 delete obj[prop];
67287 return true;
67288 }
67289
67290 if (has(obj, prop)) {
67291 var segs = prop.split('.');
67292 var last = segs.pop();
67293 while (segs.length && segs[segs.length - 1].slice(-1) === '\\') {
67294 last = segs.pop().slice(0, -1) + '.' + last;
67295 }
67296 while (segs.length) obj = obj[prop = segs.shift()];
67297 return (delete obj[last]);
67298 }
67299 return true;
67300};
67301
67302
67303/***/ }),
67304
67305/***/ 77735:
67306/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
67307
67308"use strict";
67309/*!
67310 * has-value <https://github.com/jonschlinkert/has-value>
67311 *
67312 * Copyright (c) 2014-2016, Jon Schlinkert.
67313 * Licensed under the MIT License.
67314 */
67315
67316
67317
67318var isObject = __webpack_require__(78037);
67319var hasValues = __webpack_require__(38719);
67320var get = __webpack_require__(89304);
67321
67322module.exports = function(obj, prop, noZero) {
67323 if (isObject(obj)) {
67324 return hasValues(get(obj, prop), noZero);
67325 }
67326 return hasValues(obj, prop);
67327};
67328
67329
67330/***/ }),
67331
67332/***/ 78037:
67333/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
67334
67335"use strict";
67336/*!
67337 * isobject <https://github.com/jonschlinkert/isobject>
67338 *
67339 * Copyright (c) 2014-2015, Jon Schlinkert.
67340 * Licensed under the MIT License.
67341 */
67342
67343
67344
67345var isArray = __webpack_require__(21352);
67346
67347module.exports = function isObject(val) {
67348 return val != null && typeof val === 'object' && isArray(val) === false;
67349};
67350
67351
67352/***/ }),
67353
67354/***/ 38719:
67355/***/ (function(module) {
67356
67357"use strict";
67358/*!
67359 * has-values <https://github.com/jonschlinkert/has-values>
67360 *
67361 * Copyright (c) 2014-2015, Jon Schlinkert.
67362 * Licensed under the MIT License.
67363 */
67364
67365
67366
67367module.exports = function hasValue(o, noZero) {
67368 if (o === null || o === undefined) {
67369 return false;
67370 }
67371
67372 if (typeof o === 'boolean') {
67373 return true;
67374 }
67375
67376 if (typeof o === 'number') {
67377 if (o === 0 && noZero === true) {
67378 return false;
67379 }
67380 return true;
67381 }
67382
67383 if (o.length !== undefined) {
67384 return o.length !== 0;
67385 }
67386
67387 for (var key in o) {
67388 if (o.hasOwnProperty(key)) {
67389 return true;
67390 }
67391 }
67392 return false;
67393};
67394
67395
67396/***/ }),
67397
67398/***/ 94007:
67399/***/ (function(__unused_webpack_module, exports) {
67400
67401/** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
67402(function (global, factory) {
67403 true ? factory(exports) :
67404 0;
67405}(this, (function (exports) { 'use strict';
67406
67407function merge() {
67408 for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
67409 sets[_key] = arguments[_key];
67410 }
67411
67412 if (sets.length > 1) {
67413 sets[0] = sets[0].slice(0, -1);
67414 var xl = sets.length - 1;
67415 for (var x = 1; x < xl; ++x) {
67416 sets[x] = sets[x].slice(1, -1);
67417 }
67418 sets[xl] = sets[xl].slice(1);
67419 return sets.join('');
67420 } else {
67421 return sets[0];
67422 }
67423}
67424function subexp(str) {
67425 return "(?:" + str + ")";
67426}
67427function typeOf(o) {
67428 return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
67429}
67430function toUpperCase(str) {
67431 return str.toUpperCase();
67432}
67433function toArray(obj) {
67434 return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
67435}
67436function assign(target, source) {
67437 var obj = target;
67438 if (source) {
67439 for (var key in source) {
67440 obj[key] = source[key];
67441 }
67442 }
67443 return obj;
67444}
67445
67446function buildExps(isIRI) {
67447 var ALPHA$$ = "[A-Za-z]",
67448 CR$ = "[\\x0D]",
67449 DIGIT$$ = "[0-9]",
67450 DQUOTE$$ = "[\\x22]",
67451 HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
67452 //case-insensitive
67453 LF$$ = "[\\x0A]",
67454 SP$$ = "[\\x20]",
67455 PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
67456 //expanded
67457 GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
67458 SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
67459 RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
67460 UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
67461 //subset, excludes bidi control characters
67462 IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
67463 //subset
67464 UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$),
67465 SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"),
67466 USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"),
67467 DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$),
67468 DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
67469 //relaxed parsing rules
67470 IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
67471 H16$ = subexp(HEXDIG$$ + "{1,4}"),
67472 LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
67473 IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
67474 // 6( h16 ":" ) ls32
67475 IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
67476 // "::" 5( h16 ":" ) ls32
67477 IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
67478 //[ h16 ] "::" 4( h16 ":" ) ls32
67479 IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
67480 //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
67481 IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
67482 //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
67483 IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
67484 //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
67485 IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
67486 //[ *4( h16 ":" ) h16 ] "::" ls32
67487 IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
67488 //[ *5( h16 ":" ) h16 ] "::" h16
67489 IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
67490 //[ *6( h16 ":" ) h16 ] "::"
67491 IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
67492 ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"),
67493 //RFC 6874
67494 IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$),
67495 //RFC 6874
67496 IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$),
67497 //RFC 6874, with relaxed parsing rules
67498 IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"),
67499 IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"),
67500 //RFC 6874
67501 REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"),
67502 HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$),
67503 PORT$ = subexp(DIGIT$$ + "*"),
67504 AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"),
67505 PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")),
67506 SEGMENT$ = subexp(PCHAR$ + "*"),
67507 SEGMENT_NZ$ = subexp(PCHAR$ + "+"),
67508 SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"),
67509 PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"),
67510 PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"),
67511 //simplified
67512 PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$),
67513 //simplified
67514 PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$),
67515 //simplified
67516 PATH_EMPTY$ = "(?!" + PCHAR$ + ")",
67517 PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
67518 QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"),
67519 FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"),
67520 HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
67521 URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
67522 RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$),
67523 RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
67524 URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$),
67525 ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"),
67526 GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
67527 RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
67528 ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$",
67529 SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
67530 AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";
67531 return {
67532 NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
67533 NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
67534 NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
67535 NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
67536 NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
67537 NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
67538 NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
67539 ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
67540 UNRESERVED: new RegExp(UNRESERVED$$, "g"),
67541 OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
67542 PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
67543 IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
67544 IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
67545 };
67546}
67547var URI_PROTOCOL = buildExps(false);
67548
67549var IRI_PROTOCOL = buildExps(true);
67550
67551var slicedToArray = function () {
67552 function sliceIterator(arr, i) {
67553 var _arr = [];
67554 var _n = true;
67555 var _d = false;
67556 var _e = undefined;
67557
67558 try {
67559 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
67560 _arr.push(_s.value);
67561
67562 if (i && _arr.length === i) break;
67563 }
67564 } catch (err) {
67565 _d = true;
67566 _e = err;
67567 } finally {
67568 try {
67569 if (!_n && _i["return"]) _i["return"]();
67570 } finally {
67571 if (_d) throw _e;
67572 }
67573 }
67574
67575 return _arr;
67576 }
67577
67578 return function (arr, i) {
67579 if (Array.isArray(arr)) {
67580 return arr;
67581 } else if (Symbol.iterator in Object(arr)) {
67582 return sliceIterator(arr, i);
67583 } else {
67584 throw new TypeError("Invalid attempt to destructure non-iterable instance");
67585 }
67586 };
67587}();
67588
67589
67590
67591
67592
67593
67594
67595
67596
67597
67598
67599
67600
67601var toConsumableArray = function (arr) {
67602 if (Array.isArray(arr)) {
67603 for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
67604
67605 return arr2;
67606 } else {
67607 return Array.from(arr);
67608 }
67609};
67610
67611/** Highest positive signed 32-bit float value */
67612
67613var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
67614
67615/** Bootstring parameters */
67616var base = 36;
67617var tMin = 1;
67618var tMax = 26;
67619var skew = 38;
67620var damp = 700;
67621var initialBias = 72;
67622var initialN = 128; // 0x80
67623var delimiter = '-'; // '\x2D'
67624
67625/** Regular expressions */
67626var regexPunycode = /^xn--/;
67627var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
67628var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
67629
67630/** Error messages */
67631var errors = {
67632 'overflow': 'Overflow: input needs wider integers to process',
67633 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
67634 'invalid-input': 'Invalid input'
67635};
67636
67637/** Convenience shortcuts */
67638var baseMinusTMin = base - tMin;
67639var floor = Math.floor;
67640var stringFromCharCode = String.fromCharCode;
67641
67642/*--------------------------------------------------------------------------*/
67643
67644/**
67645 * A generic error utility function.
67646 * @private
67647 * @param {String} type The error type.
67648 * @returns {Error} Throws a `RangeError` with the applicable error message.
67649 */
67650function error$1(type) {
67651 throw new RangeError(errors[type]);
67652}
67653
67654/**
67655 * A generic `Array#map` utility function.
67656 * @private
67657 * @param {Array} array The array to iterate over.
67658 * @param {Function} callback The function that gets called for every array
67659 * item.
67660 * @returns {Array} A new array of values returned by the callback function.
67661 */
67662function map(array, fn) {
67663 var result = [];
67664 var length = array.length;
67665 while (length--) {
67666 result[length] = fn(array[length]);
67667 }
67668 return result;
67669}
67670
67671/**
67672 * A simple `Array#map`-like wrapper to work with domain name strings or email
67673 * addresses.
67674 * @private
67675 * @param {String} domain The domain name or email address.
67676 * @param {Function} callback The function that gets called for every
67677 * character.
67678 * @returns {Array} A new string of characters returned by the callback
67679 * function.
67680 */
67681function mapDomain(string, fn) {
67682 var parts = string.split('@');
67683 var result = '';
67684 if (parts.length > 1) {
67685 // In email addresses, only the domain name should be punycoded. Leave
67686 // the local part (i.e. everything up to `@`) intact.
67687 result = parts[0] + '@';
67688 string = parts[1];
67689 }
67690 // Avoid `split(regex)` for IE8 compatibility. See #17.
67691 string = string.replace(regexSeparators, '\x2E');
67692 var labels = string.split('.');
67693 var encoded = map(labels, fn).join('.');
67694 return result + encoded;
67695}
67696
67697/**
67698 * Creates an array containing the numeric code points of each Unicode
67699 * character in the string. While JavaScript uses UCS-2 internally,
67700 * this function will convert a pair of surrogate halves (each of which
67701 * UCS-2 exposes as separate characters) into a single code point,
67702 * matching UTF-16.
67703 * @see `punycode.ucs2.encode`
67704 * @see <https://mathiasbynens.be/notes/javascript-encoding>
67705 * @memberOf punycode.ucs2
67706 * @name decode
67707 * @param {String} string The Unicode input string (UCS-2).
67708 * @returns {Array} The new array of code points.
67709 */
67710function ucs2decode(string) {
67711 var output = [];
67712 var counter = 0;
67713 var length = string.length;
67714 while (counter < length) {
67715 var value = string.charCodeAt(counter++);
67716 if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
67717 // It's a high surrogate, and there is a next character.
67718 var extra = string.charCodeAt(counter++);
67719 if ((extra & 0xFC00) == 0xDC00) {
67720 // Low surrogate.
67721 output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
67722 } else {
67723 // It's an unmatched surrogate; only append this code unit, in case the
67724 // next code unit is the high surrogate of a surrogate pair.
67725 output.push(value);
67726 counter--;
67727 }
67728 } else {
67729 output.push(value);
67730 }
67731 }
67732 return output;
67733}
67734
67735/**
67736 * Creates a string based on an array of numeric code points.
67737 * @see `punycode.ucs2.decode`
67738 * @memberOf punycode.ucs2
67739 * @name encode
67740 * @param {Array} codePoints The array of numeric code points.
67741 * @returns {String} The new Unicode string (UCS-2).
67742 */
67743var ucs2encode = function ucs2encode(array) {
67744 return String.fromCodePoint.apply(String, toConsumableArray(array));
67745};
67746
67747/**
67748 * Converts a basic code point into a digit/integer.
67749 * @see `digitToBasic()`
67750 * @private
67751 * @param {Number} codePoint The basic numeric code point value.
67752 * @returns {Number} The numeric value of a basic code point (for use in
67753 * representing integers) in the range `0` to `base - 1`, or `base` if
67754 * the code point does not represent a value.
67755 */
67756var basicToDigit = function basicToDigit(codePoint) {
67757 if (codePoint - 0x30 < 0x0A) {
67758 return codePoint - 0x16;
67759 }
67760 if (codePoint - 0x41 < 0x1A) {
67761 return codePoint - 0x41;
67762 }
67763 if (codePoint - 0x61 < 0x1A) {
67764 return codePoint - 0x61;
67765 }
67766 return base;
67767};
67768
67769/**
67770 * Converts a digit/integer into a basic code point.
67771 * @see `basicToDigit()`
67772 * @private
67773 * @param {Number} digit The numeric value of a basic code point.
67774 * @returns {Number} The basic code point whose value (when used for
67775 * representing integers) is `digit`, which needs to be in the range
67776 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
67777 * used; else, the lowercase form is used. The behavior is undefined
67778 * if `flag` is non-zero and `digit` has no uppercase form.
67779 */
67780var digitToBasic = function digitToBasic(digit, flag) {
67781 // 0..25 map to ASCII a..z or A..Z
67782 // 26..35 map to ASCII 0..9
67783 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
67784};
67785
67786/**
67787 * Bias adaptation function as per section 3.4 of RFC 3492.
67788 * https://tools.ietf.org/html/rfc3492#section-3.4
67789 * @private
67790 */
67791var adapt = function adapt(delta, numPoints, firstTime) {
67792 var k = 0;
67793 delta = firstTime ? floor(delta / damp) : delta >> 1;
67794 delta += floor(delta / numPoints);
67795 for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
67796 delta = floor(delta / baseMinusTMin);
67797 }
67798 return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
67799};
67800
67801/**
67802 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
67803 * symbols.
67804 * @memberOf punycode
67805 * @param {String} input The Punycode string of ASCII-only symbols.
67806 * @returns {String} The resulting string of Unicode symbols.
67807 */
67808var decode = function decode(input) {
67809 // Don't use UCS-2.
67810 var output = [];
67811 var inputLength = input.length;
67812 var i = 0;
67813 var n = initialN;
67814 var bias = initialBias;
67815
67816 // Handle the basic code points: let `basic` be the number of input code
67817 // points before the last delimiter, or `0` if there is none, then copy
67818 // the first basic code points to the output.
67819
67820 var basic = input.lastIndexOf(delimiter);
67821 if (basic < 0) {
67822 basic = 0;
67823 }
67824
67825 for (var j = 0; j < basic; ++j) {
67826 // if it's not a basic code point
67827 if (input.charCodeAt(j) >= 0x80) {
67828 error$1('not-basic');
67829 }
67830 output.push(input.charCodeAt(j));
67831 }
67832
67833 // Main decoding loop: start just after the last delimiter if any basic code
67834 // points were copied; start at the beginning otherwise.
67835
67836 for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
67837
67838 // `index` is the index of the next character to be consumed.
67839 // Decode a generalized variable-length integer into `delta`,
67840 // which gets added to `i`. The overflow checking is easier
67841 // if we increase `i` as we go, then subtract off its starting
67842 // value at the end to obtain `delta`.
67843 var oldi = i;
67844 for (var w = 1, k = base;; /* no condition */k += base) {
67845
67846 if (index >= inputLength) {
67847 error$1('invalid-input');
67848 }
67849
67850 var digit = basicToDigit(input.charCodeAt(index++));
67851
67852 if (digit >= base || digit > floor((maxInt - i) / w)) {
67853 error$1('overflow');
67854 }
67855
67856 i += digit * w;
67857 var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
67858
67859 if (digit < t) {
67860 break;
67861 }
67862
67863 var baseMinusT = base - t;
67864 if (w > floor(maxInt / baseMinusT)) {
67865 error$1('overflow');
67866 }
67867
67868 w *= baseMinusT;
67869 }
67870
67871 var out = output.length + 1;
67872 bias = adapt(i - oldi, out, oldi == 0);
67873
67874 // `i` was supposed to wrap around from `out` to `0`,
67875 // incrementing `n` each time, so we'll fix that now:
67876 if (floor(i / out) > maxInt - n) {
67877 error$1('overflow');
67878 }
67879
67880 n += floor(i / out);
67881 i %= out;
67882
67883 // Insert `n` at position `i` of the output.
67884 output.splice(i++, 0, n);
67885 }
67886
67887 return String.fromCodePoint.apply(String, output);
67888};
67889
67890/**
67891 * Converts a string of Unicode symbols (e.g. a domain name label) to a
67892 * Punycode string of ASCII-only symbols.
67893 * @memberOf punycode
67894 * @param {String} input The string of Unicode symbols.
67895 * @returns {String} The resulting Punycode string of ASCII-only symbols.
67896 */
67897var encode = function encode(input) {
67898 var output = [];
67899
67900 // Convert the input in UCS-2 to an array of Unicode code points.
67901 input = ucs2decode(input);
67902
67903 // Cache the length.
67904 var inputLength = input.length;
67905
67906 // Initialize the state.
67907 var n = initialN;
67908 var delta = 0;
67909 var bias = initialBias;
67910
67911 // Handle the basic code points.
67912 var _iteratorNormalCompletion = true;
67913 var _didIteratorError = false;
67914 var _iteratorError = undefined;
67915
67916 try {
67917 for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
67918 var _currentValue2 = _step.value;
67919
67920 if (_currentValue2 < 0x80) {
67921 output.push(stringFromCharCode(_currentValue2));
67922 }
67923 }
67924 } catch (err) {
67925 _didIteratorError = true;
67926 _iteratorError = err;
67927 } finally {
67928 try {
67929 if (!_iteratorNormalCompletion && _iterator.return) {
67930 _iterator.return();
67931 }
67932 } finally {
67933 if (_didIteratorError) {
67934 throw _iteratorError;
67935 }
67936 }
67937 }
67938
67939 var basicLength = output.length;
67940 var handledCPCount = basicLength;
67941
67942 // `handledCPCount` is the number of code points that have been handled;
67943 // `basicLength` is the number of basic code points.
67944
67945 // Finish the basic string with a delimiter unless it's empty.
67946 if (basicLength) {
67947 output.push(delimiter);
67948 }
67949
67950 // Main encoding loop:
67951 while (handledCPCount < inputLength) {
67952
67953 // All non-basic code points < n have been handled already. Find the next
67954 // larger one:
67955 var m = maxInt;
67956 var _iteratorNormalCompletion2 = true;
67957 var _didIteratorError2 = false;
67958 var _iteratorError2 = undefined;
67959
67960 try {
67961 for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
67962 var currentValue = _step2.value;
67963
67964 if (currentValue >= n && currentValue < m) {
67965 m = currentValue;
67966 }
67967 }
67968
67969 // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
67970 // but guard against overflow.
67971 } catch (err) {
67972 _didIteratorError2 = true;
67973 _iteratorError2 = err;
67974 } finally {
67975 try {
67976 if (!_iteratorNormalCompletion2 && _iterator2.return) {
67977 _iterator2.return();
67978 }
67979 } finally {
67980 if (_didIteratorError2) {
67981 throw _iteratorError2;
67982 }
67983 }
67984 }
67985
67986 var handledCPCountPlusOne = handledCPCount + 1;
67987 if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
67988 error$1('overflow');
67989 }
67990
67991 delta += (m - n) * handledCPCountPlusOne;
67992 n = m;
67993
67994 var _iteratorNormalCompletion3 = true;
67995 var _didIteratorError3 = false;
67996 var _iteratorError3 = undefined;
67997
67998 try {
67999 for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
68000 var _currentValue = _step3.value;
68001
68002 if (_currentValue < n && ++delta > maxInt) {
68003 error$1('overflow');
68004 }
68005 if (_currentValue == n) {
68006 // Represent delta as a generalized variable-length integer.
68007 var q = delta;
68008 for (var k = base;; /* no condition */k += base) {
68009 var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
68010 if (q < t) {
68011 break;
68012 }
68013 var qMinusT = q - t;
68014 var baseMinusT = base - t;
68015 output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
68016 q = floor(qMinusT / baseMinusT);
68017 }
68018
68019 output.push(stringFromCharCode(digitToBasic(q, 0)));
68020 bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
68021 delta = 0;
68022 ++handledCPCount;
68023 }
68024 }
68025 } catch (err) {
68026 _didIteratorError3 = true;
68027 _iteratorError3 = err;
68028 } finally {
68029 try {
68030 if (!_iteratorNormalCompletion3 && _iterator3.return) {
68031 _iterator3.return();
68032 }
68033 } finally {
68034 if (_didIteratorError3) {
68035 throw _iteratorError3;
68036 }
68037 }
68038 }
68039
68040 ++delta;
68041 ++n;
68042 }
68043 return output.join('');
68044};
68045
68046/**
68047 * Converts a Punycode string representing a domain name or an email address
68048 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
68049 * it doesn't matter if you call it on a string that has already been
68050 * converted to Unicode.
68051 * @memberOf punycode
68052 * @param {String} input The Punycoded domain name or email address to
68053 * convert to Unicode.
68054 * @returns {String} The Unicode representation of the given Punycode
68055 * string.
68056 */
68057var toUnicode = function toUnicode(input) {
68058 return mapDomain(input, function (string) {
68059 return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
68060 });
68061};
68062
68063/**
68064 * Converts a Unicode string representing a domain name or an email address to
68065 * Punycode. Only the non-ASCII parts of the domain name will be converted,
68066 * i.e. it doesn't matter if you call it with a domain that's already in
68067 * ASCII.
68068 * @memberOf punycode
68069 * @param {String} input The domain name or email address to convert, as a
68070 * Unicode string.
68071 * @returns {String} The Punycode representation of the given domain name or
68072 * email address.
68073 */
68074var toASCII = function toASCII(input) {
68075 return mapDomain(input, function (string) {
68076 return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
68077 });
68078};
68079
68080/*--------------------------------------------------------------------------*/
68081
68082/** Define the public API */
68083var punycode = {
68084 /**
68085 * A string representing the current Punycode.js version number.
68086 * @memberOf punycode
68087 * @type String
68088 */
68089 'version': '2.1.0',
68090 /**
68091 * An object of methods to convert from JavaScript's internal character
68092 * representation (UCS-2) to Unicode code points, and back.
68093 * @see <https://mathiasbynens.be/notes/javascript-encoding>
68094 * @memberOf punycode
68095 * @type Object
68096 */
68097 'ucs2': {
68098 'decode': ucs2decode,
68099 'encode': ucs2encode
68100 },
68101 'decode': decode,
68102 'encode': encode,
68103 'toASCII': toASCII,
68104 'toUnicode': toUnicode
68105};
68106
68107/**
68108 * URI.js
68109 *
68110 * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
68111 * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
68112 * @see http://github.com/garycourt/uri-js
68113 */
68114/**
68115 * Copyright 2011 Gary Court. All rights reserved.
68116 *
68117 * Redistribution and use in source and binary forms, with or without modification, are
68118 * permitted provided that the following conditions are met:
68119 *
68120 * 1. Redistributions of source code must retain the above copyright notice, this list of
68121 * conditions and the following disclaimer.
68122 *
68123 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
68124 * of conditions and the following disclaimer in the documentation and/or other materials
68125 * provided with the distribution.
68126 *
68127 * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
68128 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
68129 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
68130 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
68131 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
68132 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
68133 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
68134 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
68135 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68136 *
68137 * The views and conclusions contained in the software and documentation are those of the
68138 * authors and should not be interpreted as representing official policies, either expressed
68139 * or implied, of Gary Court.
68140 */
68141var SCHEMES = {};
68142function pctEncChar(chr) {
68143 var c = chr.charCodeAt(0);
68144 var e = void 0;
68145 if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
68146 return e;
68147}
68148function pctDecChars(str) {
68149 var newStr = "";
68150 var i = 0;
68151 var il = str.length;
68152 while (i < il) {
68153 var c = parseInt(str.substr(i + 1, 2), 16);
68154 if (c < 128) {
68155 newStr += String.fromCharCode(c);
68156 i += 3;
68157 } else if (c >= 194 && c < 224) {
68158 if (il - i >= 6) {
68159 var c2 = parseInt(str.substr(i + 4, 2), 16);
68160 newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
68161 } else {
68162 newStr += str.substr(i, 6);
68163 }
68164 i += 6;
68165 } else if (c >= 224) {
68166 if (il - i >= 9) {
68167 var _c = parseInt(str.substr(i + 4, 2), 16);
68168 var c3 = parseInt(str.substr(i + 7, 2), 16);
68169 newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
68170 } else {
68171 newStr += str.substr(i, 9);
68172 }
68173 i += 9;
68174 } else {
68175 newStr += str.substr(i, 3);
68176 i += 3;
68177 }
68178 }
68179 return newStr;
68180}
68181function _normalizeComponentEncoding(components, protocol) {
68182 function decodeUnreserved(str) {
68183 var decStr = pctDecChars(str);
68184 return !decStr.match(protocol.UNRESERVED) ? str : decStr;
68185 }
68186 if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
68187 if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
68188 if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
68189 if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
68190 if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
68191 if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
68192 return components;
68193}
68194
68195function _stripLeadingZeros(str) {
68196 return str.replace(/^0*(.*)/, "$1") || "0";
68197}
68198function _normalizeIPv4(host, protocol) {
68199 var matches = host.match(protocol.IPV4ADDRESS) || [];
68200
68201 var _matches = slicedToArray(matches, 2),
68202 address = _matches[1];
68203
68204 if (address) {
68205 return address.split(".").map(_stripLeadingZeros).join(".");
68206 } else {
68207 return host;
68208 }
68209}
68210function _normalizeIPv6(host, protocol) {
68211 var matches = host.match(protocol.IPV6ADDRESS) || [];
68212
68213 var _matches2 = slicedToArray(matches, 3),
68214 address = _matches2[1],
68215 zone = _matches2[2];
68216
68217 if (address) {
68218 var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
68219 _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
68220 last = _address$toLowerCase$2[0],
68221 first = _address$toLowerCase$2[1];
68222
68223 var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
68224 var lastFields = last.split(":").map(_stripLeadingZeros);
68225 var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
68226 var fieldCount = isLastFieldIPv4Address ? 7 : 8;
68227 var lastFieldsStart = lastFields.length - fieldCount;
68228 var fields = Array(fieldCount);
68229 for (var x = 0; x < fieldCount; ++x) {
68230 fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
68231 }
68232 if (isLastFieldIPv4Address) {
68233 fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
68234 }
68235 var allZeroFields = fields.reduce(function (acc, field, index) {
68236 if (!field || field === "0") {
68237 var lastLongest = acc[acc.length - 1];
68238 if (lastLongest && lastLongest.index + lastLongest.length === index) {
68239 lastLongest.length++;
68240 } else {
68241 acc.push({ index: index, length: 1 });
68242 }
68243 }
68244 return acc;
68245 }, []);
68246 var longestZeroFields = allZeroFields.sort(function (a, b) {
68247 return b.length - a.length;
68248 })[0];
68249 var newHost = void 0;
68250 if (longestZeroFields && longestZeroFields.length > 1) {
68251 var newFirst = fields.slice(0, longestZeroFields.index);
68252 var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
68253 newHost = newFirst.join(":") + "::" + newLast.join(":");
68254 } else {
68255 newHost = fields.join(":");
68256 }
68257 if (zone) {
68258 newHost += "%" + zone;
68259 }
68260 return newHost;
68261 } else {
68262 return host;
68263 }
68264}
68265var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
68266var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
68267function parse(uriString) {
68268 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
68269
68270 var components = {};
68271 var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
68272 if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
68273 var matches = uriString.match(URI_PARSE);
68274 if (matches) {
68275 if (NO_MATCH_IS_UNDEFINED) {
68276 //store each component
68277 components.scheme = matches[1];
68278 components.userinfo = matches[3];
68279 components.host = matches[4];
68280 components.port = parseInt(matches[5], 10);
68281 components.path = matches[6] || "";
68282 components.query = matches[7];
68283 components.fragment = matches[8];
68284 //fix port number
68285 if (isNaN(components.port)) {
68286 components.port = matches[5];
68287 }
68288 } else {
68289 //IE FIX for improper RegExp matching
68290 //store each component
68291 components.scheme = matches[1] || undefined;
68292 components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
68293 components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
68294 components.port = parseInt(matches[5], 10);
68295 components.path = matches[6] || "";
68296 components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
68297 components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
68298 //fix port number
68299 if (isNaN(components.port)) {
68300 components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
68301 }
68302 }
68303 if (components.host) {
68304 //normalize IP hosts
68305 components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
68306 }
68307 //determine reference type
68308 if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
68309 components.reference = "same-document";
68310 } else if (components.scheme === undefined) {
68311 components.reference = "relative";
68312 } else if (components.fragment === undefined) {
68313 components.reference = "absolute";
68314 } else {
68315 components.reference = "uri";
68316 }
68317 //check for reference errors
68318 if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
68319 components.error = components.error || "URI is not a " + options.reference + " reference.";
68320 }
68321 //find scheme handler
68322 var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
68323 //check if scheme can't handle IRIs
68324 if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
68325 //if host component is a domain name
68326 if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
68327 //convert Unicode IDN -> ASCII IDN
68328 try {
68329 components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
68330 } catch (e) {
68331 components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
68332 }
68333 }
68334 //convert IRI -> URI
68335 _normalizeComponentEncoding(components, URI_PROTOCOL);
68336 } else {
68337 //normalize encodings
68338 _normalizeComponentEncoding(components, protocol);
68339 }
68340 //perform scheme specific parsing
68341 if (schemeHandler && schemeHandler.parse) {
68342 schemeHandler.parse(components, options);
68343 }
68344 } else {
68345 components.error = components.error || "URI can not be parsed.";
68346 }
68347 return components;
68348}
68349
68350function _recomposeAuthority(components, options) {
68351 var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
68352 var uriTokens = [];
68353 if (components.userinfo !== undefined) {
68354 uriTokens.push(components.userinfo);
68355 uriTokens.push("@");
68356 }
68357 if (components.host !== undefined) {
68358 //normalize IP hosts, add brackets and escape zone separator for IPv6
68359 uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
68360 return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
68361 }));
68362 }
68363 if (typeof components.port === "number") {
68364 uriTokens.push(":");
68365 uriTokens.push(components.port.toString(10));
68366 }
68367 return uriTokens.length ? uriTokens.join("") : undefined;
68368}
68369
68370var RDS1 = /^\.\.?\//;
68371var RDS2 = /^\/\.(\/|$)/;
68372var RDS3 = /^\/\.\.(\/|$)/;
68373var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
68374function removeDotSegments(input) {
68375 var output = [];
68376 while (input.length) {
68377 if (input.match(RDS1)) {
68378 input = input.replace(RDS1, "");
68379 } else if (input.match(RDS2)) {
68380 input = input.replace(RDS2, "/");
68381 } else if (input.match(RDS3)) {
68382 input = input.replace(RDS3, "/");
68383 output.pop();
68384 } else if (input === "." || input === "..") {
68385 input = "";
68386 } else {
68387 var im = input.match(RDS5);
68388 if (im) {
68389 var s = im[0];
68390 input = input.slice(s.length);
68391 output.push(s);
68392 } else {
68393 throw new Error("Unexpected dot segment condition");
68394 }
68395 }
68396 }
68397 return output.join("");
68398}
68399
68400function serialize(components) {
68401 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
68402
68403 var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
68404 var uriTokens = [];
68405 //find scheme handler
68406 var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
68407 //perform scheme specific serialization
68408 if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
68409 if (components.host) {
68410 //if host component is an IPv6 address
68411 if (protocol.IPV6ADDRESS.test(components.host)) {}
68412 //TODO: normalize IPv6 address as per RFC 5952
68413
68414 //if host component is a domain name
68415 else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
68416 //convert IDN via punycode
68417 try {
68418 components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
68419 } catch (e) {
68420 components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
68421 }
68422 }
68423 }
68424 //normalize encoding
68425 _normalizeComponentEncoding(components, protocol);
68426 if (options.reference !== "suffix" && components.scheme) {
68427 uriTokens.push(components.scheme);
68428 uriTokens.push(":");
68429 }
68430 var authority = _recomposeAuthority(components, options);
68431 if (authority !== undefined) {
68432 if (options.reference !== "suffix") {
68433 uriTokens.push("//");
68434 }
68435 uriTokens.push(authority);
68436 if (components.path && components.path.charAt(0) !== "/") {
68437 uriTokens.push("/");
68438 }
68439 }
68440 if (components.path !== undefined) {
68441 var s = components.path;
68442 if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
68443 s = removeDotSegments(s);
68444 }
68445 if (authority === undefined) {
68446 s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
68447 }
68448 uriTokens.push(s);
68449 }
68450 if (components.query !== undefined) {
68451 uriTokens.push("?");
68452 uriTokens.push(components.query);
68453 }
68454 if (components.fragment !== undefined) {
68455 uriTokens.push("#");
68456 uriTokens.push(components.fragment);
68457 }
68458 return uriTokens.join(""); //merge tokens into a string
68459}
68460
68461function resolveComponents(base, relative) {
68462 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
68463 var skipNormalization = arguments[3];
68464
68465 var target = {};
68466 if (!skipNormalization) {
68467 base = parse(serialize(base, options), options); //normalize base components
68468 relative = parse(serialize(relative, options), options); //normalize relative components
68469 }
68470 options = options || {};
68471 if (!options.tolerant && relative.scheme) {
68472 target.scheme = relative.scheme;
68473 //target.authority = relative.authority;
68474 target.userinfo = relative.userinfo;
68475 target.host = relative.host;
68476 target.port = relative.port;
68477 target.path = removeDotSegments(relative.path || "");
68478 target.query = relative.query;
68479 } else {
68480 if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
68481 //target.authority = relative.authority;
68482 target.userinfo = relative.userinfo;
68483 target.host = relative.host;
68484 target.port = relative.port;
68485 target.path = removeDotSegments(relative.path || "");
68486 target.query = relative.query;
68487 } else {
68488 if (!relative.path) {
68489 target.path = base.path;
68490 if (relative.query !== undefined) {
68491 target.query = relative.query;
68492 } else {
68493 target.query = base.query;
68494 }
68495 } else {
68496 if (relative.path.charAt(0) === "/") {
68497 target.path = removeDotSegments(relative.path);
68498 } else {
68499 if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
68500 target.path = "/" + relative.path;
68501 } else if (!base.path) {
68502 target.path = relative.path;
68503 } else {
68504 target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
68505 }
68506 target.path = removeDotSegments(target.path);
68507 }
68508 target.query = relative.query;
68509 }
68510 //target.authority = base.authority;
68511 target.userinfo = base.userinfo;
68512 target.host = base.host;
68513 target.port = base.port;
68514 }
68515 target.scheme = base.scheme;
68516 }
68517 target.fragment = relative.fragment;
68518 return target;
68519}
68520
68521function resolve(baseURI, relativeURI, options) {
68522 var schemelessOptions = assign({ scheme: 'null' }, options);
68523 return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
68524}
68525
68526function normalize(uri, options) {
68527 if (typeof uri === "string") {
68528 uri = serialize(parse(uri, options), options);
68529 } else if (typeOf(uri) === "object") {
68530 uri = parse(serialize(uri, options), options);
68531 }
68532 return uri;
68533}
68534
68535function equal(uriA, uriB, options) {
68536 if (typeof uriA === "string") {
68537 uriA = serialize(parse(uriA, options), options);
68538 } else if (typeOf(uriA) === "object") {
68539 uriA = serialize(uriA, options);
68540 }
68541 if (typeof uriB === "string") {
68542 uriB = serialize(parse(uriB, options), options);
68543 } else if (typeOf(uriB) === "object") {
68544 uriB = serialize(uriB, options);
68545 }
68546 return uriA === uriB;
68547}
68548
68549function escapeComponent(str, options) {
68550 return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
68551}
68552
68553function unescapeComponent(str, options) {
68554 return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
68555}
68556
68557var handler = {
68558 scheme: "http",
68559 domainHost: true,
68560 parse: function parse(components, options) {
68561 //report missing host
68562 if (!components.host) {
68563 components.error = components.error || "HTTP URIs must have a host.";
68564 }
68565 return components;
68566 },
68567 serialize: function serialize(components, options) {
68568 //normalize the default port
68569 if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
68570 components.port = undefined;
68571 }
68572 //normalize the empty path
68573 if (!components.path) {
68574 components.path = "/";
68575 }
68576 //NOTE: We do not parse query strings for HTTP URIs
68577 //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
68578 //and not the HTTP spec.
68579 return components;
68580 }
68581};
68582
68583var handler$1 = {
68584 scheme: "https",
68585 domainHost: handler.domainHost,
68586 parse: handler.parse,
68587 serialize: handler.serialize
68588};
68589
68590var O = {};
68591var isIRI = true;
68592//RFC 3986
68593var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
68594var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
68595var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
68596//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
68597//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
68598//const WSP$$ = "[\\x20\\x09]";
68599//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
68600//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
68601//const VCHAR$$ = "[\\x21-\\x7E]";
68602//const WSP$$ = "[\\x20\\x09]";
68603//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
68604//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
68605//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
68606//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
68607var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
68608var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
68609var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
68610var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
68611var UNRESERVED = new RegExp(UNRESERVED$$, "g");
68612var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
68613var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
68614var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
68615var NOT_HFVALUE = NOT_HFNAME;
68616function decodeUnreserved(str) {
68617 var decStr = pctDecChars(str);
68618 return !decStr.match(UNRESERVED) ? str : decStr;
68619}
68620var handler$2 = {
68621 scheme: "mailto",
68622 parse: function parse$$1(components, options) {
68623 var mailtoComponents = components;
68624 var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
68625 mailtoComponents.path = undefined;
68626 if (mailtoComponents.query) {
68627 var unknownHeaders = false;
68628 var headers = {};
68629 var hfields = mailtoComponents.query.split("&");
68630 for (var x = 0, xl = hfields.length; x < xl; ++x) {
68631 var hfield = hfields[x].split("=");
68632 switch (hfield[0]) {
68633 case "to":
68634 var toAddrs = hfield[1].split(",");
68635 for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
68636 to.push(toAddrs[_x]);
68637 }
68638 break;
68639 case "subject":
68640 mailtoComponents.subject = unescapeComponent(hfield[1], options);
68641 break;
68642 case "body":
68643 mailtoComponents.body = unescapeComponent(hfield[1], options);
68644 break;
68645 default:
68646 unknownHeaders = true;
68647 headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
68648 break;
68649 }
68650 }
68651 if (unknownHeaders) mailtoComponents.headers = headers;
68652 }
68653 mailtoComponents.query = undefined;
68654 for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
68655 var addr = to[_x2].split("@");
68656 addr[0] = unescapeComponent(addr[0]);
68657 if (!options.unicodeSupport) {
68658 //convert Unicode IDN -> ASCII IDN
68659 try {
68660 addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
68661 } catch (e) {
68662 mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
68663 }
68664 } else {
68665 addr[1] = unescapeComponent(addr[1], options).toLowerCase();
68666 }
68667 to[_x2] = addr.join("@");
68668 }
68669 return mailtoComponents;
68670 },
68671 serialize: function serialize$$1(mailtoComponents, options) {
68672 var components = mailtoComponents;
68673 var to = toArray(mailtoComponents.to);
68674 if (to) {
68675 for (var x = 0, xl = to.length; x < xl; ++x) {
68676 var toAddr = String(to[x]);
68677 var atIdx = toAddr.lastIndexOf("@");
68678 var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
68679 var domain = toAddr.slice(atIdx + 1);
68680 //convert IDN via punycode
68681 try {
68682 domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
68683 } catch (e) {
68684 components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
68685 }
68686 to[x] = localPart + "@" + domain;
68687 }
68688 components.path = to.join(",");
68689 }
68690 var headers = mailtoComponents.headers = mailtoComponents.headers || {};
68691 if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
68692 if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
68693 var fields = [];
68694 for (var name in headers) {
68695 if (headers[name] !== O[name]) {
68696 fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
68697 }
68698 }
68699 if (fields.length) {
68700 components.query = fields.join("&");
68701 }
68702 return components;
68703 }
68704};
68705
68706var URN_PARSE = /^([^\:]+)\:(.*)/;
68707//RFC 2141
68708var handler$3 = {
68709 scheme: "urn",
68710 parse: function parse$$1(components, options) {
68711 var matches = components.path && components.path.match(URN_PARSE);
68712 var urnComponents = components;
68713 if (matches) {
68714 var scheme = options.scheme || urnComponents.scheme || "urn";
68715 var nid = matches[1].toLowerCase();
68716 var nss = matches[2];
68717 var urnScheme = scheme + ":" + (options.nid || nid);
68718 var schemeHandler = SCHEMES[urnScheme];
68719 urnComponents.nid = nid;
68720 urnComponents.nss = nss;
68721 urnComponents.path = undefined;
68722 if (schemeHandler) {
68723 urnComponents = schemeHandler.parse(urnComponents, options);
68724 }
68725 } else {
68726 urnComponents.error = urnComponents.error || "URN can not be parsed.";
68727 }
68728 return urnComponents;
68729 },
68730 serialize: function serialize$$1(urnComponents, options) {
68731 var scheme = options.scheme || urnComponents.scheme || "urn";
68732 var nid = urnComponents.nid;
68733 var urnScheme = scheme + ":" + (options.nid || nid);
68734 var schemeHandler = SCHEMES[urnScheme];
68735 if (schemeHandler) {
68736 urnComponents = schemeHandler.serialize(urnComponents, options);
68737 }
68738 var uriComponents = urnComponents;
68739 var nss = urnComponents.nss;
68740 uriComponents.path = (nid || options.nid) + ":" + nss;
68741 return uriComponents;
68742 }
68743};
68744
68745var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
68746//RFC 4122
68747var handler$4 = {
68748 scheme: "urn:uuid",
68749 parse: function parse(urnComponents, options) {
68750 var uuidComponents = urnComponents;
68751 uuidComponents.uuid = uuidComponents.nss;
68752 uuidComponents.nss = undefined;
68753 if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
68754 uuidComponents.error = uuidComponents.error || "UUID is not valid.";
68755 }
68756 return uuidComponents;
68757 },
68758 serialize: function serialize(uuidComponents, options) {
68759 var urnComponents = uuidComponents;
68760 //normalize UUID
68761 urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
68762 return urnComponents;
68763 }
68764};
68765
68766SCHEMES[handler.scheme] = handler;
68767SCHEMES[handler$1.scheme] = handler$1;
68768SCHEMES[handler$2.scheme] = handler$2;
68769SCHEMES[handler$3.scheme] = handler$3;
68770SCHEMES[handler$4.scheme] = handler$4;
68771
68772exports.SCHEMES = SCHEMES;
68773exports.pctEncChar = pctEncChar;
68774exports.pctDecChars = pctDecChars;
68775exports.parse = parse;
68776exports.removeDotSegments = removeDotSegments;
68777exports.serialize = serialize;
68778exports.resolveComponents = resolveComponents;
68779exports.resolve = resolve;
68780exports.normalize = normalize;
68781exports.equal = equal;
68782exports.escapeComponent = escapeComponent;
68783exports.unescapeComponent = unescapeComponent;
68784
68785Object.defineProperty(exports, '__esModule', { value: true });
68786
68787})));
68788//# sourceMappingURL=uri.all.js.map
68789
68790
68791/***/ }),
68792
68793/***/ 67806:
68794/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
68795
68796// Copyright 2014 Simon Lydell
68797// X11 (“MIT”) Licensed. (See LICENSE.)
68798
68799var path = __webpack_require__(85622)
68800
68801"use strict"
68802
68803function urix(aPath) {
68804 if (path.sep === "\\") {
68805 return aPath
68806 .replace(/\\/g, "/")
68807 .replace(/^[a-z]:\/?/i, "/")
68808 }
68809 return aPath
68810}
68811
68812module.exports = urix
68813
68814
68815/***/ }),
68816
68817/***/ 77709:
68818/***/ (function(module) {
68819
68820"use strict";
68821/*!
68822 * use <https://github.com/jonschlinkert/use>
68823 *
68824 * Copyright (c) 2015-2017, Jon Schlinkert.
68825 * Released under the MIT License.
68826 */
68827
68828
68829
68830module.exports = function base(app, options) {
68831 if (!isObject(app) && typeof app !== 'function') {
68832 throw new TypeError('expected an object or function');
68833 }
68834
68835 var opts = isObject(options) ? options : {};
68836 var prop = typeof opts.prop === 'string' ? opts.prop : 'fns';
68837 if (!Array.isArray(app[prop])) {
68838 define(app, prop, []);
68839 }
68840
68841 /**
68842 * Define a plugin function to be passed to use. The only
68843 * parameter exposed to the plugin is `app`, the object or function.
68844 * passed to `use(app)`. `app` is also exposed as `this` in plugins.
68845 *
68846 * Additionally, **if a plugin returns a function, the function will
68847 * be pushed onto the `fns` array**, allowing the plugin to be
68848 * called at a later point by the `run` method.
68849 *
68850 * ```js
68851 * var use = require('use');
68852 *
68853 * // define a plugin
68854 * function foo(app) {
68855 * // do stuff
68856 * }
68857 *
68858 * var app = function(){};
68859 * use(app);
68860 *
68861 * // register plugins
68862 * app.use(foo);
68863 * app.use(bar);
68864 * app.use(baz);
68865 * ```
68866 * @name .use
68867 * @param {Function} `fn` plugin function to call
68868 * @api public
68869 */
68870
68871 define(app, 'use', use);
68872
68873 /**
68874 * Run all plugins on `fns`. Any plugin that returns a function
68875 * when called by `use` is pushed onto the `fns` array.
68876 *
68877 * ```js
68878 * var config = {};
68879 * app.run(config);
68880 * ```
68881 * @name .run
68882 * @param {Object} `value` Object to be modified by plugins.
68883 * @return {Object} Returns the object passed to `run`
68884 * @api public
68885 */
68886
68887 define(app, 'run', function(val) {
68888 if (!isObject(val)) return;
68889
68890 if (!val.use || !val.run) {
68891 define(val, prop, val[prop] || []);
68892 define(val, 'use', use);
68893 }
68894
68895 if (!val[prop] || val[prop].indexOf(base) === -1) {
68896 val.use(base);
68897 }
68898
68899 var self = this || app;
68900 var fns = self[prop];
68901 var len = fns.length;
68902 var idx = -1;
68903
68904 while (++idx < len) {
68905 val.use(fns[idx]);
68906 }
68907 return val;
68908 });
68909
68910 /**
68911 * Call plugin `fn`. If a function is returned push it into the
68912 * `fns` array to be called by the `run` method.
68913 */
68914
68915 function use(type, fn, options) {
68916 var offset = 1;
68917
68918 if (typeof type === 'string' || Array.isArray(type)) {
68919 fn = wrap(type, fn);
68920 offset++;
68921 } else {
68922 options = fn;
68923 fn = type;
68924 }
68925
68926 if (typeof fn !== 'function') {
68927 throw new TypeError('expected a function');
68928 }
68929
68930 var self = this || app;
68931 var fns = self[prop];
68932
68933 var args = [].slice.call(arguments, offset);
68934 args.unshift(self);
68935
68936 if (typeof opts.hook === 'function') {
68937 opts.hook.apply(self, args);
68938 }
68939
68940 var val = fn.apply(self, args);
68941 if (typeof val === 'function' && fns.indexOf(val) === -1) {
68942 fns.push(val);
68943 }
68944 return self;
68945 }
68946
68947 /**
68948 * Wrap a named plugin function so that it's only called on objects of the
68949 * given `type`
68950 *
68951 * @param {String} `type`
68952 * @param {Function} `fn` Plugin function
68953 * @return {Function}
68954 */
68955
68956 function wrap(type, fn) {
68957 return function plugin() {
68958 return this.type === type ? fn.apply(this, arguments) : plugin;
68959 };
68960 }
68961
68962 return app;
68963};
68964
68965function isObject(val) {
68966 return val && typeof val === 'object' && !Array.isArray(val);
68967}
68968
68969function define(obj, key, val) {
68970 Object.defineProperty(obj, key, {
68971 configurable: true,
68972 writable: true,
68973 value: val
68974 });
68975}
68976
68977
68978/***/ }),
68979
68980/***/ 92262:
68981/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
68982
68983
68984/**
68985 * For Node.js, simply re-export the core `util.deprecate` function.
68986 */
68987
68988module.exports = __webpack_require__(31669).deprecate;
68989
68990
68991/***/ }),
68992
68993/***/ 24059:
68994/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
68995
68996module.exports = __webpack_require__(47257);
68997
68998
68999/***/ }),
69000
69001/***/ 71118:
69002/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69003
69004"use strict";
69005/*
69006 MIT License http://www.opensource.org/licenses/mit-license.php
69007 Author Tobias Koppers @sokra
69008*/
69009
69010
69011const ConstDependency = __webpack_require__(71101);
69012const ParserHelpers = __webpack_require__(23999);
69013
69014const NullFactory = __webpack_require__(40438);
69015
69016/* eslint-disable camelcase */
69017const REPLACEMENTS = {
69018 __webpack_require__: "__webpack_require__",
69019 __webpack_public_path__: "__webpack_require__.p",
69020 __webpack_modules__: "__webpack_require__.m",
69021 __webpack_chunk_load__: "__webpack_require__.e",
69022 __non_webpack_require__: "require",
69023 __webpack_nonce__: "__webpack_require__.nc",
69024 "require.onError": "__webpack_require__.oe"
69025};
69026const NO_WEBPACK_REQUIRE = {
69027 __non_webpack_require__: true
69028};
69029const REPLACEMENT_TYPES = {
69030 __webpack_public_path__: "string",
69031 __webpack_require__: "function",
69032 __webpack_modules__: "object",
69033 __webpack_chunk_load__: "function",
69034 __webpack_nonce__: "string"
69035};
69036/* eslint-enable camelcase */
69037
69038class APIPlugin {
69039 apply(compiler) {
69040 compiler.hooks.compilation.tap(
69041 "APIPlugin",
69042 (compilation, { normalModuleFactory }) => {
69043 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
69044 compilation.dependencyTemplates.set(
69045 ConstDependency,
69046 new ConstDependency.Template()
69047 );
69048
69049 const handler = parser => {
69050 Object.keys(REPLACEMENTS).forEach(key => {
69051 parser.hooks.expression
69052 .for(key)
69053 .tap(
69054 "APIPlugin",
69055 NO_WEBPACK_REQUIRE[key]
69056 ? ParserHelpers.toConstantDependency(
69057 parser,
69058 REPLACEMENTS[key]
69059 )
69060 : ParserHelpers.toConstantDependencyWithWebpackRequire(
69061 parser,
69062 REPLACEMENTS[key]
69063 )
69064 );
69065 const type = REPLACEMENT_TYPES[key];
69066 if (type) {
69067 parser.hooks.evaluateTypeof
69068 .for(key)
69069 .tap("APIPlugin", ParserHelpers.evaluateToString(type));
69070 }
69071 });
69072 };
69073
69074 normalModuleFactory.hooks.parser
69075 .for("javascript/auto")
69076 .tap("APIPlugin", handler);
69077 normalModuleFactory.hooks.parser
69078 .for("javascript/dynamic")
69079 .tap("APIPlugin", handler);
69080 normalModuleFactory.hooks.parser
69081 .for("javascript/esm")
69082 .tap("APIPlugin", handler);
69083 }
69084 );
69085 }
69086}
69087
69088module.exports = APIPlugin;
69089
69090
69091/***/ }),
69092
69093/***/ 36104:
69094/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69095
69096"use strict";
69097
69098
69099const WebpackError = __webpack_require__(97391);
69100const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
69101
69102/**
69103 * @param {string=} method method name
69104 * @returns {string} message
69105 */
69106function createMessage(method) {
69107 return `Abstract method${method ? " " + method : ""}. Must be overridden.`;
69108}
69109
69110/**
69111 * @constructor
69112 */
69113function Message() {
69114 this.stack = undefined;
69115 Error.captureStackTrace(this);
69116 /** @type {RegExpMatchArray} */
69117 const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
69118
69119 this.message = match && match[1] ? createMessage(match[1]) : createMessage();
69120}
69121
69122/**
69123 * Error for abstract method
69124 * @example
69125 * class FooClass {
69126 * abstractMethod() {
69127 * throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overriden.
69128 * }
69129 * }
69130 *
69131 */
69132class AbstractMethodError extends WebpackError {
69133 constructor() {
69134 super(new Message().message);
69135 this.name = "AbstractMethodError";
69136 }
69137}
69138
69139module.exports = AbstractMethodError;
69140
69141
69142/***/ }),
69143
69144/***/ 9701:
69145/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69146
69147"use strict";
69148/*
69149 MIT License http://www.opensource.org/licenses/mit-license.php
69150 Author Tobias Koppers @sokra
69151 */
69152
69153
69154
69155const { ConcatSource } = __webpack_require__(53665);
69156const Template = __webpack_require__(96066);
69157
69158/** @typedef {import("./Compilation")} Compilation */
69159
69160/**
69161 * @typedef {Object} AmdMainTemplatePluginOptions
69162 * @param {string=} name the library name
69163 * @property {boolean=} requireAsWrapper
69164 */
69165
69166class AmdMainTemplatePlugin {
69167 /**
69168 * @param {AmdMainTemplatePluginOptions} options the plugin options
69169 */
69170 constructor(options) {
69171 if (!options || typeof options === "string") {
69172 this.name = options;
69173 this.requireAsWrapper = false;
69174 } else {
69175 this.name = options.name;
69176 this.requireAsWrapper = options.requireAsWrapper;
69177 }
69178 }
69179
69180 /**
69181 * @param {Compilation} compilation the compilation instance
69182 * @returns {void}
69183 */
69184 apply(compilation) {
69185 const { mainTemplate, chunkTemplate } = compilation;
69186
69187 const onRenderWithEntry = (source, chunk, hash) => {
69188 const externals = chunk.getModules().filter(m => m.external);
69189 const externalsDepsArray = JSON.stringify(
69190 externals.map(m =>
69191 typeof m.request === "object" ? m.request.amd : m.request
69192 )
69193 );
69194 const externalsArguments = externals
69195 .map(
69196 m => `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(`${m.id}`)}__`
69197 )
69198 .join(", ");
69199
69200 if (this.requireAsWrapper) {
69201 return new ConcatSource(
69202 `require(${externalsDepsArray}, function(${externalsArguments}) { return `,
69203 source,
69204 "});"
69205 );
69206 } else if (this.name) {
69207 const name = mainTemplate.getAssetPath(this.name, {
69208 hash,
69209 chunk
69210 });
69211
69212 return new ConcatSource(
69213 `define(${JSON.stringify(
69214 name
69215 )}, ${externalsDepsArray}, function(${externalsArguments}) { return `,
69216 source,
69217 "});"
69218 );
69219 } else if (externalsArguments) {
69220 return new ConcatSource(
69221 `define(${externalsDepsArray}, function(${externalsArguments}) { return `,
69222 source,
69223 "});"
69224 );
69225 } else {
69226 return new ConcatSource("define(function() { return ", source, "});");
69227 }
69228 };
69229
69230 for (const template of [mainTemplate, chunkTemplate]) {
69231 template.hooks.renderWithEntry.tap(
69232 "AmdMainTemplatePlugin",
69233 onRenderWithEntry
69234 );
69235 }
69236
69237 mainTemplate.hooks.globalHashPaths.tap("AmdMainTemplatePlugin", paths => {
69238 if (this.name) {
69239 paths.push(this.name);
69240 }
69241 return paths;
69242 });
69243
69244 mainTemplate.hooks.hash.tap("AmdMainTemplatePlugin", hash => {
69245 hash.update("exports amd");
69246 if (this.name) {
69247 hash.update(this.name);
69248 }
69249 });
69250 }
69251}
69252
69253module.exports = AmdMainTemplatePlugin;
69254
69255
69256/***/ }),
69257
69258/***/ 22814:
69259/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69260
69261"use strict";
69262/*
69263 MIT License http://www.opensource.org/licenses/mit-license.php
69264 Author Tobias Koppers @sokra
69265*/
69266
69267
69268const DependenciesBlock = __webpack_require__(16071);
69269
69270/** @typedef {import("./ChunkGroup")} ChunkGroup */
69271/** @typedef {import("./Module")} Module */
69272/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
69273/** @typedef {import("./util/createHash").Hash} Hash */
69274/** @typedef {TODO} GroupOptions */
69275
69276module.exports = class AsyncDependenciesBlock extends DependenciesBlock {
69277 /**
69278 * @param {GroupOptions} groupOptions options for the group
69279 * @param {Module} module the Module object
69280 * @param {DependencyLocation=} loc the line of code
69281 * @param {TODO=} request the request
69282 */
69283 constructor(groupOptions, module, loc, request) {
69284 super();
69285 if (typeof groupOptions === "string") {
69286 groupOptions = { name: groupOptions };
69287 } else if (!groupOptions) {
69288 groupOptions = { name: undefined };
69289 }
69290 this.groupOptions = groupOptions;
69291 /** @type {ChunkGroup=} */
69292 this.chunkGroup = undefined;
69293 this.module = module;
69294 this.loc = loc;
69295 this.request = request;
69296 /** @type {DependenciesBlock} */
69297 this.parent = undefined;
69298 }
69299
69300 /**
69301 * @returns {string} The name of the chunk
69302 */
69303 get chunkName() {
69304 return this.groupOptions.name;
69305 }
69306
69307 /**
69308 * @param {string} value The new chunk name
69309 * @returns {void}
69310 */
69311 set chunkName(value) {
69312 this.groupOptions.name = value;
69313 }
69314
69315 /**
69316 * @returns {never} this throws and should never be called
69317 */
69318 get chunks() {
69319 throw new Error("Moved to AsyncDependenciesBlock.chunkGroup");
69320 }
69321
69322 /**
69323 * @param {never} value setter value
69324 * @returns {never} this is going to throw therefore we should throw type
69325 * assertions by returning never
69326 */
69327 set chunks(value) {
69328 throw new Error("Moved to AsyncDependenciesBlock.chunkGroup");
69329 }
69330
69331 /**
69332 * @param {Hash} hash the hash used to track block changes, from "crypto" module
69333 * @returns {void}
69334 */
69335 updateHash(hash) {
69336 hash.update(JSON.stringify(this.groupOptions));
69337 hash.update(
69338 (this.chunkGroup &&
69339 this.chunkGroup.chunks
69340 .map(chunk => {
69341 return chunk.id !== null ? chunk.id : "";
69342 })
69343 .join(",")) ||
69344 ""
69345 );
69346 super.updateHash(hash);
69347 }
69348
69349 /**
69350 * @returns {void}
69351 */
69352 disconnect() {
69353 this.chunkGroup = undefined;
69354 super.disconnect();
69355 }
69356
69357 /**
69358 * @returns {void}
69359 */
69360 unseal() {
69361 this.chunkGroup = undefined;
69362 super.unseal();
69363 }
69364
69365 /**
69366 * @returns {void}
69367 */
69368 sortItems() {
69369 super.sortItems();
69370 }
69371};
69372
69373
69374/***/ }),
69375
69376/***/ 67089:
69377/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69378
69379"use strict";
69380/*
69381 MIT License http://www.opensource.org/licenses/mit-license.php
69382 Author Sean Larkin @thelarkinn
69383*/
69384
69385
69386const WebpackError = __webpack_require__(97391);
69387
69388/** @typedef {import("./Module")} Module */
69389
69390class AsyncDependencyToInitialChunkError extends WebpackError {
69391 /**
69392 * Creates an instance of AsyncDependencyToInitialChunkError.
69393 * @param {string} chunkName Name of Chunk
69394 * @param {Module} module module tied to dependency
69395 * @param {TODO} loc location of dependency
69396 */
69397 constructor(chunkName, module, loc) {
69398 super(
69399 `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`
69400 );
69401
69402 this.name = "AsyncDependencyToInitialChunkError";
69403 this.module = module;
69404 this.loc = loc;
69405
69406 Error.captureStackTrace(this, this.constructor);
69407 }
69408}
69409
69410module.exports = AsyncDependencyToInitialChunkError;
69411
69412
69413/***/ }),
69414
69415/***/ 51596:
69416/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69417
69418"use strict";
69419/*
69420 MIT License http://www.opensource.org/licenses/mit-license.php
69421 Author Tobias Koppers @sokra
69422*/
69423
69424
69425const asyncLib = __webpack_require__(36386);
69426const PrefetchDependency = __webpack_require__(14237);
69427const NormalModule = __webpack_require__(25963);
69428
69429/** @typedef {import("./Compiler")} Compiler */
69430
69431class AutomaticPrefetchPlugin {
69432 /**
69433 * Apply the plugin
69434 * @param {Compiler} compiler Webpack Compiler
69435 * @returns {void}
69436 */
69437 apply(compiler) {
69438 compiler.hooks.compilation.tap(
69439 "AutomaticPrefetchPlugin",
69440 (compilation, { normalModuleFactory }) => {
69441 compilation.dependencyFactories.set(
69442 PrefetchDependency,
69443 normalModuleFactory
69444 );
69445 }
69446 );
69447 let lastModules = null;
69448 compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => {
69449 lastModules = compilation.modules
69450 .filter(m => m instanceof NormalModule)
69451 .map((/** @type {NormalModule} */ m) => ({
69452 context: m.context,
69453 request: m.request
69454 }));
69455 });
69456 compiler.hooks.make.tapAsync(
69457 "AutomaticPrefetchPlugin",
69458 (compilation, callback) => {
69459 if (!lastModules) return callback();
69460 asyncLib.forEach(
69461 lastModules,
69462 (m, callback) => {
69463 compilation.prefetch(
69464 m.context || compiler.context,
69465 new PrefetchDependency(m.request),
69466 callback
69467 );
69468 },
69469 callback
69470 );
69471 }
69472 );
69473 }
69474}
69475module.exports = AutomaticPrefetchPlugin;
69476
69477
69478/***/ }),
69479
69480/***/ 4009:
69481/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69482
69483"use strict";
69484/*
69485 MIT License http://www.opensource.org/licenses/mit-license.php
69486 Author Tobias Koppers @sokra
69487 */
69488
69489
69490
69491const { ConcatSource } = __webpack_require__(53665);
69492const ModuleFilenameHelpers = __webpack_require__(71474);
69493const Template = __webpack_require__(96066);
69494
69495const validateOptions = __webpack_require__(33225);
69496const schema = __webpack_require__(10171);
69497
69498/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */
69499/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */
69500
69501const wrapComment = str => {
69502 if (!str.includes("\n")) {
69503 return Template.toComment(str);
69504 }
69505 return `/*!\n * ${str
69506 .replace(/\*\//g, "* /")
69507 .split("\n")
69508 .join("\n * ")}\n */`;
69509};
69510
69511class BannerPlugin {
69512 /**
69513 * @param {BannerPluginArgument} options options object
69514 */
69515 constructor(options) {
69516 if (arguments.length > 1) {
69517 throw new Error(
69518 "BannerPlugin only takes one argument (pass an options object)"
69519 );
69520 }
69521
69522 validateOptions(schema, options, "Banner Plugin");
69523
69524 if (typeof options === "string" || typeof options === "function") {
69525 options = {
69526 banner: options
69527 };
69528 }
69529
69530 /** @type {BannerPluginOptions} */
69531 this.options = options;
69532
69533 const bannerOption = options.banner;
69534 if (typeof bannerOption === "function") {
69535 const getBanner = bannerOption;
69536 this.banner = this.options.raw
69537 ? getBanner
69538 : data => wrapComment(getBanner(data));
69539 } else {
69540 const banner = this.options.raw
69541 ? bannerOption
69542 : wrapComment(bannerOption);
69543 this.banner = () => banner;
69544 }
69545 }
69546
69547 apply(compiler) {
69548 const options = this.options;
69549 const banner = this.banner;
69550 const matchObject = ModuleFilenameHelpers.matchObject.bind(
69551 undefined,
69552 options
69553 );
69554
69555 compiler.hooks.compilation.tap("BannerPlugin", compilation => {
69556 compilation.hooks.optimizeChunkAssets.tap("BannerPlugin", chunks => {
69557 for (const chunk of chunks) {
69558 if (options.entryOnly && !chunk.canBeInitial()) {
69559 continue;
69560 }
69561
69562 for (const file of chunk.files) {
69563 if (!matchObject(file)) {
69564 continue;
69565 }
69566
69567 let query = "";
69568 let filename = file;
69569 const hash = compilation.hash;
69570 const querySplit = filename.indexOf("?");
69571
69572 if (querySplit >= 0) {
69573 query = filename.substr(querySplit);
69574 filename = filename.substr(0, querySplit);
69575 }
69576
69577 const lastSlashIndex = filename.lastIndexOf("/");
69578
69579 const basename =
69580 lastSlashIndex === -1
69581 ? filename
69582 : filename.substr(lastSlashIndex + 1);
69583
69584 const data = {
69585 hash,
69586 chunk,
69587 filename,
69588 basename,
69589 query
69590 };
69591
69592 const comment = compilation.getPath(banner(data), data);
69593
69594 compilation.updateAsset(
69595 file,
69596 old => new ConcatSource(comment, "\n", old)
69597 );
69598 }
69599 }
69600 });
69601 });
69602 }
69603}
69604
69605module.exports = BannerPlugin;
69606
69607
69608/***/ }),
69609
69610/***/ 96770:
69611/***/ (function(module) {
69612
69613"use strict";
69614/*
69615 MIT License http://www.opensource.org/licenses/mit-license.php
69616 Author Tobias Koppers @sokra
69617*/
69618
69619
69620
69621const TypeUnknown = 0;
69622const TypeNull = 1;
69623const TypeString = 2;
69624const TypeNumber = 3;
69625const TypeBoolean = 4;
69626const TypeRegExp = 5;
69627const TypeConditional = 6;
69628const TypeArray = 7;
69629const TypeConstArray = 8;
69630const TypeIdentifier = 9;
69631const TypeWrapped = 10;
69632const TypeTemplateString = 11;
69633
69634class BasicEvaluatedExpression {
69635 constructor() {
69636 this.type = TypeUnknown;
69637 this.range = null;
69638 this.falsy = false;
69639 this.truthy = false;
69640 this.bool = null;
69641 this.number = null;
69642 this.regExp = null;
69643 this.string = null;
69644 this.quasis = null;
69645 this.parts = null;
69646 this.array = null;
69647 this.items = null;
69648 this.options = null;
69649 this.prefix = null;
69650 this.postfix = null;
69651 this.wrappedInnerExpressions = null;
69652 this.expression = null;
69653 }
69654
69655 isNull() {
69656 return this.type === TypeNull;
69657 }
69658
69659 isString() {
69660 return this.type === TypeString;
69661 }
69662
69663 isNumber() {
69664 return this.type === TypeNumber;
69665 }
69666
69667 isBoolean() {
69668 return this.type === TypeBoolean;
69669 }
69670
69671 isRegExp() {
69672 return this.type === TypeRegExp;
69673 }
69674
69675 isConditional() {
69676 return this.type === TypeConditional;
69677 }
69678
69679 isArray() {
69680 return this.type === TypeArray;
69681 }
69682
69683 isConstArray() {
69684 return this.type === TypeConstArray;
69685 }
69686
69687 isIdentifier() {
69688 return this.type === TypeIdentifier;
69689 }
69690
69691 isWrapped() {
69692 return this.type === TypeWrapped;
69693 }
69694
69695 isTemplateString() {
69696 return this.type === TypeTemplateString;
69697 }
69698
69699 isTruthy() {
69700 return this.truthy;
69701 }
69702
69703 isFalsy() {
69704 return this.falsy;
69705 }
69706
69707 asBool() {
69708 if (this.truthy) return true;
69709 if (this.falsy) return false;
69710 if (this.isBoolean()) return this.bool;
69711 if (this.isNull()) return false;
69712 if (this.isString()) return this.string !== "";
69713 if (this.isNumber()) return this.number !== 0;
69714 if (this.isRegExp()) return true;
69715 if (this.isArray()) return true;
69716 if (this.isConstArray()) return true;
69717 if (this.isWrapped()) {
69718 return (this.prefix && this.prefix.asBool()) ||
69719 (this.postfix && this.postfix.asBool())
69720 ? true
69721 : undefined;
69722 }
69723 if (this.isTemplateString()) {
69724 const str = this.asString();
69725 if (typeof str === "string") return str !== "";
69726 }
69727 return undefined;
69728 }
69729
69730 asString() {
69731 if (this.isBoolean()) return `${this.bool}`;
69732 if (this.isNull()) return "null";
69733 if (this.isString()) return this.string;
69734 if (this.isNumber()) return `${this.number}`;
69735 if (this.isRegExp()) return `${this.regExp}`;
69736 if (this.isArray()) {
69737 let array = [];
69738 for (const item of this.items) {
69739 const itemStr = item.asString();
69740 if (itemStr === undefined) return undefined;
69741 array.push(itemStr);
69742 }
69743 return `${array}`;
69744 }
69745 if (this.isConstArray()) return `${this.array}`;
69746 if (this.isTemplateString()) {
69747 let str = "";
69748 for (const part of this.parts) {
69749 const partStr = part.asString();
69750 if (partStr === undefined) return undefined;
69751 str += partStr;
69752 }
69753 return str;
69754 }
69755 return undefined;
69756 }
69757
69758 setString(string) {
69759 this.type = TypeString;
69760 this.string = string;
69761 return this;
69762 }
69763
69764 setNull() {
69765 this.type = TypeNull;
69766 return this;
69767 }
69768
69769 setNumber(number) {
69770 this.type = TypeNumber;
69771 this.number = number;
69772 return this;
69773 }
69774
69775 setBoolean(bool) {
69776 this.type = TypeBoolean;
69777 this.bool = bool;
69778 return this;
69779 }
69780
69781 setRegExp(regExp) {
69782 this.type = TypeRegExp;
69783 this.regExp = regExp;
69784 return this;
69785 }
69786
69787 setIdentifier(identifier) {
69788 this.type = TypeIdentifier;
69789 this.identifier = identifier;
69790 return this;
69791 }
69792
69793 setWrapped(prefix, postfix, innerExpressions) {
69794 this.type = TypeWrapped;
69795 this.prefix = prefix;
69796 this.postfix = postfix;
69797 this.wrappedInnerExpressions = innerExpressions;
69798 return this;
69799 }
69800
69801 setOptions(options) {
69802 this.type = TypeConditional;
69803 this.options = options;
69804 return this;
69805 }
69806
69807 addOptions(options) {
69808 if (!this.options) {
69809 this.type = TypeConditional;
69810 this.options = [];
69811 }
69812 for (const item of options) {
69813 this.options.push(item);
69814 }
69815 return this;
69816 }
69817
69818 setItems(items) {
69819 this.type = TypeArray;
69820 this.items = items;
69821 return this;
69822 }
69823
69824 setArray(array) {
69825 this.type = TypeConstArray;
69826 this.array = array;
69827 return this;
69828 }
69829
69830 setTemplateString(quasis, parts, kind) {
69831 this.type = TypeTemplateString;
69832 this.quasis = quasis;
69833 this.parts = parts;
69834 this.templateStringKind = kind;
69835 return this;
69836 }
69837
69838 setTruthy() {
69839 this.falsy = false;
69840 this.truthy = true;
69841 return this;
69842 }
69843
69844 setFalsy() {
69845 this.falsy = true;
69846 this.truthy = false;
69847 return this;
69848 }
69849
69850 setRange(range) {
69851 this.range = range;
69852 return this;
69853 }
69854
69855 setExpression(expression) {
69856 this.expression = expression;
69857 return this;
69858 }
69859}
69860
69861module.exports = BasicEvaluatedExpression;
69862
69863
69864/***/ }),
69865
69866/***/ 6465:
69867/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69868
69869"use strict";
69870/*
69871 MIT License http://www.opensource.org/licenses/mit-license.php
69872 Author Tobias Koppers @sokra
69873*/
69874
69875
69876const asyncLib = __webpack_require__(36386);
69877
69878class CachePlugin {
69879 constructor(cache) {
69880 this.cache = cache || {};
69881 this.FS_ACCURACY = 2000;
69882 }
69883
69884 apply(compiler) {
69885 if (Array.isArray(compiler.compilers)) {
69886 compiler.compilers.forEach((c, idx) => {
69887 new CachePlugin((this.cache[idx] = this.cache[idx] || {})).apply(c);
69888 });
69889 } else {
69890 const registerCacheToCompiler = (compiler, cache) => {
69891 compiler.hooks.thisCompilation.tap("CachePlugin", compilation => {
69892 compilation.cache = cache;
69893 compilation.hooks.childCompiler.tap(
69894 "CachePlugin",
69895 (childCompiler, compilerName, compilerIndex) => {
69896 let childCache;
69897 if (!cache.children) {
69898 cache.children = {};
69899 }
69900 if (!cache.children[compilerName]) {
69901 cache.children[compilerName] = [];
69902 }
69903 if (cache.children[compilerName][compilerIndex]) {
69904 childCache = cache.children[compilerName][compilerIndex];
69905 } else {
69906 cache.children[compilerName].push((childCache = {}));
69907 }
69908 registerCacheToCompiler(childCompiler, childCache);
69909 }
69910 );
69911 });
69912 };
69913 registerCacheToCompiler(compiler, this.cache);
69914 compiler.hooks.watchRun.tap("CachePlugin", () => {
69915 this.watching = true;
69916 });
69917 compiler.hooks.run.tapAsync("CachePlugin", (compiler, callback) => {
69918 if (!compiler._lastCompilationFileDependencies) {
69919 return callback();
69920 }
69921 const fs = compiler.inputFileSystem;
69922 const fileTs = (compiler.fileTimestamps = new Map());
69923 asyncLib.forEach(
69924 compiler._lastCompilationFileDependencies,
69925 (file, callback) => {
69926 fs.stat(file, (err, stat) => {
69927 if (err) {
69928 if (err.code === "ENOENT") return callback();
69929 return callback(err);
69930 }
69931
69932 if (stat.mtime) this.applyMtime(+stat.mtime);
69933
69934 fileTs.set(file, +stat.mtime || Infinity);
69935
69936 callback();
69937 });
69938 },
69939 err => {
69940 if (err) return callback(err);
69941
69942 for (const [file, ts] of fileTs) {
69943 fileTs.set(file, ts + this.FS_ACCURACY);
69944 }
69945
69946 callback();
69947 }
69948 );
69949 });
69950 compiler.hooks.afterCompile.tap("CachePlugin", compilation => {
69951 compilation.compiler._lastCompilationFileDependencies =
69952 compilation.fileDependencies;
69953 compilation.compiler._lastCompilationContextDependencies =
69954 compilation.contextDependencies;
69955 });
69956 }
69957 }
69958
69959 /* istanbul ignore next */
69960 applyMtime(mtime) {
69961 if (this.FS_ACCURACY > 1 && mtime % 2 !== 0) this.FS_ACCURACY = 1;
69962 else if (this.FS_ACCURACY > 10 && mtime % 20 !== 0) this.FS_ACCURACY = 10;
69963 else if (this.FS_ACCURACY > 100 && mtime % 200 !== 0)
69964 this.FS_ACCURACY = 100;
69965 else if (this.FS_ACCURACY > 1000 && mtime % 2000 !== 0)
69966 this.FS_ACCURACY = 1000;
69967 }
69968}
69969module.exports = CachePlugin;
69970
69971
69972/***/ }),
69973
69974/***/ 8335:
69975/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
69976
69977"use strict";
69978/*
69979 MIT License http://www.opensource.org/licenses/mit-license.php
69980 Author Tobias Koppers @sokra
69981*/
69982
69983
69984const WebpackError = __webpack_require__(97391);
69985
69986/** @typedef {import("./Module")} Module */
69987
69988/**
69989 * @param {Module[]} modules the modules to be sorted
69990 * @returns {Module[]} sorted version of original modules
69991 */
69992const sortModules = modules => {
69993 return modules.slice().sort((a, b) => {
69994 const aIdent = a.identifier();
69995 const bIdent = b.identifier();
69996 /* istanbul ignore next */
69997 if (aIdent < bIdent) return -1;
69998 /* istanbul ignore next */
69999 if (aIdent > bIdent) return 1;
70000 /* istanbul ignore next */
70001 return 0;
70002 });
70003};
70004
70005/**
70006 * @param {Module[]} modules each module from throw
70007 * @returns {string} each message from provided moduels
70008 */
70009const createModulesListMessage = modules => {
70010 return modules
70011 .map(m => {
70012 let message = `* ${m.identifier()}`;
70013 const validReasons = m.reasons.filter(reason => reason.module);
70014
70015 if (validReasons.length > 0) {
70016 message += `\n Used by ${validReasons.length} module(s), i. e.`;
70017 message += `\n ${validReasons[0].module.identifier()}`;
70018 }
70019 return message;
70020 })
70021 .join("\n");
70022};
70023
70024class CaseSensitiveModulesWarning extends WebpackError {
70025 /**
70026 * Creates an instance of CaseSensitiveModulesWarning.
70027 * @param {Module[]} modules modules that were detected
70028 */
70029 constructor(modules) {
70030 const sortedModules = sortModules(modules);
70031 const modulesList = createModulesListMessage(sortedModules);
70032 super(`There are multiple modules with names that only differ in casing.
70033This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
70034Use equal casing. Compare these module identifiers:
70035${modulesList}`);
70036
70037 this.name = "CaseSensitiveModulesWarning";
70038 this.origin = this.module = sortedModules[0];
70039
70040 Error.captureStackTrace(this, this.constructor);
70041 }
70042}
70043
70044module.exports = CaseSensitiveModulesWarning;
70045
70046
70047/***/ }),
70048
70049/***/ 2919:
70050/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
70051
70052"use strict";
70053/*
70054MIT License http://www.opensource.org/licenses/mit-license.php
70055Author Tobias Koppers @sokra
70056*/
70057
70058
70059const util = __webpack_require__(31669);
70060const SortableSet = __webpack_require__(50071);
70061const intersect = __webpack_require__(54262).intersect;
70062const GraphHelpers = __webpack_require__(32973);
70063const Entrypoint = __webpack_require__(71931);
70064let debugId = 1000;
70065const ERR_CHUNK_ENTRY = "Chunk.entry was removed. Use hasRuntime()";
70066const ERR_CHUNK_INITIAL =
70067 "Chunk.initial was removed. Use canBeInitial/isOnlyInitial()";
70068
70069/** @typedef {import("./Module")} Module */
70070/** @typedef {import("./ChunkGroup")} ChunkGroup */
70071/** @typedef {import("./ModuleReason")} ModuleReason */
70072/** @typedef {import("webpack-sources").Source} Source */
70073/** @typedef {import("./util/createHash").Hash} Hash */
70074
70075/**
70076 * @typedef {Object} WithId an object who has an id property *
70077 * @property {string | number} id the id of the object
70078 */
70079
70080/**
70081 * Compare two Modules based on their ids for sorting
70082 * @param {Module} a module
70083 * @param {Module} b module
70084 * @returns {-1|0|1} sort value
70085 */
70086
70087// TODO use @callback
70088/** @typedef {(a: Module, b: Module) => -1|0|1} ModuleSortPredicate */
70089/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */
70090/** @typedef {(c: Chunk) => boolean} ChunkFilterPredicate */
70091
70092const sortModuleById = (a, b) => {
70093 if (a.id < b.id) return -1;
70094 if (b.id < a.id) return 1;
70095 return 0;
70096};
70097
70098/**
70099 * Compare two ChunkGroups based on their ids for sorting
70100 * @param {ChunkGroup} a chunk group
70101 * @param {ChunkGroup} b chunk group
70102 * @returns {-1|0|1} sort value
70103 */
70104const sortChunkGroupById = (a, b) => {
70105 if (a.id < b.id) return -1;
70106 if (b.id < a.id) return 1;
70107 return 0;
70108};
70109
70110/**
70111 * Compare two Identifiables , based on their ids for sorting
70112 * @param {Module} a first object with ident fn
70113 * @param {Module} b second object with ident fn
70114 * @returns {-1|0|1} The order number of the sort
70115 */
70116const sortByIdentifier = (a, b) => {
70117 if (a.identifier() > b.identifier()) return 1;
70118 if (a.identifier() < b.identifier()) return -1;
70119 return 0;
70120};
70121
70122/**
70123 * @returns {string} a concatenation of module identifiers sorted
70124 * @param {SortableSet} set to pull module identifiers from
70125 */
70126const getModulesIdent = set => {
70127 set.sort();
70128 let str = "";
70129 for (const m of set) {
70130 str += m.identifier() + "#";
70131 }
70132 return str;
70133};
70134
70135/**
70136 * @template T
70137 * @param {SortableSet<T>} set the sortable set to convert to array
70138 * @returns {Array<T>} the array returned from Array.from(set)
70139 */
70140const getArray = set => Array.from(set);
70141
70142/**
70143 * @param {SortableSet<Module>} set the sortable Set to get the count/size of
70144 * @returns {number} the size of the modules
70145 */
70146const getModulesSize = set => {
70147 let size = 0;
70148 for (const module of set) {
70149 size += module.size();
70150 }
70151 return size;
70152};
70153
70154/**
70155 * A Chunk is a unit of encapsulation for Modules.
70156 * Chunks are "rendered" into bundles that get emitted when the build completes.
70157 */
70158class Chunk {
70159 /**
70160 * @param {string=} name of chunk being created, is optional (for subclasses)
70161 */
70162 constructor(name) {
70163 /** @type {number | null} */
70164 this.id = null;
70165 /** @type {number[] | null} */
70166 this.ids = null;
70167 /** @type {number} */
70168 this.debugId = debugId++;
70169 /** @type {string} */
70170 this.name = name;
70171 /** @type {boolean} */
70172 this.preventIntegration = false;
70173 /** @type {Module=} */
70174 this.entryModule = undefined;
70175 /** @private @type {SortableSet<Module>} */
70176 this._modules = new SortableSet(undefined, sortByIdentifier);
70177 /** @type {string?} */
70178 this.filenameTemplate = undefined;
70179 /** @private @type {SortableSet<ChunkGroup>} */
70180 this._groups = new SortableSet(undefined, sortChunkGroupById);
70181 /** @type {string[]} */
70182 this.files = [];
70183 /** @type {boolean} */
70184 this.rendered = false;
70185 /** @type {string=} */
70186 this.hash = undefined;
70187 /** @type {Object} */
70188 this.contentHash = Object.create(null);
70189 /** @type {string=} */
70190 this.renderedHash = undefined;
70191 /** @type {string=} */
70192 this.chunkReason = undefined;
70193 /** @type {boolean} */
70194 this.extraAsync = false;
70195 this.removedModules = undefined;
70196 }
70197
70198 /**
70199 * @deprecated Chunk.entry has been deprecated. Please use .hasRuntime() instead
70200 * @returns {never} Throws an error trying to access this property
70201 */
70202 get entry() {
70203 throw new Error(ERR_CHUNK_ENTRY);
70204 }
70205
70206 /**
70207 * @deprecated .entry has been deprecated. Please use .hasRuntime() instead
70208 * @param {never} data The data that was attempting to be set
70209 * @returns {never} Throws an error trying to access this property
70210 */
70211 set entry(data) {
70212 throw new Error(ERR_CHUNK_ENTRY);
70213 }
70214
70215 /**
70216 * @deprecated Chunk.initial was removed. Use canBeInitial/isOnlyInitial()
70217 * @returns {never} Throws an error trying to access this property
70218 */
70219 get initial() {
70220 throw new Error(ERR_CHUNK_INITIAL);
70221 }
70222
70223 /**
70224 * @deprecated Chunk.initial was removed. Use canBeInitial/isOnlyInitial()
70225 * @param {never} data The data attempting to be set
70226 * @returns {never} Throws an error trying to access this property
70227 */
70228 set initial(data) {
70229 throw new Error(ERR_CHUNK_INITIAL);
70230 }
70231
70232 /**
70233 * @returns {boolean} whether or not the Chunk will have a runtime
70234 */
70235 hasRuntime() {
70236 for (const chunkGroup of this._groups) {
70237 if (
70238 chunkGroup.isInitial() &&
70239 chunkGroup instanceof Entrypoint &&
70240 chunkGroup.getRuntimeChunk() === this
70241 ) {
70242 return true;
70243 }
70244 }
70245 return false;
70246 }
70247
70248 /**
70249 * @returns {boolean} whether or not this chunk can be an initial chunk
70250 */
70251 canBeInitial() {
70252 for (const chunkGroup of this._groups) {
70253 if (chunkGroup.isInitial()) return true;
70254 }
70255 return false;
70256 }
70257
70258 /**
70259 * @returns {boolean} whether this chunk can only be an initial chunk
70260 */
70261 isOnlyInitial() {
70262 if (this._groups.size <= 0) return false;
70263 for (const chunkGroup of this._groups) {
70264 if (!chunkGroup.isInitial()) return false;
70265 }
70266 return true;
70267 }
70268
70269 /**
70270 * @returns {boolean} if this chunk contains the entry module
70271 */
70272 hasEntryModule() {
70273 return !!this.entryModule;
70274 }
70275
70276 /**
70277 * @param {Module} module the module that will be added to this chunk.
70278 * @returns {boolean} returns true if the chunk doesn't have the module and it was added
70279 */
70280 addModule(module) {
70281 if (!this._modules.has(module)) {
70282 this._modules.add(module);
70283 return true;
70284 }
70285 return false;
70286 }
70287
70288 /**
70289 * @param {Module} module the module that will be removed from this chunk
70290 * @returns {boolean} returns true if chunk exists and is successfully deleted
70291 */
70292 removeModule(module) {
70293 if (this._modules.delete(module)) {
70294 module.removeChunk(this);
70295 return true;
70296 }
70297 return false;
70298 }
70299
70300 /**
70301 * @param {Module[]} modules the new modules to be set
70302 * @returns {void} set new modules to this chunk and return nothing
70303 */
70304 setModules(modules) {
70305 this._modules = new SortableSet(modules, sortByIdentifier);
70306 }
70307
70308 /**
70309 * @returns {number} the amount of modules in chunk
70310 */
70311 getNumberOfModules() {
70312 return this._modules.size;
70313 }
70314
70315 /**
70316 * @returns {SortableSet} return the modules SortableSet for this chunk
70317 */
70318 get modulesIterable() {
70319 return this._modules;
70320 }
70321
70322 /**
70323 * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added
70324 * @returns {boolean} returns true if chunk is not apart of chunkGroup and is added successfully
70325 */
70326 addGroup(chunkGroup) {
70327 if (this._groups.has(chunkGroup)) return false;
70328 this._groups.add(chunkGroup);
70329 return true;
70330 }
70331
70332 /**
70333 * @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from
70334 * @returns {boolean} returns true if chunk does exist in chunkGroup and is removed
70335 */
70336 removeGroup(chunkGroup) {
70337 if (!this._groups.has(chunkGroup)) return false;
70338 this._groups.delete(chunkGroup);
70339 return true;
70340 }
70341
70342 /**
70343 * @param {ChunkGroup} chunkGroup the chunkGroup to check
70344 * @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup
70345 */
70346 isInGroup(chunkGroup) {
70347 return this._groups.has(chunkGroup);
70348 }
70349
70350 /**
70351 * @returns {number} the amount of groups said chunk is in
70352 */
70353 getNumberOfGroups() {
70354 return this._groups.size;
70355 }
70356
70357 /**
70358 * @returns {SortableSet<ChunkGroup>} the chunkGroups that said chunk is referenced in
70359 */
70360 get groupsIterable() {
70361 return this._groups;
70362 }
70363
70364 /**
70365 * @param {Chunk} otherChunk the chunk to compare itself with
70366 * @returns {-1|0|1} this is a comparitor function like sort and returns -1, 0, or 1 based on sort order
70367 */
70368 compareTo(otherChunk) {
70369 if (this.name && !otherChunk.name) return -1;
70370 if (!this.name && otherChunk.name) return 1;
70371 if (this.name < otherChunk.name) return -1;
70372 if (this.name > otherChunk.name) return 1;
70373 if (this._modules.size > otherChunk._modules.size) return -1;
70374 if (this._modules.size < otherChunk._modules.size) return 1;
70375 this._modules.sort();
70376 otherChunk._modules.sort();
70377 const a = this._modules[Symbol.iterator]();
70378 const b = otherChunk._modules[Symbol.iterator]();
70379 // eslint-disable-next-line no-constant-condition
70380 while (true) {
70381 const aItem = a.next();
70382 if (aItem.done) return 0;
70383 const bItem = b.next();
70384 const aModuleIdentifier = aItem.value.identifier();
70385 const bModuleIdentifier = bItem.value.identifier();
70386 if (aModuleIdentifier < bModuleIdentifier) return -1;
70387 if (aModuleIdentifier > bModuleIdentifier) return 1;
70388 }
70389 }
70390
70391 /**
70392 * @param {Module} module Module to check
70393 * @returns {boolean} returns true if module does exist in this chunk
70394 */
70395 containsModule(module) {
70396 return this._modules.has(module);
70397 }
70398
70399 /**
70400 * @returns {Module[]} an array of modules (do not modify)
70401 */
70402 getModules() {
70403 return this._modules.getFromCache(getArray);
70404 }
70405
70406 getModulesIdent() {
70407 return this._modules.getFromUnorderedCache(getModulesIdent);
70408 }
70409
70410 /**
70411 * @param {string=} reason reason why chunk is removed
70412 * @returns {void}
70413 */
70414 remove(reason) {
70415 // cleanup modules
70416 // Array.from is used here to create a clone, because removeChunk modifies this._modules
70417 for (const module of Array.from(this._modules)) {
70418 module.removeChunk(this);
70419 }
70420 for (const chunkGroup of this._groups) {
70421 chunkGroup.removeChunk(this);
70422 }
70423 }
70424
70425 /**
70426 *
70427 * @param {Module} module module to move
70428 * @param {Chunk} otherChunk other chunk to move it to
70429 * @returns {void}
70430 */
70431 moveModule(module, otherChunk) {
70432 GraphHelpers.disconnectChunkAndModule(this, module);
70433 GraphHelpers.connectChunkAndModule(otherChunk, module);
70434 module.rewriteChunkInReasons(this, [otherChunk]);
70435 }
70436
70437 /**
70438 *
70439 * @param {Chunk} otherChunk the chunk to integrate with
70440 * @param {string} reason reason why the module is being integrated
70441 * @returns {boolean} returns true or false if integration succeeds or fails
70442 */
70443 integrate(otherChunk, reason) {
70444 if (!this.canBeIntegrated(otherChunk)) {
70445 return false;
70446 }
70447
70448 // Pick a new name for the integrated chunk
70449 if (this.name && otherChunk.name) {
70450 if (this.hasEntryModule() === otherChunk.hasEntryModule()) {
70451 // When both chunks have entry modules or none have one, use
70452 // shortest name
70453 if (this.name.length !== otherChunk.name.length) {
70454 this.name =
70455 this.name.length < otherChunk.name.length
70456 ? this.name
70457 : otherChunk.name;
70458 } else {
70459 this.name = this.name < otherChunk.name ? this.name : otherChunk.name;
70460 }
70461 } else if (otherChunk.hasEntryModule()) {
70462 // Pick the name of the chunk with the entry module
70463 this.name = otherChunk.name;
70464 }
70465 } else if (otherChunk.name) {
70466 this.name = otherChunk.name;
70467 }
70468
70469 // Array.from is used here to create a clone, because moveModule modifies otherChunk._modules
70470 for (const module of Array.from(otherChunk._modules)) {
70471 otherChunk.moveModule(module, this);
70472 }
70473 otherChunk._modules.clear();
70474
70475 if (otherChunk.entryModule) {
70476 this.entryModule = otherChunk.entryModule;
70477 }
70478
70479 for (const chunkGroup of otherChunk._groups) {
70480 chunkGroup.replaceChunk(otherChunk, this);
70481 this.addGroup(chunkGroup);
70482 }
70483 otherChunk._groups.clear();
70484
70485 return true;
70486 }
70487
70488 /**
70489 * @param {Chunk} newChunk the new chunk that will be split out of the current chunk
70490 * @returns {void}
70491 */
70492 split(newChunk) {
70493 for (const chunkGroup of this._groups) {
70494 chunkGroup.insertChunk(newChunk, this);
70495 newChunk.addGroup(chunkGroup);
70496 }
70497 }
70498
70499 isEmpty() {
70500 return this._modules.size === 0;
70501 }
70502
70503 updateHash(hash) {
70504 hash.update(`${this.id} `);
70505 hash.update(this.ids ? this.ids.join(",") : "");
70506 hash.update(`${this.name || ""} `);
70507 for (const m of this._modules) {
70508 hash.update(m.hash);
70509 }
70510 }
70511
70512 canBeIntegrated(otherChunk) {
70513 if (this.preventIntegration || otherChunk.preventIntegration) {
70514 return false;
70515 }
70516
70517 /**
70518 * @param {Chunk} a chunk
70519 * @param {Chunk} b chunk
70520 * @returns {boolean} true, if a is always available when b is reached
70521 */
70522 const isAvailable = (a, b) => {
70523 const queue = new Set(b.groupsIterable);
70524 for (const chunkGroup of queue) {
70525 if (a.isInGroup(chunkGroup)) continue;
70526 if (chunkGroup.isInitial()) return false;
70527 for (const parent of chunkGroup.parentsIterable) {
70528 queue.add(parent);
70529 }
70530 }
70531 return true;
70532 };
70533
70534 const selfHasRuntime = this.hasRuntime();
70535 const otherChunkHasRuntime = otherChunk.hasRuntime();
70536
70537 if (selfHasRuntime !== otherChunkHasRuntime) {
70538 if (selfHasRuntime) {
70539 return isAvailable(this, otherChunk);
70540 } else if (otherChunkHasRuntime) {
70541 return isAvailable(otherChunk, this);
70542 } else {
70543 return false;
70544 }
70545 }
70546
70547 if (this.hasEntryModule() || otherChunk.hasEntryModule()) {
70548 return false;
70549 }
70550
70551 return true;
70552 }
70553
70554 /**
70555 *
70556 * @param {number} size the size
70557 * @param {Object} options the options passed in
70558 * @returns {number} the multiplier returned
70559 */
70560 addMultiplierAndOverhead(size, options) {
70561 const overhead =
70562 typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000;
70563 const multiplicator = this.canBeInitial()
70564 ? options.entryChunkMultiplicator || 10
70565 : 1;
70566
70567 return size * multiplicator + overhead;
70568 }
70569
70570 /**
70571 * @returns {number} the size of all modules
70572 */
70573 modulesSize() {
70574 return this._modules.getFromUnorderedCache(getModulesSize);
70575 }
70576
70577 /**
70578 * @param {Object} options the size display options
70579 * @returns {number} the chunk size
70580 */
70581 size(options = {}) {
70582 return this.addMultiplierAndOverhead(this.modulesSize(), options);
70583 }
70584
70585 /**
70586 * @param {Chunk} otherChunk the other chunk
70587 * @param {TODO} options the options for this function
70588 * @returns {number | false} the size, or false if it can't be integrated
70589 */
70590 integratedSize(otherChunk, options) {
70591 // Chunk if it's possible to integrate this chunk
70592 if (!this.canBeIntegrated(otherChunk)) {
70593 return false;
70594 }
70595
70596 let integratedModulesSize = this.modulesSize();
70597 // only count modules that do not exist in this chunk!
70598 for (const otherModule of otherChunk._modules) {
70599 if (!this._modules.has(otherModule)) {
70600 integratedModulesSize += otherModule.size();
70601 }
70602 }
70603
70604 return this.addMultiplierAndOverhead(integratedModulesSize, options);
70605 }
70606
70607 /**
70608 * @param {function(Module, Module): -1|0|1=} sortByFn a predicate function used to sort modules
70609 * @returns {void}
70610 */
70611 sortModules(sortByFn) {
70612 this._modules.sortWith(sortByFn || sortModuleById);
70613 }
70614
70615 sortItems() {
70616 this.sortModules();
70617 }
70618
70619 /**
70620 * @returns {Set<Chunk>} a set of all the async chunks
70621 */
70622 getAllAsyncChunks() {
70623 const queue = new Set();
70624 const chunks = new Set();
70625
70626 const initialChunks = intersect(
70627 Array.from(this.groupsIterable, g => new Set(g.chunks))
70628 );
70629
70630 for (const chunkGroup of this.groupsIterable) {
70631 for (const child of chunkGroup.childrenIterable) {
70632 queue.add(child);
70633 }
70634 }
70635
70636 for (const chunkGroup of queue) {
70637 for (const chunk of chunkGroup.chunks) {
70638 if (!initialChunks.has(chunk)) {
70639 chunks.add(chunk);
70640 }
70641 }
70642 for (const child of chunkGroup.childrenIterable) {
70643 queue.add(child);
70644 }
70645 }
70646
70647 return chunks;
70648 }
70649
70650 /**
70651 * @typedef {Object} ChunkMaps
70652 * @property {Record<string|number, string>} hash
70653 * @property {Record<string|number, Record<string, string>>} contentHash
70654 * @property {Record<string|number, string>} name
70655 */
70656
70657 /**
70658 * @param {boolean} realHash should the full hash or the rendered hash be used
70659 * @returns {ChunkMaps} the chunk map information
70660 */
70661 getChunkMaps(realHash) {
70662 /** @type {Record<string|number, string>} */
70663 const chunkHashMap = Object.create(null);
70664 /** @type {Record<string|number, Record<string, string>>} */
70665 const chunkContentHashMap = Object.create(null);
70666 /** @type {Record<string|number, string>} */
70667 const chunkNameMap = Object.create(null);
70668
70669 for (const chunk of this.getAllAsyncChunks()) {
70670 chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash;
70671 for (const key of Object.keys(chunk.contentHash)) {
70672 if (!chunkContentHashMap[key]) {
70673 chunkContentHashMap[key] = Object.create(null);
70674 }
70675 chunkContentHashMap[key][chunk.id] = chunk.contentHash[key];
70676 }
70677 if (chunk.name) {
70678 chunkNameMap[chunk.id] = chunk.name;
70679 }
70680 }
70681
70682 return {
70683 hash: chunkHashMap,
70684 contentHash: chunkContentHashMap,
70685 name: chunkNameMap
70686 };
70687 }
70688
70689 /**
70690 * @returns {Record<string, Set<TODO>[]>} a record object of names to lists of child ids(?)
70691 */
70692 getChildIdsByOrders() {
70693 const lists = new Map();
70694 for (const group of this.groupsIterable) {
70695 if (group.chunks[group.chunks.length - 1] === this) {
70696 for (const childGroup of group.childrenIterable) {
70697 // TODO webpack 5 remove this check for options
70698 if (typeof childGroup.options === "object") {
70699 for (const key of Object.keys(childGroup.options)) {
70700 if (key.endsWith("Order")) {
70701 const name = key.substr(0, key.length - "Order".length);
70702 let list = lists.get(name);
70703 if (list === undefined) lists.set(name, (list = []));
70704 list.push({
70705 order: childGroup.options[key],
70706 group: childGroup
70707 });
70708 }
70709 }
70710 }
70711 }
70712 }
70713 }
70714 const result = Object.create(null);
70715 for (const [name, list] of lists) {
70716 list.sort((a, b) => {
70717 const cmp = b.order - a.order;
70718 if (cmp !== 0) return cmp;
70719 // TODO webpack 5 remove this check of compareTo
70720 if (a.group.compareTo) {
70721 return a.group.compareTo(b.group);
70722 }
70723 return 0;
70724 });
70725 result[name] = Array.from(
70726 list.reduce((set, item) => {
70727 for (const chunk of item.group.chunks) {
70728 set.add(chunk.id);
70729 }
70730 return set;
70731 }, new Set())
70732 );
70733 }
70734 return result;
70735 }
70736
70737 getChildIdsByOrdersMap(includeDirectChildren) {
70738 const chunkMaps = Object.create(null);
70739
70740 const addChildIdsByOrdersToMap = chunk => {
70741 const data = chunk.getChildIdsByOrders();
70742 for (const key of Object.keys(data)) {
70743 let chunkMap = chunkMaps[key];
70744 if (chunkMap === undefined) {
70745 chunkMaps[key] = chunkMap = Object.create(null);
70746 }
70747 chunkMap[chunk.id] = data[key];
70748 }
70749 };
70750
70751 if (includeDirectChildren) {
70752 const chunks = new Set();
70753 for (const chunkGroup of this.groupsIterable) {
70754 for (const chunk of chunkGroup.chunks) {
70755 chunks.add(chunk);
70756 }
70757 }
70758 for (const chunk of chunks) {
70759 addChildIdsByOrdersToMap(chunk);
70760 }
70761 }
70762
70763 for (const chunk of this.getAllAsyncChunks()) {
70764 addChildIdsByOrdersToMap(chunk);
70765 }
70766
70767 return chunkMaps;
70768 }
70769
70770 /**
70771 * @typedef {Object} ChunkModuleMaps
70772 * @property {Record<string|number, (string|number)[]>} id
70773 * @property {Record<string|number, string>} hash
70774 */
70775
70776 /**
70777 * @param {ModuleFilterPredicate} filterFn function used to filter modules
70778 * @returns {ChunkModuleMaps} module map information
70779 */
70780 getChunkModuleMaps(filterFn) {
70781 /** @type {Record<string|number, (string|number)[]>} */
70782 const chunkModuleIdMap = Object.create(null);
70783 /** @type {Record<string|number, string>} */
70784 const chunkModuleHashMap = Object.create(null);
70785
70786 for (const chunk of this.getAllAsyncChunks()) {
70787 /** @type {(string|number)[]} */
70788 let array;
70789 for (const module of chunk.modulesIterable) {
70790 if (filterFn(module)) {
70791 if (array === undefined) {
70792 array = [];
70793 chunkModuleIdMap[chunk.id] = array;
70794 }
70795 array.push(module.id);
70796 chunkModuleHashMap[module.id] = module.renderedHash;
70797 }
70798 }
70799 if (array !== undefined) {
70800 array.sort();
70801 }
70802 }
70803
70804 return {
70805 id: chunkModuleIdMap,
70806 hash: chunkModuleHashMap
70807 };
70808 }
70809
70810 /**
70811 *
70812 * @param {function(Module): boolean} filterFn predicate function used to filter modules
70813 * @param {function(Chunk): boolean} filterChunkFn predicate function used to filter chunks
70814 * @returns {boolean} return true if module exists in graph
70815 */
70816 hasModuleInGraph(filterFn, filterChunkFn) {
70817 const queue = new Set(this.groupsIterable);
70818 const chunksProcessed = new Set();
70819
70820 for (const chunkGroup of queue) {
70821 for (const chunk of chunkGroup.chunks) {
70822 if (!chunksProcessed.has(chunk)) {
70823 chunksProcessed.add(chunk);
70824 if (!filterChunkFn || filterChunkFn(chunk)) {
70825 for (const module of chunk.modulesIterable) {
70826 if (filterFn(module)) {
70827 return true;
70828 }
70829 }
70830 }
70831 }
70832 }
70833 for (const child of chunkGroup.childrenIterable) {
70834 queue.add(child);
70835 }
70836 }
70837 return false;
70838 }
70839
70840 toString() {
70841 return `Chunk[${Array.from(this._modules).join()}]`;
70842 }
70843}
70844
70845// TODO remove in webpack 5
70846Object.defineProperty(Chunk.prototype, "forEachModule", {
70847 configurable: false,
70848 value: util.deprecate(
70849 /**
70850 * @deprecated
70851 * @this {Chunk}
70852 * @typedef {function(any, any, Set<any>): void} ForEachModuleCallback
70853 * @param {ForEachModuleCallback} fn Callback function
70854 * @returns {void}
70855 */
70856 function(fn) {
70857 this._modules.forEach(fn);
70858 },
70859 "Chunk.forEachModule: Use for(const module of chunk.modulesIterable) instead"
70860 )
70861});
70862
70863// TODO remove in webpack 5
70864Object.defineProperty(Chunk.prototype, "mapModules", {
70865 configurable: false,
70866 value: util.deprecate(
70867 /**
70868 * @deprecated
70869 * @this {Chunk}
70870 * @typedef {function(any, number): any} MapModulesCallback
70871 * @param {MapModulesCallback} fn Callback function
70872 * @returns {TODO[]} result of mapped modules
70873 */
70874 function(fn) {
70875 return Array.from(this._modules, fn);
70876 },
70877 "Chunk.mapModules: Use Array.from(chunk.modulesIterable, fn) instead"
70878 )
70879});
70880
70881// TODO remove in webpack 5
70882Object.defineProperty(Chunk.prototype, "chunks", {
70883 configurable: false,
70884 get() {
70885 throw new Error("Chunk.chunks: Use ChunkGroup.getChildren() instead");
70886 },
70887 set() {
70888 throw new Error("Chunk.chunks: Use ChunkGroup.add/removeChild() instead");
70889 }
70890});
70891
70892// TODO remove in webpack 5
70893Object.defineProperty(Chunk.prototype, "parents", {
70894 configurable: false,
70895 get() {
70896 throw new Error("Chunk.parents: Use ChunkGroup.getParents() instead");
70897 },
70898 set() {
70899 throw new Error("Chunk.parents: Use ChunkGroup.add/removeParent() instead");
70900 }
70901});
70902
70903// TODO remove in webpack 5
70904Object.defineProperty(Chunk.prototype, "blocks", {
70905 configurable: false,
70906 get() {
70907 throw new Error("Chunk.blocks: Use ChunkGroup.getBlocks() instead");
70908 },
70909 set() {
70910 throw new Error("Chunk.blocks: Use ChunkGroup.add/removeBlock() instead");
70911 }
70912});
70913
70914// TODO remove in webpack 5
70915Object.defineProperty(Chunk.prototype, "entrypoints", {
70916 configurable: false,
70917 get() {
70918 throw new Error(
70919 "Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead"
70920 );
70921 },
70922 set() {
70923 throw new Error("Chunk.entrypoints: Use Chunks.addGroup instead");
70924 }
70925});
70926
70927module.exports = Chunk;
70928
70929
70930/***/ }),
70931
70932/***/ 52911:
70933/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
70934
70935"use strict";
70936/*
70937 MIT License http://www.opensource.org/licenses/mit-license.php
70938 Author Tobias Koppers @sokra
70939*/
70940
70941
70942const SortableSet = __webpack_require__(50071);
70943const compareLocations = __webpack_require__(22562);
70944
70945/** @typedef {import("./Chunk")} Chunk */
70946/** @typedef {import("./Module")} Module */
70947/** @typedef {import("./ModuleReason")} ModuleReason */
70948
70949/** @typedef {{module: Module, loc: TODO, request: string}} OriginRecord */
70950/** @typedef {string|{name: string}} ChunkGroupOptions */
70951
70952let debugId = 5000;
70953
70954/**
70955 * @template T
70956 * @param {SortableSet<T>} set set to convert to array.
70957 * @returns {T[]} the array format of existing set
70958 */
70959const getArray = set => Array.from(set);
70960
70961/**
70962 * A convenience method used to sort chunks based on their id's
70963 * @param {ChunkGroup} a first sorting comparator
70964 * @param {ChunkGroup} b second sorting comparator
70965 * @returns {1|0|-1} a sorting index to determine order
70966 */
70967const sortById = (a, b) => {
70968 if (a.id < b.id) return -1;
70969 if (b.id < a.id) return 1;
70970 return 0;
70971};
70972
70973/**
70974 * @param {OriginRecord} a the first comparator in sort
70975 * @param {OriginRecord} b the second comparator in sort
70976 * @returns {1|-1|0} returns sorting order as index
70977 */
70978const sortOrigin = (a, b) => {
70979 const aIdent = a.module ? a.module.identifier() : "";
70980 const bIdent = b.module ? b.module.identifier() : "";
70981 if (aIdent < bIdent) return -1;
70982 if (aIdent > bIdent) return 1;
70983 return compareLocations(a.loc, b.loc);
70984};
70985
70986class ChunkGroup {
70987 /**
70988 * Creates an instance of ChunkGroup.
70989 * @param {ChunkGroupOptions=} options chunk group options passed to chunkGroup
70990 */
70991 constructor(options) {
70992 if (typeof options === "string") {
70993 options = { name: options };
70994 } else if (!options) {
70995 options = { name: undefined };
70996 }
70997 /** @type {number} */
70998 this.groupDebugId = debugId++;
70999 this.options = options;
71000 /** @type {SortableSet<ChunkGroup>} */
71001 this._children = new SortableSet(undefined, sortById);
71002 this._parents = new SortableSet(undefined, sortById);
71003 this._blocks = new SortableSet();
71004 /** @type {Chunk[]} */
71005 this.chunks = [];
71006 /** @type {OriginRecord[]} */
71007 this.origins = [];
71008 /** Indices in top-down order */
71009 /** @private @type {Map<Module, number>} */
71010 this._moduleIndices = new Map();
71011 /** Indices in bottom-up order */
71012 /** @private @type {Map<Module, number>} */
71013 this._moduleIndices2 = new Map();
71014 }
71015
71016 /**
71017 * when a new chunk is added to a chunkGroup, addingOptions will occur.
71018 * @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions
71019 * @returns {void}
71020 */
71021 addOptions(options) {
71022 for (const key of Object.keys(options)) {
71023 if (this.options[key] === undefined) {
71024 this.options[key] = options[key];
71025 } else if (this.options[key] !== options[key]) {
71026 if (key.endsWith("Order")) {
71027 this.options[key] = Math.max(this.options[key], options[key]);
71028 } else {
71029 throw new Error(
71030 `ChunkGroup.addOptions: No option merge strategy for ${key}`
71031 );
71032 }
71033 }
71034 }
71035 }
71036
71037 /**
71038 * returns the name of current ChunkGroup
71039 * @returns {string|undefined} returns the ChunkGroup name
71040 */
71041 get name() {
71042 return this.options.name;
71043 }
71044
71045 /**
71046 * sets a new name for current ChunkGroup
71047 * @param {string} value the new name for ChunkGroup
71048 * @returns {void}
71049 */
71050 set name(value) {
71051 this.options.name = value;
71052 }
71053
71054 /**
71055 * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's
71056 * @returns {string} a unique concatenation of chunk debugId's
71057 */
71058 get debugId() {
71059 return Array.from(this.chunks, x => x.debugId).join("+");
71060 }
71061
71062 /**
71063 * get a unique id for ChunkGroup, made up of its member Chunk id's
71064 * @returns {string} a unique concatenation of chunk ids
71065 */
71066 get id() {
71067 return Array.from(this.chunks, x => x.id).join("+");
71068 }
71069
71070 /**
71071 * Performs an unshift of a specific chunk
71072 * @param {Chunk} chunk chunk being unshifted
71073 * @returns {boolean} returns true if attempted chunk shift is accepted
71074 */
71075 unshiftChunk(chunk) {
71076 const oldIdx = this.chunks.indexOf(chunk);
71077 if (oldIdx > 0) {
71078 this.chunks.splice(oldIdx, 1);
71079 this.chunks.unshift(chunk);
71080 } else if (oldIdx < 0) {
71081 this.chunks.unshift(chunk);
71082 return true;
71083 }
71084 return false;
71085 }
71086
71087 /**
71088 * inserts a chunk before another existing chunk in group
71089 * @param {Chunk} chunk Chunk being inserted
71090 * @param {Chunk} before Placeholder/target chunk marking new chunk insertion point
71091 * @returns {boolean} return true if insertion was successful
71092 */
71093 insertChunk(chunk, before) {
71094 const oldIdx = this.chunks.indexOf(chunk);
71095 const idx = this.chunks.indexOf(before);
71096 if (idx < 0) {
71097 throw new Error("before chunk not found");
71098 }
71099 if (oldIdx >= 0 && oldIdx > idx) {
71100 this.chunks.splice(oldIdx, 1);
71101 this.chunks.splice(idx, 0, chunk);
71102 } else if (oldIdx < 0) {
71103 this.chunks.splice(idx, 0, chunk);
71104 return true;
71105 }
71106 return false;
71107 }
71108
71109 /**
71110 * add a chunk into ChunkGroup. Is pushed on or prepended
71111 * @param {Chunk} chunk chunk being pushed into ChunkGroupS
71112 * @returns {boolean} returns true if chunk addition was successful.
71113 */
71114 pushChunk(chunk) {
71115 const oldIdx = this.chunks.indexOf(chunk);
71116 if (oldIdx >= 0) {
71117 return false;
71118 }
71119 this.chunks.push(chunk);
71120 return true;
71121 }
71122
71123 /**
71124 * @param {Chunk} oldChunk chunk to be replaced
71125 * @param {Chunk} newChunk New chunk that will be replaced with
71126 * @returns {boolean} returns true if the replacement was successful
71127 */
71128 replaceChunk(oldChunk, newChunk) {
71129 const oldIdx = this.chunks.indexOf(oldChunk);
71130 if (oldIdx < 0) return false;
71131 const newIdx = this.chunks.indexOf(newChunk);
71132 if (newIdx < 0) {
71133 this.chunks[oldIdx] = newChunk;
71134 return true;
71135 }
71136 if (newIdx < oldIdx) {
71137 this.chunks.splice(oldIdx, 1);
71138 return true;
71139 } else if (newIdx !== oldIdx) {
71140 this.chunks[oldIdx] = newChunk;
71141 this.chunks.splice(newIdx, 1);
71142 return true;
71143 }
71144 }
71145
71146 removeChunk(chunk) {
71147 const idx = this.chunks.indexOf(chunk);
71148 if (idx >= 0) {
71149 this.chunks.splice(idx, 1);
71150 return true;
71151 }
71152 return false;
71153 }
71154
71155 isInitial() {
71156 return false;
71157 }
71158
71159 addChild(chunk) {
71160 if (this._children.has(chunk)) {
71161 return false;
71162 }
71163 this._children.add(chunk);
71164 return true;
71165 }
71166
71167 getChildren() {
71168 return this._children.getFromCache(getArray);
71169 }
71170
71171 getNumberOfChildren() {
71172 return this._children.size;
71173 }
71174
71175 get childrenIterable() {
71176 return this._children;
71177 }
71178
71179 removeChild(chunk) {
71180 if (!this._children.has(chunk)) {
71181 return false;
71182 }
71183
71184 this._children.delete(chunk);
71185 chunk.removeParent(this);
71186 return true;
71187 }
71188
71189 addParent(parentChunk) {
71190 if (!this._parents.has(parentChunk)) {
71191 this._parents.add(parentChunk);
71192 return true;
71193 }
71194 return false;
71195 }
71196
71197 getParents() {
71198 return this._parents.getFromCache(getArray);
71199 }
71200
71201 setParents(newParents) {
71202 this._parents.clear();
71203 for (const p of newParents) {
71204 this._parents.add(p);
71205 }
71206 }
71207
71208 getNumberOfParents() {
71209 return this._parents.size;
71210 }
71211
71212 hasParent(parent) {
71213 return this._parents.has(parent);
71214 }
71215
71216 get parentsIterable() {
71217 return this._parents;
71218 }
71219
71220 removeParent(chunk) {
71221 if (this._parents.delete(chunk)) {
71222 chunk.removeChunk(this);
71223 return true;
71224 }
71225 return false;
71226 }
71227
71228 /**
71229 * @returns {Array} - an array containing the blocks
71230 */
71231 getBlocks() {
71232 return this._blocks.getFromCache(getArray);
71233 }
71234
71235 getNumberOfBlocks() {
71236 return this._blocks.size;
71237 }
71238
71239 hasBlock(block) {
71240 return this._blocks.has(block);
71241 }
71242
71243 get blocksIterable() {
71244 return this._blocks;
71245 }
71246
71247 addBlock(block) {
71248 if (!this._blocks.has(block)) {
71249 this._blocks.add(block);
71250 return true;
71251 }
71252 return false;
71253 }
71254
71255 addOrigin(module, loc, request) {
71256 this.origins.push({
71257 module,
71258 loc,
71259 request
71260 });
71261 }
71262
71263 containsModule(module) {
71264 for (const chunk of this.chunks) {
71265 if (chunk.containsModule(module)) return true;
71266 }
71267 return false;
71268 }
71269
71270 getFiles() {
71271 const files = new Set();
71272
71273 for (const chunk of this.chunks) {
71274 for (const file of chunk.files) {
71275 files.add(file);
71276 }
71277 }
71278
71279 return Array.from(files);
71280 }
71281
71282 /**
71283 * @param {string=} reason reason for removing ChunkGroup
71284 * @returns {void}
71285 */
71286 remove(reason) {
71287 // cleanup parents
71288 for (const parentChunkGroup of this._parents) {
71289 // remove this chunk from its parents
71290 parentChunkGroup._children.delete(this);
71291
71292 // cleanup "sub chunks"
71293 for (const chunkGroup of this._children) {
71294 /**
71295 * remove this chunk as "intermediary" and connect
71296 * it "sub chunks" and parents directly
71297 */
71298 // add parent to each "sub chunk"
71299 chunkGroup.addParent(parentChunkGroup);
71300 // add "sub chunk" to parent
71301 parentChunkGroup.addChild(chunkGroup);
71302 }
71303 }
71304
71305 /**
71306 * we need to iterate again over the children
71307 * to remove this from the child's parents.
71308 * This can not be done in the above loop
71309 * as it is not guaranteed that `this._parents` contains anything.
71310 */
71311 for (const chunkGroup of this._children) {
71312 // remove this as parent of every "sub chunk"
71313 chunkGroup._parents.delete(this);
71314 }
71315
71316 // cleanup blocks
71317 for (const block of this._blocks) {
71318 block.chunkGroup = null;
71319 }
71320
71321 // remove chunks
71322 for (const chunk of this.chunks) {
71323 chunk.removeGroup(this);
71324 }
71325 }
71326
71327 sortItems() {
71328 this.origins.sort(sortOrigin);
71329 this._parents.sort();
71330 this._children.sort();
71331 }
71332
71333 /**
71334 * Sorting predicate which allows current ChunkGroup to be compared against another.
71335 * Sorting values are based off of number of chunks in ChunkGroup.
71336 *
71337 * @param {ChunkGroup} otherGroup the chunkGroup to compare this against
71338 * @returns {-1|0|1} sort position for comparison
71339 */
71340 compareTo(otherGroup) {
71341 if (this.chunks.length > otherGroup.chunks.length) return -1;
71342 if (this.chunks.length < otherGroup.chunks.length) return 1;
71343 const a = this.chunks[Symbol.iterator]();
71344 const b = otherGroup.chunks[Symbol.iterator]();
71345 // eslint-disable-next-line no-constant-condition
71346 while (true) {
71347 const aItem = a.next();
71348 const bItem = b.next();
71349 if (aItem.done) return 0;
71350 const cmp = aItem.value.compareTo(bItem.value);
71351 if (cmp !== 0) return cmp;
71352 }
71353 }
71354
71355 getChildrenByOrders() {
71356 const lists = new Map();
71357 for (const childGroup of this._children) {
71358 // TODO webpack 5 remove this check for options
71359 if (typeof childGroup.options === "object") {
71360 for (const key of Object.keys(childGroup.options)) {
71361 if (key.endsWith("Order")) {
71362 const name = key.substr(0, key.length - "Order".length);
71363 let list = lists.get(name);
71364 if (list === undefined) {
71365 lists.set(name, (list = []));
71366 }
71367 list.push({
71368 order: childGroup.options[key],
71369 group: childGroup
71370 });
71371 }
71372 }
71373 }
71374 }
71375 const result = Object.create(null);
71376 for (const [name, list] of lists) {
71377 list.sort((a, b) => {
71378 const cmp = b.order - a.order;
71379 if (cmp !== 0) return cmp;
71380 // TODO webpack 5 remove this check of compareTo
71381 if (a.group.compareTo) {
71382 return a.group.compareTo(b.group);
71383 }
71384 return 0;
71385 });
71386 result[name] = list.map(i => i.group);
71387 }
71388 return result;
71389 }
71390
71391 /**
71392 * Sets the top-down index of a module in this ChunkGroup
71393 * @param {Module} module module for which the index should be set
71394 * @param {number} index the index of the module
71395 * @returns {void}
71396 */
71397 setModuleIndex(module, index) {
71398 this._moduleIndices.set(module, index);
71399 }
71400
71401 /**
71402 * Gets the top-down index of a module in this ChunkGroup
71403 * @param {Module} module the module
71404 * @returns {number} index
71405 */
71406 getModuleIndex(module) {
71407 return this._moduleIndices.get(module);
71408 }
71409
71410 /**
71411 * Sets the bottom-up index of a module in this ChunkGroup
71412 * @param {Module} module module for which the index should be set
71413 * @param {number} index the index of the module
71414 * @returns {void}
71415 */
71416 setModuleIndex2(module, index) {
71417 this._moduleIndices2.set(module, index);
71418 }
71419
71420 /**
71421 * Gets the bottom-up index of a module in this ChunkGroup
71422 * @param {Module} module the module
71423 * @returns {number} index
71424 */
71425 getModuleIndex2(module) {
71426 return this._moduleIndices2.get(module);
71427 }
71428
71429 checkConstraints() {
71430 const chunk = this;
71431 for (const child of chunk._children) {
71432 if (!child._parents.has(chunk)) {
71433 throw new Error(
71434 `checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}`
71435 );
71436 }
71437 }
71438 for (const parentChunk of chunk._parents) {
71439 if (!parentChunk._children.has(chunk)) {
71440 throw new Error(
71441 `checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}`
71442 );
71443 }
71444 }
71445 }
71446}
71447
71448module.exports = ChunkGroup;
71449
71450
71451/***/ }),
71452
71453/***/ 69865:
71454/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71455
71456"use strict";
71457/*
71458 MIT License http://www.opensource.org/licenses/mit-license.php
71459 Author Tobias Koppers @sokra
71460*/
71461
71462
71463const WebpackError = __webpack_require__(97391);
71464
71465/** @typedef {import("./Chunk")} Chunk */
71466
71467class ChunkRenderError extends WebpackError {
71468 /**
71469 * Create a new ChunkRenderError
71470 * @param {Chunk} chunk A chunk
71471 * @param {string} file Related file
71472 * @param {Error} error Original error
71473 */
71474 constructor(chunk, file, error) {
71475 super();
71476
71477 this.name = "ChunkRenderError";
71478 this.error = error;
71479 this.message = error.message;
71480 this.details = error.stack;
71481 this.file = file;
71482 this.chunk = chunk;
71483
71484 Error.captureStackTrace(this, this.constructor);
71485 }
71486}
71487
71488module.exports = ChunkRenderError;
71489
71490
71491/***/ }),
71492
71493/***/ 6170:
71494/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71495
71496"use strict";
71497/*
71498 MIT License http://www.opensource.org/licenses/mit-license.php
71499 Author Tobias Koppers @sokra
71500*/
71501
71502
71503const { Tapable, SyncWaterfallHook, SyncHook } = __webpack_require__(56758);
71504
71505/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
71506/** @typedef {import("./Chunk")} Chunk */
71507/** @typedef {import("./Module")} Module} */
71508/** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate} */
71509/** @typedef {import("./util/createHash").Hash} Hash} */
71510
71511/**
71512 * @typedef {Object} RenderManifestOptions
71513 * @property {Chunk} chunk the chunk used to render
71514 * @property {string} hash
71515 * @property {string} fullHash
71516 * @property {TODO} outputOptions
71517 * @property {{javascript: ModuleTemplate, webassembly: ModuleTemplate}} moduleTemplates
71518 * @property {Map<TODO, TODO>} dependencyTemplates
71519 */
71520
71521module.exports = class ChunkTemplate extends Tapable {
71522 constructor(outputOptions) {
71523 super();
71524 this.outputOptions = outputOptions || {};
71525 this.hooks = {
71526 /** @type {SyncWaterfallHook<TODO[], RenderManifestOptions>} */
71527 renderManifest: new SyncWaterfallHook(["result", "options"]),
71528 modules: new SyncWaterfallHook([
71529 "source",
71530 "chunk",
71531 "moduleTemplate",
71532 "dependencyTemplates"
71533 ]),
71534 render: new SyncWaterfallHook([
71535 "source",
71536 "chunk",
71537 "moduleTemplate",
71538 "dependencyTemplates"
71539 ]),
71540 renderWithEntry: new SyncWaterfallHook(["source", "chunk"]),
71541 hash: new SyncHook(["hash"]),
71542 hashForChunk: new SyncHook(["hash", "chunk"])
71543 };
71544 }
71545
71546 /**
71547 *
71548 * @param {RenderManifestOptions} options render manifest options
71549 * @returns {TODO[]} returns render manifest
71550 */
71551 getRenderManifest(options) {
71552 const result = [];
71553
71554 this.hooks.renderManifest.call(result, options);
71555
71556 return result;
71557 }
71558
71559 /**
71560 * Updates hash with information from this template
71561 * @param {Hash} hash the hash to update
71562 * @returns {void}
71563 */
71564 updateHash(hash) {
71565 hash.update("ChunkTemplate");
71566 hash.update("2");
71567 this.hooks.hash.call(hash);
71568 }
71569
71570 /**
71571 * TODO webpack 5: remove moduleTemplate and dependencyTemplates
71572 * Updates hash with chunk-specific information from this template
71573 * @param {Hash} hash the hash to update
71574 * @param {Chunk} chunk the chunk
71575 * @param {ModuleTemplate} moduleTemplate ModuleTemplate instance for render
71576 * @param {Map<Function, DependencyTemplate>} dependencyTemplates dependency templates
71577 * @returns {void}
71578 */
71579 updateHashForChunk(hash, chunk, moduleTemplate, dependencyTemplates) {
71580 this.updateHash(hash);
71581 this.hooks.hashForChunk.call(hash, chunk);
71582 }
71583};
71584
71585
71586/***/ }),
71587
71588/***/ 51760:
71589/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71590
71591"use strict";
71592/*
71593 MIT License http://www.opensource.org/licenses/mit-license.php
71594 Author Tobias Koppers @sokra
71595*/
71596
71597
71598const WebpackError = __webpack_require__(97391);
71599
71600/** @typedef {import("./Module")} Module */
71601
71602/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
71603
71604class CommentCompilationWarning extends WebpackError {
71605 /**
71606 *
71607 * @param {string} message warning message
71608 * @param {Module} module affected module
71609 * @param {DependencyLocation} loc affected lines of code
71610 */
71611 constructor(message, module, loc) {
71612 super(message);
71613
71614 this.name = "CommentCompilationWarning";
71615
71616 this.module = module;
71617 this.loc = loc;
71618
71619 Error.captureStackTrace(this, this.constructor);
71620 }
71621}
71622
71623module.exports = CommentCompilationWarning;
71624
71625
71626/***/ }),
71627
71628/***/ 85736:
71629/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71630
71631"use strict";
71632/*
71633 MIT License http://www.opensource.org/licenses/mit-license.php
71634 Author Tobias Koppers @sokra
71635*/
71636
71637
71638const path = __webpack_require__(85622);
71639const ParserHelpers = __webpack_require__(23999);
71640
71641class CommonJsStuffPlugin {
71642 apply(compiler) {
71643 compiler.hooks.compilation.tap(
71644 "CommonJsStuffPlugin",
71645 (compilation, { normalModuleFactory }) => {
71646 const handler = (parser, parserOptions) => {
71647 parser.hooks.expression
71648 .for("require.main.require")
71649 .tap(
71650 "CommonJsStuffPlugin",
71651 ParserHelpers.expressionIsUnsupported(
71652 parser,
71653 "require.main.require is not supported by webpack."
71654 )
71655 );
71656 parser.hooks.expression
71657 .for("module.parent.require")
71658 .tap(
71659 "CommonJsStuffPlugin",
71660 ParserHelpers.expressionIsUnsupported(
71661 parser,
71662 "module.parent.require is not supported by webpack."
71663 )
71664 );
71665 parser.hooks.expression
71666 .for("require.main")
71667 .tap(
71668 "CommonJsStuffPlugin",
71669 ParserHelpers.toConstantDependencyWithWebpackRequire(
71670 parser,
71671 "__webpack_require__.c[__webpack_require__.s]"
71672 )
71673 );
71674 parser.hooks.expression
71675 .for("module.loaded")
71676 .tap("CommonJsStuffPlugin", expr => {
71677 parser.state.module.buildMeta.moduleConcatenationBailout =
71678 "module.loaded";
71679 return ParserHelpers.toConstantDependency(
71680 parser,
71681 "module.l"
71682 )(expr);
71683 });
71684 parser.hooks.expression
71685 .for("module.id")
71686 .tap("CommonJsStuffPlugin", expr => {
71687 parser.state.module.buildMeta.moduleConcatenationBailout =
71688 "module.id";
71689 return ParserHelpers.toConstantDependency(
71690 parser,
71691 "module.i"
71692 )(expr);
71693 });
71694 parser.hooks.expression
71695 .for("module.exports")
71696 .tap("CommonJsStuffPlugin", () => {
71697 const module = parser.state.module;
71698 const isHarmony =
71699 module.buildMeta && module.buildMeta.exportsType;
71700 if (!isHarmony) return true;
71701 });
71702 parser.hooks.evaluateIdentifier
71703 .for("module.hot")
71704 .tap(
71705 "CommonJsStuffPlugin",
71706 ParserHelpers.evaluateToIdentifier("module.hot", false)
71707 );
71708 parser.hooks.expression
71709 .for("module")
71710 .tap("CommonJsStuffPlugin", () => {
71711 const module = parser.state.module;
71712 const isHarmony =
71713 module.buildMeta && module.buildMeta.exportsType;
71714 let moduleJsPath = isHarmony ? __webpack_require__.ab + "harmony-module.js" : __webpack_require__.ab + "module.js";
71715 if (module.context) {
71716 moduleJsPath = path.relative(
71717 parser.state.module.context,
71718 moduleJsPath
71719 );
71720 if (!/^[A-Z]:/i.test(moduleJsPath)) {
71721 moduleJsPath = `./${moduleJsPath.replace(/\\/g, "/")}`;
71722 }
71723 }
71724 return ParserHelpers.addParsedVariableToModule(
71725 parser,
71726 "module",
71727 `require(${JSON.stringify(moduleJsPath)})(module)`
71728 );
71729 });
71730 };
71731
71732 normalModuleFactory.hooks.parser
71733 .for("javascript/auto")
71734 .tap("CommonJsStuffPlugin", handler);
71735 normalModuleFactory.hooks.parser
71736 .for("javascript/dynamic")
71737 .tap("CommonJsStuffPlugin", handler);
71738 }
71739 );
71740 }
71741}
71742module.exports = CommonJsStuffPlugin;
71743
71744
71745/***/ }),
71746
71747/***/ 85918:
71748/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71749
71750"use strict";
71751/*
71752 MIT License http://www.opensource.org/licenses/mit-license.php
71753 Author Tobias Koppers @sokra
71754*/
71755
71756
71757const ConstDependency = __webpack_require__(71101);
71758
71759const NullFactory = __webpack_require__(40438);
71760
71761/** @typedef {import("./Compiler")} Compiler */
71762
71763class CompatibilityPlugin {
71764 /**
71765 * Apply the plugin
71766 * @param {Compiler} compiler Webpack Compiler
71767 * @returns {void}
71768 */
71769 apply(compiler) {
71770 compiler.hooks.compilation.tap(
71771 "CompatibilityPlugin",
71772 (compilation, { normalModuleFactory }) => {
71773 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
71774 compilation.dependencyTemplates.set(
71775 ConstDependency,
71776 new ConstDependency.Template()
71777 );
71778
71779 normalModuleFactory.hooks.parser
71780 .for("javascript/auto")
71781 .tap("CompatibilityPlugin", (parser, parserOptions) => {
71782 if (
71783 parserOptions.browserify !== undefined &&
71784 !parserOptions.browserify
71785 )
71786 return;
71787
71788 parser.hooks.call
71789 .for("require")
71790 .tap("CompatibilityPlugin", expr => {
71791 // support for browserify style require delegator: "require(o, !0)"
71792 if (expr.arguments.length !== 2) return;
71793 const second = parser.evaluateExpression(expr.arguments[1]);
71794 if (!second.isBoolean()) return;
71795 if (second.asBool() !== true) return;
71796 const dep = new ConstDependency("require", expr.callee.range);
71797 dep.loc = expr.loc;
71798 if (parser.state.current.dependencies.length > 1) {
71799 const last =
71800 parser.state.current.dependencies[
71801 parser.state.current.dependencies.length - 1
71802 ];
71803 if (
71804 last.critical &&
71805 last.options &&
71806 last.options.request === "." &&
71807 last.userRequest === "." &&
71808 last.options.recursive
71809 )
71810 parser.state.current.dependencies.pop();
71811 }
71812 parser.state.current.addDependency(dep);
71813 return true;
71814 });
71815 });
71816 }
71817 );
71818 }
71819}
71820module.exports = CompatibilityPlugin;
71821
71822
71823/***/ }),
71824
71825/***/ 34968:
71826/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
71827
71828"use strict";
71829/*
71830 MIT License http://www.opensource.org/licenses/mit-license.php
71831 Author Tobias Koppers @sokra
71832 */
71833
71834
71835const asyncLib = __webpack_require__(36386);
71836const util = __webpack_require__(31669);
71837const { CachedSource } = __webpack_require__(53665);
71838const {
71839 Tapable,
71840 SyncHook,
71841 SyncBailHook,
71842 SyncWaterfallHook,
71843 AsyncSeriesHook
71844} = __webpack_require__(56758);
71845const EntryModuleNotFoundError = __webpack_require__(99531);
71846const ModuleNotFoundError = __webpack_require__(71638);
71847const ModuleDependencyWarning = __webpack_require__(59136);
71848const ModuleDependencyError = __webpack_require__(14953);
71849const ChunkGroup = __webpack_require__(52911);
71850const Chunk = __webpack_require__(2919);
71851const Entrypoint = __webpack_require__(71931);
71852const MainTemplate = __webpack_require__(43626);
71853const ChunkTemplate = __webpack_require__(6170);
71854const HotUpdateChunkTemplate = __webpack_require__(66062);
71855const ModuleTemplate = __webpack_require__(75100);
71856const RuntimeTemplate = __webpack_require__(44006);
71857const ChunkRenderError = __webpack_require__(69865);
71858const Stats = __webpack_require__(99977);
71859const Semaphore = __webpack_require__(33349);
71860const createHash = __webpack_require__(15660);
71861const SortableSet = __webpack_require__(50071);
71862const GraphHelpers = __webpack_require__(32973);
71863const ModuleDependency = __webpack_require__(90865);
71864const compareLocations = __webpack_require__(22562);
71865const { Logger, LogType } = __webpack_require__(47194);
71866const ErrorHelpers = __webpack_require__(80140);
71867const buildChunkGraph = __webpack_require__(52337);
71868const WebpackError = __webpack_require__(97391);
71869
71870/** @typedef {import("./Module")} Module */
71871/** @typedef {import("./Compiler")} Compiler */
71872/** @typedef {import("webpack-sources").Source} Source */
71873/** @typedef {import("./DependenciesBlockVariable")} DependenciesBlockVariable */
71874/** @typedef {import("./dependencies/SingleEntryDependency")} SingleEntryDependency */
71875/** @typedef {import("./dependencies/MultiEntryDependency")} MultiEntryDependency */
71876/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */
71877/** @typedef {import("./dependencies/DependencyReference")} DependencyReference */
71878/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
71879/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
71880/** @typedef {import("./Dependency")} Dependency */
71881/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
71882/** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate */
71883/** @typedef {import("./util/createHash").Hash} Hash */
71884
71885// TODO use @callback
71886/** @typedef {{[assetName: string]: Source}} CompilationAssets */
71887/** @typedef {(err: Error|null, result?: Module) => void } ModuleCallback */
71888/** @typedef {(err?: Error|null, result?: Module) => void } ModuleChainCallback */
71889/** @typedef {(module: Module) => void} OnModuleCallback */
71890/** @typedef {(err?: Error|null) => void} Callback */
71891/** @typedef {(d: Dependency) => any} DepBlockVarDependenciesCallback */
71892/** @typedef {new (...args: any[]) => Dependency} DepConstructor */
71893/** @typedef {{apply: () => void}} Plugin */
71894
71895/**
71896 * @typedef {Object} ModuleFactoryCreateDataContextInfo
71897 * @property {string} issuer
71898 * @property {string} compiler
71899 */
71900
71901/**
71902 * @typedef {Object} ModuleFactoryCreateData
71903 * @property {ModuleFactoryCreateDataContextInfo} contextInfo
71904 * @property {any=} resolveOptions
71905 * @property {string} context
71906 * @property {Dependency[]} dependencies
71907 */
71908
71909/**
71910 * @typedef {Object} ModuleFactory
71911 * @property {(data: ModuleFactoryCreateData, callback: ModuleCallback) => any} create
71912 */
71913
71914/**
71915 * @typedef {Object} SortedDependency
71916 * @property {ModuleFactory} factory
71917 * @property {Dependency[]} dependencies
71918 */
71919
71920/**
71921 * @typedef {Object} DependenciesBlockLike
71922 * @property {Dependency[]} dependencies
71923 * @property {AsyncDependenciesBlock[]} blocks
71924 * @property {DependenciesBlockVariable[]} variables
71925 */
71926
71927/**
71928 * @typedef {Object} LogEntry
71929 * @property {string} type
71930 * @property {any[]} args
71931 * @property {number} time
71932 * @property {string[]=} trace
71933 */
71934
71935/**
71936 * @typedef {Object} AssetInfo
71937 * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash)
71938 * @property {number=} size size in bytes, only set after asset has been emitted
71939 * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets
71940 * @property {boolean=} hotModuleReplacement true, when asset ships data for updating an existing application (HMR)
71941 */
71942
71943/**
71944 * @typedef {Object} Asset
71945 * @property {string} name the filename of the asset
71946 * @property {Source} source source of the asset
71947 * @property {AssetInfo} info info about the asset
71948 */
71949
71950/**
71951 * @param {Chunk} a first chunk to sort by id
71952 * @param {Chunk} b second chunk to sort by id
71953 * @returns {-1|0|1} sort value
71954 */
71955const byId = (a, b) => {
71956 if (typeof a.id !== typeof b.id) {
71957 return typeof a.id < typeof b.id ? -1 : 1;
71958 }
71959 if (a.id < b.id) return -1;
71960 if (a.id > b.id) return 1;
71961 return 0;
71962};
71963
71964/**
71965 * @param {Module} a first module to sort by
71966 * @param {Module} b second module to sort by
71967 * @returns {-1|0|1} sort value
71968 */
71969const byIdOrIdentifier = (a, b) => {
71970 if (typeof a.id !== typeof b.id) {
71971 return typeof a.id < typeof b.id ? -1 : 1;
71972 }
71973 if (a.id < b.id) return -1;
71974 if (a.id > b.id) return 1;
71975 const identA = a.identifier();
71976 const identB = b.identifier();
71977 if (identA < identB) return -1;
71978 if (identA > identB) return 1;
71979 return 0;
71980};
71981
71982/**
71983 * @param {Module} a first module to sort by
71984 * @param {Module} b second module to sort by
71985 * @returns {-1|0|1} sort value
71986 */
71987const byIndexOrIdentifier = (a, b) => {
71988 if (a.index < b.index) return -1;
71989 if (a.index > b.index) return 1;
71990 const identA = a.identifier();
71991 const identB = b.identifier();
71992 if (identA < identB) return -1;
71993 if (identA > identB) return 1;
71994 return 0;
71995};
71996
71997/**
71998 * @param {Compilation} a first compilation to sort by
71999 * @param {Compilation} b second compilation to sort by
72000 * @returns {-1|0|1} sort value
72001 */
72002const byNameOrHash = (a, b) => {
72003 if (a.name < b.name) return -1;
72004 if (a.name > b.name) return 1;
72005 if (a.fullHash < b.fullHash) return -1;
72006 if (a.fullHash > b.fullHash) return 1;
72007 return 0;
72008};
72009
72010/**
72011 * @param {DependenciesBlockVariable[]} variables DepBlock Variables to iterate over
72012 * @param {DepBlockVarDependenciesCallback} fn callback to apply on iterated elements
72013 * @returns {void}
72014 */
72015const iterationBlockVariable = (variables, fn) => {
72016 for (
72017 let indexVariable = 0;
72018 indexVariable < variables.length;
72019 indexVariable++
72020 ) {
72021 const varDep = variables[indexVariable].dependencies;
72022 for (let indexVDep = 0; indexVDep < varDep.length; indexVDep++) {
72023 fn(varDep[indexVDep]);
72024 }
72025 }
72026};
72027
72028/**
72029 * @template T
72030 * @param {T[]} arr array of elements to iterate over
72031 * @param {function(T): void} fn callback applied to each element
72032 * @returns {void}
72033 */
72034const iterationOfArrayCallback = (arr, fn) => {
72035 for (let index = 0; index < arr.length; index++) {
72036 fn(arr[index]);
72037 }
72038};
72039
72040/**
72041 * @template T
72042 * @param {Set<T>} set set to add items to
72043 * @param {Set<T>} otherSet set to add items from
72044 * @returns {void}
72045 */
72046const addAllToSet = (set, otherSet) => {
72047 for (const item of otherSet) {
72048 set.add(item);
72049 }
72050};
72051
72052/**
72053 * @param {Source} a a source
72054 * @param {Source} b another source
72055 * @returns {boolean} true, when both sources are equal
72056 */
72057const isSourceEqual = (a, b) => {
72058 if (a === b) return true;
72059 // TODO webpack 5: check .buffer() instead, it's called anyway during emit
72060 /** @type {Buffer|string} */
72061 let aSource = a.source();
72062 /** @type {Buffer|string} */
72063 let bSource = b.source();
72064 if (aSource === bSource) return true;
72065 if (typeof aSource === "string" && typeof bSource === "string") return false;
72066 if (!Buffer.isBuffer(aSource)) aSource = Buffer.from(aSource, "utf-8");
72067 if (!Buffer.isBuffer(bSource)) bSource = Buffer.from(bSource, "utf-8");
72068 return aSource.equals(bSource);
72069};
72070
72071class Compilation extends Tapable {
72072 /**
72073 * Creates an instance of Compilation.
72074 * @param {Compiler} compiler the compiler which created the compilation
72075 */
72076 constructor(compiler) {
72077 super();
72078 this.hooks = {
72079 /** @type {SyncHook<Module>} */
72080 buildModule: new SyncHook(["module"]),
72081 /** @type {SyncHook<Module>} */
72082 rebuildModule: new SyncHook(["module"]),
72083 /** @type {SyncHook<Module, Error>} */
72084 failedModule: new SyncHook(["module", "error"]),
72085 /** @type {SyncHook<Module>} */
72086 succeedModule: new SyncHook(["module"]),
72087
72088 /** @type {SyncHook<Dependency, string>} */
72089 addEntry: new SyncHook(["entry", "name"]),
72090 /** @type {SyncHook<Dependency, string, Error>} */
72091 failedEntry: new SyncHook(["entry", "name", "error"]),
72092 /** @type {SyncHook<Dependency, string, Module>} */
72093 succeedEntry: new SyncHook(["entry", "name", "module"]),
72094
72095 /** @type {SyncWaterfallHook<DependencyReference, Dependency, Module>} */
72096 dependencyReference: new SyncWaterfallHook([
72097 "dependencyReference",
72098 "dependency",
72099 "module"
72100 ]),
72101
72102 /** @type {AsyncSeriesHook<Module[]>} */
72103 finishModules: new AsyncSeriesHook(["modules"]),
72104 /** @type {SyncHook<Module>} */
72105 finishRebuildingModule: new SyncHook(["module"]),
72106 /** @type {SyncHook} */
72107 unseal: new SyncHook([]),
72108 /** @type {SyncHook} */
72109 seal: new SyncHook([]),
72110
72111 /** @type {SyncHook} */
72112 beforeChunks: new SyncHook([]),
72113 /** @type {SyncHook<Chunk[]>} */
72114 afterChunks: new SyncHook(["chunks"]),
72115
72116 /** @type {SyncBailHook<Module[]>} */
72117 optimizeDependenciesBasic: new SyncBailHook(["modules"]),
72118 /** @type {SyncBailHook<Module[]>} */
72119 optimizeDependencies: new SyncBailHook(["modules"]),
72120 /** @type {SyncBailHook<Module[]>} */
72121 optimizeDependenciesAdvanced: new SyncBailHook(["modules"]),
72122 /** @type {SyncBailHook<Module[]>} */
72123 afterOptimizeDependencies: new SyncHook(["modules"]),
72124
72125 /** @type {SyncHook} */
72126 optimize: new SyncHook([]),
72127 /** @type {SyncBailHook<Module[]>} */
72128 optimizeModulesBasic: new SyncBailHook(["modules"]),
72129 /** @type {SyncBailHook<Module[]>} */
72130 optimizeModules: new SyncBailHook(["modules"]),
72131 /** @type {SyncBailHook<Module[]>} */
72132 optimizeModulesAdvanced: new SyncBailHook(["modules"]),
72133 /** @type {SyncHook<Module[]>} */
72134 afterOptimizeModules: new SyncHook(["modules"]),
72135
72136 /** @type {SyncBailHook<Chunk[], ChunkGroup[]>} */
72137 optimizeChunksBasic: new SyncBailHook(["chunks", "chunkGroups"]),
72138 /** @type {SyncBailHook<Chunk[], ChunkGroup[]>} */
72139 optimizeChunks: new SyncBailHook(["chunks", "chunkGroups"]),
72140 /** @type {SyncBailHook<Chunk[], ChunkGroup[]>} */
72141 optimizeChunksAdvanced: new SyncBailHook(["chunks", "chunkGroups"]),
72142 /** @type {SyncHook<Chunk[], ChunkGroup[]>} */
72143 afterOptimizeChunks: new SyncHook(["chunks", "chunkGroups"]),
72144
72145 /** @type {AsyncSeriesHook<Chunk[], Module[]>} */
72146 optimizeTree: new AsyncSeriesHook(["chunks", "modules"]),
72147 /** @type {SyncHook<Chunk[], Module[]>} */
72148 afterOptimizeTree: new SyncHook(["chunks", "modules"]),
72149
72150 /** @type {SyncBailHook<Chunk[], Module[]>} */
72151 optimizeChunkModulesBasic: new SyncBailHook(["chunks", "modules"]),
72152 /** @type {SyncBailHook<Chunk[], Module[]>} */
72153 optimizeChunkModules: new SyncBailHook(["chunks", "modules"]),
72154 /** @type {SyncBailHook<Chunk[], Module[]>} */
72155 optimizeChunkModulesAdvanced: new SyncBailHook(["chunks", "modules"]),
72156 /** @type {SyncHook<Chunk[], Module[]>} */
72157 afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]),
72158 /** @type {SyncBailHook} */
72159 shouldRecord: new SyncBailHook([]),
72160
72161 /** @type {SyncHook<Module[], any>} */
72162 reviveModules: new SyncHook(["modules", "records"]),
72163 /** @type {SyncHook<Module[]>} */
72164 optimizeModuleOrder: new SyncHook(["modules"]),
72165 /** @type {SyncHook<Module[]>} */
72166 advancedOptimizeModuleOrder: new SyncHook(["modules"]),
72167 /** @type {SyncHook<Module[]>} */
72168 beforeModuleIds: new SyncHook(["modules"]),
72169 /** @type {SyncHook<Module[]>} */
72170 moduleIds: new SyncHook(["modules"]),
72171 /** @type {SyncHook<Module[]>} */
72172 optimizeModuleIds: new SyncHook(["modules"]),
72173 /** @type {SyncHook<Module[]>} */
72174 afterOptimizeModuleIds: new SyncHook(["modules"]),
72175
72176 /** @type {SyncHook<Chunk[], any>} */
72177 reviveChunks: new SyncHook(["chunks", "records"]),
72178 /** @type {SyncHook<Chunk[]>} */
72179 optimizeChunkOrder: new SyncHook(["chunks"]),
72180 /** @type {SyncHook<Chunk[]>} */
72181 beforeChunkIds: new SyncHook(["chunks"]),
72182 /** @type {SyncHook<Chunk[]>} */
72183 optimizeChunkIds: new SyncHook(["chunks"]),
72184 /** @type {SyncHook<Chunk[]>} */
72185 afterOptimizeChunkIds: new SyncHook(["chunks"]),
72186
72187 /** @type {SyncHook<Module[], any>} */
72188 recordModules: new SyncHook(["modules", "records"]),
72189 /** @type {SyncHook<Chunk[], any>} */
72190 recordChunks: new SyncHook(["chunks", "records"]),
72191
72192 /** @type {SyncHook} */
72193 beforeHash: new SyncHook([]),
72194 /** @type {SyncHook<Chunk>} */
72195 contentHash: new SyncHook(["chunk"]),
72196 /** @type {SyncHook} */
72197 afterHash: new SyncHook([]),
72198 /** @type {SyncHook<any>} */
72199 recordHash: new SyncHook(["records"]),
72200 /** @type {SyncHook<Compilation, any>} */
72201 record: new SyncHook(["compilation", "records"]),
72202
72203 /** @type {SyncHook} */
72204 beforeModuleAssets: new SyncHook([]),
72205 /** @type {SyncBailHook} */
72206 shouldGenerateChunkAssets: new SyncBailHook([]),
72207 /** @type {SyncHook} */
72208 beforeChunkAssets: new SyncHook([]),
72209 /** @type {SyncHook<Chunk[]>} */
72210 additionalChunkAssets: new SyncHook(["chunks"]),
72211
72212 /** @type {AsyncSeriesHook} */
72213 additionalAssets: new AsyncSeriesHook([]),
72214 /** @type {AsyncSeriesHook<Chunk[]>} */
72215 optimizeChunkAssets: new AsyncSeriesHook(["chunks"]),
72216 /** @type {SyncHook<Chunk[]>} */
72217 afterOptimizeChunkAssets: new SyncHook(["chunks"]),
72218 /** @type {AsyncSeriesHook<CompilationAssets>} */
72219 optimizeAssets: new AsyncSeriesHook(["assets"]),
72220 /** @type {SyncHook<CompilationAssets>} */
72221 afterOptimizeAssets: new SyncHook(["assets"]),
72222
72223 /** @type {SyncBailHook} */
72224 needAdditionalSeal: new SyncBailHook([]),
72225 /** @type {AsyncSeriesHook} */
72226 afterSeal: new AsyncSeriesHook([]),
72227
72228 /** @type {SyncHook<Chunk, Hash>} */
72229 chunkHash: new SyncHook(["chunk", "chunkHash"]),
72230 /** @type {SyncHook<Module, string>} */
72231 moduleAsset: new SyncHook(["module", "filename"]),
72232 /** @type {SyncHook<Chunk, string>} */
72233 chunkAsset: new SyncHook(["chunk", "filename"]),
72234
72235 /** @type {SyncWaterfallHook<string, TODO>} */
72236 assetPath: new SyncWaterfallHook(["filename", "data"]), // TODO MainTemplate
72237
72238 /** @type {SyncBailHook} */
72239 needAdditionalPass: new SyncBailHook([]),
72240
72241 /** @type {SyncHook<Compiler, string, number>} */
72242 childCompiler: new SyncHook([
72243 "childCompiler",
72244 "compilerName",
72245 "compilerIndex"
72246 ]),
72247
72248 /** @type {SyncBailHook<string, LogEntry>} */
72249 log: new SyncBailHook(["origin", "logEntry"]),
72250
72251 // TODO the following hooks are weirdly located here
72252 // TODO move them for webpack 5
72253 /** @type {SyncHook<object, Module>} */
72254 normalModuleLoader: new SyncHook(["loaderContext", "module"]),
72255
72256 /** @type {SyncBailHook<Chunk[]>} */
72257 optimizeExtractedChunksBasic: new SyncBailHook(["chunks"]),
72258 /** @type {SyncBailHook<Chunk[]>} */
72259 optimizeExtractedChunks: new SyncBailHook(["chunks"]),
72260 /** @type {SyncBailHook<Chunk[]>} */
72261 optimizeExtractedChunksAdvanced: new SyncBailHook(["chunks"]),
72262 /** @type {SyncHook<Chunk[]>} */
72263 afterOptimizeExtractedChunks: new SyncHook(["chunks"])
72264 };
72265 this._pluginCompat.tap("Compilation", options => {
72266 switch (options.name) {
72267 case "optimize-tree":
72268 case "additional-assets":
72269 case "optimize-chunk-assets":
72270 case "optimize-assets":
72271 case "after-seal":
72272 options.async = true;
72273 break;
72274 }
72275 });
72276 /** @type {string=} */
72277 this.name = undefined;
72278 /** @type {Compiler} */
72279 this.compiler = compiler;
72280 this.resolverFactory = compiler.resolverFactory;
72281 this.inputFileSystem = compiler.inputFileSystem;
72282 this.requestShortener = compiler.requestShortener;
72283
72284 const options = compiler.options;
72285 this.options = options;
72286 this.outputOptions = options && options.output;
72287 /** @type {boolean=} */
72288 this.bail = options && options.bail;
72289 this.profile = options && options.profile;
72290 this.performance = options && options.performance;
72291
72292 this.mainTemplate = new MainTemplate(this.outputOptions);
72293 this.chunkTemplate = new ChunkTemplate(this.outputOptions);
72294 this.hotUpdateChunkTemplate = new HotUpdateChunkTemplate(
72295 this.outputOptions
72296 );
72297 this.runtimeTemplate = new RuntimeTemplate(
72298 this.outputOptions,
72299 this.requestShortener
72300 );
72301 this.moduleTemplates = {
72302 javascript: new ModuleTemplate(this.runtimeTemplate, "javascript"),
72303 webassembly: new ModuleTemplate(this.runtimeTemplate, "webassembly")
72304 };
72305
72306 this.semaphore = new Semaphore(options.parallelism || 100);
72307
72308 this.entries = [];
72309 /** @private @type {{name: string, request: string, module: Module}[]} */
72310 this._preparedEntrypoints = [];
72311 /** @type {Map<string, Entrypoint>} */
72312 this.entrypoints = new Map();
72313 /** @type {Chunk[]} */
72314 this.chunks = [];
72315 /** @type {ChunkGroup[]} */
72316 this.chunkGroups = [];
72317 /** @type {Map<string, ChunkGroup>} */
72318 this.namedChunkGroups = new Map();
72319 /** @type {Map<string, Chunk>} */
72320 this.namedChunks = new Map();
72321 /** @type {Module[]} */
72322 this.modules = [];
72323 /** @private @type {Map<string, Module>} */
72324 this._modules = new Map();
72325 this.cache = null;
72326 this.records = null;
72327 /** @type {string[]} */
72328 this.additionalChunkAssets = [];
72329 /** @type {CompilationAssets} */
72330 this.assets = {};
72331 /** @type {Map<string, AssetInfo>} */
72332 this.assetsInfo = new Map();
72333 /** @type {WebpackError[]} */
72334 this.errors = [];
72335 /** @type {WebpackError[]} */
72336 this.warnings = [];
72337 /** @type {Compilation[]} */
72338 this.children = [];
72339 /** @type {Map<string, LogEntry[]>} */
72340 this.logging = new Map();
72341 /** @type {Map<DepConstructor, ModuleFactory>} */
72342 this.dependencyFactories = new Map();
72343 /** @type {Map<DepConstructor, DependencyTemplate>} */
72344 this.dependencyTemplates = new Map();
72345 // TODO refactor this in webpack 5 to a custom DependencyTemplates class with a hash property
72346 // @ts-ignore
72347 this.dependencyTemplates.set("hash", "");
72348 this.childrenCounters = {};
72349 /** @type {Set<number|string>} */
72350 this.usedChunkIds = null;
72351 /** @type {Set<number>} */
72352 this.usedModuleIds = null;
72353 /** @type {Map<string, number>=} */
72354 this.fileTimestamps = undefined;
72355 /** @type {Map<string, number>=} */
72356 this.contextTimestamps = undefined;
72357 /** @type {Set<string>=} */
72358 this.compilationDependencies = undefined;
72359 /** @private @type {Map<Module, Callback[]>} */
72360 this._buildingModules = new Map();
72361 /** @private @type {Map<Module, Callback[]>} */
72362 this._rebuildingModules = new Map();
72363 /** @type {Set<string>} */
72364 this.emittedAssets = new Set();
72365 }
72366
72367 getStats() {
72368 return new Stats(this);
72369 }
72370
72371 /**
72372 * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name
72373 * @returns {Logger} a logger with that name
72374 */
72375 getLogger(name) {
72376 if (!name) {
72377 throw new TypeError("Compilation.getLogger(name) called without a name");
72378 }
72379 /** @type {LogEntry[] | undefined} */
72380 let logEntries;
72381 return new Logger((type, args) => {
72382 if (typeof name === "function") {
72383 name = name();
72384 if (!name) {
72385 throw new TypeError(
72386 "Compilation.getLogger(name) called with a function not returning a name"
72387 );
72388 }
72389 }
72390 let trace;
72391 switch (type) {
72392 case LogType.warn:
72393 case LogType.error:
72394 case LogType.trace:
72395 trace = ErrorHelpers.cutOffLoaderExecution(new Error("Trace").stack)
72396 .split("\n")
72397 .slice(3);
72398 break;
72399 }
72400 /** @type {LogEntry} */
72401 const logEntry = {
72402 time: Date.now(),
72403 type,
72404 args,
72405 trace
72406 };
72407 if (this.hooks.log.call(name, logEntry) === undefined) {
72408 if (logEntry.type === LogType.profileEnd) {
72409 // eslint-disable-next-line node/no-unsupported-features/node-builtins
72410 if (typeof console.profileEnd === "function") {
72411 // eslint-disable-next-line node/no-unsupported-features/node-builtins
72412 console.profileEnd(`[${name}] ${logEntry.args[0]}`);
72413 }
72414 }
72415 if (logEntries === undefined) {
72416 logEntries = this.logging.get(name);
72417 if (logEntries === undefined) {
72418 logEntries = [];
72419 this.logging.set(name, logEntries);
72420 }
72421 }
72422 logEntries.push(logEntry);
72423 if (logEntry.type === LogType.profile) {
72424 // eslint-disable-next-line node/no-unsupported-features/node-builtins
72425 if (typeof console.profile === "function") {
72426 // eslint-disable-next-line node/no-unsupported-features/node-builtins
72427 console.profile(`[${name}] ${logEntry.args[0]}`);
72428 }
72429 }
72430 }
72431 });
72432 }
72433
72434 /**
72435 * @typedef {Object} AddModuleResult
72436 * @property {Module} module the added or existing module
72437 * @property {boolean} issuer was this the first request for this module
72438 * @property {boolean} build should the module be build
72439 * @property {boolean} dependencies should dependencies be walked
72440 */
72441
72442 /**
72443 * @param {Module} module module to be added that was created
72444 * @param {any=} cacheGroup cacheGroup it is apart of
72445 * @returns {AddModuleResult} returns meta about whether or not the module had built
72446 * had an issuer, or any dependnecies
72447 */
72448 addModule(module, cacheGroup) {
72449 const identifier = module.identifier();
72450 const alreadyAddedModule = this._modules.get(identifier);
72451 if (alreadyAddedModule) {
72452 return {
72453 module: alreadyAddedModule,
72454 issuer: false,
72455 build: false,
72456 dependencies: false
72457 };
72458 }
72459 const cacheName = (cacheGroup || "m") + identifier;
72460 if (this.cache && this.cache[cacheName]) {
72461 const cacheModule = this.cache[cacheName];
72462
72463 if (typeof cacheModule.updateCacheModule === "function") {
72464 cacheModule.updateCacheModule(module);
72465 }
72466
72467 let rebuild = true;
72468 if (this.fileTimestamps && this.contextTimestamps) {
72469 rebuild = cacheModule.needRebuild(
72470 this.fileTimestamps,
72471 this.contextTimestamps
72472 );
72473 }
72474
72475 if (!rebuild) {
72476 cacheModule.disconnect();
72477 this._modules.set(identifier, cacheModule);
72478 this.modules.push(cacheModule);
72479 for (const err of cacheModule.errors) {
72480 this.errors.push(err);
72481 }
72482 for (const err of cacheModule.warnings) {
72483 this.warnings.push(err);
72484 }
72485 return {
72486 module: cacheModule,
72487 issuer: true,
72488 build: false,
72489 dependencies: true
72490 };
72491 }
72492 cacheModule.unbuild();
72493 module = cacheModule;
72494 }
72495 this._modules.set(identifier, module);
72496 if (this.cache) {
72497 this.cache[cacheName] = module;
72498 }
72499 this.modules.push(module);
72500 return {
72501 module: module,
72502 issuer: true,
72503 build: true,
72504 dependencies: true
72505 };
72506 }
72507
72508 /**
72509 * Fetches a module from a compilation by its identifier
72510 * @param {Module} module the module provided
72511 * @returns {Module} the module requested
72512 */
72513 getModule(module) {
72514 const identifier = module.identifier();
72515 return this._modules.get(identifier);
72516 }
72517
72518 /**
72519 * Attempts to search for a module by its identifier
72520 * @param {string} identifier identifier (usually path) for module
72521 * @returns {Module|undefined} attempt to search for module and return it, else undefined
72522 */
72523 findModule(identifier) {
72524 return this._modules.get(identifier);
72525 }
72526
72527 /**
72528 * @param {Module} module module with its callback list
72529 * @param {Callback} callback the callback function
72530 * @returns {void}
72531 */
72532 waitForBuildingFinished(module, callback) {
72533 let callbackList = this._buildingModules.get(module);
72534 if (callbackList) {
72535 callbackList.push(() => callback());
72536 } else {
72537 process.nextTick(callback);
72538 }
72539 }
72540
72541 /**
72542 * Builds the module object
72543 *
72544 * @param {Module} module module to be built
72545 * @param {boolean} optional optional flag
72546 * @param {Module=} origin origin module this module build was requested from
72547 * @param {Dependency[]=} dependencies optional dependencies from the module to be built
72548 * @param {TODO} thisCallback the callback
72549 * @returns {TODO} returns the callback function with results
72550 */
72551 buildModule(module, optional, origin, dependencies, thisCallback) {
72552 let callbackList = this._buildingModules.get(module);
72553 if (callbackList) {
72554 callbackList.push(thisCallback);
72555 return;
72556 }
72557 this._buildingModules.set(module, (callbackList = [thisCallback]));
72558
72559 const callback = err => {
72560 this._buildingModules.delete(module);
72561 for (const cb of callbackList) {
72562 cb(err);
72563 }
72564 };
72565
72566 this.hooks.buildModule.call(module);
72567 module.build(
72568 this.options,
72569 this,
72570 this.resolverFactory.get("normal", module.resolveOptions),
72571 this.inputFileSystem,
72572 error => {
72573 const errors = module.errors;
72574 for (let indexError = 0; indexError < errors.length; indexError++) {
72575 const err = errors[indexError];
72576 err.origin = origin;
72577 err.dependencies = dependencies;
72578 if (optional) {
72579 this.warnings.push(err);
72580 } else {
72581 this.errors.push(err);
72582 }
72583 }
72584
72585 const warnings = module.warnings;
72586 for (
72587 let indexWarning = 0;
72588 indexWarning < warnings.length;
72589 indexWarning++
72590 ) {
72591 const war = warnings[indexWarning];
72592 war.origin = origin;
72593 war.dependencies = dependencies;
72594 this.warnings.push(war);
72595 }
72596 const originalMap = module.dependencies.reduce((map, v, i) => {
72597 map.set(v, i);
72598 return map;
72599 }, new Map());
72600 module.dependencies.sort((a, b) => {
72601 const cmp = compareLocations(a.loc, b.loc);
72602 if (cmp) return cmp;
72603 return originalMap.get(a) - originalMap.get(b);
72604 });
72605 if (error) {
72606 this.hooks.failedModule.call(module, error);
72607 return callback(error);
72608 }
72609 this.hooks.succeedModule.call(module);
72610 return callback();
72611 }
72612 );
72613 }
72614
72615 /**
72616 * @param {Module} module to be processed for deps
72617 * @param {ModuleCallback} callback callback to be triggered
72618 * @returns {void}
72619 */
72620 processModuleDependencies(module, callback) {
72621 const dependencies = new Map();
72622
72623 const addDependency = dep => {
72624 const resourceIdent = dep.getResourceIdentifier();
72625 if (resourceIdent) {
72626 const factory = this.dependencyFactories.get(dep.constructor);
72627 if (factory === undefined) {
72628 throw new Error(
72629 `No module factory available for dependency type: ${dep.constructor.name}`
72630 );
72631 }
72632 let innerMap = dependencies.get(factory);
72633 if (innerMap === undefined) {
72634 dependencies.set(factory, (innerMap = new Map()));
72635 }
72636 let list = innerMap.get(resourceIdent);
72637 if (list === undefined) innerMap.set(resourceIdent, (list = []));
72638 list.push(dep);
72639 }
72640 };
72641
72642 const addDependenciesBlock = block => {
72643 if (block.dependencies) {
72644 iterationOfArrayCallback(block.dependencies, addDependency);
72645 }
72646 if (block.blocks) {
72647 iterationOfArrayCallback(block.blocks, addDependenciesBlock);
72648 }
72649 if (block.variables) {
72650 iterationBlockVariable(block.variables, addDependency);
72651 }
72652 };
72653
72654 try {
72655 addDependenciesBlock(module);
72656 } catch (e) {
72657 callback(e);
72658 }
72659
72660 const sortedDependencies = [];
72661
72662 for (const pair1 of dependencies) {
72663 for (const pair2 of pair1[1]) {
72664 sortedDependencies.push({
72665 factory: pair1[0],
72666 dependencies: pair2[1]
72667 });
72668 }
72669 }
72670
72671 this.addModuleDependencies(
72672 module,
72673 sortedDependencies,
72674 this.bail,
72675 null,
72676 true,
72677 callback
72678 );
72679 }
72680
72681 /**
72682 * @param {Module} module module to add deps to
72683 * @param {SortedDependency[]} dependencies set of sorted dependencies to iterate through
72684 * @param {(boolean|null)=} bail whether to bail or not
72685 * @param {TODO} cacheGroup optional cacheGroup
72686 * @param {boolean} recursive whether it is recursive traversal
72687 * @param {function} callback callback for when dependencies are finished being added
72688 * @returns {void}
72689 */
72690 addModuleDependencies(
72691 module,
72692 dependencies,
72693 bail,
72694 cacheGroup,
72695 recursive,
72696 callback
72697 ) {
72698 const start = this.profile && Date.now();
72699 const currentProfile = this.profile && {};
72700
72701 asyncLib.forEach(
72702 dependencies,
72703 (item, callback) => {
72704 const dependencies = item.dependencies;
72705
72706 const errorAndCallback = err => {
72707 err.origin = module;
72708 err.dependencies = dependencies;
72709 this.errors.push(err);
72710 if (bail) {
72711 callback(err);
72712 } else {
72713 callback();
72714 }
72715 };
72716 const warningAndCallback = err => {
72717 err.origin = module;
72718 this.warnings.push(err);
72719 callback();
72720 };
72721
72722 const semaphore = this.semaphore;
72723 semaphore.acquire(() => {
72724 const factory = item.factory;
72725 factory.create(
72726 {
72727 contextInfo: {
72728 issuer: module.nameForCondition && module.nameForCondition(),
72729 compiler: this.compiler.name
72730 },
72731 resolveOptions: module.resolveOptions,
72732 context: module.context,
72733 dependencies: dependencies
72734 },
72735 (err, dependentModule) => {
72736 let afterFactory;
72737
72738 const isOptional = () => {
72739 return dependencies.every(d => d.optional);
72740 };
72741
72742 const errorOrWarningAndCallback = err => {
72743 if (isOptional()) {
72744 return warningAndCallback(err);
72745 } else {
72746 return errorAndCallback(err);
72747 }
72748 };
72749
72750 if (err) {
72751 semaphore.release();
72752 return errorOrWarningAndCallback(
72753 new ModuleNotFoundError(module, err)
72754 );
72755 }
72756 if (!dependentModule) {
72757 semaphore.release();
72758 return process.nextTick(callback);
72759 }
72760 if (currentProfile) {
72761 afterFactory = Date.now();
72762 currentProfile.factory = afterFactory - start;
72763 }
72764
72765 const iterationDependencies = depend => {
72766 for (let index = 0; index < depend.length; index++) {
72767 const dep = depend[index];
72768 dep.module = dependentModule;
72769 dependentModule.addReason(module, dep);
72770 }
72771 };
72772
72773 const addModuleResult = this.addModule(
72774 dependentModule,
72775 cacheGroup
72776 );
72777 dependentModule = addModuleResult.module;
72778 iterationDependencies(dependencies);
72779
72780 const afterBuild = () => {
72781 if (recursive && addModuleResult.dependencies) {
72782 this.processModuleDependencies(dependentModule, callback);
72783 } else {
72784 return callback();
72785 }
72786 };
72787
72788 if (addModuleResult.issuer) {
72789 if (currentProfile) {
72790 dependentModule.profile = currentProfile;
72791 }
72792
72793 dependentModule.issuer = module;
72794 } else {
72795 if (this.profile) {
72796 if (module.profile) {
72797 const time = Date.now() - start;
72798 if (
72799 !module.profile.dependencies ||
72800 time > module.profile.dependencies
72801 ) {
72802 module.profile.dependencies = time;
72803 }
72804 }
72805 }
72806 }
72807
72808 if (addModuleResult.build) {
72809 this.buildModule(
72810 dependentModule,
72811 isOptional(),
72812 module,
72813 dependencies,
72814 err => {
72815 if (err) {
72816 semaphore.release();
72817 return errorOrWarningAndCallback(err);
72818 }
72819
72820 if (currentProfile) {
72821 const afterBuilding = Date.now();
72822 currentProfile.building = afterBuilding - afterFactory;
72823 }
72824
72825 semaphore.release();
72826 afterBuild();
72827 }
72828 );
72829 } else {
72830 semaphore.release();
72831 this.waitForBuildingFinished(dependentModule, afterBuild);
72832 }
72833 }
72834 );
72835 });
72836 },
72837 err => {
72838 // In V8, the Error objects keep a reference to the functions on the stack. These warnings &
72839 // errors are created inside closures that keep a reference to the Compilation, so errors are
72840 // leaking the Compilation object.
72841
72842 if (err) {
72843 // eslint-disable-next-line no-self-assign
72844 err.stack = err.stack;
72845 return callback(err);
72846 }
72847
72848 return process.nextTick(callback);
72849 }
72850 );
72851 }
72852
72853 /**
72854 *
72855 * @param {string} context context string path
72856 * @param {Dependency} dependency dependency used to create Module chain
72857 * @param {OnModuleCallback} onModule function invoked on modules creation
72858 * @param {ModuleChainCallback} callback callback for when module chain is complete
72859 * @returns {void} will throw if dependency instance is not a valid Dependency
72860 */
72861 _addModuleChain(context, dependency, onModule, callback) {
72862 const start = this.profile && Date.now();
72863 const currentProfile = this.profile && {};
72864
72865 const errorAndCallback = this.bail
72866 ? err => {
72867 callback(err);
72868 }
72869 : err => {
72870 err.dependencies = [dependency];
72871 this.errors.push(err);
72872 callback();
72873 };
72874
72875 if (
72876 typeof dependency !== "object" ||
72877 dependency === null ||
72878 !dependency.constructor
72879 ) {
72880 throw new Error("Parameter 'dependency' must be a Dependency");
72881 }
72882 const Dep = /** @type {DepConstructor} */ (dependency.constructor);
72883 const moduleFactory = this.dependencyFactories.get(Dep);
72884 if (!moduleFactory) {
72885 throw new Error(
72886 `No dependency factory available for this dependency type: ${dependency.constructor.name}`
72887 );
72888 }
72889
72890 this.semaphore.acquire(() => {
72891 moduleFactory.create(
72892 {
72893 contextInfo: {
72894 issuer: "",
72895 compiler: this.compiler.name
72896 },
72897 context: context,
72898 dependencies: [dependency]
72899 },
72900 (err, module) => {
72901 if (err) {
72902 this.semaphore.release();
72903 return errorAndCallback(new EntryModuleNotFoundError(err));
72904 }
72905
72906 let afterFactory;
72907
72908 if (currentProfile) {
72909 afterFactory = Date.now();
72910 currentProfile.factory = afterFactory - start;
72911 }
72912
72913 const addModuleResult = this.addModule(module);
72914 module = addModuleResult.module;
72915
72916 onModule(module);
72917
72918 dependency.module = module;
72919 module.addReason(null, dependency);
72920
72921 const afterBuild = () => {
72922 if (addModuleResult.dependencies) {
72923 this.processModuleDependencies(module, err => {
72924 if (err) return callback(err);
72925 callback(null, module);
72926 });
72927 } else {
72928 return callback(null, module);
72929 }
72930 };
72931
72932 if (addModuleResult.issuer) {
72933 if (currentProfile) {
72934 module.profile = currentProfile;
72935 }
72936 }
72937
72938 if (addModuleResult.build) {
72939 this.buildModule(module, false, null, null, err => {
72940 if (err) {
72941 this.semaphore.release();
72942 return errorAndCallback(err);
72943 }
72944
72945 if (currentProfile) {
72946 const afterBuilding = Date.now();
72947 currentProfile.building = afterBuilding - afterFactory;
72948 }
72949
72950 this.semaphore.release();
72951 afterBuild();
72952 });
72953 } else {
72954 this.semaphore.release();
72955 this.waitForBuildingFinished(module, afterBuild);
72956 }
72957 }
72958 );
72959 });
72960 }
72961
72962 /**
72963 *
72964 * @param {string} context context path for entry
72965 * @param {Dependency} entry entry dependency being created
72966 * @param {string} name name of entry
72967 * @param {ModuleCallback} callback callback function
72968 * @returns {void} returns
72969 */
72970 addEntry(context, entry, name, callback) {
72971 this.hooks.addEntry.call(entry, name);
72972
72973 const slot = {
72974 name: name,
72975 // TODO webpack 5 remove `request`
72976 request: null,
72977 module: null
72978 };
72979
72980 if (entry instanceof ModuleDependency) {
72981 slot.request = entry.request;
72982 }
72983
72984 // TODO webpack 5: merge modules instead when multiple entry modules are supported
72985 const idx = this._preparedEntrypoints.findIndex(slot => slot.name === name);
72986 if (idx >= 0) {
72987 // Overwrite existing entrypoint
72988 this._preparedEntrypoints[idx] = slot;
72989 } else {
72990 this._preparedEntrypoints.push(slot);
72991 }
72992 this._addModuleChain(
72993 context,
72994 entry,
72995 module => {
72996 this.entries.push(module);
72997 },
72998 (err, module) => {
72999 if (err) {
73000 this.hooks.failedEntry.call(entry, name, err);
73001 return callback(err);
73002 }
73003
73004 if (module) {
73005 slot.module = module;
73006 } else {
73007 const idx = this._preparedEntrypoints.indexOf(slot);
73008 if (idx >= 0) {
73009 this._preparedEntrypoints.splice(idx, 1);
73010 }
73011 }
73012 this.hooks.succeedEntry.call(entry, name, module);
73013 return callback(null, module);
73014 }
73015 );
73016 }
73017
73018 /**
73019 * @param {string} context context path string
73020 * @param {Dependency} dependency dep used to create module
73021 * @param {ModuleCallback} callback module callback sending module up a level
73022 * @returns {void}
73023 */
73024 prefetch(context, dependency, callback) {
73025 this._addModuleChain(
73026 context,
73027 dependency,
73028 module => {
73029 module.prefetched = true;
73030 },
73031 callback
73032 );
73033 }
73034
73035 /**
73036 * @param {Module} module module to be rebuilt
73037 * @param {Callback} thisCallback callback when module finishes rebuilding
73038 * @returns {void}
73039 */
73040 rebuildModule(module, thisCallback) {
73041 let callbackList = this._rebuildingModules.get(module);
73042 if (callbackList) {
73043 callbackList.push(thisCallback);
73044 return;
73045 }
73046 this._rebuildingModules.set(module, (callbackList = [thisCallback]));
73047
73048 const callback = err => {
73049 this._rebuildingModules.delete(module);
73050 for (const cb of callbackList) {
73051 cb(err);
73052 }
73053 };
73054
73055 this.hooks.rebuildModule.call(module);
73056 const oldDependencies = module.dependencies.slice();
73057 const oldVariables = module.variables.slice();
73058 const oldBlocks = module.blocks.slice();
73059 module.unbuild();
73060 this.buildModule(module, false, module, null, err => {
73061 if (err) {
73062 this.hooks.finishRebuildingModule.call(module);
73063 return callback(err);
73064 }
73065
73066 this.processModuleDependencies(module, err => {
73067 if (err) return callback(err);
73068 this.removeReasonsOfDependencyBlock(module, {
73069 dependencies: oldDependencies,
73070 variables: oldVariables,
73071 blocks: oldBlocks
73072 });
73073 this.hooks.finishRebuildingModule.call(module);
73074 callback();
73075 });
73076 });
73077 }
73078
73079 finish(callback) {
73080 const modules = this.modules;
73081 this.hooks.finishModules.callAsync(modules, err => {
73082 if (err) return callback(err);
73083
73084 for (let index = 0; index < modules.length; index++) {
73085 const module = modules[index];
73086 this.reportDependencyErrorsAndWarnings(module, [module]);
73087 }
73088
73089 callback();
73090 });
73091 }
73092
73093 unseal() {
73094 this.hooks.unseal.call();
73095 this.chunks.length = 0;
73096 this.chunkGroups.length = 0;
73097 this.namedChunks.clear();
73098 this.namedChunkGroups.clear();
73099 this.additionalChunkAssets.length = 0;
73100 this.assets = {};
73101 this.assetsInfo.clear();
73102 for (const module of this.modules) {
73103 module.unseal();
73104 }
73105 }
73106
73107 /**
73108 * @param {Callback} callback signals when the seal method is finishes
73109 * @returns {void}
73110 */
73111 seal(callback) {
73112 this.hooks.seal.call();
73113
73114 while (
73115 this.hooks.optimizeDependenciesBasic.call(this.modules) ||
73116 this.hooks.optimizeDependencies.call(this.modules) ||
73117 this.hooks.optimizeDependenciesAdvanced.call(this.modules)
73118 ) {
73119 /* empty */
73120 }
73121 this.hooks.afterOptimizeDependencies.call(this.modules);
73122
73123 this.hooks.beforeChunks.call();
73124 for (const preparedEntrypoint of this._preparedEntrypoints) {
73125 const module = preparedEntrypoint.module;
73126 const name = preparedEntrypoint.name;
73127 const chunk = this.addChunk(name);
73128 const entrypoint = new Entrypoint(name);
73129 entrypoint.setRuntimeChunk(chunk);
73130 entrypoint.addOrigin(null, name, preparedEntrypoint.request);
73131 this.namedChunkGroups.set(name, entrypoint);
73132 this.entrypoints.set(name, entrypoint);
73133 this.chunkGroups.push(entrypoint);
73134
73135 GraphHelpers.connectChunkGroupAndChunk(entrypoint, chunk);
73136 GraphHelpers.connectChunkAndModule(chunk, module);
73137
73138 chunk.entryModule = module;
73139 chunk.name = name;
73140
73141 this.assignDepth(module);
73142 }
73143 buildChunkGraph(
73144 this,
73145 /** @type {Entrypoint[]} */ (this.chunkGroups.slice())
73146 );
73147 this.sortModules(this.modules);
73148 this.hooks.afterChunks.call(this.chunks);
73149
73150 this.hooks.optimize.call();
73151
73152 while (
73153 this.hooks.optimizeModulesBasic.call(this.modules) ||
73154 this.hooks.optimizeModules.call(this.modules) ||
73155 this.hooks.optimizeModulesAdvanced.call(this.modules)
73156 ) {
73157 /* empty */
73158 }
73159 this.hooks.afterOptimizeModules.call(this.modules);
73160
73161 while (
73162 this.hooks.optimizeChunksBasic.call(this.chunks, this.chunkGroups) ||
73163 this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups) ||
73164 this.hooks.optimizeChunksAdvanced.call(this.chunks, this.chunkGroups)
73165 ) {
73166 /* empty */
73167 }
73168 this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups);
73169
73170 this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
73171 if (err) {
73172 return callback(err);
73173 }
73174
73175 this.hooks.afterOptimizeTree.call(this.chunks, this.modules);
73176
73177 while (
73178 this.hooks.optimizeChunkModulesBasic.call(this.chunks, this.modules) ||
73179 this.hooks.optimizeChunkModules.call(this.chunks, this.modules) ||
73180 this.hooks.optimizeChunkModulesAdvanced.call(this.chunks, this.modules)
73181 ) {
73182 /* empty */
73183 }
73184 this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules);
73185
73186 const shouldRecord = this.hooks.shouldRecord.call() !== false;
73187
73188 this.hooks.reviveModules.call(this.modules, this.records);
73189 this.hooks.optimizeModuleOrder.call(this.modules);
73190 this.hooks.advancedOptimizeModuleOrder.call(this.modules);
73191 this.hooks.beforeModuleIds.call(this.modules);
73192 this.hooks.moduleIds.call(this.modules);
73193 this.applyModuleIds();
73194 this.hooks.optimizeModuleIds.call(this.modules);
73195 this.hooks.afterOptimizeModuleIds.call(this.modules);
73196
73197 this.sortItemsWithModuleIds();
73198
73199 this.hooks.reviveChunks.call(this.chunks, this.records);
73200 this.hooks.optimizeChunkOrder.call(this.chunks);
73201 this.hooks.beforeChunkIds.call(this.chunks);
73202 this.applyChunkIds();
73203 this.hooks.optimizeChunkIds.call(this.chunks);
73204 this.hooks.afterOptimizeChunkIds.call(this.chunks);
73205
73206 this.sortItemsWithChunkIds();
73207
73208 if (shouldRecord) {
73209 this.hooks.recordModules.call(this.modules, this.records);
73210 this.hooks.recordChunks.call(this.chunks, this.records);
73211 }
73212
73213 this.hooks.beforeHash.call();
73214 this.createHash();
73215 this.hooks.afterHash.call();
73216
73217 if (shouldRecord) {
73218 this.hooks.recordHash.call(this.records);
73219 }
73220
73221 this.hooks.beforeModuleAssets.call();
73222 this.createModuleAssets();
73223 if (this.hooks.shouldGenerateChunkAssets.call() !== false) {
73224 this.hooks.beforeChunkAssets.call();
73225 this.createChunkAssets();
73226 }
73227 this.hooks.additionalChunkAssets.call(this.chunks);
73228 this.summarizeDependencies();
73229 if (shouldRecord) {
73230 this.hooks.record.call(this, this.records);
73231 }
73232
73233 this.hooks.additionalAssets.callAsync(err => {
73234 if (err) {
73235 return callback(err);
73236 }
73237 this.hooks.optimizeChunkAssets.callAsync(this.chunks, err => {
73238 if (err) {
73239 return callback(err);
73240 }
73241 this.hooks.afterOptimizeChunkAssets.call(this.chunks);
73242 this.hooks.optimizeAssets.callAsync(this.assets, err => {
73243 if (err) {
73244 return callback(err);
73245 }
73246 this.hooks.afterOptimizeAssets.call(this.assets);
73247 if (this.hooks.needAdditionalSeal.call()) {
73248 this.unseal();
73249 return this.seal(callback);
73250 }
73251 return this.hooks.afterSeal.callAsync(callback);
73252 });
73253 });
73254 });
73255 });
73256 }
73257
73258 /**
73259 * @param {Module[]} modules the modules array on compilation to perform the sort for
73260 * @returns {void}
73261 */
73262 sortModules(modules) {
73263 // TODO webpack 5: this should only be enabled when `moduleIds: "natural"`
73264 // TODO move it into a plugin (NaturalModuleIdsPlugin) and use this in WebpackOptionsApply
73265 // TODO remove this method
73266 modules.sort(byIndexOrIdentifier);
73267 }
73268
73269 /**
73270 * @param {Module} module moulde to report from
73271 * @param {DependenciesBlock[]} blocks blocks to report from
73272 * @returns {void}
73273 */
73274 reportDependencyErrorsAndWarnings(module, blocks) {
73275 for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) {
73276 const block = blocks[indexBlock];
73277 const dependencies = block.dependencies;
73278
73279 for (let indexDep = 0; indexDep < dependencies.length; indexDep++) {
73280 const d = dependencies[indexDep];
73281
73282 const warnings = d.getWarnings();
73283 if (warnings) {
73284 for (let indexWar = 0; indexWar < warnings.length; indexWar++) {
73285 const w = warnings[indexWar];
73286
73287 const warning = new ModuleDependencyWarning(module, w, d.loc);
73288 this.warnings.push(warning);
73289 }
73290 }
73291 const errors = d.getErrors();
73292 if (errors) {
73293 for (let indexErr = 0; indexErr < errors.length; indexErr++) {
73294 const e = errors[indexErr];
73295
73296 const error = new ModuleDependencyError(module, e, d.loc);
73297 this.errors.push(error);
73298 }
73299 }
73300 }
73301
73302 this.reportDependencyErrorsAndWarnings(module, block.blocks);
73303 }
73304 }
73305
73306 /**
73307 * @param {TODO} groupOptions options for the chunk group
73308 * @param {Module} module the module the references the chunk group
73309 * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module)
73310 * @param {string} request the request from which the the chunk group is referenced
73311 * @returns {ChunkGroup} the new or existing chunk group
73312 */
73313 addChunkInGroup(groupOptions, module, loc, request) {
73314 if (typeof groupOptions === "string") {
73315 groupOptions = { name: groupOptions };
73316 }
73317 const name = groupOptions.name;
73318 if (name) {
73319 const chunkGroup = this.namedChunkGroups.get(name);
73320 if (chunkGroup !== undefined) {
73321 chunkGroup.addOptions(groupOptions);
73322 if (module) {
73323 chunkGroup.addOrigin(module, loc, request);
73324 }
73325 return chunkGroup;
73326 }
73327 }
73328 const chunkGroup = new ChunkGroup(groupOptions);
73329 if (module) chunkGroup.addOrigin(module, loc, request);
73330 const chunk = this.addChunk(name);
73331
73332 GraphHelpers.connectChunkGroupAndChunk(chunkGroup, chunk);
73333
73334 this.chunkGroups.push(chunkGroup);
73335 if (name) {
73336 this.namedChunkGroups.set(name, chunkGroup);
73337 }
73338 return chunkGroup;
73339 }
73340
73341 /**
73342 * This method first looks to see if a name is provided for a new chunk,
73343 * and first looks to see if any named chunks already exist and reuse that chunk instead.
73344 *
73345 * @param {string=} name optional chunk name to be provided
73346 * @returns {Chunk} create a chunk (invoked during seal event)
73347 */
73348 addChunk(name) {
73349 if (name) {
73350 const chunk = this.namedChunks.get(name);
73351 if (chunk !== undefined) {
73352 return chunk;
73353 }
73354 }
73355 const chunk = new Chunk(name);
73356 this.chunks.push(chunk);
73357 if (name) {
73358 this.namedChunks.set(name, chunk);
73359 }
73360 return chunk;
73361 }
73362
73363 /**
73364 * @param {Module} module module to assign depth
73365 * @returns {void}
73366 */
73367 assignDepth(module) {
73368 const queue = new Set([module]);
73369 let depth;
73370
73371 module.depth = 0;
73372
73373 /**
73374 * @param {Module} module module for processeing
73375 * @returns {void}
73376 */
73377 const enqueueJob = module => {
73378 const d = module.depth;
73379 if (typeof d === "number" && d <= depth) return;
73380 queue.add(module);
73381 module.depth = depth;
73382 };
73383
73384 /**
73385 * @param {Dependency} dependency dependency to assign depth to
73386 * @returns {void}
73387 */
73388 const assignDepthToDependency = dependency => {
73389 if (dependency.module) {
73390 enqueueJob(dependency.module);
73391 }
73392 };
73393
73394 /**
73395 * @param {DependenciesBlock} block block to assign depth to
73396 * @returns {void}
73397 */
73398 const assignDepthToDependencyBlock = block => {
73399 if (block.variables) {
73400 iterationBlockVariable(block.variables, assignDepthToDependency);
73401 }
73402
73403 if (block.dependencies) {
73404 iterationOfArrayCallback(block.dependencies, assignDepthToDependency);
73405 }
73406
73407 if (block.blocks) {
73408 iterationOfArrayCallback(block.blocks, assignDepthToDependencyBlock);
73409 }
73410 };
73411
73412 for (module of queue) {
73413 queue.delete(module);
73414 depth = module.depth;
73415
73416 depth++;
73417 assignDepthToDependencyBlock(module);
73418 }
73419 }
73420
73421 /**
73422 * @param {Module} module the module containing the dependency
73423 * @param {Dependency} dependency the dependency
73424 * @returns {DependencyReference} a reference for the dependency
73425 */
73426 getDependencyReference(module, dependency) {
73427 // TODO remove dep.getReference existence check in webpack 5
73428 if (typeof dependency.getReference !== "function") return null;
73429 const ref = dependency.getReference();
73430 if (!ref) return null;
73431 return this.hooks.dependencyReference.call(ref, dependency, module);
73432 }
73433
73434 /**
73435 *
73436 * @param {Module} module module relationship for removal
73437 * @param {DependenciesBlockLike} block //TODO: good description
73438 * @returns {void}
73439 */
73440 removeReasonsOfDependencyBlock(module, block) {
73441 const iteratorDependency = d => {
73442 if (!d.module) {
73443 return;
73444 }
73445 if (d.module.removeReason(module, d)) {
73446 for (const chunk of d.module.chunksIterable) {
73447 this.patchChunksAfterReasonRemoval(d.module, chunk);
73448 }
73449 }
73450 };
73451
73452 if (block.blocks) {
73453 iterationOfArrayCallback(block.blocks, block =>
73454 this.removeReasonsOfDependencyBlock(module, block)
73455 );
73456 }
73457
73458 if (block.dependencies) {
73459 iterationOfArrayCallback(block.dependencies, iteratorDependency);
73460 }
73461
73462 if (block.variables) {
73463 iterationBlockVariable(block.variables, iteratorDependency);
73464 }
73465 }
73466
73467 /**
73468 * @param {Module} module module to patch tie
73469 * @param {Chunk} chunk chunk to patch tie
73470 * @returns {void}
73471 */
73472 patchChunksAfterReasonRemoval(module, chunk) {
73473 if (!module.hasReasons()) {
73474 this.removeReasonsOfDependencyBlock(module, module);
73475 }
73476 if (!module.hasReasonForChunk(chunk)) {
73477 if (module.removeChunk(chunk)) {
73478 this.removeChunkFromDependencies(module, chunk);
73479 }
73480 }
73481 }
73482
73483 /**
73484 *
73485 * @param {DependenciesBlock} block block tie for Chunk
73486 * @param {Chunk} chunk chunk to remove from dep
73487 * @returns {void}
73488 */
73489 removeChunkFromDependencies(block, chunk) {
73490 const iteratorDependency = d => {
73491 if (!d.module) {
73492 return;
73493 }
73494 this.patchChunksAfterReasonRemoval(d.module, chunk);
73495 };
73496
73497 const blocks = block.blocks;
73498 for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) {
73499 const asyncBlock = blocks[indexBlock];
73500 // Grab all chunks from the first Block's AsyncDepBlock
73501 const chunks = asyncBlock.chunkGroup.chunks;
73502 // For each chunk in chunkGroup
73503 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
73504 const iteratedChunk = chunks[indexChunk];
73505 asyncBlock.chunkGroup.removeChunk(iteratedChunk);
73506 asyncBlock.chunkGroup.removeParent(iteratedChunk);
73507 // Recurse
73508 this.removeChunkFromDependencies(block, iteratedChunk);
73509 }
73510 }
73511
73512 if (block.dependencies) {
73513 iterationOfArrayCallback(block.dependencies, iteratorDependency);
73514 }
73515
73516 if (block.variables) {
73517 iterationBlockVariable(block.variables, iteratorDependency);
73518 }
73519 }
73520
73521 applyModuleIds() {
73522 const unusedIds = [];
73523 let nextFreeModuleId = 0;
73524 const usedIds = new Set();
73525 if (this.usedModuleIds) {
73526 for (const id of this.usedModuleIds) {
73527 usedIds.add(id);
73528 }
73529 }
73530
73531 const modules1 = this.modules;
73532 for (let indexModule1 = 0; indexModule1 < modules1.length; indexModule1++) {
73533 const module1 = modules1[indexModule1];
73534 if (module1.id !== null) {
73535 usedIds.add(module1.id);
73536 }
73537 }
73538
73539 if (usedIds.size > 0) {
73540 let usedIdMax = -1;
73541 for (const usedIdKey of usedIds) {
73542 if (typeof usedIdKey !== "number") {
73543 continue;
73544 }
73545
73546 usedIdMax = Math.max(usedIdMax, usedIdKey);
73547 }
73548
73549 let lengthFreeModules = (nextFreeModuleId = usedIdMax + 1);
73550
73551 while (lengthFreeModules--) {
73552 if (!usedIds.has(lengthFreeModules)) {
73553 unusedIds.push(lengthFreeModules);
73554 }
73555 }
73556 }
73557
73558 const modules2 = this.modules;
73559 for (let indexModule2 = 0; indexModule2 < modules2.length; indexModule2++) {
73560 const module2 = modules2[indexModule2];
73561 if (module2.id === null) {
73562 if (unusedIds.length > 0) {
73563 module2.id = unusedIds.pop();
73564 } else {
73565 module2.id = nextFreeModuleId++;
73566 }
73567 }
73568 }
73569 }
73570
73571 applyChunkIds() {
73572 /** @type {Set<number>} */
73573 const usedIds = new Set();
73574
73575 // Get used ids from usedChunkIds property (i. e. from records)
73576 if (this.usedChunkIds) {
73577 for (const id of this.usedChunkIds) {
73578 if (typeof id !== "number") {
73579 continue;
73580 }
73581
73582 usedIds.add(id);
73583 }
73584 }
73585
73586 // Get used ids from existing chunks
73587 const chunks = this.chunks;
73588 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
73589 const chunk = chunks[indexChunk];
73590 const usedIdValue = chunk.id;
73591
73592 if (typeof usedIdValue !== "number") {
73593 continue;
73594 }
73595
73596 usedIds.add(usedIdValue);
73597 }
73598
73599 // Calculate maximum assigned chunk id
73600 let nextFreeChunkId = -1;
73601 for (const id of usedIds) {
73602 nextFreeChunkId = Math.max(nextFreeChunkId, id);
73603 }
73604 nextFreeChunkId++;
73605
73606 // Determine free chunk ids from 0 to maximum
73607 /** @type {number[]} */
73608 const unusedIds = [];
73609 if (nextFreeChunkId > 0) {
73610 let index = nextFreeChunkId;
73611 while (index--) {
73612 if (!usedIds.has(index)) {
73613 unusedIds.push(index);
73614 }
73615 }
73616 }
73617
73618 // Assign ids to chunk which has no id
73619 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
73620 const chunk = chunks[indexChunk];
73621 if (chunk.id === null) {
73622 if (unusedIds.length > 0) {
73623 chunk.id = unusedIds.pop();
73624 } else {
73625 chunk.id = nextFreeChunkId++;
73626 }
73627 }
73628 if (!chunk.ids) {
73629 chunk.ids = [chunk.id];
73630 }
73631 }
73632 }
73633
73634 sortItemsWithModuleIds() {
73635 this.modules.sort(byIdOrIdentifier);
73636
73637 const modules = this.modules;
73638 for (let indexModule = 0; indexModule < modules.length; indexModule++) {
73639 modules[indexModule].sortItems(false);
73640 }
73641
73642 const chunks = this.chunks;
73643 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
73644 chunks[indexChunk].sortItems();
73645 }
73646
73647 chunks.sort((a, b) => a.compareTo(b));
73648 }
73649
73650 sortItemsWithChunkIds() {
73651 for (const chunkGroup of this.chunkGroups) {
73652 chunkGroup.sortItems();
73653 }
73654
73655 this.chunks.sort(byId);
73656
73657 for (
73658 let indexModule = 0;
73659 indexModule < this.modules.length;
73660 indexModule++
73661 ) {
73662 this.modules[indexModule].sortItems(true);
73663 }
73664
73665 const chunks = this.chunks;
73666 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
73667 chunks[indexChunk].sortItems();
73668 }
73669
73670 /**
73671 * Used to sort errors and warnings in compilation. this.warnings, and
73672 * this.errors contribute to the compilation hash and therefore should be
73673 * updated whenever other references (having a chunk id) are sorted. This preserves the hash
73674 * integrity
73675 *
73676 * @param {WebpackError} a first WebpackError instance (including subclasses)
73677 * @param {WebpackError} b second WebpackError instance (including subclasses)
73678 * @returns {-1|0|1} sort order index
73679 */
73680 const byMessage = (a, b) => {
73681 const ma = `${a.message}`;
73682 const mb = `${b.message}`;
73683 if (ma < mb) return -1;
73684 if (mb < ma) return 1;
73685 return 0;
73686 };
73687
73688 this.errors.sort(byMessage);
73689 this.warnings.sort(byMessage);
73690 this.children.sort(byNameOrHash);
73691 }
73692
73693 summarizeDependencies() {
73694 this.fileDependencies = new SortableSet(this.compilationDependencies);
73695 this.contextDependencies = new SortableSet();
73696 this.missingDependencies = new SortableSet();
73697
73698 for (
73699 let indexChildren = 0;
73700 indexChildren < this.children.length;
73701 indexChildren++
73702 ) {
73703 const child = this.children[indexChildren];
73704
73705 addAllToSet(this.fileDependencies, child.fileDependencies);
73706 addAllToSet(this.contextDependencies, child.contextDependencies);
73707 addAllToSet(this.missingDependencies, child.missingDependencies);
73708 }
73709
73710 for (
73711 let indexModule = 0;
73712 indexModule < this.modules.length;
73713 indexModule++
73714 ) {
73715 const module = this.modules[indexModule];
73716
73717 if (module.buildInfo.fileDependencies) {
73718 addAllToSet(this.fileDependencies, module.buildInfo.fileDependencies);
73719 }
73720 if (module.buildInfo.contextDependencies) {
73721 addAllToSet(
73722 this.contextDependencies,
73723 module.buildInfo.contextDependencies
73724 );
73725 }
73726 }
73727 for (const error of this.errors) {
73728 if (
73729 typeof error.missing === "object" &&
73730 error.missing &&
73731 error.missing[Symbol.iterator]
73732 ) {
73733 addAllToSet(this.missingDependencies, error.missing);
73734 }
73735 }
73736 this.fileDependencies.sort();
73737 this.contextDependencies.sort();
73738 this.missingDependencies.sort();
73739 }
73740
73741 createHash() {
73742 const outputOptions = this.outputOptions;
73743 const hashFunction = outputOptions.hashFunction;
73744 const hashDigest = outputOptions.hashDigest;
73745 const hashDigestLength = outputOptions.hashDigestLength;
73746 const hash = createHash(hashFunction);
73747 if (outputOptions.hashSalt) {
73748 hash.update(outputOptions.hashSalt);
73749 }
73750 this.mainTemplate.updateHash(hash);
73751 this.chunkTemplate.updateHash(hash);
73752 for (const key of Object.keys(this.moduleTemplates).sort()) {
73753 this.moduleTemplates[key].updateHash(hash);
73754 }
73755 for (const child of this.children) {
73756 hash.update(child.hash);
73757 }
73758 for (const warning of this.warnings) {
73759 hash.update(`${warning.message}`);
73760 }
73761 for (const error of this.errors) {
73762 hash.update(`${error.message}`);
73763 }
73764 const modules = this.modules;
73765 for (let i = 0; i < modules.length; i++) {
73766 const module = modules[i];
73767 const moduleHash = createHash(hashFunction);
73768 module.updateHash(moduleHash);
73769 module.hash = /** @type {string} */ (moduleHash.digest(hashDigest));
73770 module.renderedHash = module.hash.substr(0, hashDigestLength);
73771 }
73772 // clone needed as sort below is inplace mutation
73773 const chunks = this.chunks.slice();
73774 /**
73775 * sort here will bring all "falsy" values to the beginning
73776 * this is needed as the "hasRuntime()" chunks are dependent on the
73777 * hashes of the non-runtime chunks.
73778 */
73779 chunks.sort((a, b) => {
73780 const aEntry = a.hasRuntime();
73781 const bEntry = b.hasRuntime();
73782 if (aEntry && !bEntry) return 1;
73783 if (!aEntry && bEntry) return -1;
73784 return byId(a, b);
73785 });
73786 for (let i = 0; i < chunks.length; i++) {
73787 const chunk = chunks[i];
73788 const chunkHash = createHash(hashFunction);
73789 try {
73790 if (outputOptions.hashSalt) {
73791 chunkHash.update(outputOptions.hashSalt);
73792 }
73793 chunk.updateHash(chunkHash);
73794 const template = chunk.hasRuntime()
73795 ? this.mainTemplate
73796 : this.chunkTemplate;
73797 template.updateHashForChunk(
73798 chunkHash,
73799 chunk,
73800 this.moduleTemplates.javascript,
73801 this.dependencyTemplates
73802 );
73803 this.hooks.chunkHash.call(chunk, chunkHash);
73804 chunk.hash = /** @type {string} */ (chunkHash.digest(hashDigest));
73805 hash.update(chunk.hash);
73806 chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
73807 this.hooks.contentHash.call(chunk);
73808 } catch (err) {
73809 this.errors.push(new ChunkRenderError(chunk, "", err));
73810 }
73811 }
73812 this.fullHash = /** @type {string} */ (hash.digest(hashDigest));
73813 this.hash = this.fullHash.substr(0, hashDigestLength);
73814 }
73815
73816 /**
73817 * @param {string} update extra information
73818 * @returns {void}
73819 */
73820 modifyHash(update) {
73821 const outputOptions = this.outputOptions;
73822 const hashFunction = outputOptions.hashFunction;
73823 const hashDigest = outputOptions.hashDigest;
73824 const hashDigestLength = outputOptions.hashDigestLength;
73825 const hash = createHash(hashFunction);
73826 hash.update(this.fullHash);
73827 hash.update(update);
73828 this.fullHash = /** @type {string} */ (hash.digest(hashDigest));
73829 this.hash = this.fullHash.substr(0, hashDigestLength);
73830 }
73831
73832 /**
73833 * @param {string} file file name
73834 * @param {Source} source asset source
73835 * @param {AssetInfo} assetInfo extra asset information
73836 * @returns {void}
73837 */
73838 emitAsset(file, source, assetInfo = {}) {
73839 if (this.assets[file]) {
73840 if (!isSourceEqual(this.assets[file], source)) {
73841 // TODO webpack 5: make this an error instead
73842 this.warnings.push(
73843 new WebpackError(
73844 `Conflict: Multiple assets emit different content to the same filename ${file}`
73845 )
73846 );
73847 this.assets[file] = source;
73848 this.assetsInfo.set(file, assetInfo);
73849 return;
73850 }
73851 const oldInfo = this.assetsInfo.get(file);
73852 this.assetsInfo.set(file, Object.assign({}, oldInfo, assetInfo));
73853 return;
73854 }
73855 this.assets[file] = source;
73856 this.assetsInfo.set(file, assetInfo);
73857 }
73858
73859 /**
73860 * @param {string} file file name
73861 * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
73862 * @param {AssetInfo | function(AssetInfo | undefined): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
73863 */
73864 updateAsset(
73865 file,
73866 newSourceOrFunction,
73867 assetInfoUpdateOrFunction = undefined
73868 ) {
73869 if (!this.assets[file]) {
73870 throw new Error(
73871 `Called Compilation.updateAsset for not existing filename ${file}`
73872 );
73873 }
73874 if (typeof newSourceOrFunction === "function") {
73875 this.assets[file] = newSourceOrFunction(this.assets[file]);
73876 } else {
73877 this.assets[file] = newSourceOrFunction;
73878 }
73879 if (assetInfoUpdateOrFunction !== undefined) {
73880 const oldInfo = this.assetsInfo.get(file);
73881 if (typeof assetInfoUpdateOrFunction === "function") {
73882 this.assetsInfo.set(file, assetInfoUpdateOrFunction(oldInfo || {}));
73883 } else {
73884 this.assetsInfo.set(
73885 file,
73886 Object.assign({}, oldInfo, assetInfoUpdateOrFunction)
73887 );
73888 }
73889 }
73890 }
73891
73892 getAssets() {
73893 /** @type {Asset[]} */
73894 const array = [];
73895 for (const assetName of Object.keys(this.assets)) {
73896 if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) {
73897 array.push({
73898 name: assetName,
73899 source: this.assets[assetName],
73900 info: this.assetsInfo.get(assetName) || {}
73901 });
73902 }
73903 }
73904 return array;
73905 }
73906
73907 /**
73908 * @param {string} name the name of the asset
73909 * @returns {Asset | undefined} the asset or undefined when not found
73910 */
73911 getAsset(name) {
73912 if (!Object.prototype.hasOwnProperty.call(this.assets, name))
73913 return undefined;
73914 return {
73915 name,
73916 source: this.assets[name],
73917 info: this.assetsInfo.get(name) || {}
73918 };
73919 }
73920
73921 createModuleAssets() {
73922 for (let i = 0; i < this.modules.length; i++) {
73923 const module = this.modules[i];
73924 if (module.buildInfo.assets) {
73925 const assetsInfo = module.buildInfo.assetsInfo;
73926 for (const assetName of Object.keys(module.buildInfo.assets)) {
73927 const fileName = this.getPath(assetName);
73928 this.emitAsset(
73929 fileName,
73930 module.buildInfo.assets[assetName],
73931 assetsInfo ? assetsInfo.get(assetName) : undefined
73932 );
73933 this.hooks.moduleAsset.call(module, fileName);
73934 }
73935 }
73936 }
73937 }
73938
73939 createChunkAssets() {
73940 const outputOptions = this.outputOptions;
73941 const cachedSourceMap = new Map();
73942 /** @type {Map<string, {hash: string, source: Source, chunk: Chunk}>} */
73943 const alreadyWrittenFiles = new Map();
73944 for (let i = 0; i < this.chunks.length; i++) {
73945 const chunk = this.chunks[i];
73946 chunk.files = [];
73947 let source;
73948 let file;
73949 let filenameTemplate;
73950 try {
73951 const template = chunk.hasRuntime()
73952 ? this.mainTemplate
73953 : this.chunkTemplate;
73954 const manifest = template.getRenderManifest({
73955 chunk,
73956 hash: this.hash,
73957 fullHash: this.fullHash,
73958 outputOptions,
73959 moduleTemplates: this.moduleTemplates,
73960 dependencyTemplates: this.dependencyTemplates
73961 }); // [{ render(), filenameTemplate, pathOptions, identifier, hash }]
73962 for (const fileManifest of manifest) {
73963 const cacheName = fileManifest.identifier;
73964 const usedHash = fileManifest.hash;
73965 filenameTemplate = fileManifest.filenameTemplate;
73966 const pathAndInfo = this.getPathWithInfo(
73967 filenameTemplate,
73968 fileManifest.pathOptions
73969 );
73970 file = pathAndInfo.path;
73971 const assetInfo = pathAndInfo.info;
73972
73973 // check if the same filename was already written by another chunk
73974 const alreadyWritten = alreadyWrittenFiles.get(file);
73975 if (alreadyWritten !== undefined) {
73976 if (alreadyWritten.hash === usedHash) {
73977 if (this.cache) {
73978 this.cache[cacheName] = {
73979 hash: usedHash,
73980 source: alreadyWritten.source
73981 };
73982 }
73983 chunk.files.push(file);
73984 this.hooks.chunkAsset.call(chunk, file);
73985 continue;
73986 } else {
73987 throw new Error(
73988 `Conflict: Multiple chunks emit assets to the same filename ${file}` +
73989 ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})`
73990 );
73991 }
73992 }
73993 if (
73994 this.cache &&
73995 this.cache[cacheName] &&
73996 this.cache[cacheName].hash === usedHash
73997 ) {
73998 source = this.cache[cacheName].source;
73999 } else {
74000 source = fileManifest.render();
74001 // Ensure that source is a cached source to avoid additional cost because of repeated access
74002 if (!(source instanceof CachedSource)) {
74003 const cacheEntry = cachedSourceMap.get(source);
74004 if (cacheEntry) {
74005 source = cacheEntry;
74006 } else {
74007 const cachedSource = new CachedSource(source);
74008 cachedSourceMap.set(source, cachedSource);
74009 source = cachedSource;
74010 }
74011 }
74012 if (this.cache) {
74013 this.cache[cacheName] = {
74014 hash: usedHash,
74015 source
74016 };
74017 }
74018 }
74019 this.emitAsset(file, source, assetInfo);
74020 chunk.files.push(file);
74021 this.hooks.chunkAsset.call(chunk, file);
74022 alreadyWrittenFiles.set(file, {
74023 hash: usedHash,
74024 source,
74025 chunk
74026 });
74027 }
74028 } catch (err) {
74029 this.errors.push(
74030 new ChunkRenderError(chunk, file || filenameTemplate, err)
74031 );
74032 }
74033 }
74034 }
74035
74036 /**
74037 * @param {string} filename used to get asset path with hash
74038 * @param {TODO=} data // TODO: figure out this param type
74039 * @returns {string} interpolated path
74040 */
74041 getPath(filename, data) {
74042 data = data || {};
74043 data.hash = data.hash || this.hash;
74044 return this.mainTemplate.getAssetPath(filename, data);
74045 }
74046
74047 /**
74048 * @param {string} filename used to get asset path with hash
74049 * @param {TODO=} data // TODO: figure out this param type
74050 * @returns {{ path: string, info: AssetInfo }} interpolated path and asset info
74051 */
74052 getPathWithInfo(filename, data) {
74053 data = data || {};
74054 data.hash = data.hash || this.hash;
74055 return this.mainTemplate.getAssetPathWithInfo(filename, data);
74056 }
74057
74058 /**
74059 * This function allows you to run another instance of webpack inside of webpack however as
74060 * a child with different settings and configurations (if desired) applied. It copies all hooks, plugins
74061 * from parent (or top level compiler) and creates a child Compilation
74062 *
74063 * @param {string} name name of the child compiler
74064 * @param {TODO} outputOptions // Need to convert config schema to types for this
74065 * @param {Plugin[]} plugins webpack plugins that will be applied
74066 * @returns {Compiler} creates a child Compiler instance
74067 */
74068 createChildCompiler(name, outputOptions, plugins) {
74069 const idx = this.childrenCounters[name] || 0;
74070 this.childrenCounters[name] = idx + 1;
74071 return this.compiler.createChildCompiler(
74072 this,
74073 name,
74074 idx,
74075 outputOptions,
74076 plugins
74077 );
74078 }
74079
74080 checkConstraints() {
74081 /** @type {Set<number|string>} */
74082 const usedIds = new Set();
74083
74084 const modules = this.modules;
74085 for (let indexModule = 0; indexModule < modules.length; indexModule++) {
74086 const moduleId = modules[indexModule].id;
74087 if (moduleId === null) continue;
74088 if (usedIds.has(moduleId)) {
74089 throw new Error(`checkConstraints: duplicate module id ${moduleId}`);
74090 }
74091 usedIds.add(moduleId);
74092 }
74093
74094 const chunks = this.chunks;
74095 for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
74096 const chunk = chunks[indexChunk];
74097 if (chunks.indexOf(chunk) !== indexChunk) {
74098 throw new Error(
74099 `checkConstraints: duplicate chunk in compilation ${chunk.debugId}`
74100 );
74101 }
74102 }
74103
74104 for (const chunkGroup of this.chunkGroups) {
74105 chunkGroup.checkConstraints();
74106 }
74107 }
74108}
74109
74110// TODO remove in webpack 5
74111Compilation.prototype.applyPlugins = util.deprecate(
74112 /**
74113 * @deprecated
74114 * @param {string} name Name
74115 * @param {any[]} args Other arguments
74116 * @returns {void}
74117 * @this {Compilation}
74118 */
74119 function(name, ...args) {
74120 this.hooks[
74121 name.replace(/[- ]([a-z])/g, match => match[1].toUpperCase())
74122 ].call(...args);
74123 },
74124 "Compilation.applyPlugins is deprecated. Use new API on `.hooks` instead"
74125);
74126
74127// TODO remove in webpack 5
74128Object.defineProperty(Compilation.prototype, "moduleTemplate", {
74129 configurable: false,
74130 get: util.deprecate(
74131 /**
74132 * @deprecated
74133 * @this {Compilation}
74134 * @returns {TODO} module template
74135 */
74136 function() {
74137 return this.moduleTemplates.javascript;
74138 },
74139 "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead"
74140 ),
74141 set: util.deprecate(
74142 /**
74143 * @deprecated
74144 * @param {ModuleTemplate} value Template value
74145 * @this {Compilation}
74146 * @returns {void}
74147 */
74148 function(value) {
74149 this.moduleTemplates.javascript = value;
74150 },
74151 "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead."
74152 )
74153});
74154
74155module.exports = Compilation;
74156
74157
74158/***/ }),
74159
74160/***/ 58705:
74161/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
74162
74163"use strict";
74164/*
74165 MIT License http://www.opensource.org/licenses/mit-license.php
74166 Author Tobias Koppers @sokra
74167*/
74168
74169
74170const parseJson = __webpack_require__(48335);
74171const asyncLib = __webpack_require__(36386);
74172const path = __webpack_require__(85622);
74173const { Source } = __webpack_require__(53665);
74174const util = __webpack_require__(31669);
74175const {
74176 Tapable,
74177 SyncHook,
74178 SyncBailHook,
74179 AsyncParallelHook,
74180 AsyncSeriesHook
74181} = __webpack_require__(56758);
74182
74183const Compilation = __webpack_require__(34968);
74184const Stats = __webpack_require__(99977);
74185const Watching = __webpack_require__(29580);
74186const NormalModuleFactory = __webpack_require__(22298);
74187const ContextModuleFactory = __webpack_require__(88239);
74188const ResolverFactory = __webpack_require__(50588);
74189
74190const RequestShortener = __webpack_require__(54254);
74191const { makePathsRelative } = __webpack_require__(94658);
74192const ConcurrentCompilationError = __webpack_require__(18933);
74193const { Logger } = __webpack_require__(47194);
74194
74195/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */
74196/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
74197
74198/**
74199 * @typedef {Object} CompilationParams
74200 * @property {NormalModuleFactory} normalModuleFactory
74201 * @property {ContextModuleFactory} contextModuleFactory
74202 * @property {Set<string>} compilationDependencies
74203 */
74204
74205class Compiler extends Tapable {
74206 constructor(context) {
74207 super();
74208 this.hooks = {
74209 /** @type {SyncBailHook<Compilation>} */
74210 shouldEmit: new SyncBailHook(["compilation"]),
74211 /** @type {AsyncSeriesHook<Stats>} */
74212 done: new AsyncSeriesHook(["stats"]),
74213 /** @type {AsyncSeriesHook<>} */
74214 additionalPass: new AsyncSeriesHook([]),
74215 /** @type {AsyncSeriesHook<Compiler>} */
74216 beforeRun: new AsyncSeriesHook(["compiler"]),
74217 /** @type {AsyncSeriesHook<Compiler>} */
74218 run: new AsyncSeriesHook(["compiler"]),
74219 /** @type {AsyncSeriesHook<Compilation>} */
74220 emit: new AsyncSeriesHook(["compilation"]),
74221 /** @type {AsyncSeriesHook<string, Buffer>} */
74222 assetEmitted: new AsyncSeriesHook(["file", "content"]),
74223 /** @type {AsyncSeriesHook<Compilation>} */
74224 afterEmit: new AsyncSeriesHook(["compilation"]),
74225
74226 /** @type {SyncHook<Compilation, CompilationParams>} */
74227 thisCompilation: new SyncHook(["compilation", "params"]),
74228 /** @type {SyncHook<Compilation, CompilationParams>} */
74229 compilation: new SyncHook(["compilation", "params"]),
74230 /** @type {SyncHook<NormalModuleFactory>} */
74231 normalModuleFactory: new SyncHook(["normalModuleFactory"]),
74232 /** @type {SyncHook<ContextModuleFactory>} */
74233 contextModuleFactory: new SyncHook(["contextModulefactory"]),
74234
74235 /** @type {AsyncSeriesHook<CompilationParams>} */
74236 beforeCompile: new AsyncSeriesHook(["params"]),
74237 /** @type {SyncHook<CompilationParams>} */
74238 compile: new SyncHook(["params"]),
74239 /** @type {AsyncParallelHook<Compilation>} */
74240 make: new AsyncParallelHook(["compilation"]),
74241 /** @type {AsyncSeriesHook<Compilation>} */
74242 afterCompile: new AsyncSeriesHook(["compilation"]),
74243
74244 /** @type {AsyncSeriesHook<Compiler>} */
74245 watchRun: new AsyncSeriesHook(["compiler"]),
74246 /** @type {SyncHook<Error>} */
74247 failed: new SyncHook(["error"]),
74248 /** @type {SyncHook<string, string>} */
74249 invalid: new SyncHook(["filename", "changeTime"]),
74250 /** @type {SyncHook} */
74251 watchClose: new SyncHook([]),
74252
74253 /** @type {SyncBailHook<string, string, any[]>} */
74254 infrastructureLog: new SyncBailHook(["origin", "type", "args"]),
74255
74256 // TODO the following hooks are weirdly located here
74257 // TODO move them for webpack 5
74258 /** @type {SyncHook} */
74259 environment: new SyncHook([]),
74260 /** @type {SyncHook} */
74261 afterEnvironment: new SyncHook([]),
74262 /** @type {SyncHook<Compiler>} */
74263 afterPlugins: new SyncHook(["compiler"]),
74264 /** @type {SyncHook<Compiler>} */
74265 afterResolvers: new SyncHook(["compiler"]),
74266 /** @type {SyncBailHook<string, Entry>} */
74267 entryOption: new SyncBailHook(["context", "entry"])
74268 };
74269 // TODO webpack 5 remove this
74270 this.hooks.infrastructurelog = this.hooks.infrastructureLog;
74271
74272 this._pluginCompat.tap("Compiler", options => {
74273 switch (options.name) {
74274 case "additional-pass":
74275 case "before-run":
74276 case "run":
74277 case "emit":
74278 case "after-emit":
74279 case "before-compile":
74280 case "make":
74281 case "after-compile":
74282 case "watch-run":
74283 options.async = true;
74284 break;
74285 }
74286 });
74287
74288 /** @type {string=} */
74289 this.name = undefined;
74290 /** @type {Compilation=} */
74291 this.parentCompilation = undefined;
74292 /** @type {string} */
74293 this.outputPath = "";
74294
74295 this.outputFileSystem = null;
74296 this.inputFileSystem = null;
74297
74298 /** @type {string|null} */
74299 this.recordsInputPath = null;
74300 /** @type {string|null} */
74301 this.recordsOutputPath = null;
74302 this.records = {};
74303 this.removedFiles = new Set();
74304 /** @type {Map<string, number>} */
74305 this.fileTimestamps = new Map();
74306 /** @type {Map<string, number>} */
74307 this.contextTimestamps = new Map();
74308 /** @type {ResolverFactory} */
74309 this.resolverFactory = new ResolverFactory();
74310
74311 this.infrastructureLogger = undefined;
74312
74313 // TODO remove in webpack 5
74314 this.resolvers = {
74315 normal: {
74316 plugins: util.deprecate((hook, fn) => {
74317 this.resolverFactory.plugin("resolver normal", resolver => {
74318 resolver.plugin(hook, fn);
74319 });
74320 }, "webpack: Using compiler.resolvers.normal is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver normal", resolver => {\n resolver.plugin(/* … */);\n}); instead.'),
74321 apply: util.deprecate((...args) => {
74322 this.resolverFactory.plugin("resolver normal", resolver => {
74323 resolver.apply(...args);
74324 });
74325 }, "webpack: Using compiler.resolvers.normal is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver normal", resolver => {\n resolver.apply(/* … */);\n}); instead.')
74326 },
74327 loader: {
74328 plugins: util.deprecate((hook, fn) => {
74329 this.resolverFactory.plugin("resolver loader", resolver => {
74330 resolver.plugin(hook, fn);
74331 });
74332 }, "webpack: Using compiler.resolvers.loader is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver loader", resolver => {\n resolver.plugin(/* … */);\n}); instead.'),
74333 apply: util.deprecate((...args) => {
74334 this.resolverFactory.plugin("resolver loader", resolver => {
74335 resolver.apply(...args);
74336 });
74337 }, "webpack: Using compiler.resolvers.loader is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver loader", resolver => {\n resolver.apply(/* … */);\n}); instead.')
74338 },
74339 context: {
74340 plugins: util.deprecate((hook, fn) => {
74341 this.resolverFactory.plugin("resolver context", resolver => {
74342 resolver.plugin(hook, fn);
74343 });
74344 }, "webpack: Using compiler.resolvers.context is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver context", resolver => {\n resolver.plugin(/* … */);\n}); instead.'),
74345 apply: util.deprecate((...args) => {
74346 this.resolverFactory.plugin("resolver context", resolver => {
74347 resolver.apply(...args);
74348 });
74349 }, "webpack: Using compiler.resolvers.context is deprecated.\n" + 'Use compiler.resolverFactory.plugin("resolver context", resolver => {\n resolver.apply(/* … */);\n}); instead.')
74350 }
74351 };
74352
74353 /** @type {WebpackOptions} */
74354 this.options = /** @type {WebpackOptions} */ ({});
74355
74356 this.context = context;
74357
74358 this.requestShortener = new RequestShortener(context);
74359
74360 /** @type {boolean} */
74361 this.running = false;
74362
74363 /** @type {boolean} */
74364 this.watchMode = false;
74365
74366 /** @private @type {WeakMap<Source, { sizeOnlySource: SizeOnlySource, writtenTo: Map<string, number> }>} */
74367 this._assetEmittingSourceCache = new WeakMap();
74368 /** @private @type {Map<string, number>} */
74369 this._assetEmittingWrittenFiles = new Map();
74370 }
74371
74372 /**
74373 * @param {string | (function(): string)} name name of the logger, or function called once to get the logger name
74374 * @returns {Logger} a logger with that name
74375 */
74376 getInfrastructureLogger(name) {
74377 if (!name) {
74378 throw new TypeError(
74379 "Compiler.getInfrastructureLogger(name) called without a name"
74380 );
74381 }
74382 return new Logger((type, args) => {
74383 if (typeof name === "function") {
74384 name = name();
74385 if (!name) {
74386 throw new TypeError(
74387 "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
74388 );
74389 }
74390 }
74391 if (this.hooks.infrastructureLog.call(name, type, args) === undefined) {
74392 if (this.infrastructureLogger !== undefined) {
74393 this.infrastructureLogger(name, type, args);
74394 }
74395 }
74396 });
74397 }
74398
74399 watch(watchOptions, handler) {
74400 if (this.running) return handler(new ConcurrentCompilationError());
74401
74402 this.running = true;
74403 this.watchMode = true;
74404 this.fileTimestamps = new Map();
74405 this.contextTimestamps = new Map();
74406 this.removedFiles = new Set();
74407 return new Watching(this, watchOptions, handler);
74408 }
74409
74410 run(callback) {
74411 if (this.running) return callback(new ConcurrentCompilationError());
74412
74413 const finalCallback = (err, stats) => {
74414 this.running = false;
74415
74416 if (err) {
74417 this.hooks.failed.call(err);
74418 }
74419
74420 if (callback !== undefined) return callback(err, stats);
74421 };
74422
74423 const startTime = Date.now();
74424
74425 this.running = true;
74426
74427 const onCompiled = (err, compilation) => {
74428 if (err) return finalCallback(err);
74429
74430 if (this.hooks.shouldEmit.call(compilation) === false) {
74431 const stats = new Stats(compilation);
74432 stats.startTime = startTime;
74433 stats.endTime = Date.now();
74434 this.hooks.done.callAsync(stats, err => {
74435 if (err) return finalCallback(err);
74436 return finalCallback(null, stats);
74437 });
74438 return;
74439 }
74440
74441 this.emitAssets(compilation, err => {
74442 if (err) return finalCallback(err);
74443
74444 if (compilation.hooks.needAdditionalPass.call()) {
74445 compilation.needAdditionalPass = true;
74446
74447 const stats = new Stats(compilation);
74448 stats.startTime = startTime;
74449 stats.endTime = Date.now();
74450 this.hooks.done.callAsync(stats, err => {
74451 if (err) return finalCallback(err);
74452
74453 this.hooks.additionalPass.callAsync(err => {
74454 if (err) return finalCallback(err);
74455 this.compile(onCompiled);
74456 });
74457 });
74458 return;
74459 }
74460
74461 this.emitRecords(err => {
74462 if (err) return finalCallback(err);
74463
74464 const stats = new Stats(compilation);
74465 stats.startTime = startTime;
74466 stats.endTime = Date.now();
74467 this.hooks.done.callAsync(stats, err => {
74468 if (err) return finalCallback(err);
74469 return finalCallback(null, stats);
74470 });
74471 });
74472 });
74473 };
74474
74475 this.hooks.beforeRun.callAsync(this, err => {
74476 if (err) return finalCallback(err);
74477
74478 this.hooks.run.callAsync(this, err => {
74479 if (err) return finalCallback(err);
74480
74481 this.readRecords(err => {
74482 if (err) return finalCallback(err);
74483
74484 this.compile(onCompiled);
74485 });
74486 });
74487 });
74488 }
74489
74490 runAsChild(callback) {
74491 this.compile((err, compilation) => {
74492 if (err) return callback(err);
74493
74494 this.parentCompilation.children.push(compilation);
74495 for (const { name, source, info } of compilation.getAssets()) {
74496 this.parentCompilation.emitAsset(name, source, info);
74497 }
74498
74499 const entries = Array.from(
74500 compilation.entrypoints.values(),
74501 ep => ep.chunks
74502 ).reduce((array, chunks) => {
74503 return array.concat(chunks);
74504 }, []);
74505
74506 return callback(null, entries, compilation);
74507 });
74508 }
74509
74510 purgeInputFileSystem() {
74511 if (this.inputFileSystem && this.inputFileSystem.purge) {
74512 this.inputFileSystem.purge();
74513 }
74514 }
74515
74516 emitAssets(compilation, callback) {
74517 let outputPath;
74518 const emitFiles = err => {
74519 if (err) return callback(err);
74520
74521 asyncLib.forEachLimit(
74522 compilation.getAssets(),
74523 15,
74524 ({ name: file, source }, callback) => {
74525 let targetFile = file;
74526 const queryStringIdx = targetFile.indexOf("?");
74527 if (queryStringIdx >= 0) {
74528 targetFile = targetFile.substr(0, queryStringIdx);
74529 }
74530
74531 const writeOut = err => {
74532 if (err) return callback(err);
74533 const targetPath = this.outputFileSystem.join(
74534 outputPath,
74535 targetFile
74536 );
74537 // TODO webpack 5 remove futureEmitAssets option and make it on by default
74538 if (this.options.output.futureEmitAssets) {
74539 // check if the target file has already been written by this Compiler
74540 const targetFileGeneration = this._assetEmittingWrittenFiles.get(
74541 targetPath
74542 );
74543
74544 // create an cache entry for this Source if not already existing
74545 let cacheEntry = this._assetEmittingSourceCache.get(source);
74546 if (cacheEntry === undefined) {
74547 cacheEntry = {
74548 sizeOnlySource: undefined,
74549 writtenTo: new Map()
74550 };
74551 this._assetEmittingSourceCache.set(source, cacheEntry);
74552 }
74553
74554 // if the target file has already been written
74555 if (targetFileGeneration !== undefined) {
74556 // check if the Source has been written to this target file
74557 const writtenGeneration = cacheEntry.writtenTo.get(targetPath);
74558 if (writtenGeneration === targetFileGeneration) {
74559 // if yes, we skip writing the file
74560 // as it's already there
74561 // (we assume one doesn't remove files while the Compiler is running)
74562
74563 compilation.updateAsset(file, cacheEntry.sizeOnlySource, {
74564 size: cacheEntry.sizeOnlySource.size()
74565 });
74566
74567 return callback();
74568 }
74569 }
74570
74571 // TODO webpack 5: if info.immutable check if file already exists in output
74572 // skip emitting if it's already there
74573
74574 // get the binary (Buffer) content from the Source
74575 /** @type {Buffer} */
74576 let content;
74577 if (typeof source.buffer === "function") {
74578 content = source.buffer();
74579 } else {
74580 const bufferOrString = source.source();
74581 if (Buffer.isBuffer(bufferOrString)) {
74582 content = bufferOrString;
74583 } else {
74584 content = Buffer.from(bufferOrString, "utf8");
74585 }
74586 }
74587
74588 // Create a replacement resource which only allows to ask for size
74589 // This allows to GC all memory allocated by the Source
74590 // (expect when the Source is stored in any other cache)
74591 cacheEntry.sizeOnlySource = new SizeOnlySource(content.length);
74592 compilation.updateAsset(file, cacheEntry.sizeOnlySource, {
74593 size: content.length
74594 });
74595
74596 // Write the file to output file system
74597 this.outputFileSystem.writeFile(targetPath, content, err => {
74598 if (err) return callback(err);
74599
74600 // information marker that the asset has been emitted
74601 compilation.emittedAssets.add(file);
74602
74603 // cache the information that the Source has been written to that location
74604 const newGeneration =
74605 targetFileGeneration === undefined
74606 ? 1
74607 : targetFileGeneration + 1;
74608 cacheEntry.writtenTo.set(targetPath, newGeneration);
74609 this._assetEmittingWrittenFiles.set(targetPath, newGeneration);
74610 this.hooks.assetEmitted.callAsync(file, content, callback);
74611 });
74612 } else {
74613 if (source.existsAt === targetPath) {
74614 source.emitted = false;
74615 return callback();
74616 }
74617 let content = source.source();
74618
74619 if (!Buffer.isBuffer(content)) {
74620 content = Buffer.from(content, "utf8");
74621 }
74622
74623 source.existsAt = targetPath;
74624 source.emitted = true;
74625 this.outputFileSystem.writeFile(targetPath, content, err => {
74626 if (err) return callback(err);
74627 this.hooks.assetEmitted.callAsync(file, content, callback);
74628 });
74629 }
74630 };
74631
74632 if (targetFile.match(/\/|\\/)) {
74633 const dir = path.dirname(targetFile);
74634 this.outputFileSystem.mkdirp(
74635 this.outputFileSystem.join(outputPath, dir),
74636 writeOut
74637 );
74638 } else {
74639 writeOut();
74640 }
74641 },
74642 err => {
74643 if (err) return callback(err);
74644
74645 this.hooks.afterEmit.callAsync(compilation, err => {
74646 if (err) return callback(err);
74647
74648 return callback();
74649 });
74650 }
74651 );
74652 };
74653
74654 this.hooks.emit.callAsync(compilation, err => {
74655 if (err) return callback(err);
74656 outputPath = compilation.getPath(this.outputPath);
74657 this.outputFileSystem.mkdirp(outputPath, emitFiles);
74658 });
74659 }
74660
74661 emitRecords(callback) {
74662 if (!this.recordsOutputPath) return callback();
74663 const idx1 = this.recordsOutputPath.lastIndexOf("/");
74664 const idx2 = this.recordsOutputPath.lastIndexOf("\\");
74665 let recordsOutputPathDirectory = null;
74666 if (idx1 > idx2) {
74667 recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx1);
74668 } else if (idx1 < idx2) {
74669 recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx2);
74670 }
74671
74672 const writeFile = () => {
74673 this.outputFileSystem.writeFile(
74674 this.recordsOutputPath,
74675 JSON.stringify(this.records, undefined, 2),
74676 callback
74677 );
74678 };
74679
74680 if (!recordsOutputPathDirectory) {
74681 return writeFile();
74682 }
74683 this.outputFileSystem.mkdirp(recordsOutputPathDirectory, err => {
74684 if (err) return callback(err);
74685 writeFile();
74686 });
74687 }
74688
74689 readRecords(callback) {
74690 if (!this.recordsInputPath) {
74691 this.records = {};
74692 return callback();
74693 }
74694 this.inputFileSystem.stat(this.recordsInputPath, err => {
74695 // It doesn't exist
74696 // We can ignore this.
74697 if (err) return callback();
74698
74699 this.inputFileSystem.readFile(this.recordsInputPath, (err, content) => {
74700 if (err) return callback(err);
74701
74702 try {
74703 this.records = parseJson(content.toString("utf-8"));
74704 } catch (e) {
74705 e.message = "Cannot parse records: " + e.message;
74706 return callback(e);
74707 }
74708
74709 return callback();
74710 });
74711 });
74712 }
74713
74714 createChildCompiler(
74715 compilation,
74716 compilerName,
74717 compilerIndex,
74718 outputOptions,
74719 plugins
74720 ) {
74721 const childCompiler = new Compiler(this.context);
74722 if (Array.isArray(plugins)) {
74723 for (const plugin of plugins) {
74724 plugin.apply(childCompiler);
74725 }
74726 }
74727 for (const name in this.hooks) {
74728 if (
74729 ![
74730 "make",
74731 "compile",
74732 "emit",
74733 "afterEmit",
74734 "invalid",
74735 "done",
74736 "thisCompilation"
74737 ].includes(name)
74738 ) {
74739 if (childCompiler.hooks[name]) {
74740 childCompiler.hooks[name].taps = this.hooks[name].taps.slice();
74741 }
74742 }
74743 }
74744 childCompiler.name = compilerName;
74745 childCompiler.outputPath = this.outputPath;
74746 childCompiler.inputFileSystem = this.inputFileSystem;
74747 childCompiler.outputFileSystem = null;
74748 childCompiler.resolverFactory = this.resolverFactory;
74749 childCompiler.fileTimestamps = this.fileTimestamps;
74750 childCompiler.contextTimestamps = this.contextTimestamps;
74751
74752 const relativeCompilerName = makePathsRelative(this.context, compilerName);
74753 if (!this.records[relativeCompilerName]) {
74754 this.records[relativeCompilerName] = [];
74755 }
74756 if (this.records[relativeCompilerName][compilerIndex]) {
74757 childCompiler.records = this.records[relativeCompilerName][compilerIndex];
74758 } else {
74759 this.records[relativeCompilerName].push((childCompiler.records = {}));
74760 }
74761
74762 childCompiler.options = Object.create(this.options);
74763 childCompiler.options.output = Object.create(childCompiler.options.output);
74764 for (const name in outputOptions) {
74765 childCompiler.options.output[name] = outputOptions[name];
74766 }
74767 childCompiler.parentCompilation = compilation;
74768
74769 compilation.hooks.childCompiler.call(
74770 childCompiler,
74771 compilerName,
74772 compilerIndex
74773 );
74774
74775 return childCompiler;
74776 }
74777
74778 isChild() {
74779 return !!this.parentCompilation;
74780 }
74781
74782 createCompilation() {
74783 return new Compilation(this);
74784 }
74785
74786 newCompilation(params) {
74787 const compilation = this.createCompilation();
74788 compilation.fileTimestamps = this.fileTimestamps;
74789 compilation.contextTimestamps = this.contextTimestamps;
74790 compilation.name = this.name;
74791 compilation.records = this.records;
74792 compilation.compilationDependencies = params.compilationDependencies;
74793 this.hooks.thisCompilation.call(compilation, params);
74794 this.hooks.compilation.call(compilation, params);
74795 return compilation;
74796 }
74797
74798 createNormalModuleFactory() {
74799 const normalModuleFactory = new NormalModuleFactory(
74800 this.options.context,
74801 this.resolverFactory,
74802 this.options.module || {}
74803 );
74804 this.hooks.normalModuleFactory.call(normalModuleFactory);
74805 return normalModuleFactory;
74806 }
74807
74808 createContextModuleFactory() {
74809 const contextModuleFactory = new ContextModuleFactory(this.resolverFactory);
74810 this.hooks.contextModuleFactory.call(contextModuleFactory);
74811 return contextModuleFactory;
74812 }
74813
74814 newCompilationParams() {
74815 const params = {
74816 normalModuleFactory: this.createNormalModuleFactory(),
74817 contextModuleFactory: this.createContextModuleFactory(),
74818 compilationDependencies: new Set()
74819 };
74820 return params;
74821 }
74822
74823 compile(callback) {
74824 const params = this.newCompilationParams();
74825 this.hooks.beforeCompile.callAsync(params, err => {
74826 if (err) return callback(err);
74827
74828 this.hooks.compile.call(params);
74829
74830 const compilation = this.newCompilation(params);
74831
74832 this.hooks.make.callAsync(compilation, err => {
74833 if (err) return callback(err);
74834
74835 compilation.finish(err => {
74836 if (err) return callback(err);
74837
74838 compilation.seal(err => {
74839 if (err) return callback(err);
74840
74841 this.hooks.afterCompile.callAsync(compilation, err => {
74842 if (err) return callback(err);
74843
74844 return callback(null, compilation);
74845 });
74846 });
74847 });
74848 });
74849 });
74850 }
74851}
74852
74853module.exports = Compiler;
74854
74855class SizeOnlySource extends Source {
74856 constructor(size) {
74857 super();
74858 this._size = size;
74859 }
74860
74861 _error() {
74862 return new Error(
74863 "Content and Map of this Source is no longer available (only size() is supported)"
74864 );
74865 }
74866
74867 size() {
74868 return this._size;
74869 }
74870
74871 /**
74872 * @param {any} options options
74873 * @returns {string} the source
74874 */
74875 source(options) {
74876 throw this._error();
74877 }
74878
74879 node() {
74880 throw this._error();
74881 }
74882
74883 listMap() {
74884 throw this._error();
74885 }
74886
74887 map() {
74888 throw this._error();
74889 }
74890
74891 listNode() {
74892 throw this._error();
74893 }
74894
74895 updateHash() {
74896 throw this._error();
74897 }
74898}
74899
74900
74901/***/ }),
74902
74903/***/ 18933:
74904/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
74905
74906"use strict";
74907/*
74908 MIT License http://www.opensource.org/licenses/mit-license.php
74909 Author Maksim Nazarjev @acupofspirt
74910*/
74911
74912
74913const WebpackError = __webpack_require__(97391);
74914
74915module.exports = class ConcurrentCompilationError extends WebpackError {
74916 constructor() {
74917 super();
74918
74919 this.name = "ConcurrentCompilationError";
74920 this.message =
74921 "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.";
74922
74923 Error.captureStackTrace(this, this.constructor);
74924 }
74925};
74926
74927
74928/***/ }),
74929
74930/***/ 84072:
74931/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
74932
74933"use strict";
74934/*
74935 MIT License http://www.opensource.org/licenses/mit-license.php
74936 Author Tobias Koppers @sokra
74937*/
74938
74939const ConstDependency = __webpack_require__(71101);
74940const NullFactory = __webpack_require__(40438);
74941const ParserHelpers = __webpack_require__(23999);
74942
74943const getQuery = request => {
74944 const i = request.indexOf("?");
74945 return i !== -1 ? request.substr(i) : "";
74946};
74947
74948const collectDeclaration = (declarations, pattern) => {
74949 const stack = [pattern];
74950 while (stack.length > 0) {
74951 const node = stack.pop();
74952 switch (node.type) {
74953 case "Identifier":
74954 declarations.add(node.name);
74955 break;
74956 case "ArrayPattern":
74957 for (const element of node.elements) {
74958 if (element) {
74959 stack.push(element);
74960 }
74961 }
74962 break;
74963 case "AssignmentPattern":
74964 stack.push(node.left);
74965 break;
74966 case "ObjectPattern":
74967 for (const property of node.properties) {
74968 stack.push(property.value);
74969 }
74970 break;
74971 case "RestElement":
74972 stack.push(node.argument);
74973 break;
74974 }
74975 }
74976};
74977
74978const getHoistedDeclarations = (branch, includeFunctionDeclarations) => {
74979 const declarations = new Set();
74980 const stack = [branch];
74981 while (stack.length > 0) {
74982 const node = stack.pop();
74983 // Some node could be `null` or `undefined`.
74984 if (!node) continue;
74985 switch (node.type) {
74986 // Walk through control statements to look for hoisted declarations.
74987 // Some branches are skipped since they do not allow declarations.
74988 case "BlockStatement":
74989 for (const stmt of node.body) {
74990 stack.push(stmt);
74991 }
74992 break;
74993 case "IfStatement":
74994 stack.push(node.consequent);
74995 stack.push(node.alternate);
74996 break;
74997 case "ForStatement":
74998 stack.push(node.init);
74999 stack.push(node.body);
75000 break;
75001 case "ForInStatement":
75002 case "ForOfStatement":
75003 stack.push(node.left);
75004 stack.push(node.body);
75005 break;
75006 case "DoWhileStatement":
75007 case "WhileStatement":
75008 case "LabeledStatement":
75009 stack.push(node.body);
75010 break;
75011 case "SwitchStatement":
75012 for (const cs of node.cases) {
75013 for (const consequent of cs.consequent) {
75014 stack.push(consequent);
75015 }
75016 }
75017 break;
75018 case "TryStatement":
75019 stack.push(node.block);
75020 if (node.handler) {
75021 stack.push(node.handler.body);
75022 }
75023 stack.push(node.finalizer);
75024 break;
75025 case "FunctionDeclaration":
75026 if (includeFunctionDeclarations) {
75027 collectDeclaration(declarations, node.id);
75028 }
75029 break;
75030 case "VariableDeclaration":
75031 if (node.kind === "var") {
75032 for (const decl of node.declarations) {
75033 collectDeclaration(declarations, decl.id);
75034 }
75035 }
75036 break;
75037 }
75038 }
75039 return Array.from(declarations);
75040};
75041
75042class ConstPlugin {
75043 apply(compiler) {
75044 compiler.hooks.compilation.tap(
75045 "ConstPlugin",
75046 (compilation, { normalModuleFactory }) => {
75047 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
75048 compilation.dependencyTemplates.set(
75049 ConstDependency,
75050 new ConstDependency.Template()
75051 );
75052
75053 const handler = parser => {
75054 parser.hooks.statementIf.tap("ConstPlugin", statement => {
75055 if (parser.scope.isAsmJs) return;
75056 const param = parser.evaluateExpression(statement.test);
75057 const bool = param.asBool();
75058 if (typeof bool === "boolean") {
75059 if (statement.test.type !== "Literal") {
75060 const dep = new ConstDependency(`${bool}`, param.range);
75061 dep.loc = statement.loc;
75062 parser.state.current.addDependency(dep);
75063 }
75064 const branchToRemove = bool
75065 ? statement.alternate
75066 : statement.consequent;
75067 if (branchToRemove) {
75068 // Before removing the dead branch, the hoisted declarations
75069 // must be collected.
75070 //
75071 // Given the following code:
75072 //
75073 // if (true) f() else g()
75074 // if (false) {
75075 // function f() {}
75076 // const g = function g() {}
75077 // if (someTest) {
75078 // let a = 1
75079 // var x, {y, z} = obj
75080 // }
75081 // } else {
75082 // …
75083 // }
75084 //
75085 // the generated code is:
75086 //
75087 // if (true) f() else {}
75088 // if (false) {
75089 // var f, x, y, z; (in loose mode)
75090 // var x, y, z; (in strict mode)
75091 // } else {
75092 // …
75093 // }
75094 //
75095 // NOTE: When code runs in strict mode, `var` declarations
75096 // are hoisted but `function` declarations don't.
75097 //
75098 let declarations;
75099 if (parser.scope.isStrict) {
75100 // If the code runs in strict mode, variable declarations
75101 // using `var` must be hoisted.
75102 declarations = getHoistedDeclarations(branchToRemove, false);
75103 } else {
75104 // Otherwise, collect all hoisted declaration.
75105 declarations = getHoistedDeclarations(branchToRemove, true);
75106 }
75107 let replacement;
75108 if (declarations.length > 0) {
75109 replacement = `{ var ${declarations.join(", ")}; }`;
75110 } else {
75111 replacement = "{}";
75112 }
75113 const dep = new ConstDependency(
75114 replacement,
75115 branchToRemove.range
75116 );
75117 dep.loc = branchToRemove.loc;
75118 parser.state.current.addDependency(dep);
75119 }
75120 return bool;
75121 }
75122 });
75123 parser.hooks.expressionConditionalOperator.tap(
75124 "ConstPlugin",
75125 expression => {
75126 if (parser.scope.isAsmJs) return;
75127 const param = parser.evaluateExpression(expression.test);
75128 const bool = param.asBool();
75129 if (typeof bool === "boolean") {
75130 if (expression.test.type !== "Literal") {
75131 const dep = new ConstDependency(` ${bool}`, param.range);
75132 dep.loc = expression.loc;
75133 parser.state.current.addDependency(dep);
75134 }
75135 // Expressions do not hoist.
75136 // It is safe to remove the dead branch.
75137 //
75138 // Given the following code:
75139 //
75140 // false ? someExpression() : otherExpression();
75141 //
75142 // the generated code is:
75143 //
75144 // false ? undefined : otherExpression();
75145 //
75146 const branchToRemove = bool
75147 ? expression.alternate
75148 : expression.consequent;
75149 const dep = new ConstDependency(
75150 "undefined",
75151 branchToRemove.range
75152 );
75153 dep.loc = branchToRemove.loc;
75154 parser.state.current.addDependency(dep);
75155 return bool;
75156 }
75157 }
75158 );
75159 parser.hooks.expressionLogicalOperator.tap(
75160 "ConstPlugin",
75161 expression => {
75162 if (parser.scope.isAsmJs) return;
75163 if (
75164 expression.operator === "&&" ||
75165 expression.operator === "||"
75166 ) {
75167 const param = parser.evaluateExpression(expression.left);
75168 const bool = param.asBool();
75169 if (typeof bool === "boolean") {
75170 // Expressions do not hoist.
75171 // It is safe to remove the dead branch.
75172 //
75173 // ------------------------------------------
75174 //
75175 // Given the following code:
75176 //
75177 // falsyExpression() && someExpression();
75178 //
75179 // the generated code is:
75180 //
75181 // falsyExpression() && false;
75182 //
75183 // ------------------------------------------
75184 //
75185 // Given the following code:
75186 //
75187 // truthyExpression() && someExpression();
75188 //
75189 // the generated code is:
75190 //
75191 // true && someExpression();
75192 //
75193 // ------------------------------------------
75194 //
75195 // Given the following code:
75196 //
75197 // truthyExpression() || someExpression();
75198 //
75199 // the generated code is:
75200 //
75201 // truthyExpression() || false;
75202 //
75203 // ------------------------------------------
75204 //
75205 // Given the following code:
75206 //
75207 // falsyExpression() || someExpression();
75208 //
75209 // the generated code is:
75210 //
75211 // false && someExpression();
75212 //
75213 const keepRight =
75214 (expression.operator === "&&" && bool) ||
75215 (expression.operator === "||" && !bool);
75216
75217 if (param.isBoolean() || keepRight) {
75218 // for case like
75219 //
75220 // return'development'===process.env.NODE_ENV&&'foo'
75221 //
75222 // we need a space before the bool to prevent result like
75223 //
75224 // returnfalse&&'foo'
75225 //
75226 const dep = new ConstDependency(` ${bool}`, param.range);
75227 dep.loc = expression.loc;
75228 parser.state.current.addDependency(dep);
75229 } else {
75230 parser.walkExpression(expression.left);
75231 }
75232 if (!keepRight) {
75233 const dep = new ConstDependency(
75234 "false",
75235 expression.right.range
75236 );
75237 dep.loc = expression.loc;
75238 parser.state.current.addDependency(dep);
75239 }
75240 return keepRight;
75241 }
75242 }
75243 }
75244 );
75245 parser.hooks.evaluateIdentifier
75246 .for("__resourceQuery")
75247 .tap("ConstPlugin", expr => {
75248 if (parser.scope.isAsmJs) return;
75249 if (!parser.state.module) return;
75250 return ParserHelpers.evaluateToString(
75251 getQuery(parser.state.module.resource)
75252 )(expr);
75253 });
75254 parser.hooks.expression
75255 .for("__resourceQuery")
75256 .tap("ConstPlugin", () => {
75257 if (parser.scope.isAsmJs) return;
75258 if (!parser.state.module) return;
75259 parser.state.current.addVariable(
75260 "__resourceQuery",
75261 JSON.stringify(getQuery(parser.state.module.resource))
75262 );
75263 return true;
75264 });
75265 };
75266
75267 normalModuleFactory.hooks.parser
75268 .for("javascript/auto")
75269 .tap("ConstPlugin", handler);
75270 normalModuleFactory.hooks.parser
75271 .for("javascript/dynamic")
75272 .tap("ConstPlugin", handler);
75273 normalModuleFactory.hooks.parser
75274 .for("javascript/esm")
75275 .tap("ConstPlugin", handler);
75276 }
75277 );
75278 }
75279}
75280
75281module.exports = ConstPlugin;
75282
75283
75284/***/ }),
75285
75286/***/ 10706:
75287/***/ (function(module) {
75288
75289"use strict";
75290
75291
75292/** @typedef {import("./Compiler")} Compiler */
75293/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */
75294
75295class ContextExclusionPlugin {
75296 /**
75297 * @param {RegExp} negativeMatcher Matcher regular expression
75298 */
75299 constructor(negativeMatcher) {
75300 this.negativeMatcher = negativeMatcher;
75301 }
75302
75303 /**
75304 * Apply the plugin
75305 * @param {Compiler} compiler Webpack Compiler
75306 * @returns {void}
75307 */
75308 apply(compiler) {
75309 compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => {
75310 cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => {
75311 return files.filter(filePath => !this.negativeMatcher.test(filePath));
75312 });
75313 });
75314 }
75315}
75316
75317module.exports = ContextExclusionPlugin;
75318
75319
75320/***/ }),
75321
75322/***/ 20090:
75323/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
75324
75325"use strict";
75326/*
75327 MIT License http://www.opensource.org/licenses/mit-license.php
75328 Author Tobias Koppers @sokra
75329*/
75330
75331const util = __webpack_require__(31669);
75332const { OriginalSource, RawSource } = __webpack_require__(53665);
75333const Module = __webpack_require__(75993);
75334const AsyncDependenciesBlock = __webpack_require__(22814);
75335const Template = __webpack_require__(96066);
75336const contextify = __webpack_require__(94658).contextify;
75337
75338/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */
75339/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */
75340
75341/**
75342 * @callback ResolveDependenciesCallback
75343 * @param {Error=} err
75344 * @param {ContextElementDependency[]} dependencies
75345 */
75346
75347/**
75348 * @callback ResolveDependencies
75349 * @param {TODO} fs
75350 * @param {TODO} options
75351 * @param {ResolveDependenciesCallback} callback
75352 */
75353
75354class ContextModule extends Module {
75355 // type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"
75356 // type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object }
75357 // resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void
75358 // options: ContextOptions
75359 /**
75360 * @param {ResolveDependencies} resolveDependencies function to get dependencies in this context
75361 * @param {TODO} options options object
75362 */
75363 constructor(resolveDependencies, options) {
75364 let resource;
75365 let resourceQuery;
75366 const queryIdx = options.resource.indexOf("?");
75367 if (queryIdx >= 0) {
75368 resource = options.resource.substr(0, queryIdx);
75369 resourceQuery = options.resource.substr(queryIdx);
75370 } else {
75371 resource = options.resource;
75372 resourceQuery = "";
75373 }
75374
75375 super("javascript/dynamic", resource);
75376
75377 // Info from Factory
75378 this.resolveDependencies = resolveDependencies;
75379 this.options = Object.assign({}, options, {
75380 resource: resource,
75381 resourceQuery: resourceQuery
75382 });
75383 if (options.resolveOptions !== undefined) {
75384 this.resolveOptions = options.resolveOptions;
75385 }
75386
75387 // Info from Build
75388 this._contextDependencies = new Set([this.context]);
75389
75390 if (typeof options.mode !== "string") {
75391 throw new Error("options.mode is a required option");
75392 }
75393
75394 this._identifier = this._createIdentifier();
75395 }
75396
75397 updateCacheModule(module) {
75398 this.resolveDependencies = module.resolveDependencies;
75399 this.options = module.options;
75400 this.resolveOptions = module.resolveOptions;
75401 }
75402
75403 prettyRegExp(regexString) {
75404 // remove the "/" at the front and the beginning
75405 // "/foo/" -> "foo"
75406 return regexString.substring(1, regexString.length - 1);
75407 }
75408
75409 _createIdentifier() {
75410 let identifier = this.context;
75411 if (this.options.resourceQuery) {
75412 identifier += ` ${this.options.resourceQuery}`;
75413 }
75414 if (this.options.mode) {
75415 identifier += ` ${this.options.mode}`;
75416 }
75417 if (!this.options.recursive) {
75418 identifier += " nonrecursive";
75419 }
75420 if (this.options.addon) {
75421 identifier += ` ${this.options.addon}`;
75422 }
75423 if (this.options.regExp) {
75424 identifier += ` ${this.options.regExp}`;
75425 }
75426 if (this.options.include) {
75427 identifier += ` include: ${this.options.include}`;
75428 }
75429 if (this.options.exclude) {
75430 identifier += ` exclude: ${this.options.exclude}`;
75431 }
75432 if (this.options.groupOptions) {
75433 identifier += ` groupOptions: ${JSON.stringify(
75434 this.options.groupOptions
75435 )}`;
75436 }
75437 if (this.options.namespaceObject === "strict") {
75438 identifier += " strict namespace object";
75439 } else if (this.options.namespaceObject) {
75440 identifier += " namespace object";
75441 }
75442
75443 return identifier;
75444 }
75445
75446 identifier() {
75447 return this._identifier;
75448 }
75449
75450 readableIdentifier(requestShortener) {
75451 let identifier = requestShortener.shorten(this.context);
75452 if (this.options.resourceQuery) {
75453 identifier += ` ${this.options.resourceQuery}`;
75454 }
75455 if (this.options.mode) {
75456 identifier += ` ${this.options.mode}`;
75457 }
75458 if (!this.options.recursive) {
75459 identifier += " nonrecursive";
75460 }
75461 if (this.options.addon) {
75462 identifier += ` ${requestShortener.shorten(this.options.addon)}`;
75463 }
75464 if (this.options.regExp) {
75465 identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
75466 }
75467 if (this.options.include) {
75468 identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
75469 }
75470 if (this.options.exclude) {
75471 identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
75472 }
75473 if (this.options.groupOptions) {
75474 const groupOptions = this.options.groupOptions;
75475 for (const key of Object.keys(groupOptions)) {
75476 identifier += ` ${key}: ${groupOptions[key]}`;
75477 }
75478 }
75479 if (this.options.namespaceObject === "strict") {
75480 identifier += " strict namespace object";
75481 } else if (this.options.namespaceObject) {
75482 identifier += " namespace object";
75483 }
75484
75485 return identifier;
75486 }
75487
75488 libIdent(options) {
75489 let identifier = contextify(options.context, this.context);
75490 if (this.options.mode) {
75491 identifier += ` ${this.options.mode}`;
75492 }
75493 if (this.options.recursive) {
75494 identifier += " recursive";
75495 }
75496 if (this.options.addon) {
75497 identifier += ` ${contextify(options.context, this.options.addon)}`;
75498 }
75499 if (this.options.regExp) {
75500 identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
75501 }
75502 if (this.options.include) {
75503 identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
75504 }
75505 if (this.options.exclude) {
75506 identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
75507 }
75508
75509 return identifier;
75510 }
75511
75512 needRebuild(fileTimestamps, contextTimestamps) {
75513 const ts = contextTimestamps.get(this.context);
75514 if (!ts) {
75515 return true;
75516 }
75517
75518 return ts >= this.buildInfo.builtTime;
75519 }
75520
75521 build(options, compilation, resolver, fs, callback) {
75522 this.built = true;
75523 this.buildMeta = {};
75524 this.buildInfo = {
75525 builtTime: Date.now(),
75526 contextDependencies: this._contextDependencies
75527 };
75528 this.resolveDependencies(fs, this.options, (err, dependencies) => {
75529 if (err) return callback(err);
75530
75531 // abort if something failed
75532 // this will create an empty context
75533 if (!dependencies) {
75534 callback();
75535 return;
75536 }
75537
75538 // enhance dependencies with meta info
75539 for (const dep of dependencies) {
75540 dep.loc = {
75541 name: dep.userRequest
75542 };
75543 dep.request = this.options.addon + dep.request;
75544 }
75545
75546 if (this.options.mode === "sync" || this.options.mode === "eager") {
75547 // if we have an sync or eager context
75548 // just add all dependencies and continue
75549 this.dependencies = dependencies;
75550 } else if (this.options.mode === "lazy-once") {
75551 // for the lazy-once mode create a new async dependency block
75552 // and add that block to this context
75553 if (dependencies.length > 0) {
75554 const block = new AsyncDependenciesBlock(
75555 Object.assign({}, this.options.groupOptions, {
75556 name: this.options.chunkName
75557 }),
75558 this
75559 );
75560 for (const dep of dependencies) {
75561 block.addDependency(dep);
75562 }
75563 this.addBlock(block);
75564 }
75565 } else if (
75566 this.options.mode === "weak" ||
75567 this.options.mode === "async-weak"
75568 ) {
75569 // we mark all dependencies as weak
75570 for (const dep of dependencies) {
75571 dep.weak = true;
75572 }
75573 this.dependencies = dependencies;
75574 } else if (this.options.mode === "lazy") {
75575 // if we are lazy create a new async dependency block per dependency
75576 // and add all blocks to this context
75577 let index = 0;
75578 for (const dep of dependencies) {
75579 let chunkName = this.options.chunkName;
75580 if (chunkName) {
75581 if (!/\[(index|request)\]/.test(chunkName)) {
75582 chunkName += "[index]";
75583 }
75584 chunkName = chunkName.replace(/\[index\]/g, index++);
75585 chunkName = chunkName.replace(
75586 /\[request\]/g,
75587 Template.toPath(dep.userRequest)
75588 );
75589 }
75590 const block = new AsyncDependenciesBlock(
75591 Object.assign({}, this.options.groupOptions, {
75592 name: chunkName
75593 }),
75594 dep.module,
75595 dep.loc,
75596 dep.userRequest
75597 );
75598 block.addDependency(dep);
75599 this.addBlock(block);
75600 }
75601 } else {
75602 callback(
75603 new Error(`Unsupported mode "${this.options.mode}" in context`)
75604 );
75605 return;
75606 }
75607 callback();
75608 });
75609 }
75610
75611 getUserRequestMap(dependencies) {
75612 // if we filter first we get a new array
75613 // therefor we dont need to create a clone of dependencies explicitly
75614 // therefore the order of this is !important!
75615 return dependencies
75616 .filter(dependency => dependency.module)
75617 .sort((a, b) => {
75618 if (a.userRequest === b.userRequest) {
75619 return 0;
75620 }
75621 return a.userRequest < b.userRequest ? -1 : 1;
75622 })
75623 .reduce((map, dep) => {
75624 map[dep.userRequest] = dep.module.id;
75625 return map;
75626 }, Object.create(null));
75627 }
75628
75629 getFakeMap(dependencies) {
75630 if (!this.options.namespaceObject) {
75631 return 9;
75632 }
75633 // if we filter first we get a new array
75634 // therefor we dont need to create a clone of dependencies explicitly
75635 // therefore the order of this is !important!
75636 let hasNonHarmony = false;
75637 let hasNamespace = false;
75638 let hasNamed = false;
75639 const fakeMap = dependencies
75640 .filter(dependency => dependency.module)
75641 .sort((a, b) => {
75642 return b.module.id - a.module.id;
75643 })
75644 .reduce((map, dep) => {
75645 const exportsType =
75646 dep.module.buildMeta && dep.module.buildMeta.exportsType;
75647 const id = dep.module.id;
75648 if (!exportsType) {
75649 map[id] = this.options.namespaceObject === "strict" ? 1 : 7;
75650 hasNonHarmony = true;
75651 } else if (exportsType === "namespace") {
75652 map[id] = 9;
75653 hasNamespace = true;
75654 } else if (exportsType === "named") {
75655 map[id] = 3;
75656 hasNamed = true;
75657 }
75658 return map;
75659 }, Object.create(null));
75660 if (!hasNamespace && hasNonHarmony && !hasNamed) {
75661 return this.options.namespaceObject === "strict" ? 1 : 7;
75662 }
75663 if (hasNamespace && !hasNonHarmony && !hasNamed) {
75664 return 9;
75665 }
75666 if (!hasNamespace && !hasNonHarmony && hasNamed) {
75667 return 3;
75668 }
75669 if (!hasNamespace && !hasNonHarmony && !hasNamed) {
75670 return 9;
75671 }
75672 return fakeMap;
75673 }
75674
75675 getFakeMapInitStatement(fakeMap) {
75676 return typeof fakeMap === "object"
75677 ? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};`
75678 : "";
75679 }
75680
75681 getReturn(type) {
75682 if (type === 9) {
75683 return "__webpack_require__(id)";
75684 }
75685 return `__webpack_require__.t(id, ${type})`;
75686 }
75687
75688 getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
75689 if (typeof fakeMap === "number") {
75690 return `return ${this.getReturn(fakeMap)};`;
75691 }
75692 return `return __webpack_require__.t(id, ${fakeMapDataExpression})`;
75693 }
75694
75695 getSyncSource(dependencies, id) {
75696 const map = this.getUserRequestMap(dependencies);
75697 const fakeMap = this.getFakeMap(dependencies);
75698 const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
75699
75700 return `var map = ${JSON.stringify(map, null, "\t")};
75701${this.getFakeMapInitStatement(fakeMap)}
75702
75703function webpackContext(req) {
75704 var id = webpackContextResolve(req);
75705 ${returnModuleObject}
75706}
75707function webpackContextResolve(req) {
75708 if(!__webpack_require__.o(map, req)) {
75709 var e = new Error("Cannot find module '" + req + "'");
75710 e.code = 'MODULE_NOT_FOUND';
75711 throw e;
75712 }
75713 return map[req];
75714}
75715webpackContext.keys = function webpackContextKeys() {
75716 return Object.keys(map);
75717};
75718webpackContext.resolve = webpackContextResolve;
75719module.exports = webpackContext;
75720webpackContext.id = ${JSON.stringify(id)};`;
75721 }
75722
75723 getWeakSyncSource(dependencies, id) {
75724 const map = this.getUserRequestMap(dependencies);
75725 const fakeMap = this.getFakeMap(dependencies);
75726 const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
75727
75728 return `var map = ${JSON.stringify(map, null, "\t")};
75729${this.getFakeMapInitStatement(fakeMap)}
75730
75731function webpackContext(req) {
75732 var id = webpackContextResolve(req);
75733 if(!__webpack_require__.m[id]) {
75734 var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
75735 e.code = 'MODULE_NOT_FOUND';
75736 throw e;
75737 }
75738 ${returnModuleObject}
75739}
75740function webpackContextResolve(req) {
75741 if(!__webpack_require__.o(map, req)) {
75742 var e = new Error("Cannot find module '" + req + "'");
75743 e.code = 'MODULE_NOT_FOUND';
75744 throw e;
75745 }
75746 return map[req];
75747}
75748webpackContext.keys = function webpackContextKeys() {
75749 return Object.keys(map);
75750};
75751webpackContext.resolve = webpackContextResolve;
75752webpackContext.id = ${JSON.stringify(id)};
75753module.exports = webpackContext;`;
75754 }
75755
75756 getAsyncWeakSource(dependencies, id) {
75757 const map = this.getUserRequestMap(dependencies);
75758 const fakeMap = this.getFakeMap(dependencies);
75759 const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
75760
75761 return `var map = ${JSON.stringify(map, null, "\t")};
75762${this.getFakeMapInitStatement(fakeMap)}
75763
75764function webpackAsyncContext(req) {
75765 return webpackAsyncContextResolve(req).then(function(id) {
75766 if(!__webpack_require__.m[id]) {
75767 var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
75768 e.code = 'MODULE_NOT_FOUND';
75769 throw e;
75770 }
75771 ${returnModuleObject}
75772 });
75773}
75774function webpackAsyncContextResolve(req) {
75775 // Here Promise.resolve().then() is used instead of new Promise() to prevent
75776 // uncaught exception popping up in devtools
75777 return Promise.resolve().then(function() {
75778 if(!__webpack_require__.o(map, req)) {
75779 var e = new Error("Cannot find module '" + req + "'");
75780 e.code = 'MODULE_NOT_FOUND';
75781 throw e;
75782 }
75783 return map[req];
75784 });
75785}
75786webpackAsyncContext.keys = function webpackAsyncContextKeys() {
75787 return Object.keys(map);
75788};
75789webpackAsyncContext.resolve = webpackAsyncContextResolve;
75790webpackAsyncContext.id = ${JSON.stringify(id)};
75791module.exports = webpackAsyncContext;`;
75792 }
75793
75794 getEagerSource(dependencies, id) {
75795 const map = this.getUserRequestMap(dependencies);
75796 const fakeMap = this.getFakeMap(dependencies);
75797 const thenFunction =
75798 fakeMap !== 9
75799 ? `function(id) {
75800 ${this.getReturnModuleObjectSource(fakeMap)}
75801 }`
75802 : "__webpack_require__";
75803 return `var map = ${JSON.stringify(map, null, "\t")};
75804${this.getFakeMapInitStatement(fakeMap)}
75805
75806function webpackAsyncContext(req) {
75807 return webpackAsyncContextResolve(req).then(${thenFunction});
75808}
75809function webpackAsyncContextResolve(req) {
75810 // Here Promise.resolve().then() is used instead of new Promise() to prevent
75811 // uncaught exception popping up in devtools
75812 return Promise.resolve().then(function() {
75813 if(!__webpack_require__.o(map, req)) {
75814 var e = new Error("Cannot find module '" + req + "'");
75815 e.code = 'MODULE_NOT_FOUND';
75816 throw e;
75817 }
75818 return map[req];
75819 });
75820}
75821webpackAsyncContext.keys = function webpackAsyncContextKeys() {
75822 return Object.keys(map);
75823};
75824webpackAsyncContext.resolve = webpackAsyncContextResolve;
75825webpackAsyncContext.id = ${JSON.stringify(id)};
75826module.exports = webpackAsyncContext;`;
75827 }
75828
75829 getLazyOnceSource(block, dependencies, id, runtimeTemplate) {
75830 const promise = runtimeTemplate.blockPromise({
75831 block,
75832 message: "lazy-once context"
75833 });
75834 const map = this.getUserRequestMap(dependencies);
75835 const fakeMap = this.getFakeMap(dependencies);
75836 const thenFunction =
75837 fakeMap !== 9
75838 ? `function(id) {
75839 ${this.getReturnModuleObjectSource(fakeMap)};
75840 }`
75841 : "__webpack_require__";
75842
75843 return `var map = ${JSON.stringify(map, null, "\t")};
75844${this.getFakeMapInitStatement(fakeMap)}
75845
75846function webpackAsyncContext(req) {
75847 return webpackAsyncContextResolve(req).then(${thenFunction});
75848}
75849function webpackAsyncContextResolve(req) {
75850 return ${promise}.then(function() {
75851 if(!__webpack_require__.o(map, req)) {
75852 var e = new Error("Cannot find module '" + req + "'");
75853 e.code = 'MODULE_NOT_FOUND';
75854 throw e;
75855 }
75856 return map[req];
75857 });
75858}
75859webpackAsyncContext.keys = function webpackAsyncContextKeys() {
75860 return Object.keys(map);
75861};
75862webpackAsyncContext.resolve = webpackAsyncContextResolve;
75863webpackAsyncContext.id = ${JSON.stringify(id)};
75864module.exports = webpackAsyncContext;`;
75865 }
75866
75867 getLazySource(blocks, id) {
75868 let hasMultipleOrNoChunks = false;
75869 let hasNoChunk = true;
75870 const fakeMap = this.getFakeMap(blocks.map(b => b.dependencies[0]));
75871 const hasFakeMap = typeof fakeMap === "object";
75872 const map = blocks
75873 .filter(block => block.dependencies[0].module)
75874 .map(block => {
75875 const chunks = block.chunkGroup ? block.chunkGroup.chunks : [];
75876 if (chunks.length > 0) {
75877 hasNoChunk = false;
75878 }
75879 if (chunks.length !== 1) {
75880 hasMultipleOrNoChunks = true;
75881 }
75882 return {
75883 dependency: block.dependencies[0],
75884 block: block,
75885 userRequest: block.dependencies[0].userRequest,
75886 chunks
75887 };
75888 })
75889 .sort((a, b) => {
75890 if (a.userRequest === b.userRequest) return 0;
75891 return a.userRequest < b.userRequest ? -1 : 1;
75892 })
75893 .reduce((map, item) => {
75894 const chunks = item.chunks;
75895
75896 if (hasNoChunk && !hasFakeMap) {
75897 map[item.userRequest] = item.dependency.module.id;
75898 } else {
75899 const arrayStart = [item.dependency.module.id];
75900 if (typeof fakeMap === "object") {
75901 arrayStart.push(fakeMap[item.dependency.module.id]);
75902 }
75903 map[item.userRequest] = arrayStart.concat(
75904 chunks.map(chunk => chunk.id)
75905 );
75906 }
75907
75908 return map;
75909 }, Object.create(null));
75910
75911 const shortMode = hasNoChunk && !hasFakeMap;
75912 const chunksStartPosition = hasFakeMap ? 2 : 1;
75913 const requestPrefix = hasNoChunk
75914 ? "Promise.resolve()"
75915 : hasMultipleOrNoChunks
75916 ? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
75917 : `__webpack_require__.e(ids[${chunksStartPosition}])`;
75918 const returnModuleObject = this.getReturnModuleObjectSource(
75919 fakeMap,
75920 shortMode ? "invalid" : "ids[1]"
75921 );
75922
75923 const webpackAsyncContext =
75924 requestPrefix === "Promise.resolve()"
75925 ? `${shortMode ? "" : ""}
75926function webpackAsyncContext(req) {
75927 return Promise.resolve().then(function() {
75928 if(!__webpack_require__.o(map, req)) {
75929 var e = new Error("Cannot find module '" + req + "'");
75930 e.code = 'MODULE_NOT_FOUND';
75931 throw e;
75932 }
75933
75934 ${shortMode ? "var id = map[req];" : "var ids = map[req], id = ids[0];"}
75935 ${returnModuleObject}
75936 });
75937}`
75938 : `function webpackAsyncContext(req) {
75939 if(!__webpack_require__.o(map, req)) {
75940 return Promise.resolve().then(function() {
75941 var e = new Error("Cannot find module '" + req + "'");
75942 e.code = 'MODULE_NOT_FOUND';
75943 throw e;
75944 });
75945 }
75946
75947 var ids = map[req], id = ids[0];
75948 return ${requestPrefix}.then(function() {
75949 ${returnModuleObject}
75950 });
75951}`;
75952
75953 return `var map = ${JSON.stringify(map, null, "\t")};
75954${webpackAsyncContext}
75955webpackAsyncContext.keys = function webpackAsyncContextKeys() {
75956 return Object.keys(map);
75957};
75958webpackAsyncContext.id = ${JSON.stringify(id)};
75959module.exports = webpackAsyncContext;`;
75960 }
75961
75962 getSourceForEmptyContext(id) {
75963 return `function webpackEmptyContext(req) {
75964 var e = new Error("Cannot find module '" + req + "'");
75965 e.code = 'MODULE_NOT_FOUND';
75966 throw e;
75967}
75968webpackEmptyContext.keys = function() { return []; };
75969webpackEmptyContext.resolve = webpackEmptyContext;
75970module.exports = webpackEmptyContext;
75971webpackEmptyContext.id = ${JSON.stringify(id)};`;
75972 }
75973
75974 getSourceForEmptyAsyncContext(id) {
75975 return `function webpackEmptyAsyncContext(req) {
75976 // Here Promise.resolve().then() is used instead of new Promise() to prevent
75977 // uncaught exception popping up in devtools
75978 return Promise.resolve().then(function() {
75979 var e = new Error("Cannot find module '" + req + "'");
75980 e.code = 'MODULE_NOT_FOUND';
75981 throw e;
75982 });
75983}
75984webpackEmptyAsyncContext.keys = function() { return []; };
75985webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
75986module.exports = webpackEmptyAsyncContext;
75987webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`;
75988 }
75989
75990 getSourceString(asyncMode, runtimeTemplate) {
75991 if (asyncMode === "lazy") {
75992 if (this.blocks && this.blocks.length > 0) {
75993 return this.getLazySource(this.blocks, this.id);
75994 }
75995 return this.getSourceForEmptyAsyncContext(this.id);
75996 }
75997 if (asyncMode === "eager") {
75998 if (this.dependencies && this.dependencies.length > 0) {
75999 return this.getEagerSource(this.dependencies, this.id);
76000 }
76001 return this.getSourceForEmptyAsyncContext(this.id);
76002 }
76003 if (asyncMode === "lazy-once") {
76004 const block = this.blocks[0];
76005 if (block) {
76006 return this.getLazyOnceSource(
76007 block,
76008 block.dependencies,
76009 this.id,
76010 runtimeTemplate
76011 );
76012 }
76013 return this.getSourceForEmptyAsyncContext(this.id);
76014 }
76015 if (asyncMode === "async-weak") {
76016 if (this.dependencies && this.dependencies.length > 0) {
76017 return this.getAsyncWeakSource(this.dependencies, this.id);
76018 }
76019 return this.getSourceForEmptyAsyncContext(this.id);
76020 }
76021 if (asyncMode === "weak") {
76022 if (this.dependencies && this.dependencies.length > 0) {
76023 return this.getWeakSyncSource(this.dependencies, this.id);
76024 }
76025 }
76026 if (this.dependencies && this.dependencies.length > 0) {
76027 return this.getSyncSource(this.dependencies, this.id);
76028 }
76029 return this.getSourceForEmptyContext(this.id);
76030 }
76031
76032 getSource(sourceString) {
76033 if (this.useSourceMap) {
76034 return new OriginalSource(sourceString, this.identifier());
76035 }
76036 return new RawSource(sourceString);
76037 }
76038
76039 source(dependencyTemplates, runtimeTemplate) {
76040 return this.getSource(
76041 this.getSourceString(this.options.mode, runtimeTemplate)
76042 );
76043 }
76044
76045 size() {
76046 // base penalty
76047 const initialSize = 160;
76048
76049 // if we dont have dependencies we stop here.
76050 return this.dependencies.reduce((size, dependency) => {
76051 const element = /** @type {ContextElementDependency} */ (dependency);
76052 return size + 5 + element.userRequest.length;
76053 }, initialSize);
76054 }
76055}
76056
76057// TODO remove in webpack 5
76058Object.defineProperty(ContextModule.prototype, "recursive", {
76059 configurable: false,
76060 get: util.deprecate(
76061 /**
76062 * @deprecated
76063 * @this {ContextModule}
76064 * @returns {boolean} is recursive
76065 */
76066 function() {
76067 return this.options.recursive;
76068 },
76069 "ContextModule.recursive has been moved to ContextModule.options.recursive"
76070 ),
76071 set: util.deprecate(
76072 /**
76073 * @deprecated
76074 * @this {ContextModule}
76075 * @param {boolean} value is recursive
76076 * @returns {void}
76077 */
76078 function(value) {
76079 this.options.recursive = value;
76080 },
76081 "ContextModule.recursive has been moved to ContextModule.options.recursive"
76082 )
76083});
76084
76085// TODO remove in webpack 5
76086Object.defineProperty(ContextModule.prototype, "regExp", {
76087 configurable: false,
76088 get: util.deprecate(
76089 /**
76090 * @deprecated
76091 * @this {ContextModule}
76092 * @returns {RegExp} regular expression
76093 */
76094 function() {
76095 return this.options.regExp;
76096 },
76097 "ContextModule.regExp has been moved to ContextModule.options.regExp"
76098 ),
76099 set: util.deprecate(
76100 /**
76101 * @deprecated
76102 * @this {ContextModule}
76103 * @param {RegExp} value Regular expression
76104 * @returns {void}
76105 */
76106 function(value) {
76107 this.options.regExp = value;
76108 },
76109 "ContextModule.regExp has been moved to ContextModule.options.regExp"
76110 )
76111});
76112
76113// TODO remove in webpack 5
76114Object.defineProperty(ContextModule.prototype, "addon", {
76115 configurable: false,
76116 get: util.deprecate(
76117 /**
76118 * @deprecated
76119 * @this {ContextModule}
76120 * @returns {string} addon
76121 */
76122 function() {
76123 return this.options.addon;
76124 },
76125 "ContextModule.addon has been moved to ContextModule.options.addon"
76126 ),
76127 set: util.deprecate(
76128 /**
76129 * @deprecated
76130 * @this {ContextModule}
76131 * @param {string} value addon
76132 * @returns {void}
76133 */
76134 function(value) {
76135 this.options.addon = value;
76136 },
76137 "ContextModule.addon has been moved to ContextModule.options.addon"
76138 )
76139});
76140
76141// TODO remove in webpack 5
76142Object.defineProperty(ContextModule.prototype, "async", {
76143 configurable: false,
76144 get: util.deprecate(
76145 /**
76146 * @deprecated
76147 * @this {ContextModule}
76148 * @returns {boolean} is async
76149 */
76150 function() {
76151 return this.options.mode;
76152 },
76153 "ContextModule.async has been moved to ContextModule.options.mode"
76154 ),
76155 set: util.deprecate(
76156 /**
76157 * @deprecated
76158 * @this {ContextModule}
76159 * @param {ContextMode} value Context mode
76160 * @returns {void}
76161 */
76162 function(value) {
76163 this.options.mode = value;
76164 },
76165 "ContextModule.async has been moved to ContextModule.options.mode"
76166 )
76167});
76168
76169// TODO remove in webpack 5
76170Object.defineProperty(ContextModule.prototype, "chunkName", {
76171 configurable: false,
76172 get: util.deprecate(
76173 /**
76174 * @deprecated
76175 * @this {ContextModule}
76176 * @returns {string} chunk name
76177 */
76178 function() {
76179 return this.options.chunkName;
76180 },
76181 "ContextModule.chunkName has been moved to ContextModule.options.chunkName"
76182 ),
76183 set: util.deprecate(
76184 /**
76185 * @deprecated
76186 * @this {ContextModule}
76187 * @param {string} value chunk name
76188 * @returns {void}
76189 */
76190 function(value) {
76191 this.options.chunkName = value;
76192 },
76193 "ContextModule.chunkName has been moved to ContextModule.options.chunkName"
76194 )
76195});
76196
76197module.exports = ContextModule;
76198
76199
76200/***/ }),
76201
76202/***/ 88239:
76203/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
76204
76205"use strict";
76206/*
76207 MIT License http://www.opensource.org/licenses/mit-license.php
76208 Author Tobias Koppers @sokra
76209*/
76210
76211
76212const asyncLib = __webpack_require__(36386);
76213const path = __webpack_require__(85622);
76214
76215const {
76216 Tapable,
76217 AsyncSeriesWaterfallHook,
76218 SyncWaterfallHook
76219} = __webpack_require__(56758);
76220const ContextModule = __webpack_require__(20090);
76221const ContextElementDependency = __webpack_require__(89079);
76222
76223/** @typedef {import("./Module")} Module */
76224
76225const EMPTY_RESOLVE_OPTIONS = {};
76226
76227module.exports = class ContextModuleFactory extends Tapable {
76228 constructor(resolverFactory) {
76229 super();
76230 this.hooks = {
76231 /** @type {AsyncSeriesWaterfallHook<TODO>} */
76232 beforeResolve: new AsyncSeriesWaterfallHook(["data"]),
76233 /** @type {AsyncSeriesWaterfallHook<TODO>} */
76234 afterResolve: new AsyncSeriesWaterfallHook(["data"]),
76235 /** @type {SyncWaterfallHook<string[]>} */
76236 contextModuleFiles: new SyncWaterfallHook(["files"]),
76237 /** @type {SyncWaterfallHook<TODO[]>} */
76238 alternatives: new AsyncSeriesWaterfallHook(["modules"])
76239 };
76240 this._pluginCompat.tap("ContextModuleFactory", options => {
76241 switch (options.name) {
76242 case "before-resolve":
76243 case "after-resolve":
76244 case "alternatives":
76245 options.async = true;
76246 break;
76247 }
76248 });
76249 this.resolverFactory = resolverFactory;
76250 }
76251
76252 create(data, callback) {
76253 const context = data.context;
76254 const dependencies = data.dependencies;
76255 const resolveOptions = data.resolveOptions;
76256 const dependency = dependencies[0];
76257 this.hooks.beforeResolve.callAsync(
76258 Object.assign(
76259 {
76260 context: context,
76261 dependencies: dependencies,
76262 resolveOptions
76263 },
76264 dependency.options
76265 ),
76266 (err, beforeResolveResult) => {
76267 if (err) return callback(err);
76268
76269 // Ignored
76270 if (!beforeResolveResult) return callback();
76271
76272 const context = beforeResolveResult.context;
76273 const request = beforeResolveResult.request;
76274 const resolveOptions = beforeResolveResult.resolveOptions;
76275
76276 let loaders,
76277 resource,
76278 loadersPrefix = "";
76279 const idx = request.lastIndexOf("!");
76280 if (idx >= 0) {
76281 let loadersRequest = request.substr(0, idx + 1);
76282 let i;
76283 for (
76284 i = 0;
76285 i < loadersRequest.length && loadersRequest[i] === "!";
76286 i++
76287 ) {
76288 loadersPrefix += "!";
76289 }
76290 loadersRequest = loadersRequest
76291 .substr(i)
76292 .replace(/!+$/, "")
76293 .replace(/!!+/g, "!");
76294 if (loadersRequest === "") {
76295 loaders = [];
76296 } else {
76297 loaders = loadersRequest.split("!");
76298 }
76299 resource = request.substr(idx + 1);
76300 } else {
76301 loaders = [];
76302 resource = request;
76303 }
76304
76305 const contextResolver = this.resolverFactory.get(
76306 "context",
76307 resolveOptions || EMPTY_RESOLVE_OPTIONS
76308 );
76309 const loaderResolver = this.resolverFactory.get(
76310 "loader",
76311 EMPTY_RESOLVE_OPTIONS
76312 );
76313
76314 asyncLib.parallel(
76315 [
76316 callback => {
76317 contextResolver.resolve(
76318 {},
76319 context,
76320 resource,
76321 {},
76322 (err, result) => {
76323 if (err) return callback(err);
76324 callback(null, result);
76325 }
76326 );
76327 },
76328 callback => {
76329 asyncLib.map(
76330 loaders,
76331 (loader, callback) => {
76332 loaderResolver.resolve(
76333 {},
76334 context,
76335 loader,
76336 {},
76337 (err, result) => {
76338 if (err) return callback(err);
76339 callback(null, result);
76340 }
76341 );
76342 },
76343 callback
76344 );
76345 }
76346 ],
76347 (err, result) => {
76348 if (err) return callback(err);
76349
76350 this.hooks.afterResolve.callAsync(
76351 Object.assign(
76352 {
76353 addon:
76354 loadersPrefix +
76355 result[1].join("!") +
76356 (result[1].length > 0 ? "!" : ""),
76357 resource: result[0],
76358 resolveDependencies: this.resolveDependencies.bind(this)
76359 },
76360 beforeResolveResult
76361 ),
76362 (err, result) => {
76363 if (err) return callback(err);
76364
76365 // Ignored
76366 if (!result) return callback();
76367
76368 return callback(
76369 null,
76370 new ContextModule(result.resolveDependencies, result)
76371 );
76372 }
76373 );
76374 }
76375 );
76376 }
76377 );
76378 }
76379
76380 resolveDependencies(fs, options, callback) {
76381 const cmf = this;
76382 let resource = options.resource;
76383 let resourceQuery = options.resourceQuery;
76384 let recursive = options.recursive;
76385 let regExp = options.regExp;
76386 let include = options.include;
76387 let exclude = options.exclude;
76388 if (!regExp || !resource) return callback(null, []);
76389
76390 const addDirectory = (directory, callback) => {
76391 fs.readdir(directory, (err, files) => {
76392 if (err) return callback(err);
76393 files = cmf.hooks.contextModuleFiles.call(files);
76394 if (!files || files.length === 0) return callback(null, []);
76395 asyncLib.map(
76396 files.filter(p => p.indexOf(".") !== 0),
76397 (segment, callback) => {
76398 const subResource = path.join(directory, segment);
76399
76400 if (!exclude || !subResource.match(exclude)) {
76401 fs.stat(subResource, (err, stat) => {
76402 if (err) {
76403 if (err.code === "ENOENT") {
76404 // ENOENT is ok here because the file may have been deleted between
76405 // the readdir and stat calls.
76406 return callback();
76407 } else {
76408 return callback(err);
76409 }
76410 }
76411
76412 if (stat.isDirectory()) {
76413 if (!recursive) return callback();
76414 addDirectory.call(this, subResource, callback);
76415 } else if (
76416 stat.isFile() &&
76417 (!include || subResource.match(include))
76418 ) {
76419 const obj = {
76420 context: resource,
76421 request:
76422 "." +
76423 subResource.substr(resource.length).replace(/\\/g, "/")
76424 };
76425
76426 this.hooks.alternatives.callAsync(
76427 [obj],
76428 (err, alternatives) => {
76429 if (err) return callback(err);
76430 alternatives = alternatives
76431 .filter(obj => regExp.test(obj.request))
76432 .map(obj => {
76433 const dep = new ContextElementDependency(
76434 obj.request + resourceQuery,
76435 obj.request
76436 );
76437 dep.optional = true;
76438 return dep;
76439 });
76440 callback(null, alternatives);
76441 }
76442 );
76443 } else {
76444 callback();
76445 }
76446 });
76447 } else {
76448 callback();
76449 }
76450 },
76451 (err, result) => {
76452 if (err) return callback(err);
76453
76454 if (!result) return callback(null, []);
76455
76456 callback(
76457 null,
76458 result.filter(Boolean).reduce((a, i) => a.concat(i), [])
76459 );
76460 }
76461 );
76462 });
76463 };
76464
76465 addDirectory(resource, callback);
76466 }
76467};
76468
76469
76470/***/ }),
76471
76472/***/ 27295:
76473/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
76474
76475"use strict";
76476/*
76477 MIT License http://www.opensource.org/licenses/mit-license.php
76478 Author Tobias Koppers @sokra
76479*/
76480
76481
76482const path = __webpack_require__(85622);
76483const ContextElementDependency = __webpack_require__(89079);
76484
76485class ContextReplacementPlugin {
76486 constructor(
76487 resourceRegExp,
76488 newContentResource,
76489 newContentRecursive,
76490 newContentRegExp
76491 ) {
76492 this.resourceRegExp = resourceRegExp;
76493
76494 if (typeof newContentResource === "function") {
76495 this.newContentCallback = newContentResource;
76496 } else if (
76497 typeof newContentResource === "string" &&
76498 typeof newContentRecursive === "object"
76499 ) {
76500 this.newContentResource = newContentResource;
76501 this.newContentCreateContextMap = (fs, callback) => {
76502 callback(null, newContentRecursive);
76503 };
76504 } else if (
76505 typeof newContentResource === "string" &&
76506 typeof newContentRecursive === "function"
76507 ) {
76508 this.newContentResource = newContentResource;
76509 this.newContentCreateContextMap = newContentRecursive;
76510 } else {
76511 if (typeof newContentResource !== "string") {
76512 newContentRegExp = newContentRecursive;
76513 newContentRecursive = newContentResource;
76514 newContentResource = undefined;
76515 }
76516 if (typeof newContentRecursive !== "boolean") {
76517 newContentRegExp = newContentRecursive;
76518 newContentRecursive = undefined;
76519 }
76520 this.newContentResource = newContentResource;
76521 this.newContentRecursive = newContentRecursive;
76522 this.newContentRegExp = newContentRegExp;
76523 }
76524 }
76525
76526 apply(compiler) {
76527 const resourceRegExp = this.resourceRegExp;
76528 const newContentCallback = this.newContentCallback;
76529 const newContentResource = this.newContentResource;
76530 const newContentRecursive = this.newContentRecursive;
76531 const newContentRegExp = this.newContentRegExp;
76532 const newContentCreateContextMap = this.newContentCreateContextMap;
76533
76534 compiler.hooks.contextModuleFactory.tap("ContextReplacementPlugin", cmf => {
76535 cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => {
76536 if (!result) return;
76537 if (resourceRegExp.test(result.request)) {
76538 if (newContentResource !== undefined) {
76539 result.request = newContentResource;
76540 }
76541 if (newContentRecursive !== undefined) {
76542 result.recursive = newContentRecursive;
76543 }
76544 if (newContentRegExp !== undefined) {
76545 result.regExp = newContentRegExp;
76546 }
76547 if (typeof newContentCallback === "function") {
76548 newContentCallback(result);
76549 } else {
76550 for (const d of result.dependencies) {
76551 if (d.critical) d.critical = false;
76552 }
76553 }
76554 }
76555 return result;
76556 });
76557 cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => {
76558 if (!result) return;
76559 if (resourceRegExp.test(result.resource)) {
76560 if (newContentResource !== undefined) {
76561 result.resource = path.resolve(result.resource, newContentResource);
76562 }
76563 if (newContentRecursive !== undefined) {
76564 result.recursive = newContentRecursive;
76565 }
76566 if (newContentRegExp !== undefined) {
76567 result.regExp = newContentRegExp;
76568 }
76569 if (typeof newContentCreateContextMap === "function") {
76570 result.resolveDependencies = createResolveDependenciesFromContextMap(
76571 newContentCreateContextMap
76572 );
76573 }
76574 if (typeof newContentCallback === "function") {
76575 const origResource = result.resource;
76576 newContentCallback(result);
76577 if (result.resource !== origResource) {
76578 result.resource = path.resolve(origResource, result.resource);
76579 }
76580 } else {
76581 for (const d of result.dependencies) {
76582 if (d.critical) d.critical = false;
76583 }
76584 }
76585 }
76586 return result;
76587 });
76588 });
76589 }
76590}
76591
76592const createResolveDependenciesFromContextMap = createContextMap => {
76593 const resolveDependenciesFromContextMap = (fs, options, callback) => {
76594 createContextMap(fs, (err, map) => {
76595 if (err) return callback(err);
76596 const dependencies = Object.keys(map).map(key => {
76597 return new ContextElementDependency(
76598 map[key] + options.resourceQuery,
76599 key
76600 );
76601 });
76602 callback(null, dependencies);
76603 });
76604 };
76605 return resolveDependenciesFromContextMap;
76606};
76607
76608module.exports = ContextReplacementPlugin;
76609
76610
76611/***/ }),
76612
76613/***/ 97374:
76614/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
76615
76616"use strict";
76617/*
76618 MIT License http://www.opensource.org/licenses/mit-license.php
76619 Author Tobias Koppers @sokra
76620*/
76621
76622
76623const ConstDependency = __webpack_require__(71101);
76624const BasicEvaluatedExpression = __webpack_require__(96770);
76625const ParserHelpers = __webpack_require__(23999);
76626const NullFactory = __webpack_require__(40438);
76627
76628/** @typedef {import("./Compiler")} Compiler */
76629/** @typedef {import("./Parser")} Parser */
76630/** @typedef {null|undefined|RegExp|Function|string|number} CodeValuePrimitive */
76631/** @typedef {CodeValuePrimitive|Record<string, CodeValuePrimitive>|RuntimeValue} CodeValue */
76632
76633class RuntimeValue {
76634 constructor(fn, fileDependencies) {
76635 this.fn = fn;
76636 this.fileDependencies = fileDependencies || [];
76637 }
76638
76639 exec(parser) {
76640 if (this.fileDependencies === true) {
76641 parser.state.module.buildInfo.cacheable = false;
76642 } else {
76643 for (const fileDependency of this.fileDependencies) {
76644 parser.state.module.buildInfo.fileDependencies.add(fileDependency);
76645 }
76646 }
76647
76648 return this.fn({ module: parser.state.module });
76649 }
76650}
76651
76652const stringifyObj = (obj, parser) => {
76653 return (
76654 "Object({" +
76655 Object.keys(obj)
76656 .map(key => {
76657 const code = obj[key];
76658 return JSON.stringify(key) + ":" + toCode(code, parser);
76659 })
76660 .join(",") +
76661 "})"
76662 );
76663};
76664
76665/**
76666 * Convert code to a string that evaluates
76667 * @param {CodeValue} code Code to evaluate
76668 * @param {Parser} parser Parser
76669 * @returns {string} code converted to string that evaluates
76670 */
76671const toCode = (code, parser) => {
76672 if (code === null) {
76673 return "null";
76674 }
76675 if (code === undefined) {
76676 return "undefined";
76677 }
76678 if (code instanceof RuntimeValue) {
76679 return toCode(code.exec(parser), parser);
76680 }
76681 if (code instanceof RegExp && code.toString) {
76682 return code.toString();
76683 }
76684 if (typeof code === "function" && code.toString) {
76685 return "(" + code.toString() + ")";
76686 }
76687 if (typeof code === "object") {
76688 return stringifyObj(code, parser);
76689 }
76690 return code + "";
76691};
76692
76693class DefinePlugin {
76694 /**
76695 * Create a new define plugin
76696 * @param {Record<string, CodeValue>} definitions A map of global object definitions
76697 */
76698 constructor(definitions) {
76699 this.definitions = definitions;
76700 }
76701
76702 static runtimeValue(fn, fileDependencies) {
76703 return new RuntimeValue(fn, fileDependencies);
76704 }
76705
76706 /**
76707 * Apply the plugin
76708 * @param {Compiler} compiler Webpack compiler
76709 * @returns {void}
76710 */
76711 apply(compiler) {
76712 const definitions = this.definitions;
76713 compiler.hooks.compilation.tap(
76714 "DefinePlugin",
76715 (compilation, { normalModuleFactory }) => {
76716 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
76717 compilation.dependencyTemplates.set(
76718 ConstDependency,
76719 new ConstDependency.Template()
76720 );
76721
76722 /**
76723 * Handler
76724 * @param {Parser} parser Parser
76725 * @returns {void}
76726 */
76727 const handler = parser => {
76728 /**
76729 * Walk definitions
76730 * @param {Object} definitions Definitions map
76731 * @param {string} prefix Prefix string
76732 * @returns {void}
76733 */
76734 const walkDefinitions = (definitions, prefix) => {
76735 Object.keys(definitions).forEach(key => {
76736 const code = definitions[key];
76737 if (
76738 code &&
76739 typeof code === "object" &&
76740 !(code instanceof RuntimeValue) &&
76741 !(code instanceof RegExp)
76742 ) {
76743 walkDefinitions(code, prefix + key + ".");
76744 applyObjectDefine(prefix + key, code);
76745 return;
76746 }
76747 applyDefineKey(prefix, key);
76748 applyDefine(prefix + key, code);
76749 });
76750 };
76751
76752 /**
76753 * Apply define key
76754 * @param {string} prefix Prefix
76755 * @param {string} key Key
76756 * @returns {void}
76757 */
76758 const applyDefineKey = (prefix, key) => {
76759 const splittedKey = key.split(".");
76760 splittedKey.slice(1).forEach((_, i) => {
76761 const fullKey = prefix + splittedKey.slice(0, i + 1).join(".");
76762 parser.hooks.canRename
76763 .for(fullKey)
76764 .tap("DefinePlugin", ParserHelpers.approve);
76765 });
76766 };
76767
76768 /**
76769 * Apply Code
76770 * @param {string} key Key
76771 * @param {CodeValue} code Code
76772 * @returns {void}
76773 */
76774 const applyDefine = (key, code) => {
76775 const isTypeof = /^typeof\s+/.test(key);
76776 if (isTypeof) key = key.replace(/^typeof\s+/, "");
76777 let recurse = false;
76778 let recurseTypeof = false;
76779 if (!isTypeof) {
76780 parser.hooks.canRename
76781 .for(key)
76782 .tap("DefinePlugin", ParserHelpers.approve);
76783 parser.hooks.evaluateIdentifier
76784 .for(key)
76785 .tap("DefinePlugin", expr => {
76786 /**
76787 * this is needed in case there is a recursion in the DefinePlugin
76788 * to prevent an endless recursion
76789 * e.g.: new DefinePlugin({
76790 * "a": "b",
76791 * "b": "a"
76792 * });
76793 */
76794 if (recurse) return;
76795 recurse = true;
76796 const res = parser.evaluate(toCode(code, parser));
76797 recurse = false;
76798 res.setRange(expr.range);
76799 return res;
76800 });
76801 parser.hooks.expression.for(key).tap("DefinePlugin", expr => {
76802 const strCode = toCode(code, parser);
76803 if (/__webpack_require__/.test(strCode)) {
76804 return ParserHelpers.toConstantDependencyWithWebpackRequire(
76805 parser,
76806 strCode
76807 )(expr);
76808 } else {
76809 return ParserHelpers.toConstantDependency(
76810 parser,
76811 strCode
76812 )(expr);
76813 }
76814 });
76815 }
76816 parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => {
76817 /**
76818 * this is needed in case there is a recursion in the DefinePlugin
76819 * to prevent an endless recursion
76820 * e.g.: new DefinePlugin({
76821 * "typeof a": "typeof b",
76822 * "typeof b": "typeof a"
76823 * });
76824 */
76825 if (recurseTypeof) return;
76826 recurseTypeof = true;
76827 const typeofCode = isTypeof
76828 ? toCode(code, parser)
76829 : "typeof (" + toCode(code, parser) + ")";
76830 const res = parser.evaluate(typeofCode);
76831 recurseTypeof = false;
76832 res.setRange(expr.range);
76833 return res;
76834 });
76835 parser.hooks.typeof.for(key).tap("DefinePlugin", expr => {
76836 const typeofCode = isTypeof
76837 ? toCode(code, parser)
76838 : "typeof (" + toCode(code, parser) + ")";
76839 const res = parser.evaluate(typeofCode);
76840 if (!res.isString()) return;
76841 return ParserHelpers.toConstantDependency(
76842 parser,
76843 JSON.stringify(res.string)
76844 ).bind(parser)(expr);
76845 });
76846 };
76847
76848 /**
76849 * Apply Object
76850 * @param {string} key Key
76851 * @param {Object} obj Object
76852 * @returns {void}
76853 */
76854 const applyObjectDefine = (key, obj) => {
76855 parser.hooks.canRename
76856 .for(key)
76857 .tap("DefinePlugin", ParserHelpers.approve);
76858 parser.hooks.evaluateIdentifier
76859 .for(key)
76860 .tap("DefinePlugin", expr =>
76861 new BasicEvaluatedExpression().setTruthy().setRange(expr.range)
76862 );
76863 parser.hooks.evaluateTypeof.for(key).tap("DefinePlugin", expr => {
76864 return ParserHelpers.evaluateToString("object")(expr);
76865 });
76866 parser.hooks.expression.for(key).tap("DefinePlugin", expr => {
76867 const strCode = stringifyObj(obj, parser);
76868
76869 if (/__webpack_require__/.test(strCode)) {
76870 return ParserHelpers.toConstantDependencyWithWebpackRequire(
76871 parser,
76872 strCode
76873 )(expr);
76874 } else {
76875 return ParserHelpers.toConstantDependency(
76876 parser,
76877 strCode
76878 )(expr);
76879 }
76880 });
76881 parser.hooks.typeof.for(key).tap("DefinePlugin", expr => {
76882 return ParserHelpers.toConstantDependency(
76883 parser,
76884 JSON.stringify("object")
76885 )(expr);
76886 });
76887 };
76888
76889 walkDefinitions(definitions, "");
76890 };
76891
76892 normalModuleFactory.hooks.parser
76893 .for("javascript/auto")
76894 .tap("DefinePlugin", handler);
76895 normalModuleFactory.hooks.parser
76896 .for("javascript/dynamic")
76897 .tap("DefinePlugin", handler);
76898 normalModuleFactory.hooks.parser
76899 .for("javascript/esm")
76900 .tap("DefinePlugin", handler);
76901 }
76902 );
76903 }
76904}
76905module.exports = DefinePlugin;
76906
76907
76908/***/ }),
76909
76910/***/ 42173:
76911/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
76912
76913"use strict";
76914/*
76915 MIT License http://www.opensource.org/licenses/mit-license.php
76916 Author Tobias Koppers @sokra
76917*/
76918
76919
76920const { OriginalSource, RawSource } = __webpack_require__(53665);
76921
76922const Module = __webpack_require__(75993);
76923const WebpackMissingModule = __webpack_require__(75386);
76924const DelegatedSourceDependency = __webpack_require__(25930);
76925const DelegatedExportsDependency = __webpack_require__(53104);
76926
76927/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
76928/** @typedef {import("./util/createHash").Hash} Hash */
76929
76930class DelegatedModule extends Module {
76931 constructor(sourceRequest, data, type, userRequest, originalRequest) {
76932 super("javascript/dynamic", null);
76933
76934 // Info from Factory
76935 this.sourceRequest = sourceRequest;
76936 this.request = data.id;
76937 this.type = type;
76938 this.userRequest = userRequest;
76939 this.originalRequest = originalRequest;
76940 this.delegateData = data;
76941
76942 // Build info
76943 this.delegatedSourceDependency = undefined;
76944 }
76945
76946 libIdent(options) {
76947 return typeof this.originalRequest === "string"
76948 ? this.originalRequest
76949 : this.originalRequest.libIdent(options);
76950 }
76951
76952 identifier() {
76953 return `delegated ${JSON.stringify(this.request)} from ${
76954 this.sourceRequest
76955 }`;
76956 }
76957
76958 readableIdentifier() {
76959 return `delegated ${this.userRequest} from ${this.sourceRequest}`;
76960 }
76961
76962 needRebuild() {
76963 return false;
76964 }
76965
76966 build(options, compilation, resolver, fs, callback) {
76967 this.built = true;
76968 this.buildMeta = Object.assign({}, this.delegateData.buildMeta);
76969 this.buildInfo = {};
76970 this.delegatedSourceDependency = new DelegatedSourceDependency(
76971 this.sourceRequest
76972 );
76973 this.addDependency(this.delegatedSourceDependency);
76974 this.addDependency(
76975 new DelegatedExportsDependency(this, this.delegateData.exports || true)
76976 );
76977 callback();
76978 }
76979
76980 source(depTemplates, runtime) {
76981 const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]);
76982 const sourceModule = dep.module;
76983 let str;
76984
76985 if (!sourceModule) {
76986 str = WebpackMissingModule.moduleCode(this.sourceRequest);
76987 } else {
76988 str = `module.exports = (${runtime.moduleExports({
76989 module: sourceModule,
76990 request: dep.request
76991 })})`;
76992
76993 switch (this.type) {
76994 case "require":
76995 str += `(${JSON.stringify(this.request)})`;
76996 break;
76997 case "object":
76998 str += `[${JSON.stringify(this.request)}]`;
76999 break;
77000 }
77001
77002 str += ";";
77003 }
77004
77005 if (this.useSourceMap) {
77006 return new OriginalSource(str, this.identifier());
77007 } else {
77008 return new RawSource(str);
77009 }
77010 }
77011
77012 size() {
77013 return 42;
77014 }
77015
77016 /**
77017 * @param {Hash} hash the hash used to track dependencies
77018 * @returns {void}
77019 */
77020 updateHash(hash) {
77021 hash.update(this.type);
77022 hash.update(JSON.stringify(this.request));
77023 super.updateHash(hash);
77024 }
77025}
77026
77027module.exports = DelegatedModule;
77028
77029
77030/***/ }),
77031
77032/***/ 81002:
77033/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77034
77035"use strict";
77036/*
77037 MIT License http://www.opensource.org/licenses/mit-license.php
77038 Author Tobias Koppers @sokra
77039*/
77040
77041
77042const DelegatedModule = __webpack_require__(42173);
77043
77044// options.source
77045// options.type
77046// options.context
77047// options.scope
77048// options.content
77049class DelegatedModuleFactoryPlugin {
77050 constructor(options) {
77051 this.options = options;
77052 options.type = options.type || "require";
77053 options.extensions = options.extensions || [
77054 "",
77055 ".wasm",
77056 ".mjs",
77057 ".js",
77058 ".json"
77059 ];
77060 }
77061
77062 apply(normalModuleFactory) {
77063 const scope = this.options.scope;
77064 if (scope) {
77065 normalModuleFactory.hooks.factory.tap(
77066 "DelegatedModuleFactoryPlugin",
77067 factory => (data, callback) => {
77068 const dependency = data.dependencies[0];
77069 const request = dependency.request;
77070 if (request && request.indexOf(scope + "/") === 0) {
77071 const innerRequest = "." + request.substr(scope.length);
77072 let resolved;
77073 if (innerRequest in this.options.content) {
77074 resolved = this.options.content[innerRequest];
77075 return callback(
77076 null,
77077 new DelegatedModule(
77078 this.options.source,
77079 resolved,
77080 this.options.type,
77081 innerRequest,
77082 request
77083 )
77084 );
77085 }
77086 for (let i = 0; i < this.options.extensions.length; i++) {
77087 const extension = this.options.extensions[i];
77088 const requestPlusExt = innerRequest + extension;
77089 if (requestPlusExt in this.options.content) {
77090 resolved = this.options.content[requestPlusExt];
77091 return callback(
77092 null,
77093 new DelegatedModule(
77094 this.options.source,
77095 resolved,
77096 this.options.type,
77097 requestPlusExt,
77098 request + extension
77099 )
77100 );
77101 }
77102 }
77103 }
77104 return factory(data, callback);
77105 }
77106 );
77107 } else {
77108 normalModuleFactory.hooks.module.tap(
77109 "DelegatedModuleFactoryPlugin",
77110 module => {
77111 if (module.libIdent) {
77112 const request = module.libIdent(this.options);
77113 if (request && request in this.options.content) {
77114 const resolved = this.options.content[request];
77115 return new DelegatedModule(
77116 this.options.source,
77117 resolved,
77118 this.options.type,
77119 request,
77120 module
77121 );
77122 }
77123 }
77124 return module;
77125 }
77126 );
77127 }
77128 }
77129}
77130module.exports = DelegatedModuleFactoryPlugin;
77131
77132
77133/***/ }),
77134
77135/***/ 16071:
77136/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77137
77138"use strict";
77139/*
77140 MIT License http://www.opensource.org/licenses/mit-license.php
77141 Author Tobias Koppers @sokra
77142 */
77143
77144
77145const DependenciesBlockVariable = __webpack_require__(82904);
77146
77147/** @typedef {import("./ChunkGroup")} ChunkGroup */
77148/** @typedef {import("./Dependency")} Dependency */
77149/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
77150/** @typedef {import("./DependenciesBlockVariable")} DependenciesBlockVariable */
77151/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */
77152/** @typedef {import("./util/createHash").Hash} Hash */
77153
77154class DependenciesBlock {
77155 constructor() {
77156 /** @type {Dependency[]} */
77157 this.dependencies = [];
77158 /** @type {AsyncDependenciesBlock[]} */
77159 this.blocks = [];
77160 /** @type {DependenciesBlockVariable[]} */
77161 this.variables = [];
77162 }
77163
77164 /**
77165 * Adds a DependencyBlock to DependencyBlock relationship.
77166 * This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting)
77167 *
77168 * @param {AsyncDependenciesBlock} block block being added
77169 * @returns {void}
77170 */
77171 addBlock(block) {
77172 this.blocks.push(block);
77173 block.parent = this;
77174 }
77175
77176 /**
77177 * @param {string} name name of dependency
77178 * @param {string} expression expression string for variable
77179 * @param {Dependency[]} dependencies dependency instances tied to variable
77180 * @returns {void}
77181 */
77182 addVariable(name, expression, dependencies) {
77183 for (let v of this.variables) {
77184 if (v.name === name && v.expression === expression) {
77185 return;
77186 }
77187 }
77188 this.variables.push(
77189 new DependenciesBlockVariable(name, expression, dependencies)
77190 );
77191 }
77192
77193 /**
77194 * @param {Dependency} dependency dependency being tied to block.
77195 * This is an "edge" pointing to another "node" on module graph.
77196 * @returns {void}
77197 */
77198 addDependency(dependency) {
77199 this.dependencies.push(dependency);
77200 }
77201
77202 /**
77203 * @param {Dependency} dependency dependency being removed
77204 * @returns {void}
77205 */
77206 removeDependency(dependency) {
77207 const idx = this.dependencies.indexOf(dependency);
77208 if (idx >= 0) {
77209 this.dependencies.splice(idx, 1);
77210 }
77211 }
77212
77213 /**
77214 * @param {Hash} hash the hash used to track dependencies
77215 * @returns {void}
77216 */
77217 updateHash(hash) {
77218 for (const dep of this.dependencies) dep.updateHash(hash);
77219 for (const block of this.blocks) block.updateHash(hash);
77220 for (const variable of this.variables) variable.updateHash(hash);
77221 }
77222
77223 disconnect() {
77224 for (const dep of this.dependencies) dep.disconnect();
77225 for (const block of this.blocks) block.disconnect();
77226 for (const variable of this.variables) variable.disconnect();
77227 }
77228
77229 unseal() {
77230 for (const block of this.blocks) block.unseal();
77231 }
77232
77233 /**
77234 * @param {DependencyFilterFunction} filter filter function for dependencies, gets passed all dependency ties from current instance
77235 * @returns {boolean} returns boolean for filter
77236 */
77237 hasDependencies(filter) {
77238 if (filter) {
77239 for (const dep of this.dependencies) {
77240 if (filter(dep)) return true;
77241 }
77242 } else {
77243 if (this.dependencies.length > 0) {
77244 return true;
77245 }
77246 }
77247
77248 for (const block of this.blocks) {
77249 if (block.hasDependencies(filter)) return true;
77250 }
77251 for (const variable of this.variables) {
77252 if (variable.hasDependencies(filter)) return true;
77253 }
77254 return false;
77255 }
77256
77257 sortItems() {
77258 for (const block of this.blocks) block.sortItems();
77259 }
77260}
77261
77262module.exports = DependenciesBlock;
77263
77264
77265/***/ }),
77266
77267/***/ 82904:
77268/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77269
77270"use strict";
77271/*
77272 MIT License http://www.opensource.org/licenses/mit-license.php
77273 Author Tobias Koppers @sokra
77274*/
77275
77276
77277const { RawSource, ReplaceSource } = __webpack_require__(53665);
77278
77279/** @typedef {import("./Dependency")} Dependency */
77280/** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate */
77281/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
77282/** @typedef {import("./util/createHash").Hash} Hash */
77283/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */
77284/** @typedef {Map<Function, DependencyTemplate>} DependencyTemplates */
77285
77286class DependenciesBlockVariable {
77287 /**
77288 * Creates an instance of DependenciesBlockVariable.
77289 * @param {string} name name of DependenciesBlockVariable
77290 * @param {string} expression expression string
77291 * @param {Dependency[]=} dependencies dependencies tied to this varaiable
77292 */
77293 constructor(name, expression, dependencies) {
77294 this.name = name;
77295 this.expression = expression;
77296 this.dependencies = dependencies || [];
77297 }
77298
77299 /**
77300 * @param {Hash} hash hash for instance to update
77301 * @returns {void}
77302 */
77303 updateHash(hash) {
77304 hash.update(this.name);
77305 hash.update(this.expression);
77306 for (const d of this.dependencies) {
77307 d.updateHash(hash);
77308 }
77309 }
77310
77311 /**
77312 * @param {DependencyTemplates} dependencyTemplates Dependency constructors and templates Map.
77313 * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate to generate expression souce
77314 * @returns {ReplaceSource} returns constructed source for expression via templates
77315 */
77316 expressionSource(dependencyTemplates, runtimeTemplate) {
77317 const source = new ReplaceSource(new RawSource(this.expression));
77318 for (const dep of this.dependencies) {
77319 const template = dependencyTemplates.get(dep.constructor);
77320 if (!template) {
77321 throw new Error(`No template for dependency: ${dep.constructor.name}`);
77322 }
77323 template.apply(dep, source, runtimeTemplate, dependencyTemplates);
77324 }
77325 return source;
77326 }
77327
77328 disconnect() {
77329 for (const d of this.dependencies) {
77330 d.disconnect();
77331 }
77332 }
77333
77334 hasDependencies(filter) {
77335 if (filter) {
77336 return this.dependencies.some(filter);
77337 }
77338 return this.dependencies.length > 0;
77339 }
77340}
77341
77342module.exports = DependenciesBlockVariable;
77343
77344
77345/***/ }),
77346
77347/***/ 57282:
77348/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77349
77350"use strict";
77351/*
77352 MIT License http://www.opensource.org/licenses/mit-license.php
77353 Author Tobias Koppers @sokra
77354*/
77355
77356
77357const util = __webpack_require__(31669);
77358const compareLocations = __webpack_require__(22562);
77359const DependencyReference = __webpack_require__(71722);
77360
77361/** @typedef {import("./Module")} Module */
77362/** @typedef {import("webpack-sources").Source} Source */
77363/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
77364
77365/**
77366 * @typedef {Object} DependencyTemplate
77367 * @property {function(Dependency, Source, RuntimeTemplate, Map<Function, DependencyTemplate>): void} apply
77368 */
77369
77370/** @typedef {Object} SourcePosition
77371 * @property {number} line
77372 * @property {number=} column
77373 */
77374
77375/** @typedef {Object} RealDependencyLocation
77376 * @property {SourcePosition} start
77377 * @property {SourcePosition=} end
77378 * @property {number=} index
77379 */
77380
77381/** @typedef {Object} SynteticDependencyLocation
77382 * @property {string} name
77383 * @property {number=} index
77384 */
77385
77386/** @typedef {SynteticDependencyLocation|RealDependencyLocation} DependencyLocation */
77387
77388class Dependency {
77389 constructor() {
77390 /** @type {Module|null} */
77391 this.module = null;
77392 // TODO remove in webpack 5
77393 /** @type {boolean} */
77394 this.weak = false;
77395 /** @type {boolean} */
77396 this.optional = false;
77397 /** @type {DependencyLocation} */
77398 this.loc = undefined;
77399 }
77400
77401 getResourceIdentifier() {
77402 return null;
77403 }
77404
77405 // Returns the referenced module and export
77406 getReference() {
77407 if (!this.module) return null;
77408 return new DependencyReference(this.module, true, this.weak);
77409 }
77410
77411 // Returns the exported names
77412 getExports() {
77413 return null;
77414 }
77415
77416 getWarnings() {
77417 return null;
77418 }
77419
77420 getErrors() {
77421 return null;
77422 }
77423
77424 updateHash(hash) {
77425 hash.update((this.module && this.module.id) + "");
77426 }
77427
77428 disconnect() {
77429 this.module = null;
77430 }
77431}
77432
77433// TODO remove in webpack 5
77434Dependency.compare = util.deprecate(
77435 (a, b) => compareLocations(a.loc, b.loc),
77436 "Dependency.compare is deprecated and will be removed in the next major version"
77437);
77438
77439module.exports = Dependency;
77440
77441
77442/***/ }),
77443
77444/***/ 6659:
77445/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77446
77447"use strict";
77448/*
77449 MIT License http://www.opensource.org/licenses/mit-license.php
77450 Author Tobias Koppers @sokra
77451*/
77452
77453
77454const DllEntryDependency = __webpack_require__(66279);
77455const SingleEntryDependency = __webpack_require__(84828);
77456const DllModuleFactory = __webpack_require__(62468);
77457
77458class DllEntryPlugin {
77459 constructor(context, entries, name) {
77460 this.context = context;
77461 this.entries = entries;
77462 this.name = name;
77463 }
77464
77465 apply(compiler) {
77466 compiler.hooks.compilation.tap(
77467 "DllEntryPlugin",
77468 (compilation, { normalModuleFactory }) => {
77469 const dllModuleFactory = new DllModuleFactory();
77470 compilation.dependencyFactories.set(
77471 DllEntryDependency,
77472 dllModuleFactory
77473 );
77474 compilation.dependencyFactories.set(
77475 SingleEntryDependency,
77476 normalModuleFactory
77477 );
77478 }
77479 );
77480 compiler.hooks.make.tapAsync("DllEntryPlugin", (compilation, callback) => {
77481 compilation.addEntry(
77482 this.context,
77483 new DllEntryDependency(
77484 this.entries.map((e, idx) => {
77485 const dep = new SingleEntryDependency(e);
77486 dep.loc = {
77487 name: this.name,
77488 index: idx
77489 };
77490 return dep;
77491 }),
77492 this.name
77493 ),
77494 this.name,
77495 callback
77496 );
77497 });
77498 }
77499}
77500
77501module.exports = DllEntryPlugin;
77502
77503
77504/***/ }),
77505
77506/***/ 24803:
77507/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77508
77509"use strict";
77510/*
77511 MIT License http://www.opensource.org/licenses/mit-license.php
77512 Author Tobias Koppers @sokra
77513 */
77514
77515
77516const { RawSource } = __webpack_require__(53665);
77517const Module = __webpack_require__(75993);
77518
77519/** @typedef {import("./util/createHash").Hash} Hash */
77520
77521class DllModule extends Module {
77522 constructor(context, dependencies, name, type) {
77523 super("javascript/dynamic", context);
77524
77525 // Info from Factory
77526 this.dependencies = dependencies;
77527 this.name = name;
77528 this.type = type;
77529 }
77530
77531 identifier() {
77532 return `dll ${this.name}`;
77533 }
77534
77535 readableIdentifier() {
77536 return `dll ${this.name}`;
77537 }
77538
77539 build(options, compilation, resolver, fs, callback) {
77540 this.built = true;
77541 this.buildMeta = {};
77542 this.buildInfo = {};
77543 return callback();
77544 }
77545
77546 source() {
77547 return new RawSource("module.exports = __webpack_require__;");
77548 }
77549
77550 needRebuild() {
77551 return false;
77552 }
77553
77554 size() {
77555 return 12;
77556 }
77557
77558 /**
77559 * @param {Hash} hash the hash used to track dependencies
77560 * @returns {void}
77561 */
77562 updateHash(hash) {
77563 hash.update("dll module");
77564 hash.update(this.name || "");
77565 super.updateHash(hash);
77566 }
77567}
77568
77569module.exports = DllModule;
77570
77571
77572/***/ }),
77573
77574/***/ 62468:
77575/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77576
77577"use strict";
77578/*
77579 MIT License http://www.opensource.org/licenses/mit-license.php
77580 Author Tobias Koppers @sokra
77581*/
77582
77583
77584const { Tapable } = __webpack_require__(56758);
77585const DllModule = __webpack_require__(24803);
77586
77587class DllModuleFactory extends Tapable {
77588 constructor() {
77589 super();
77590 this.hooks = {};
77591 }
77592 create(data, callback) {
77593 const dependency = data.dependencies[0];
77594 callback(
77595 null,
77596 new DllModule(
77597 data.context,
77598 dependency.dependencies,
77599 dependency.name,
77600 dependency.type
77601 )
77602 );
77603 }
77604}
77605
77606module.exports = DllModuleFactory;
77607
77608
77609/***/ }),
77610
77611/***/ 45255:
77612/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77613
77614"use strict";
77615/*
77616 MIT License http://www.opensource.org/licenses/mit-license.php
77617 Author Tobias Koppers @sokra
77618 */
77619
77620
77621const DllEntryPlugin = __webpack_require__(6659);
77622const FlagAllModulesAsUsedPlugin = __webpack_require__(47163);
77623const LibManifestPlugin = __webpack_require__(30735);
77624
77625const validateOptions = __webpack_require__(33225);
77626const schema = __webpack_require__(7303);
77627
77628/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */
77629
77630class DllPlugin {
77631 /**
77632 * @param {DllPluginOptions} options options object
77633 */
77634 constructor(options) {
77635 validateOptions(schema, options, "Dll Plugin");
77636 this.options = options;
77637 }
77638
77639 apply(compiler) {
77640 compiler.hooks.entryOption.tap("DllPlugin", (context, entry) => {
77641 const itemToPlugin = (item, name) => {
77642 if (Array.isArray(item)) {
77643 return new DllEntryPlugin(context, item, name);
77644 }
77645 throw new Error("DllPlugin: supply an Array as entry");
77646 };
77647 if (typeof entry === "object" && !Array.isArray(entry)) {
77648 Object.keys(entry).forEach(name => {
77649 itemToPlugin(entry[name], name).apply(compiler);
77650 });
77651 } else {
77652 itemToPlugin(entry, "main").apply(compiler);
77653 }
77654 return true;
77655 });
77656 new LibManifestPlugin(this.options).apply(compiler);
77657 if (!this.options.entryOnly) {
77658 new FlagAllModulesAsUsedPlugin("DllPlugin").apply(compiler);
77659 }
77660 }
77661}
77662
77663module.exports = DllPlugin;
77664
77665
77666/***/ }),
77667
77668/***/ 86231:
77669/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77670
77671"use strict";
77672/*
77673 MIT License http://www.opensource.org/licenses/mit-license.php
77674 Author Tobias Koppers @sokra
77675*/
77676
77677
77678const parseJson = __webpack_require__(48335);
77679const DelegatedSourceDependency = __webpack_require__(25930);
77680const DelegatedModuleFactoryPlugin = __webpack_require__(81002);
77681const ExternalModuleFactoryPlugin = __webpack_require__(67876);
77682const DelegatedExportsDependency = __webpack_require__(53104);
77683const NullFactory = __webpack_require__(40438);
77684const makePathsRelative = __webpack_require__(94658).makePathsRelative;
77685const WebpackError = __webpack_require__(97391);
77686
77687const validateOptions = __webpack_require__(33225);
77688const schema = __webpack_require__(61112);
77689
77690/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
77691/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
77692
77693class DllReferencePlugin {
77694 /**
77695 * @param {DllReferencePluginOptions} options options object
77696 */
77697 constructor(options) {
77698 validateOptions(schema, options, "Dll Reference Plugin");
77699 this.options = options;
77700 }
77701
77702 apply(compiler) {
77703 compiler.hooks.compilation.tap(
77704 "DllReferencePlugin",
77705 (compilation, { normalModuleFactory }) => {
77706 compilation.dependencyFactories.set(
77707 DelegatedSourceDependency,
77708 normalModuleFactory
77709 );
77710 compilation.dependencyFactories.set(
77711 DelegatedExportsDependency,
77712 new NullFactory()
77713 );
77714 }
77715 );
77716
77717 compiler.hooks.beforeCompile.tapAsync(
77718 "DllReferencePlugin",
77719 (params, callback) => {
77720 if ("manifest" in this.options) {
77721 const manifest = this.options.manifest;
77722 if (typeof manifest === "string") {
77723 params.compilationDependencies.add(manifest);
77724 compiler.inputFileSystem.readFile(manifest, (err, result) => {
77725 if (err) return callback(err);
77726 // Catch errors parsing the manifest so that blank
77727 // or malformed manifest files don't kill the process.
77728 try {
77729 params["dll reference " + manifest] = parseJson(
77730 result.toString("utf-8")
77731 );
77732 } catch (e) {
77733 // Store the error in the params so that it can
77734 // be added as a compilation error later on.
77735 const manifestPath = makePathsRelative(
77736 compiler.options.context,
77737 manifest
77738 );
77739 params[
77740 "dll reference parse error " + manifest
77741 ] = new DllManifestError(manifestPath, e.message);
77742 }
77743 return callback();
77744 });
77745 return;
77746 }
77747 }
77748 return callback();
77749 }
77750 );
77751
77752 compiler.hooks.compile.tap("DllReferencePlugin", params => {
77753 let name = this.options.name;
77754 let sourceType = this.options.sourceType;
77755 let content =
77756 "content" in this.options ? this.options.content : undefined;
77757 if ("manifest" in this.options) {
77758 let manifestParameter = this.options.manifest;
77759 let manifest;
77760 if (typeof manifestParameter === "string") {
77761 // If there was an error parsing the manifest
77762 // file, exit now because the error will be added
77763 // as a compilation error in the "compilation" hook.
77764 if (params["dll reference parse error " + manifestParameter]) {
77765 return;
77766 }
77767 manifest =
77768 /** @type {DllReferencePluginOptionsManifest} */ (params[
77769 "dll reference " + manifestParameter
77770 ]);
77771 } else {
77772 manifest = manifestParameter;
77773 }
77774 if (manifest) {
77775 if (!name) name = manifest.name;
77776 if (!sourceType) sourceType = manifest.type;
77777 if (!content) content = manifest.content;
77778 }
77779 }
77780 const externals = {};
77781 const source = "dll-reference " + name;
77782 externals[source] = name;
77783 const normalModuleFactory = params.normalModuleFactory;
77784 new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply(
77785 normalModuleFactory
77786 );
77787 new DelegatedModuleFactoryPlugin({
77788 source: source,
77789 type: this.options.type,
77790 scope: this.options.scope,
77791 context: this.options.context || compiler.options.context,
77792 content,
77793 extensions: this.options.extensions
77794 }).apply(normalModuleFactory);
77795 });
77796
77797 compiler.hooks.compilation.tap(
77798 "DllReferencePlugin",
77799 (compilation, params) => {
77800 if ("manifest" in this.options) {
77801 let manifest = this.options.manifest;
77802 if (typeof manifest === "string") {
77803 // If there was an error parsing the manifest file, add the
77804 // error as a compilation error to make the compilation fail.
77805 let e = params["dll reference parse error " + manifest];
77806 if (e) {
77807 compilation.errors.push(e);
77808 }
77809 }
77810 }
77811 }
77812 );
77813 }
77814}
77815
77816class DllManifestError extends WebpackError {
77817 constructor(filename, message) {
77818 super();
77819
77820 this.name = "DllManifestError";
77821 this.message = `Dll manifest ${filename}\n${message}`;
77822
77823 Error.captureStackTrace(this, this.constructor);
77824 }
77825}
77826
77827module.exports = DllReferencePlugin;
77828
77829
77830/***/ }),
77831
77832/***/ 49784:
77833/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77834
77835"use strict";
77836/*
77837 MIT License http://www.opensource.org/licenses/mit-license.php
77838 Author Naoyuki Kanezawa @nkzawa
77839*/
77840
77841
77842const MultiEntryDependency = __webpack_require__(7791);
77843const SingleEntryDependency = __webpack_require__(84828);
77844const MultiModuleFactory = __webpack_require__(24005);
77845const MultiEntryPlugin = __webpack_require__(98046);
77846const SingleEntryPlugin = __webpack_require__(19070);
77847
77848/** @typedef {import("../declarations/WebpackOptions").EntryDynamic} EntryDynamic */
77849/** @typedef {import("../declarations/WebpackOptions").EntryStatic} EntryStatic */
77850/** @typedef {import("./Compiler")} Compiler */
77851
77852class DynamicEntryPlugin {
77853 /**
77854 * @param {string} context the context path
77855 * @param {EntryDynamic} entry the entry value
77856 */
77857 constructor(context, entry) {
77858 this.context = context;
77859 this.entry = entry;
77860 }
77861
77862 /**
77863 * @param {Compiler} compiler the compiler instance
77864 * @returns {void}
77865 */
77866 apply(compiler) {
77867 compiler.hooks.compilation.tap(
77868 "DynamicEntryPlugin",
77869 (compilation, { normalModuleFactory }) => {
77870 const multiModuleFactory = new MultiModuleFactory();
77871
77872 compilation.dependencyFactories.set(
77873 MultiEntryDependency,
77874 multiModuleFactory
77875 );
77876 compilation.dependencyFactories.set(
77877 SingleEntryDependency,
77878 normalModuleFactory
77879 );
77880 }
77881 );
77882
77883 compiler.hooks.make.tapAsync(
77884 "DynamicEntryPlugin",
77885 (compilation, callback) => {
77886 /**
77887 * @param {string|string[]} entry entry value or array of entry values
77888 * @param {string} name name of entry
77889 * @returns {Promise<EntryStatic>} returns the promise resolving the Compilation#addEntry function
77890 */
77891 const addEntry = (entry, name) => {
77892 const dep = DynamicEntryPlugin.createDependency(entry, name);
77893 return new Promise((resolve, reject) => {
77894 compilation.addEntry(this.context, dep, name, err => {
77895 if (err) return reject(err);
77896 resolve();
77897 });
77898 });
77899 };
77900
77901 Promise.resolve(this.entry()).then(entry => {
77902 if (typeof entry === "string" || Array.isArray(entry)) {
77903 addEntry(entry, "main").then(() => callback(), callback);
77904 } else if (typeof entry === "object") {
77905 Promise.all(
77906 Object.keys(entry).map(name => {
77907 return addEntry(entry[name], name);
77908 })
77909 ).then(() => callback(), callback);
77910 }
77911 });
77912 }
77913 );
77914 }
77915}
77916
77917module.exports = DynamicEntryPlugin;
77918/**
77919 * @param {string|string[]} entry entry value or array of entry paths
77920 * @param {string} name name of entry
77921 * @returns {SingleEntryDependency|MultiEntryDependency} returns dep
77922 */
77923DynamicEntryPlugin.createDependency = (entry, name) => {
77924 if (Array.isArray(entry)) {
77925 return MultiEntryPlugin.createDependency(entry, name);
77926 } else {
77927 return SingleEntryPlugin.createDependency(entry, name);
77928 }
77929};
77930
77931
77932/***/ }),
77933
77934/***/ 99531:
77935/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77936
77937"use strict";
77938/*
77939 MIT License http://www.opensource.org/licenses/mit-license.php
77940 Author Tobias Koppers @sokra
77941*/
77942
77943
77944const WebpackError = __webpack_require__(97391);
77945
77946class EntryModuleNotFoundError extends WebpackError {
77947 constructor(err) {
77948 super("Entry module not found: " + err);
77949
77950 this.name = "EntryModuleNotFoundError";
77951 this.details = err.details;
77952 this.error = err;
77953
77954 Error.captureStackTrace(this, this.constructor);
77955 }
77956}
77957
77958module.exports = EntryModuleNotFoundError;
77959
77960
77961/***/ }),
77962
77963/***/ 14604:
77964/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
77965
77966"use strict";
77967/*
77968 MIT License http://www.opensource.org/licenses/mit-license.php
77969 Author Tobias Koppers @sokra
77970*/
77971
77972
77973const SingleEntryPlugin = __webpack_require__(19070);
77974const MultiEntryPlugin = __webpack_require__(98046);
77975const DynamicEntryPlugin = __webpack_require__(49784);
77976
77977/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */
77978/** @typedef {import("./Compiler")} Compiler */
77979
77980/**
77981 * @param {string} context context path
77982 * @param {EntryItem} item entry array or single path
77983 * @param {string} name entry key name
77984 * @returns {SingleEntryPlugin | MultiEntryPlugin} returns either a single or multi entry plugin
77985 */
77986const itemToPlugin = (context, item, name) => {
77987 if (Array.isArray(item)) {
77988 return new MultiEntryPlugin(context, item, name);
77989 }
77990 return new SingleEntryPlugin(context, item, name);
77991};
77992
77993module.exports = class EntryOptionPlugin {
77994 /**
77995 * @param {Compiler} compiler the compiler instance one is tapping into
77996 * @returns {void}
77997 */
77998 apply(compiler) {
77999 compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => {
78000 if (typeof entry === "string" || Array.isArray(entry)) {
78001 itemToPlugin(context, entry, "main").apply(compiler);
78002 } else if (typeof entry === "object") {
78003 for (const name of Object.keys(entry)) {
78004 itemToPlugin(context, entry[name], name).apply(compiler);
78005 }
78006 } else if (typeof entry === "function") {
78007 new DynamicEntryPlugin(context, entry).apply(compiler);
78008 }
78009 return true;
78010 });
78011 }
78012};
78013
78014
78015/***/ }),
78016
78017/***/ 71931:
78018/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78019
78020"use strict";
78021/*
78022 MIT License http://www.opensource.org/licenses/mit-license.php
78023 Author Tobias Koppers @sokra
78024*/
78025
78026
78027const ChunkGroup = __webpack_require__(52911);
78028
78029/** @typedef {import("./Chunk")} Chunk */
78030
78031/**
78032 * Entrypoint serves as an encapsulation primitive for chunks that are
78033 * a part of a single ChunkGroup. They represent all bundles that need to be loaded for a
78034 * single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects
78035 * inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks.
78036 */
78037class Entrypoint extends ChunkGroup {
78038 /**
78039 * Creates an instance of Entrypoint.
78040 * @param {string} name the name of the entrypoint
78041 */
78042 constructor(name) {
78043 super(name);
78044 /** @type {Chunk=} */
78045 this.runtimeChunk = undefined;
78046 }
78047
78048 /**
78049 * isInitial will always return true for Entrypoint ChunkGroup.
78050 * @returns {true} returns true as all entrypoints are initial ChunkGroups
78051 */
78052 isInitial() {
78053 return true;
78054 }
78055
78056 /**
78057 * Sets the runtimeChunk for an entrypoint.
78058 * @param {Chunk} chunk the chunk being set as the runtime chunk.
78059 * @returns {void}
78060 */
78061 setRuntimeChunk(chunk) {
78062 this.runtimeChunk = chunk;
78063 }
78064
78065 /**
78066 * Fetches the chunk reference containing the webpack bootstrap code
78067 * @returns {Chunk} returns the runtime chunk or first chunk in `this.chunks`
78068 */
78069 getRuntimeChunk() {
78070 return this.runtimeChunk || this.chunks[0];
78071 }
78072
78073 /**
78074 * @param {Chunk} oldChunk chunk to be replaced
78075 * @param {Chunk} newChunk New chunk that will be replaced with
78076 * @returns {boolean} returns true if the replacement was successful
78077 */
78078 replaceChunk(oldChunk, newChunk) {
78079 if (this.runtimeChunk === oldChunk) this.runtimeChunk = newChunk;
78080 return super.replaceChunk(oldChunk, newChunk);
78081 }
78082}
78083
78084module.exports = Entrypoint;
78085
78086
78087/***/ }),
78088
78089/***/ 6098:
78090/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78091
78092"use strict";
78093/*
78094 MIT License http://www.opensource.org/licenses/mit-license.php
78095 Authors Simen Brekken @simenbrekken, Einar Löve @einarlove
78096*/
78097
78098
78099
78100/** @typedef {import("./Compiler")} Compiler */
78101
78102const WebpackError = __webpack_require__(97391);
78103const DefinePlugin = __webpack_require__(97374);
78104
78105const needsEnvVarFix =
78106 ["8", "9"].indexOf(process.versions.node.split(".")[0]) >= 0 &&
78107 process.platform === "win32";
78108
78109class EnvironmentPlugin {
78110 constructor(...keys) {
78111 if (keys.length === 1 && Array.isArray(keys[0])) {
78112 this.keys = keys[0];
78113 this.defaultValues = {};
78114 } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") {
78115 this.keys = Object.keys(keys[0]);
78116 this.defaultValues = keys[0];
78117 } else {
78118 this.keys = keys;
78119 this.defaultValues = {};
78120 }
78121 }
78122
78123 /**
78124 * @param {Compiler} compiler webpack compiler instance
78125 * @returns {void}
78126 */
78127 apply(compiler) {
78128 const definitions = this.keys.reduce((defs, key) => {
78129 // TODO remove once the fix has made its way into Node 8.
78130 // Work around https://github.com/nodejs/node/pull/18463,
78131 // affecting Node 8 & 9 by performing an OS-level
78132 // operation that always succeeds before reading
78133 // environment variables:
78134 if (needsEnvVarFix) __webpack_require__(12087).cpus();
78135
78136 const value =
78137 process.env[key] !== undefined
78138 ? process.env[key]
78139 : this.defaultValues[key];
78140
78141 if (value === undefined) {
78142 compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
78143 const error = new WebpackError(
78144 `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` +
78145 "You can pass an object with default values to suppress this warning.\n" +
78146 "See https://webpack.js.org/plugins/environment-plugin for example."
78147 );
78148
78149 error.name = "EnvVariableNotDefinedError";
78150 compilation.warnings.push(error);
78151 });
78152 }
78153
78154 defs[`process.env.${key}`] =
78155 value === undefined ? "undefined" : JSON.stringify(value);
78156
78157 return defs;
78158 }, {});
78159
78160 new DefinePlugin(definitions).apply(compiler);
78161 }
78162}
78163
78164module.exports = EnvironmentPlugin;
78165
78166
78167/***/ }),
78168
78169/***/ 80140:
78170/***/ (function(__unused_webpack_module, exports) {
78171
78172"use strict";
78173/*
78174 MIT License http://www.opensource.org/licenses/mit-license.php
78175 Author Tobias Koppers @sokra
78176*/
78177
78178
78179const loaderFlag = "LOADER_EXECUTION";
78180
78181const webpackOptionsFlag = "WEBPACK_OPTIONS";
78182
78183exports.cutOffByFlag = (stack, flag) => {
78184 stack = stack.split("\n");
78185 for (let i = 0; i < stack.length; i++) {
78186 if (stack[i].includes(flag)) {
78187 stack.length = i;
78188 }
78189 }
78190 return stack.join("\n");
78191};
78192
78193exports.cutOffLoaderExecution = stack =>
78194 exports.cutOffByFlag(stack, loaderFlag);
78195
78196exports.cutOffWebpackOptions = stack =>
78197 exports.cutOffByFlag(stack, webpackOptionsFlag);
78198
78199exports.cutOffMultilineMessage = (stack, message) => {
78200 stack = stack.split("\n");
78201 message = message.split("\n");
78202
78203 return stack
78204 .reduce(
78205 (acc, line, idx) =>
78206 line.includes(message[idx]) ? acc : acc.concat(line),
78207 []
78208 )
78209 .join("\n");
78210};
78211
78212exports.cutOffMessage = (stack, message) => {
78213 const nextLine = stack.indexOf("\n");
78214 if (nextLine === -1) {
78215 return stack === message ? "" : stack;
78216 } else {
78217 const firstLine = stack.substr(0, nextLine);
78218 return firstLine === message ? stack.substr(nextLine + 1) : stack;
78219 }
78220};
78221
78222exports.cleanUp = (stack, message) => {
78223 stack = exports.cutOffLoaderExecution(stack);
78224 stack = exports.cutOffMessage(stack, message);
78225 return stack;
78226};
78227
78228exports.cleanUpWebpackOptions = (stack, message) => {
78229 stack = exports.cutOffWebpackOptions(stack);
78230 stack = exports.cutOffMultilineMessage(stack, message);
78231 return stack;
78232};
78233
78234
78235/***/ }),
78236
78237/***/ 65200:
78238/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78239
78240"use strict";
78241/*
78242 MIT License http://www.opensource.org/licenses/mit-license.php
78243 Author Tobias Koppers @sokra
78244*/
78245
78246
78247const EvalDevToolModuleTemplatePlugin = __webpack_require__(24157);
78248
78249class EvalDevToolModulePlugin {
78250 constructor(options) {
78251 this.sourceUrlComment = options.sourceUrlComment;
78252 this.moduleFilenameTemplate = options.moduleFilenameTemplate;
78253 this.namespace = options.namespace;
78254 }
78255
78256 apply(compiler) {
78257 compiler.hooks.compilation.tap("EvalDevToolModulePlugin", compilation => {
78258 new EvalDevToolModuleTemplatePlugin({
78259 sourceUrlComment: this.sourceUrlComment,
78260 moduleFilenameTemplate: this.moduleFilenameTemplate,
78261 namespace: this.namespace
78262 }).apply(compilation.moduleTemplates.javascript);
78263 });
78264 }
78265}
78266
78267module.exports = EvalDevToolModulePlugin;
78268
78269
78270/***/ }),
78271
78272/***/ 24157:
78273/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78274
78275"use strict";
78276/*
78277 MIT License http://www.opensource.org/licenses/mit-license.php
78278 Author Tobias Koppers @sokra
78279*/
78280
78281
78282const { RawSource } = __webpack_require__(53665);
78283const ModuleFilenameHelpers = __webpack_require__(71474);
78284
78285const cache = new WeakMap();
78286
78287class EvalDevToolModuleTemplatePlugin {
78288 constructor(options) {
78289 this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]";
78290 this.moduleFilenameTemplate =
78291 options.moduleFilenameTemplate ||
78292 "webpack://[namespace]/[resourcePath]?[loaders]";
78293 this.namespace = options.namespace || "";
78294 }
78295
78296 apply(moduleTemplate) {
78297 moduleTemplate.hooks.module.tap(
78298 "EvalDevToolModuleTemplatePlugin",
78299 (source, module) => {
78300 const cacheEntry = cache.get(source);
78301 if (cacheEntry !== undefined) return cacheEntry;
78302 const content = source.source();
78303 const str = ModuleFilenameHelpers.createFilename(
78304 module,
78305 {
78306 moduleFilenameTemplate: this.moduleFilenameTemplate,
78307 namespace: this.namespace
78308 },
78309 moduleTemplate.runtimeTemplate.requestShortener
78310 );
78311 const footer =
78312 "\n" +
78313 this.sourceUrlComment.replace(
78314 /\[url\]/g,
78315 encodeURI(str)
78316 .replace(/%2F/g, "/")
78317 .replace(/%20/g, "_")
78318 .replace(/%5E/g, "^")
78319 .replace(/%5C/g, "\\")
78320 .replace(/^\//, "")
78321 );
78322 const result = new RawSource(
78323 `eval(${JSON.stringify(content + footer)});`
78324 );
78325 cache.set(source, result);
78326 return result;
78327 }
78328 );
78329 moduleTemplate.hooks.hash.tap("EvalDevToolModuleTemplatePlugin", hash => {
78330 hash.update("EvalDevToolModuleTemplatePlugin");
78331 hash.update("2");
78332 });
78333 }
78334}
78335
78336module.exports = EvalDevToolModuleTemplatePlugin;
78337
78338
78339/***/ }),
78340
78341/***/ 51352:
78342/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78343
78344"use strict";
78345/*
78346 MIT License http://www.opensource.org/licenses/mit-license.php
78347 Author Tobias Koppers @sokra
78348*/
78349
78350
78351const { RawSource } = __webpack_require__(53665);
78352const ModuleFilenameHelpers = __webpack_require__(71474);
78353const { absolutify } = __webpack_require__(94658);
78354
78355const cache = new WeakMap();
78356
78357class EvalSourceMapDevToolModuleTemplatePlugin {
78358 constructor(compilation, options) {
78359 this.compilation = compilation;
78360 this.sourceMapComment =
78361 options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]";
78362 this.moduleFilenameTemplate =
78363 options.moduleFilenameTemplate ||
78364 "webpack://[namespace]/[resource-path]?[hash]";
78365 this.namespace = options.namespace || "";
78366 this.options = options;
78367 }
78368
78369 apply(moduleTemplate) {
78370 const self = this;
78371 const options = this.options;
78372 const matchModule = ModuleFilenameHelpers.matchObject.bind(
78373 ModuleFilenameHelpers,
78374 options
78375 );
78376 moduleTemplate.hooks.module.tap(
78377 "EvalSourceMapDevToolModuleTemplatePlugin",
78378 (source, module) => {
78379 const cachedSource = cache.get(source);
78380 if (cachedSource !== undefined) {
78381 return cachedSource;
78382 }
78383
78384 if (!matchModule(module.resource)) {
78385 return source;
78386 }
78387
78388 /** @type {{ [key: string]: TODO; }} */
78389 let sourceMap;
78390 let content;
78391 if (source.sourceAndMap) {
78392 const sourceAndMap = source.sourceAndMap(options);
78393 sourceMap = sourceAndMap.map;
78394 content = sourceAndMap.source;
78395 } else {
78396 sourceMap = source.map(options);
78397 content = source.source();
78398 }
78399 if (!sourceMap) {
78400 return source;
78401 }
78402
78403 // Clone (flat) the sourcemap to ensure that the mutations below do not persist.
78404 sourceMap = Object.keys(sourceMap).reduce((obj, key) => {
78405 obj[key] = sourceMap[key];
78406 return obj;
78407 }, {});
78408 const context = this.compilation.compiler.options.context;
78409 const modules = sourceMap.sources.map(source => {
78410 if (source.startsWith("webpack://")) {
78411 source = absolutify(context, source.slice(10));
78412 }
78413 const module = self.compilation.findModule(source);
78414 return module || source;
78415 });
78416 let moduleFilenames = modules.map(module => {
78417 return ModuleFilenameHelpers.createFilename(
78418 module,
78419 {
78420 moduleFilenameTemplate: self.moduleFilenameTemplate,
78421 namespace: self.namespace
78422 },
78423 moduleTemplate.runtimeTemplate.requestShortener
78424 );
78425 });
78426 moduleFilenames = ModuleFilenameHelpers.replaceDuplicates(
78427 moduleFilenames,
78428 (filename, i, n) => {
78429 for (let j = 0; j < n; j++) filename += "*";
78430 return filename;
78431 }
78432 );
78433 sourceMap.sources = moduleFilenames;
78434 sourceMap.sourceRoot = options.sourceRoot || "";
78435 sourceMap.file = `${module.id}.js`;
78436
78437 const footer =
78438 self.sourceMapComment.replace(
78439 /\[url\]/g,
78440 `data:application/json;charset=utf-8;base64,${Buffer.from(
78441 JSON.stringify(sourceMap),
78442 "utf8"
78443 ).toString("base64")}`
78444 ) + `\n//# sourceURL=webpack-internal:///${module.id}\n`; // workaround for chrome bug
78445
78446 const evalSource = new RawSource(
78447 `eval(${JSON.stringify(content + footer)});`
78448 );
78449
78450 cache.set(source, evalSource);
78451
78452 return evalSource;
78453 }
78454 );
78455 moduleTemplate.hooks.hash.tap(
78456 "EvalSourceMapDevToolModuleTemplatePlugin",
78457 hash => {
78458 hash.update("eval-source-map");
78459 hash.update("2");
78460 }
78461 );
78462 }
78463}
78464module.exports = EvalSourceMapDevToolModuleTemplatePlugin;
78465
78466
78467/***/ }),
78468
78469/***/ 99994:
78470/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78471
78472"use strict";
78473/*
78474 MIT License http://www.opensource.org/licenses/mit-license.php
78475 Author Tobias Koppers @sokra
78476*/
78477
78478
78479const EvalSourceMapDevToolModuleTemplatePlugin = __webpack_require__(51352);
78480const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(24113);
78481
78482class EvalSourceMapDevToolPlugin {
78483 constructor(options) {
78484 if (arguments.length > 1) {
78485 throw new Error(
78486 "EvalSourceMapDevToolPlugin only takes one argument (pass an options object)"
78487 );
78488 }
78489 if (typeof options === "string") {
78490 options = {
78491 append: options
78492 };
78493 }
78494 if (!options) options = {};
78495 this.options = options;
78496 }
78497
78498 apply(compiler) {
78499 const options = this.options;
78500 compiler.hooks.compilation.tap(
78501 "EvalSourceMapDevToolPlugin",
78502 compilation => {
78503 new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
78504 new EvalSourceMapDevToolModuleTemplatePlugin(
78505 compilation,
78506 options
78507 ).apply(compilation.moduleTemplates.javascript);
78508 }
78509 );
78510 }
78511}
78512
78513module.exports = EvalSourceMapDevToolPlugin;
78514
78515
78516/***/ }),
78517
78518/***/ 50471:
78519/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78520
78521"use strict";
78522/*
78523 MIT License http://www.opensource.org/licenses/mit-license.php
78524 Author Tobias Koppers @sokra
78525*/
78526
78527
78528const { ConcatSource } = __webpack_require__(53665);
78529
78530/** @typedef {import("./Compilation")} Compilation */
78531
78532/**
78533 * @param {string[]} accessor the accessor to convert to path
78534 * @returns {string} the path
78535 */
78536const accessorToObjectAccess = accessor => {
78537 return accessor.map(a => `[${JSON.stringify(a)}]`).join("");
78538};
78539
78540class ExportPropertyMainTemplatePlugin {
78541 /**
78542 * @param {string|string[]} property the name of the property to export
78543 */
78544 constructor(property) {
78545 this.property = property;
78546 }
78547
78548 /**
78549 * @param {Compilation} compilation the compilation instance
78550 * @returns {void}
78551 */
78552 apply(compilation) {
78553 const { mainTemplate, chunkTemplate } = compilation;
78554
78555 const onRenderWithEntry = (source, chunk, hash) => {
78556 const postfix = `${accessorToObjectAccess([].concat(this.property))}`;
78557 return new ConcatSource(source, postfix);
78558 };
78559
78560 for (const template of [mainTemplate, chunkTemplate]) {
78561 template.hooks.renderWithEntry.tap(
78562 "ExportPropertyMainTemplatePlugin",
78563 onRenderWithEntry
78564 );
78565 }
78566
78567 mainTemplate.hooks.hash.tap("ExportPropertyMainTemplatePlugin", hash => {
78568 hash.update("export property");
78569 hash.update(`${this.property}`);
78570 });
78571 }
78572}
78573
78574module.exports = ExportPropertyMainTemplatePlugin;
78575
78576
78577/***/ }),
78578
78579/***/ 17270:
78580/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78581
78582"use strict";
78583/*
78584 MIT License http://www.opensource.org/licenses/mit-license.php
78585 Author Tobias Koppers @sokra
78586*/
78587
78588
78589const Template = __webpack_require__(96066);
78590const ConstDependency = __webpack_require__(71101);
78591const ParserHelpers = __webpack_require__(23999);
78592const NullFactory = __webpack_require__(40438);
78593
78594const REPLACEMENTS = {
78595 // eslint-disable-next-line camelcase
78596 __webpack_hash__: "__webpack_require__.h",
78597 // eslint-disable-next-line camelcase
78598 __webpack_chunkname__: "__webpack_require__.cn"
78599};
78600const REPLACEMENT_TYPES = {
78601 // eslint-disable-next-line camelcase
78602 __webpack_hash__: "string",
78603 // eslint-disable-next-line camelcase
78604 __webpack_chunkname__: "string"
78605};
78606
78607class ExtendedAPIPlugin {
78608 apply(compiler) {
78609 compiler.hooks.compilation.tap(
78610 "ExtendedAPIPlugin",
78611 (compilation, { normalModuleFactory }) => {
78612 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
78613 compilation.dependencyTemplates.set(
78614 ConstDependency,
78615 new ConstDependency.Template()
78616 );
78617
78618 const mainTemplate = compilation.mainTemplate;
78619 mainTemplate.hooks.requireExtensions.tap(
78620 "ExtendedAPIPlugin",
78621 (source, chunk, hash) => {
78622 const buf = [source];
78623 buf.push("");
78624 buf.push("// __webpack_hash__");
78625 buf.push(`${mainTemplate.requireFn}.h = ${JSON.stringify(hash)};`);
78626 buf.push("");
78627 buf.push("// __webpack_chunkname__");
78628 buf.push(
78629 `${mainTemplate.requireFn}.cn = ${JSON.stringify(chunk.name)};`
78630 );
78631 return Template.asString(buf);
78632 }
78633 );
78634 mainTemplate.hooks.globalHash.tap("ExtendedAPIPlugin", () => true);
78635
78636 const handler = (parser, parserOptions) => {
78637 Object.keys(REPLACEMENTS).forEach(key => {
78638 parser.hooks.expression
78639 .for(key)
78640 .tap(
78641 "ExtendedAPIPlugin",
78642 ParserHelpers.toConstantDependencyWithWebpackRequire(
78643 parser,
78644 REPLACEMENTS[key]
78645 )
78646 );
78647 parser.hooks.evaluateTypeof
78648 .for(key)
78649 .tap(
78650 "ExtendedAPIPlugin",
78651 ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])
78652 );
78653 });
78654 };
78655
78656 normalModuleFactory.hooks.parser
78657 .for("javascript/auto")
78658 .tap("ExtendedAPIPlugin", handler);
78659 normalModuleFactory.hooks.parser
78660 .for("javascript/dynamic")
78661 .tap("ExtendedAPIPlugin", handler);
78662 normalModuleFactory.hooks.parser
78663 .for("javascript/esm")
78664 .tap("ExtendedAPIPlugin", handler);
78665 }
78666 );
78667 }
78668}
78669
78670module.exports = ExtendedAPIPlugin;
78671
78672
78673/***/ }),
78674
78675/***/ 17204:
78676/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78677
78678"use strict";
78679/*
78680 MIT License http://www.opensource.org/licenses/mit-license.php
78681 Author Tobias Koppers @sokra
78682*/
78683
78684
78685const { OriginalSource, RawSource } = __webpack_require__(53665);
78686const Module = __webpack_require__(75993);
78687const WebpackMissingModule = __webpack_require__(75386);
78688const Template = __webpack_require__(96066);
78689
78690/** @typedef {import("./util/createHash").Hash} Hash */
78691
78692class ExternalModule extends Module {
78693 constructor(request, type, userRequest) {
78694 super("javascript/dynamic", null);
78695
78696 // Info from Factory
78697 this.request = request;
78698 this.externalType = type;
78699 this.userRequest = userRequest;
78700 this.external = true;
78701 }
78702
78703 libIdent() {
78704 return this.userRequest;
78705 }
78706
78707 chunkCondition(chunk) {
78708 return chunk.hasEntryModule();
78709 }
78710
78711 identifier() {
78712 return "external " + JSON.stringify(this.request);
78713 }
78714
78715 readableIdentifier() {
78716 return "external " + JSON.stringify(this.request);
78717 }
78718
78719 needRebuild() {
78720 return false;
78721 }
78722
78723 build(options, compilation, resolver, fs, callback) {
78724 this.built = true;
78725 this.buildMeta = {};
78726 this.buildInfo = {};
78727 callback();
78728 }
78729
78730 getSourceForGlobalVariableExternal(variableName, type) {
78731 if (!Array.isArray(variableName)) {
78732 // make it an array as the look up works the same basically
78733 variableName = [variableName];
78734 }
78735
78736 // needed for e.g. window["some"]["thing"]
78737 const objectLookup = variableName
78738 .map(r => `[${JSON.stringify(r)}]`)
78739 .join("");
78740 return `(function() { module.exports = ${type}${objectLookup}; }());`;
78741 }
78742
78743 getSourceForCommonJsExternal(moduleAndSpecifiers) {
78744 if (!Array.isArray(moduleAndSpecifiers)) {
78745 return `module.exports = require(${JSON.stringify(
78746 moduleAndSpecifiers
78747 )});`;
78748 }
78749
78750 const moduleName = moduleAndSpecifiers[0];
78751 const objectLookup = moduleAndSpecifiers
78752 .slice(1)
78753 .map(r => `[${JSON.stringify(r)}]`)
78754 .join("");
78755 return `module.exports = require(${JSON.stringify(
78756 moduleName
78757 )})${objectLookup};`;
78758 }
78759
78760 checkExternalVariable(variableToCheck, request) {
78761 return `if(typeof ${variableToCheck} === 'undefined') {${WebpackMissingModule.moduleCode(
78762 request
78763 )}}\n`;
78764 }
78765
78766 getSourceForAmdOrUmdExternal(id, optional, request) {
78767 const externalVariable = `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(
78768 `${id}`
78769 )}__`;
78770 const missingModuleError = optional
78771 ? this.checkExternalVariable(externalVariable, request)
78772 : "";
78773 return `${missingModuleError}module.exports = ${externalVariable};`;
78774 }
78775
78776 getSourceForDefaultCase(optional, request) {
78777 if (!Array.isArray(request)) {
78778 // make it an array as the look up works the same basically
78779 request = [request];
78780 }
78781
78782 const variableName = request[0];
78783 const missingModuleError = optional
78784 ? this.checkExternalVariable(variableName, request.join("."))
78785 : "";
78786 const objectLookup = request
78787 .slice(1)
78788 .map(r => `[${JSON.stringify(r)}]`)
78789 .join("");
78790 return `${missingModuleError}module.exports = ${variableName}${objectLookup};`;
78791 }
78792
78793 getSourceString(runtime) {
78794 const request =
78795 typeof this.request === "object" && !Array.isArray(this.request)
78796 ? this.request[this.externalType]
78797 : this.request;
78798 switch (this.externalType) {
78799 case "this":
78800 case "window":
78801 case "self":
78802 return this.getSourceForGlobalVariableExternal(
78803 request,
78804 this.externalType
78805 );
78806 case "global":
78807 return this.getSourceForGlobalVariableExternal(
78808 request,
78809 runtime.outputOptions.globalObject
78810 );
78811 case "commonjs":
78812 case "commonjs2":
78813 return this.getSourceForCommonJsExternal(request);
78814 case "amd":
78815 case "amd-require":
78816 case "umd":
78817 case "umd2":
78818 case "system":
78819 return this.getSourceForAmdOrUmdExternal(
78820 this.id,
78821 this.optional,
78822 request
78823 );
78824 default:
78825 return this.getSourceForDefaultCase(this.optional, request);
78826 }
78827 }
78828
78829 getSource(sourceString) {
78830 if (this.useSourceMap) {
78831 return new OriginalSource(sourceString, this.identifier());
78832 }
78833
78834 return new RawSource(sourceString);
78835 }
78836
78837 source(dependencyTemplates, runtime) {
78838 return this.getSource(this.getSourceString(runtime));
78839 }
78840
78841 size() {
78842 return 42;
78843 }
78844
78845 /**
78846 * @param {Hash} hash the hash used to track dependencies
78847 * @returns {void}
78848 */
78849 updateHash(hash) {
78850 hash.update(this.externalType);
78851 hash.update(JSON.stringify(this.request));
78852 hash.update(JSON.stringify(Boolean(this.optional)));
78853 super.updateHash(hash);
78854 }
78855}
78856
78857module.exports = ExternalModule;
78858
78859
78860/***/ }),
78861
78862/***/ 67876:
78863/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78864
78865"use strict";
78866/*
78867 MIT License http://www.opensource.org/licenses/mit-license.php
78868 Author Tobias Koppers @sokra
78869*/
78870
78871
78872const ExternalModule = __webpack_require__(17204);
78873
78874class ExternalModuleFactoryPlugin {
78875 constructor(type, externals) {
78876 this.type = type;
78877 this.externals = externals;
78878 }
78879
78880 apply(normalModuleFactory) {
78881 const globalType = this.type;
78882 normalModuleFactory.hooks.factory.tap(
78883 "ExternalModuleFactoryPlugin",
78884 factory => (data, callback) => {
78885 const context = data.context;
78886 const dependency = data.dependencies[0];
78887
78888 const handleExternal = (value, type, callback) => {
78889 if (typeof type === "function") {
78890 callback = type;
78891 type = undefined;
78892 }
78893 if (value === false) return factory(data, callback);
78894 if (value === true) value = dependency.request;
78895 if (type === undefined && /^[a-z0-9]+ /.test(value)) {
78896 const idx = value.indexOf(" ");
78897 type = value.substr(0, idx);
78898 value = value.substr(idx + 1);
78899 }
78900 callback(
78901 null,
78902 new ExternalModule(value, type || globalType, dependency.request)
78903 );
78904 return true;
78905 };
78906
78907 const handleExternals = (externals, callback) => {
78908 if (typeof externals === "string") {
78909 if (externals === dependency.request) {
78910 return handleExternal(dependency.request, callback);
78911 }
78912 } else if (Array.isArray(externals)) {
78913 let i = 0;
78914 const next = () => {
78915 let asyncFlag;
78916 const handleExternalsAndCallback = (err, module) => {
78917 if (err) return callback(err);
78918 if (!module) {
78919 if (asyncFlag) {
78920 asyncFlag = false;
78921 return;
78922 }
78923 return next();
78924 }
78925 callback(null, module);
78926 };
78927
78928 do {
78929 asyncFlag = true;
78930 if (i >= externals.length) return callback();
78931 handleExternals(externals[i++], handleExternalsAndCallback);
78932 } while (!asyncFlag);
78933 asyncFlag = false;
78934 };
78935
78936 next();
78937 return;
78938 } else if (externals instanceof RegExp) {
78939 if (externals.test(dependency.request)) {
78940 return handleExternal(dependency.request, callback);
78941 }
78942 } else if (typeof externals === "function") {
78943 externals.call(
78944 null,
78945 context,
78946 dependency.request,
78947 (err, value, type) => {
78948 if (err) return callback(err);
78949 if (value !== undefined) {
78950 handleExternal(value, type, callback);
78951 } else {
78952 callback();
78953 }
78954 }
78955 );
78956 return;
78957 } else if (
78958 typeof externals === "object" &&
78959 Object.prototype.hasOwnProperty.call(externals, dependency.request)
78960 ) {
78961 return handleExternal(externals[dependency.request], callback);
78962 }
78963 callback();
78964 };
78965
78966 handleExternals(this.externals, (err, module) => {
78967 if (err) return callback(err);
78968 if (!module) return handleExternal(false, callback);
78969 return callback(null, module);
78970 });
78971 }
78972 );
78973 }
78974}
78975module.exports = ExternalModuleFactoryPlugin;
78976
78977
78978/***/ }),
78979
78980/***/ 75705:
78981/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
78982
78983"use strict";
78984/*
78985 MIT License http://www.opensource.org/licenses/mit-license.php
78986 Author Tobias Koppers @sokra
78987*/
78988
78989
78990const ExternalModuleFactoryPlugin = __webpack_require__(67876);
78991
78992class ExternalsPlugin {
78993 constructor(type, externals) {
78994 this.type = type;
78995 this.externals = externals;
78996 }
78997 apply(compiler) {
78998 compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => {
78999 new ExternalModuleFactoryPlugin(this.type, this.externals).apply(
79000 normalModuleFactory
79001 );
79002 });
79003 }
79004}
79005
79006module.exports = ExternalsPlugin;
79007
79008
79009/***/ }),
79010
79011/***/ 47163:
79012/***/ (function(module) {
79013
79014"use strict";
79015/*
79016 MIT License http://www.opensource.org/licenses/mit-license.php
79017 Author Tobias Koppers @sokra
79018*/
79019
79020
79021
79022/** @typedef {import("./Compiler")} Compiler */
79023
79024class FlagAllModulesAsUsedPlugin {
79025 constructor(explanation) {
79026 this.explanation = explanation;
79027 }
79028
79029 /**
79030 * @param {Compiler} compiler webpack compiler
79031 * @returns {void}
79032 */
79033 apply(compiler) {
79034 compiler.hooks.compilation.tap(
79035 "FlagAllModulesAsUsedPlugin",
79036 compilation => {
79037 compilation.hooks.optimizeDependencies.tap(
79038 "FlagAllModulesAsUsedPlugin",
79039 modules => {
79040 for (const module of modules) {
79041 module.used = true;
79042 module.usedExports = true;
79043 module.addReason(null, null, this.explanation);
79044 }
79045 }
79046 );
79047 }
79048 );
79049 }
79050}
79051
79052module.exports = FlagAllModulesAsUsedPlugin;
79053
79054
79055/***/ }),
79056
79057/***/ 73599:
79058/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
79059
79060"use strict";
79061/*
79062 MIT License http://www.opensource.org/licenses/mit-license.php
79063 Author Tobias Koppers @sokra
79064*/
79065
79066
79067const Queue = __webpack_require__(38637);
79068
79069const addToSet = (a, b) => {
79070 for (const item of b) {
79071 a.add(item);
79072 }
79073};
79074
79075class FlagDependencyExportsPlugin {
79076 apply(compiler) {
79077 compiler.hooks.compilation.tap(
79078 "FlagDependencyExportsPlugin",
79079 compilation => {
79080 compilation.hooks.finishModules.tap(
79081 "FlagDependencyExportsPlugin",
79082 modules => {
79083 const dependencies = new Map();
79084
79085 const queue = new Queue();
79086
79087 let module;
79088 let moduleWithExports;
79089 let moduleProvidedExports;
79090 let providedExportsAreTemporary;
79091
79092 const processDependenciesBlock = depBlock => {
79093 for (const dep of depBlock.dependencies) {
79094 if (processDependency(dep)) return true;
79095 }
79096 for (const variable of depBlock.variables) {
79097 for (const dep of variable.dependencies) {
79098 if (processDependency(dep)) return true;
79099 }
79100 }
79101 for (const block of depBlock.blocks) {
79102 if (processDependenciesBlock(block)) return true;
79103 }
79104 return false;
79105 };
79106
79107 const processDependency = dep => {
79108 const exportDesc = dep.getExports && dep.getExports();
79109 if (!exportDesc) return;
79110 moduleWithExports = true;
79111 const exports = exportDesc.exports;
79112 // break early if it's only in the worst state
79113 if (module.buildMeta.providedExports === true) {
79114 return true;
79115 }
79116 // break if it should move to the worst state
79117 if (exports === true) {
79118 module.buildMeta.providedExports = true;
79119 return true;
79120 }
79121 // merge in new exports
79122 if (Array.isArray(exports)) {
79123 addToSet(moduleProvidedExports, exports);
79124 }
79125 // store dependencies
79126 const exportDeps = exportDesc.dependencies;
79127 if (exportDeps) {
79128 providedExportsAreTemporary = true;
79129 for (const exportDependency of exportDeps) {
79130 // add dependency for this module
79131 const set = dependencies.get(exportDependency);
79132 if (set === undefined) {
79133 dependencies.set(exportDependency, new Set([module]));
79134 } else {
79135 set.add(module);
79136 }
79137 }
79138 }
79139 return false;
79140 };
79141
79142 const notifyDependencies = () => {
79143 const deps = dependencies.get(module);
79144 if (deps !== undefined) {
79145 for (const dep of deps) {
79146 queue.enqueue(dep);
79147 }
79148 }
79149 };
79150
79151 const notifyDependenciesIfDifferent = (set, array) => {
79152 const deps = dependencies.get(module);
79153 if (deps !== undefined) {
79154 if (set.size === array.length) {
79155 let i = 0;
79156 let different = false;
79157 for (const item of set) {
79158 if (item !== array[i++]) {
79159 different = true;
79160 break;
79161 }
79162 }
79163 if (!different) return;
79164 }
79165 for (const dep of deps) {
79166 queue.enqueue(dep);
79167 }
79168 }
79169 };
79170
79171 // Start with all modules without provided exports
79172 for (const module of modules) {
79173 if (module.buildInfo.temporaryProvidedExports) {
79174 // Clear exports when they are temporary
79175 // and recreate them
79176 module.buildMeta.providedExports = null;
79177 queue.enqueue(module);
79178 } else if (!module.buildMeta.providedExports) {
79179 queue.enqueue(module);
79180 }
79181 }
79182
79183 while (queue.length > 0) {
79184 module = queue.dequeue();
79185
79186 if (module.buildMeta.providedExports !== true) {
79187 moduleWithExports =
79188 module.buildMeta && module.buildMeta.exportsType;
79189 moduleProvidedExports = new Set();
79190 providedExportsAreTemporary = false;
79191 processDependenciesBlock(module);
79192 module.buildInfo.temporaryProvidedExports = providedExportsAreTemporary;
79193 if (!moduleWithExports) {
79194 notifyDependencies();
79195 module.buildMeta.providedExports = true;
79196 } else if (module.buildMeta.providedExports === true) {
79197 notifyDependencies();
79198 } else if (!module.buildMeta.providedExports) {
79199 notifyDependencies();
79200 module.buildMeta.providedExports = Array.from(
79201 moduleProvidedExports
79202 );
79203 } else {
79204 notifyDependenciesIfDifferent(
79205 moduleProvidedExports,
79206 module.buildMeta.providedExports
79207 );
79208 module.buildMeta.providedExports = Array.from(
79209 moduleProvidedExports
79210 );
79211 }
79212 }
79213 }
79214 }
79215 );
79216 const providedExportsCache = new WeakMap();
79217 compilation.hooks.rebuildModule.tap(
79218 "FlagDependencyExportsPlugin",
79219 module => {
79220 providedExportsCache.set(module, module.buildMeta.providedExports);
79221 }
79222 );
79223 compilation.hooks.finishRebuildingModule.tap(
79224 "FlagDependencyExportsPlugin",
79225 module => {
79226 module.buildMeta.providedExports = providedExportsCache.get(module);
79227 }
79228 );
79229 }
79230 );
79231 }
79232}
79233
79234module.exports = FlagDependencyExportsPlugin;
79235
79236
79237/***/ }),
79238
79239/***/ 33632:
79240/***/ (function(module) {
79241
79242"use strict";
79243/*
79244 MIT License http://www.opensource.org/licenses/mit-license.php
79245 Author Tobias Koppers @sokra
79246*/
79247
79248
79249/** @typedef {import("./Module")} Module */
79250/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
79251
79252/** @typedef {false | true | string[]} UsedExports */
79253
79254const addToSet = (a, b) => {
79255 for (const item of b) {
79256 if (!a.includes(item)) a.push(item);
79257 }
79258 return a;
79259};
79260
79261const isSubset = (biggerSet, subset) => {
79262 if (biggerSet === true) return true;
79263 if (subset === true) return false;
79264 return subset.every(item => biggerSet.indexOf(item) >= 0);
79265};
79266
79267class FlagDependencyUsagePlugin {
79268 apply(compiler) {
79269 compiler.hooks.compilation.tap("FlagDependencyUsagePlugin", compilation => {
79270 compilation.hooks.optimizeDependencies.tap(
79271 "FlagDependencyUsagePlugin",
79272 modules => {
79273 const processModule = (module, usedExports) => {
79274 module.used = true;
79275 if (module.usedExports === true) return;
79276 if (usedExports === true) {
79277 module.usedExports = true;
79278 } else if (Array.isArray(usedExports)) {
79279 const old = module.usedExports ? module.usedExports.length : -1;
79280 module.usedExports = addToSet(
79281 module.usedExports || [],
79282 usedExports
79283 );
79284 if (module.usedExports.length === old) {
79285 return;
79286 }
79287 } else if (Array.isArray(module.usedExports)) {
79288 return;
79289 } else {
79290 module.usedExports = false;
79291 }
79292
79293 // for a module without side effects we stop tracking usage here when no export is used
79294 // This module won't be evaluated in this case
79295 if (module.factoryMeta.sideEffectFree) {
79296 if (module.usedExports === false) return;
79297 if (
79298 Array.isArray(module.usedExports) &&
79299 module.usedExports.length === 0
79300 )
79301 return;
79302 }
79303
79304 queue.push([module, module, module.usedExports]);
79305 };
79306
79307 const processDependenciesBlock = (module, depBlock, usedExports) => {
79308 for (const dep of depBlock.dependencies) {
79309 processDependency(module, dep);
79310 }
79311 for (const variable of depBlock.variables) {
79312 for (const dep of variable.dependencies) {
79313 processDependency(module, dep);
79314 }
79315 }
79316 for (const block of depBlock.blocks) {
79317 queue.push([module, block, usedExports]);
79318 }
79319 };
79320
79321 const processDependency = (module, dep) => {
79322 const reference = compilation.getDependencyReference(module, dep);
79323 if (!reference) return;
79324 const referenceModule = reference.module;
79325 const importedNames = reference.importedNames;
79326 const oldUsed = referenceModule.used;
79327 const oldUsedExports = referenceModule.usedExports;
79328 if (
79329 !oldUsed ||
79330 (importedNames &&
79331 (!oldUsedExports || !isSubset(oldUsedExports, importedNames)))
79332 ) {
79333 processModule(referenceModule, importedNames);
79334 }
79335 };
79336
79337 for (const module of modules) {
79338 if (!module.used) module.used = false;
79339 }
79340
79341 /** @type {[Module, DependenciesBlock, UsedExports][]} */
79342 const queue = [];
79343 for (const preparedEntrypoint of compilation._preparedEntrypoints) {
79344 if (preparedEntrypoint.module) {
79345 processModule(preparedEntrypoint.module, true);
79346 }
79347 }
79348
79349 while (queue.length) {
79350 const queueItem = queue.pop();
79351 processDependenciesBlock(queueItem[0], queueItem[1], queueItem[2]);
79352 }
79353 }
79354 );
79355 });
79356 }
79357}
79358module.exports = FlagDependencyUsagePlugin;
79359
79360
79361/***/ }),
79362
79363/***/ 31221:
79364/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
79365
79366"use strict";
79367/*
79368 MIT License http://www.opensource.org/licenses/mit-license.php
79369 Author Tobias Koppers @sokra
79370*/
79371
79372
79373const FunctionModuleTemplatePlugin = __webpack_require__(18864);
79374
79375class FunctionModulePlugin {
79376 apply(compiler) {
79377 compiler.hooks.compilation.tap("FunctionModulePlugin", compilation => {
79378 new FunctionModuleTemplatePlugin().apply(
79379 compilation.moduleTemplates.javascript
79380 );
79381 });
79382 }
79383}
79384
79385module.exports = FunctionModulePlugin;
79386
79387
79388/***/ }),
79389
79390/***/ 18864:
79391/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
79392
79393"use strict";
79394/*
79395 MIT License http://www.opensource.org/licenses/mit-license.php
79396 Author Tobias Koppers @sokra
79397*/
79398
79399
79400const { ConcatSource } = __webpack_require__(53665);
79401const Template = __webpack_require__(96066);
79402
79403class FunctionModuleTemplatePlugin {
79404 apply(moduleTemplate) {
79405 moduleTemplate.hooks.render.tap(
79406 "FunctionModuleTemplatePlugin",
79407 (moduleSource, module) => {
79408 const source = new ConcatSource();
79409 const args = [module.moduleArgument];
79410 // TODO remove HACK checking type for javascript
79411 if (module.type && module.type.startsWith("javascript")) {
79412 args.push(module.exportsArgument);
79413 if (module.hasDependencies(d => d.requireWebpackRequire !== false)) {
79414 args.push("__webpack_require__");
79415 }
79416 } else if (module.type && module.type.startsWith("json")) {
79417 // no additional arguments needed
79418 } else {
79419 args.push(module.exportsArgument, "__webpack_require__");
79420 }
79421 source.add("/***/ (function(" + args.join(", ") + ") {\n\n");
79422 if (module.buildInfo.strict) source.add('"use strict";\n');
79423 source.add(moduleSource);
79424 source.add("\n\n/***/ })");
79425 return source;
79426 }
79427 );
79428
79429 moduleTemplate.hooks.package.tap(
79430 "FunctionModuleTemplatePlugin",
79431 (moduleSource, module) => {
79432 if (moduleTemplate.runtimeTemplate.outputOptions.pathinfo) {
79433 const source = new ConcatSource();
79434 const req = module.readableIdentifier(
79435 moduleTemplate.runtimeTemplate.requestShortener
79436 );
79437 const reqStr = req.replace(/\*\//g, "*_/");
79438 const reqStrStar = "*".repeat(reqStr.length);
79439 source.add("/*!****" + reqStrStar + "****!*\\\n");
79440 source.add(" !*** " + reqStr + " ***!\n");
79441 source.add(" \\****" + reqStrStar + "****/\n");
79442 if (
79443 Array.isArray(module.buildMeta.providedExports) &&
79444 module.buildMeta.providedExports.length === 0
79445 ) {
79446 source.add(Template.toComment("no exports provided") + "\n");
79447 } else if (Array.isArray(module.buildMeta.providedExports)) {
79448 source.add(
79449 Template.toComment(
79450 "exports provided: " +
79451 module.buildMeta.providedExports.join(", ")
79452 ) + "\n"
79453 );
79454 } else if (module.buildMeta.providedExports) {
79455 source.add(Template.toComment("no static exports found") + "\n");
79456 }
79457 if (
79458 Array.isArray(module.usedExports) &&
79459 module.usedExports.length === 0
79460 ) {
79461 source.add(Template.toComment("no exports used") + "\n");
79462 } else if (Array.isArray(module.usedExports)) {
79463 source.add(
79464 Template.toComment(
79465 "exports used: " + module.usedExports.join(", ")
79466 ) + "\n"
79467 );
79468 } else if (module.usedExports) {
79469 source.add(Template.toComment("all exports used") + "\n");
79470 }
79471 if (module.optimizationBailout) {
79472 for (const text of module.optimizationBailout) {
79473 let code;
79474 if (typeof text === "function") {
79475 code = text(moduleTemplate.runtimeTemplate.requestShortener);
79476 } else {
79477 code = text;
79478 }
79479 source.add(Template.toComment(`${code}`) + "\n");
79480 }
79481 }
79482 source.add(moduleSource);
79483 return source;
79484 }
79485 return moduleSource;
79486 }
79487 );
79488
79489 moduleTemplate.hooks.hash.tap("FunctionModuleTemplatePlugin", hash => {
79490 hash.update("FunctionModuleTemplatePlugin");
79491 hash.update("2");
79492 });
79493 }
79494}
79495module.exports = FunctionModuleTemplatePlugin;
79496
79497
79498/***/ }),
79499
79500/***/ 39172:
79501/***/ (function(module) {
79502
79503"use strict";
79504/*
79505 MIT License http://www.opensource.org/licenses/mit-license.php
79506 Author Tobias Koppers @sokra
79507*/
79508
79509
79510/** @typedef {import("./NormalModule")} NormalModule */
79511/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
79512/** @typedef {import("webpack-sources").Source} Source */
79513/** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate */
79514
79515/**
79516 *
79517 */
79518class Generator {
79519 static byType(map) {
79520 return new ByTypeGenerator(map);
79521 }
79522
79523 /**
79524 * @abstract
79525 * @param {NormalModule} module module for which the code should be generated
79526 * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
79527 * @param {RuntimeTemplate} runtimeTemplate the runtime template
79528 * @param {string} type which kind of code should be generated
79529 * @returns {Source} generated code
79530 */
79531 generate(module, dependencyTemplates, runtimeTemplate, type) {
79532 throw new Error("Generator.generate: must be overridden");
79533 }
79534}
79535
79536class ByTypeGenerator extends Generator {
79537 constructor(map) {
79538 super();
79539 this.map = map;
79540 }
79541
79542 /**
79543 * @param {NormalModule} module module for which the code should be generated
79544 * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
79545 * @param {RuntimeTemplate} runtimeTemplate the runtime template
79546 * @param {string} type which kind of code should be generated
79547 * @returns {Source} generated code
79548 */
79549 generate(module, dependencyTemplates, runtimeTemplate, type) {
79550 const generator = this.map[type];
79551 if (!generator) {
79552 throw new Error(`Generator.byType: no generator specified for ${type}`);
79553 }
79554 return generator.generate(
79555 module,
79556 dependencyTemplates,
79557 runtimeTemplate,
79558 type
79559 );
79560 }
79561}
79562
79563module.exports = Generator;
79564
79565
79566/***/ }),
79567
79568/***/ 32973:
79569/***/ (function(__unused_webpack_module, exports) {
79570
79571/** @typedef {import("./Chunk")} Chunk */
79572/** @typedef {import("./ChunkGroup")} ChunkGroup */
79573/** @typedef {import("./Module")} Module */
79574/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
79575/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
79576
79577/**
79578 * @param {ChunkGroup} chunkGroup the ChunkGroup to connect
79579 * @param {Chunk} chunk chunk to tie to ChunkGroup
79580 * @returns {void}
79581 */
79582const connectChunkGroupAndChunk = (chunkGroup, chunk) => {
79583 if (chunkGroup.pushChunk(chunk)) {
79584 chunk.addGroup(chunkGroup);
79585 }
79586};
79587
79588/**
79589 * @param {ChunkGroup} parent parent ChunkGroup to connect
79590 * @param {ChunkGroup} child child ChunkGroup to connect
79591 * @returns {void}
79592 */
79593const connectChunkGroupParentAndChild = (parent, child) => {
79594 if (parent.addChild(child)) {
79595 child.addParent(parent);
79596 }
79597};
79598
79599/**
79600 * @param {Chunk} chunk Chunk to connect to Module
79601 * @param {Module} module Module to connect to Chunk
79602 * @returns {void}
79603 */
79604const connectChunkAndModule = (chunk, module) => {
79605 if (module.addChunk(chunk)) {
79606 chunk.addModule(module);
79607 }
79608};
79609
79610/**
79611 * @param {Chunk} chunk Chunk being disconnected
79612 * @param {Module} module Module being disconnected
79613 * @returns {void}
79614 */
79615const disconnectChunkAndModule = (chunk, module) => {
79616 chunk.removeModule(module);
79617 module.removeChunk(chunk);
79618};
79619
79620/**
79621 * @param {AsyncDependenciesBlock} depBlock DepBlock being tied to ChunkGroup
79622 * @param {ChunkGroup} chunkGroup ChunkGroup being tied to DepBlock
79623 * @returns {void}
79624 */
79625const connectDependenciesBlockAndChunkGroup = (depBlock, chunkGroup) => {
79626 if (chunkGroup.addBlock(depBlock)) {
79627 depBlock.chunkGroup = chunkGroup;
79628 }
79629};
79630
79631exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk;
79632exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild;
79633exports.connectChunkAndModule = connectChunkAndModule;
79634exports.disconnectChunkAndModule = disconnectChunkAndModule;
79635exports.connectDependenciesBlockAndChunkGroup = connectDependenciesBlockAndChunkGroup;
79636
79637
79638/***/ }),
79639
79640/***/ 30327:
79641/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
79642
79643"use strict";
79644/*
79645 MIT License http://www.opensource.org/licenses/mit-license.php
79646*/
79647
79648
79649const WebpackError = __webpack_require__(97391);
79650
79651module.exports = class HarmonyLinkingError extends WebpackError {
79652 /** @param {string} message Error message */
79653 constructor(message) {
79654 super(message);
79655 this.name = "HarmonyLinkingError";
79656 this.hideStack = true;
79657
79658 Error.captureStackTrace(this, this.constructor);
79659 }
79660};
79661
79662
79663/***/ }),
79664
79665/***/ 50268:
79666/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
79667
79668"use strict";
79669/*
79670 MIT License http://www.opensource.org/licenses/mit-license.php
79671 Author Tobias Koppers @sokra
79672*/
79673
79674const createHash = __webpack_require__(15660);
79675
79676const validateOptions = __webpack_require__(33225);
79677const schema = __webpack_require__(45843);
79678
79679/** @typedef {import("../declarations/plugins/HashedModuleIdsPlugin").HashedModuleIdsPluginOptions} HashedModuleIdsPluginOptions */
79680
79681class HashedModuleIdsPlugin {
79682 /**
79683 * @param {HashedModuleIdsPluginOptions=} options options object
79684 */
79685 constructor(options) {
79686 if (!options) options = {};
79687
79688 validateOptions(schema, options, "Hashed Module Ids Plugin");
79689
79690 /** @type {HashedModuleIdsPluginOptions} */
79691 this.options = Object.assign(
79692 {
79693 context: null,
79694 hashFunction: "md4",
79695 hashDigest: "base64",
79696 hashDigestLength: 4
79697 },
79698 options
79699 );
79700 }
79701
79702 apply(compiler) {
79703 const options = this.options;
79704 compiler.hooks.compilation.tap("HashedModuleIdsPlugin", compilation => {
79705 const usedIds = new Set();
79706 compilation.hooks.beforeModuleIds.tap(
79707 "HashedModuleIdsPlugin",
79708 modules => {
79709 for (const module of modules) {
79710 if (module.id === null && module.libIdent) {
79711 const id = module.libIdent({
79712 context: this.options.context || compiler.options.context
79713 });
79714 const hash = createHash(options.hashFunction);
79715 hash.update(id);
79716 const hashId = /** @type {string} */ (hash.digest(
79717 options.hashDigest
79718 ));
79719 let len = options.hashDigestLength;
79720 while (usedIds.has(hashId.substr(0, len))) len++;
79721 module.id = hashId.substr(0, len);
79722 usedIds.add(module.id);
79723 }
79724 }
79725 }
79726 );
79727 });
79728 }
79729}
79730
79731module.exports = HashedModuleIdsPlugin;
79732
79733
79734/***/ }),
79735
79736/***/ 65217:
79737/***/ (function(module) {
79738
79739/*
79740 MIT License http://www.opensource.org/licenses/mit-license.php
79741 Author Tobias Koppers @sokra
79742*/
79743// eslint-disable no-unused-vars
79744var $hash$ = undefined;
79745var $requestTimeout$ = undefined;
79746var installedModules = undefined;
79747var $require$ = undefined;
79748var hotDownloadManifest = undefined;
79749var hotDownloadUpdateChunk = undefined;
79750var hotDisposeChunk = undefined;
79751var modules = undefined;
79752var chunkId = undefined;
79753
79754module.exports = function() {
79755 var hotApplyOnUpdate = true;
79756 // eslint-disable-next-line no-unused-vars
79757 var hotCurrentHash = $hash$;
79758 var hotRequestTimeout = $requestTimeout$;
79759 var hotCurrentModuleData = {};
79760 var hotCurrentChildModule;
79761 // eslint-disable-next-line no-unused-vars
79762 var hotCurrentParents = [];
79763 // eslint-disable-next-line no-unused-vars
79764 var hotCurrentParentsTemp = [];
79765
79766 // eslint-disable-next-line no-unused-vars
79767 function hotCreateRequire(moduleId) {
79768 var me = installedModules[moduleId];
79769 if (!me) return $require$;
79770 var fn = function(request) {
79771 if (me.hot.active) {
79772 if (installedModules[request]) {
79773 if (installedModules[request].parents.indexOf(moduleId) === -1) {
79774 installedModules[request].parents.push(moduleId);
79775 }
79776 } else {
79777 hotCurrentParents = [moduleId];
79778 hotCurrentChildModule = request;
79779 }
79780 if (me.children.indexOf(request) === -1) {
79781 me.children.push(request);
79782 }
79783 } else {
79784 console.warn(
79785 "[HMR] unexpected require(" +
79786 request +
79787 ") from disposed module " +
79788 moduleId
79789 );
79790 hotCurrentParents = [];
79791 }
79792 return $require$(request);
79793 };
79794 var ObjectFactory = function ObjectFactory(name) {
79795 return {
79796 configurable: true,
79797 enumerable: true,
79798 get: function() {
79799 return $require$[name];
79800 },
79801 set: function(value) {
79802 $require$[name] = value;
79803 }
79804 };
79805 };
79806 for (var name in $require$) {
79807 if (
79808 Object.prototype.hasOwnProperty.call($require$, name) &&
79809 name !== "e" &&
79810 name !== "t"
79811 ) {
79812 Object.defineProperty(fn, name, ObjectFactory(name));
79813 }
79814 }
79815 fn.e = function(chunkId) {
79816 if (hotStatus === "ready") hotSetStatus("prepare");
79817 hotChunksLoading++;
79818 return $require$.e(chunkId).then(finishChunkLoading, function(err) {
79819 finishChunkLoading();
79820 throw err;
79821 });
79822
79823 function finishChunkLoading() {
79824 hotChunksLoading--;
79825 if (hotStatus === "prepare") {
79826 if (!hotWaitingFilesMap[chunkId]) {
79827 hotEnsureUpdateChunk(chunkId);
79828 }
79829 if (hotChunksLoading === 0 && hotWaitingFiles === 0) {
79830 hotUpdateDownloaded();
79831 }
79832 }
79833 }
79834 };
79835 fn.t = function(value, mode) {
79836 if (mode & 1) value = fn(value);
79837 return $require$.t(value, mode & ~1);
79838 };
79839 return fn;
79840 }
79841
79842 // eslint-disable-next-line no-unused-vars
79843 function hotCreateModule(moduleId) {
79844 var hot = {
79845 // private stuff
79846 _acceptedDependencies: {},
79847 _declinedDependencies: {},
79848 _selfAccepted: false,
79849 _selfDeclined: false,
79850 _selfInvalidated: false,
79851 _disposeHandlers: [],
79852 _main: hotCurrentChildModule !== moduleId,
79853
79854 // Module API
79855 active: true,
79856 accept: function(dep, callback) {
79857 if (dep === undefined) hot._selfAccepted = true;
79858 else if (typeof dep === "function") hot._selfAccepted = dep;
79859 else if (typeof dep === "object")
79860 for (var i = 0; i < dep.length; i++)
79861 hot._acceptedDependencies[dep[i]] = callback || function() {};
79862 else hot._acceptedDependencies[dep] = callback || function() {};
79863 },
79864 decline: function(dep) {
79865 if (dep === undefined) hot._selfDeclined = true;
79866 else if (typeof dep === "object")
79867 for (var i = 0; i < dep.length; i++)
79868 hot._declinedDependencies[dep[i]] = true;
79869 else hot._declinedDependencies[dep] = true;
79870 },
79871 dispose: function(callback) {
79872 hot._disposeHandlers.push(callback);
79873 },
79874 addDisposeHandler: function(callback) {
79875 hot._disposeHandlers.push(callback);
79876 },
79877 removeDisposeHandler: function(callback) {
79878 var idx = hot._disposeHandlers.indexOf(callback);
79879 if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
79880 },
79881 invalidate: function() {
79882 this._selfInvalidated = true;
79883 switch (hotStatus) {
79884 case "idle":
79885 hotUpdate = {};
79886 hotUpdate[moduleId] = modules[moduleId];
79887 hotSetStatus("ready");
79888 break;
79889 case "ready":
79890 hotApplyInvalidatedModule(moduleId);
79891 break;
79892 case "prepare":
79893 case "check":
79894 case "dispose":
79895 case "apply":
79896 (hotQueuedInvalidatedModules =
79897 hotQueuedInvalidatedModules || []).push(moduleId);
79898 break;
79899 default:
79900 // ignore requests in error states
79901 break;
79902 }
79903 },
79904
79905 // Management API
79906 check: hotCheck,
79907 apply: hotApply,
79908 status: function(l) {
79909 if (!l) return hotStatus;
79910 hotStatusHandlers.push(l);
79911 },
79912 addStatusHandler: function(l) {
79913 hotStatusHandlers.push(l);
79914 },
79915 removeStatusHandler: function(l) {
79916 var idx = hotStatusHandlers.indexOf(l);
79917 if (idx >= 0) hotStatusHandlers.splice(idx, 1);
79918 },
79919
79920 //inherit from previous dispose call
79921 data: hotCurrentModuleData[moduleId]
79922 };
79923 hotCurrentChildModule = undefined;
79924 return hot;
79925 }
79926
79927 var hotStatusHandlers = [];
79928 var hotStatus = "idle";
79929
79930 function hotSetStatus(newStatus) {
79931 hotStatus = newStatus;
79932 for (var i = 0; i < hotStatusHandlers.length; i++)
79933 hotStatusHandlers[i].call(null, newStatus);
79934 }
79935
79936 // while downloading
79937 var hotWaitingFiles = 0;
79938 var hotChunksLoading = 0;
79939 var hotWaitingFilesMap = {};
79940 var hotRequestedFilesMap = {};
79941 var hotAvailableFilesMap = {};
79942 var hotDeferred;
79943
79944 // The update info
79945 var hotUpdate, hotUpdateNewHash, hotQueuedInvalidatedModules;
79946
79947 function toModuleId(id) {
79948 var isNumber = +id + "" === id;
79949 return isNumber ? +id : id;
79950 }
79951
79952 function hotCheck(apply) {
79953 if (hotStatus !== "idle") {
79954 throw new Error("check() is only allowed in idle status");
79955 }
79956 hotApplyOnUpdate = apply;
79957 hotSetStatus("check");
79958 return hotDownloadManifest(hotRequestTimeout).then(function(update) {
79959 if (!update) {
79960 hotSetStatus(hotApplyInvalidatedModules() ? "ready" : "idle");
79961 return null;
79962 }
79963 hotRequestedFilesMap = {};
79964 hotWaitingFilesMap = {};
79965 hotAvailableFilesMap = update.c;
79966 hotUpdateNewHash = update.h;
79967
79968 hotSetStatus("prepare");
79969 var promise = new Promise(function(resolve, reject) {
79970 hotDeferred = {
79971 resolve: resolve,
79972 reject: reject
79973 };
79974 });
79975 hotUpdate = {};
79976 /*foreachInstalledChunks*/
79977 // eslint-disable-next-line no-lone-blocks
79978 {
79979 hotEnsureUpdateChunk(chunkId);
79980 }
79981 if (
79982 hotStatus === "prepare" &&
79983 hotChunksLoading === 0 &&
79984 hotWaitingFiles === 0
79985 ) {
79986 hotUpdateDownloaded();
79987 }
79988 return promise;
79989 });
79990 }
79991
79992 // eslint-disable-next-line no-unused-vars
79993 function hotAddUpdateChunk(chunkId, moreModules) {
79994 if (!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
79995 return;
79996 hotRequestedFilesMap[chunkId] = false;
79997 for (var moduleId in moreModules) {
79998 if (Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
79999 hotUpdate[moduleId] = moreModules[moduleId];
80000 }
80001 }
80002 if (--hotWaitingFiles === 0 && hotChunksLoading === 0) {
80003 hotUpdateDownloaded();
80004 }
80005 }
80006
80007 function hotEnsureUpdateChunk(chunkId) {
80008 if (!hotAvailableFilesMap[chunkId]) {
80009 hotWaitingFilesMap[chunkId] = true;
80010 } else {
80011 hotRequestedFilesMap[chunkId] = true;
80012 hotWaitingFiles++;
80013 hotDownloadUpdateChunk(chunkId);
80014 }
80015 }
80016
80017 function hotUpdateDownloaded() {
80018 hotSetStatus("ready");
80019 var deferred = hotDeferred;
80020 hotDeferred = null;
80021 if (!deferred) return;
80022 if (hotApplyOnUpdate) {
80023 // Wrap deferred object in Promise to mark it as a well-handled Promise to
80024 // avoid triggering uncaught exception warning in Chrome.
80025 // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666
80026 Promise.resolve()
80027 .then(function() {
80028 return hotApply(hotApplyOnUpdate);
80029 })
80030 .then(
80031 function(result) {
80032 deferred.resolve(result);
80033 },
80034 function(err) {
80035 deferred.reject(err);
80036 }
80037 );
80038 } else {
80039 var outdatedModules = [];
80040 for (var id in hotUpdate) {
80041 if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
80042 outdatedModules.push(toModuleId(id));
80043 }
80044 }
80045 deferred.resolve(outdatedModules);
80046 }
80047 }
80048
80049 function hotApply(options) {
80050 if (hotStatus !== "ready")
80051 throw new Error("apply() is only allowed in ready status");
80052 options = options || {};
80053 return hotApplyInternal(options);
80054 }
80055
80056 function hotApplyInternal(options) {
80057 hotApplyInvalidatedModules();
80058
80059 var cb;
80060 var i;
80061 var j;
80062 var module;
80063 var moduleId;
80064
80065 function getAffectedStuff(updateModuleId) {
80066 var outdatedModules = [updateModuleId];
80067 var outdatedDependencies = {};
80068
80069 var queue = outdatedModules.map(function(id) {
80070 return {
80071 chain: [id],
80072 id: id
80073 };
80074 });
80075 while (queue.length > 0) {
80076 var queueItem = queue.pop();
80077 var moduleId = queueItem.id;
80078 var chain = queueItem.chain;
80079 module = installedModules[moduleId];
80080 if (
80081 !module ||
80082 (module.hot._selfAccepted && !module.hot._selfInvalidated)
80083 )
80084 continue;
80085 if (module.hot._selfDeclined) {
80086 return {
80087 type: "self-declined",
80088 chain: chain,
80089 moduleId: moduleId
80090 };
80091 }
80092 if (module.hot._main) {
80093 return {
80094 type: "unaccepted",
80095 chain: chain,
80096 moduleId: moduleId
80097 };
80098 }
80099 for (var i = 0; i < module.parents.length; i++) {
80100 var parentId = module.parents[i];
80101 var parent = installedModules[parentId];
80102 if (!parent) continue;
80103 if (parent.hot._declinedDependencies[moduleId]) {
80104 return {
80105 type: "declined",
80106 chain: chain.concat([parentId]),
80107 moduleId: moduleId,
80108 parentId: parentId
80109 };
80110 }
80111 if (outdatedModules.indexOf(parentId) !== -1) continue;
80112 if (parent.hot._acceptedDependencies[moduleId]) {
80113 if (!outdatedDependencies[parentId])
80114 outdatedDependencies[parentId] = [];
80115 addAllToSet(outdatedDependencies[parentId], [moduleId]);
80116 continue;
80117 }
80118 delete outdatedDependencies[parentId];
80119 outdatedModules.push(parentId);
80120 queue.push({
80121 chain: chain.concat([parentId]),
80122 id: parentId
80123 });
80124 }
80125 }
80126
80127 return {
80128 type: "accepted",
80129 moduleId: updateModuleId,
80130 outdatedModules: outdatedModules,
80131 outdatedDependencies: outdatedDependencies
80132 };
80133 }
80134
80135 function addAllToSet(a, b) {
80136 for (var i = 0; i < b.length; i++) {
80137 var item = b[i];
80138 if (a.indexOf(item) === -1) a.push(item);
80139 }
80140 }
80141
80142 // at begin all updates modules are outdated
80143 // the "outdated" status can propagate to parents if they don't accept the children
80144 var outdatedDependencies = {};
80145 var outdatedModules = [];
80146 var appliedUpdate = {};
80147
80148 var warnUnexpectedRequire = function warnUnexpectedRequire() {
80149 console.warn(
80150 "[HMR] unexpected require(" + result.moduleId + ") to disposed module"
80151 );
80152 };
80153
80154 for (var id in hotUpdate) {
80155 if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
80156 moduleId = toModuleId(id);
80157 /** @type {TODO} */
80158 var result;
80159 if (hotUpdate[id]) {
80160 result = getAffectedStuff(moduleId);
80161 } else {
80162 result = {
80163 type: "disposed",
80164 moduleId: id
80165 };
80166 }
80167 /** @type {Error|false} */
80168 var abortError = false;
80169 var doApply = false;
80170 var doDispose = false;
80171 var chainInfo = "";
80172 if (result.chain) {
80173 chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
80174 }
80175 switch (result.type) {
80176 case "self-declined":
80177 if (options.onDeclined) options.onDeclined(result);
80178 if (!options.ignoreDeclined)
80179 abortError = new Error(
80180 "Aborted because of self decline: " +
80181 result.moduleId +
80182 chainInfo
80183 );
80184 break;
80185 case "declined":
80186 if (options.onDeclined) options.onDeclined(result);
80187 if (!options.ignoreDeclined)
80188 abortError = new Error(
80189 "Aborted because of declined dependency: " +
80190 result.moduleId +
80191 " in " +
80192 result.parentId +
80193 chainInfo
80194 );
80195 break;
80196 case "unaccepted":
80197 if (options.onUnaccepted) options.onUnaccepted(result);
80198 if (!options.ignoreUnaccepted)
80199 abortError = new Error(
80200 "Aborted because " + moduleId + " is not accepted" + chainInfo
80201 );
80202 break;
80203 case "accepted":
80204 if (options.onAccepted) options.onAccepted(result);
80205 doApply = true;
80206 break;
80207 case "disposed":
80208 if (options.onDisposed) options.onDisposed(result);
80209 doDispose = true;
80210 break;
80211 default:
80212 throw new Error("Unexception type " + result.type);
80213 }
80214 if (abortError) {
80215 hotSetStatus("abort");
80216 return Promise.reject(abortError);
80217 }
80218 if (doApply) {
80219 appliedUpdate[moduleId] = hotUpdate[moduleId];
80220 addAllToSet(outdatedModules, result.outdatedModules);
80221 for (moduleId in result.outdatedDependencies) {
80222 if (
80223 Object.prototype.hasOwnProperty.call(
80224 result.outdatedDependencies,
80225 moduleId
80226 )
80227 ) {
80228 if (!outdatedDependencies[moduleId])
80229 outdatedDependencies[moduleId] = [];
80230 addAllToSet(
80231 outdatedDependencies[moduleId],
80232 result.outdatedDependencies[moduleId]
80233 );
80234 }
80235 }
80236 }
80237 if (doDispose) {
80238 addAllToSet(outdatedModules, [result.moduleId]);
80239 appliedUpdate[moduleId] = warnUnexpectedRequire;
80240 }
80241 }
80242 }
80243
80244 // Store self accepted outdated modules to require them later by the module system
80245 var outdatedSelfAcceptedModules = [];
80246 for (i = 0; i < outdatedModules.length; i++) {
80247 moduleId = outdatedModules[i];
80248 if (
80249 installedModules[moduleId] &&
80250 installedModules[moduleId].hot._selfAccepted &&
80251 // removed self-accepted modules should not be required
80252 appliedUpdate[moduleId] !== warnUnexpectedRequire &&
80253 // when called invalidate self-accepting is not possible
80254 !installedModules[moduleId].hot._selfInvalidated
80255 ) {
80256 outdatedSelfAcceptedModules.push({
80257 module: moduleId,
80258 parents: installedModules[moduleId].parents.slice(),
80259 errorHandler: installedModules[moduleId].hot._selfAccepted
80260 });
80261 }
80262 }
80263
80264 // Now in "dispose" phase
80265 hotSetStatus("dispose");
80266 Object.keys(hotAvailableFilesMap).forEach(function(chunkId) {
80267 if (hotAvailableFilesMap[chunkId] === false) {
80268 hotDisposeChunk(chunkId);
80269 }
80270 });
80271
80272 var idx;
80273 var queue = outdatedModules.slice();
80274 while (queue.length > 0) {
80275 moduleId = queue.pop();
80276 module = installedModules[moduleId];
80277 if (!module) continue;
80278
80279 var data = {};
80280
80281 // Call dispose handlers
80282 var disposeHandlers = module.hot._disposeHandlers;
80283 for (j = 0; j < disposeHandlers.length; j++) {
80284 cb = disposeHandlers[j];
80285 cb(data);
80286 }
80287 hotCurrentModuleData[moduleId] = data;
80288
80289 // disable module (this disables requires from this module)
80290 module.hot.active = false;
80291
80292 // remove module from cache
80293 delete installedModules[moduleId];
80294
80295 // when disposing there is no need to call dispose handler
80296 delete outdatedDependencies[moduleId];
80297
80298 // remove "parents" references from all children
80299 for (j = 0; j < module.children.length; j++) {
80300 var child = installedModules[module.children[j]];
80301 if (!child) continue;
80302 idx = child.parents.indexOf(moduleId);
80303 if (idx >= 0) {
80304 child.parents.splice(idx, 1);
80305 }
80306 }
80307 }
80308
80309 // remove outdated dependency from module children
80310 var dependency;
80311 var moduleOutdatedDependencies;
80312 for (moduleId in outdatedDependencies) {
80313 if (
80314 Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)
80315 ) {
80316 module = installedModules[moduleId];
80317 if (module) {
80318 moduleOutdatedDependencies = outdatedDependencies[moduleId];
80319 for (j = 0; j < moduleOutdatedDependencies.length; j++) {
80320 dependency = moduleOutdatedDependencies[j];
80321 idx = module.children.indexOf(dependency);
80322 if (idx >= 0) module.children.splice(idx, 1);
80323 }
80324 }
80325 }
80326 }
80327
80328 // Now in "apply" phase
80329 hotSetStatus("apply");
80330
80331 if (hotUpdateNewHash !== undefined) {
80332 hotCurrentHash = hotUpdateNewHash;
80333 hotUpdateNewHash = undefined;
80334 }
80335 hotUpdate = undefined;
80336
80337 // insert new code
80338 for (moduleId in appliedUpdate) {
80339 if (Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
80340 modules[moduleId] = appliedUpdate[moduleId];
80341 }
80342 }
80343
80344 // call accept handlers
80345 var error = null;
80346 for (moduleId in outdatedDependencies) {
80347 if (
80348 Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)
80349 ) {
80350 module = installedModules[moduleId];
80351 if (module) {
80352 moduleOutdatedDependencies = outdatedDependencies[moduleId];
80353 var callbacks = [];
80354 for (i = 0; i < moduleOutdatedDependencies.length; i++) {
80355 dependency = moduleOutdatedDependencies[i];
80356 cb = module.hot._acceptedDependencies[dependency];
80357 if (cb) {
80358 if (callbacks.indexOf(cb) !== -1) continue;
80359 callbacks.push(cb);
80360 }
80361 }
80362 for (i = 0; i < callbacks.length; i++) {
80363 cb = callbacks[i];
80364 try {
80365 cb(moduleOutdatedDependencies);
80366 } catch (err) {
80367 if (options.onErrored) {
80368 options.onErrored({
80369 type: "accept-errored",
80370 moduleId: moduleId,
80371 dependencyId: moduleOutdatedDependencies[i],
80372 error: err
80373 });
80374 }
80375 if (!options.ignoreErrored) {
80376 if (!error) error = err;
80377 }
80378 }
80379 }
80380 }
80381 }
80382 }
80383
80384 // Load self accepted modules
80385 for (i = 0; i < outdatedSelfAcceptedModules.length; i++) {
80386 var item = outdatedSelfAcceptedModules[i];
80387 moduleId = item.module;
80388 hotCurrentParents = item.parents;
80389 hotCurrentChildModule = moduleId;
80390 try {
80391 $require$(moduleId);
80392 } catch (err) {
80393 if (typeof item.errorHandler === "function") {
80394 try {
80395 item.errorHandler(err);
80396 } catch (err2) {
80397 if (options.onErrored) {
80398 options.onErrored({
80399 type: "self-accept-error-handler-errored",
80400 moduleId: moduleId,
80401 error: err2,
80402 originalError: err
80403 });
80404 }
80405 if (!options.ignoreErrored) {
80406 if (!error) error = err2;
80407 }
80408 if (!error) error = err;
80409 }
80410 } else {
80411 if (options.onErrored) {
80412 options.onErrored({
80413 type: "self-accept-errored",
80414 moduleId: moduleId,
80415 error: err
80416 });
80417 }
80418 if (!options.ignoreErrored) {
80419 if (!error) error = err;
80420 }
80421 }
80422 }
80423 }
80424
80425 // handle errors in accept handlers and self accepted module load
80426 if (error) {
80427 hotSetStatus("fail");
80428 return Promise.reject(error);
80429 }
80430
80431 if (hotQueuedInvalidatedModules) {
80432 return hotApplyInternal(options).then(function(list) {
80433 outdatedModules.forEach(function(moduleId) {
80434 if (list.indexOf(moduleId) < 0) list.push(moduleId);
80435 });
80436 return list;
80437 });
80438 }
80439
80440 hotSetStatus("idle");
80441 return new Promise(function(resolve) {
80442 resolve(outdatedModules);
80443 });
80444 }
80445
80446 function hotApplyInvalidatedModules() {
80447 if (hotQueuedInvalidatedModules) {
80448 if (!hotUpdate) hotUpdate = {};
80449 hotQueuedInvalidatedModules.forEach(hotApplyInvalidatedModule);
80450 hotQueuedInvalidatedModules = undefined;
80451 return true;
80452 }
80453 }
80454
80455 function hotApplyInvalidatedModule(moduleId) {
80456 if (!Object.prototype.hasOwnProperty.call(hotUpdate, moduleId))
80457 hotUpdate[moduleId] = modules[moduleId];
80458 }
80459};
80460
80461
80462/***/ }),
80463
80464/***/ 69575:
80465/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
80466
80467"use strict";
80468/*
80469 MIT License http://www.opensource.org/licenses/mit-license.php
80470 Author Tobias Koppers @sokra
80471*/
80472
80473
80474const { SyncBailHook } = __webpack_require__(56758);
80475const { RawSource } = __webpack_require__(53665);
80476const Template = __webpack_require__(96066);
80477const ModuleHotAcceptDependency = __webpack_require__(29018);
80478const ModuleHotDeclineDependency = __webpack_require__(60482);
80479const ConstDependency = __webpack_require__(71101);
80480const NullFactory = __webpack_require__(40438);
80481const ParserHelpers = __webpack_require__(23999);
80482
80483module.exports = class HotModuleReplacementPlugin {
80484 constructor(options) {
80485 this.options = options || {};
80486 this.multiStep = this.options.multiStep;
80487 this.fullBuildTimeout = this.options.fullBuildTimeout || 200;
80488 this.requestTimeout = this.options.requestTimeout || 10000;
80489 }
80490
80491 apply(compiler) {
80492 const multiStep = this.multiStep;
80493 const fullBuildTimeout = this.fullBuildTimeout;
80494 const requestTimeout = this.requestTimeout;
80495 const hotUpdateChunkFilename =
80496 compiler.options.output.hotUpdateChunkFilename;
80497 const hotUpdateMainFilename = compiler.options.output.hotUpdateMainFilename;
80498 compiler.hooks.additionalPass.tapAsync(
80499 "HotModuleReplacementPlugin",
80500 callback => {
80501 if (multiStep) return setTimeout(callback, fullBuildTimeout);
80502 return callback();
80503 }
80504 );
80505
80506 const addParserPlugins = (parser, parserOptions) => {
80507 parser.hooks.expression
80508 .for("__webpack_hash__")
80509 .tap(
80510 "HotModuleReplacementPlugin",
80511 ParserHelpers.toConstantDependencyWithWebpackRequire(
80512 parser,
80513 "__webpack_require__.h()"
80514 )
80515 );
80516 parser.hooks.evaluateTypeof
80517 .for("__webpack_hash__")
80518 .tap(
80519 "HotModuleReplacementPlugin",
80520 ParserHelpers.evaluateToString("string")
80521 );
80522 parser.hooks.evaluateIdentifier.for("module.hot").tap(
80523 {
80524 name: "HotModuleReplacementPlugin",
80525 before: "NodeStuffPlugin"
80526 },
80527 expr => {
80528 return ParserHelpers.evaluateToIdentifier(
80529 "module.hot",
80530 !!parser.state.compilation.hotUpdateChunkTemplate
80531 )(expr);
80532 }
80533 );
80534 // TODO webpack 5: refactor this, no custom hooks
80535 if (!parser.hooks.hotAcceptCallback) {
80536 parser.hooks.hotAcceptCallback = new SyncBailHook([
80537 "expression",
80538 "requests"
80539 ]);
80540 }
80541 if (!parser.hooks.hotAcceptWithoutCallback) {
80542 parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
80543 "expression",
80544 "requests"
80545 ]);
80546 }
80547 parser.hooks.call
80548 .for("module.hot.accept")
80549 .tap("HotModuleReplacementPlugin", expr => {
80550 if (!parser.state.compilation.hotUpdateChunkTemplate) {
80551 return false;
80552 }
80553 if (expr.arguments.length >= 1) {
80554 const arg = parser.evaluateExpression(expr.arguments[0]);
80555 let params = [];
80556 let requests = [];
80557 if (arg.isString()) {
80558 params = [arg];
80559 } else if (arg.isArray()) {
80560 params = arg.items.filter(param => param.isString());
80561 }
80562 if (params.length > 0) {
80563 params.forEach((param, idx) => {
80564 const request = param.string;
80565 const dep = new ModuleHotAcceptDependency(request, param.range);
80566 dep.optional = true;
80567 dep.loc = Object.create(expr.loc);
80568 dep.loc.index = idx;
80569 parser.state.module.addDependency(dep);
80570 requests.push(request);
80571 });
80572 if (expr.arguments.length > 1) {
80573 parser.hooks.hotAcceptCallback.call(
80574 expr.arguments[1],
80575 requests
80576 );
80577 parser.walkExpression(expr.arguments[1]); // other args are ignored
80578 return true;
80579 } else {
80580 parser.hooks.hotAcceptWithoutCallback.call(expr, requests);
80581 return true;
80582 }
80583 }
80584 }
80585 });
80586 parser.hooks.call
80587 .for("module.hot.decline")
80588 .tap("HotModuleReplacementPlugin", expr => {
80589 if (!parser.state.compilation.hotUpdateChunkTemplate) {
80590 return false;
80591 }
80592 if (expr.arguments.length === 1) {
80593 const arg = parser.evaluateExpression(expr.arguments[0]);
80594 let params = [];
80595 if (arg.isString()) {
80596 params = [arg];
80597 } else if (arg.isArray()) {
80598 params = arg.items.filter(param => param.isString());
80599 }
80600 params.forEach((param, idx) => {
80601 const dep = new ModuleHotDeclineDependency(
80602 param.string,
80603 param.range
80604 );
80605 dep.optional = true;
80606 dep.loc = Object.create(expr.loc);
80607 dep.loc.index = idx;
80608 parser.state.module.addDependency(dep);
80609 });
80610 }
80611 });
80612 parser.hooks.expression
80613 .for("module.hot")
80614 .tap("HotModuleReplacementPlugin", ParserHelpers.skipTraversal);
80615 };
80616
80617 compiler.hooks.compilation.tap(
80618 "HotModuleReplacementPlugin",
80619 (compilation, { normalModuleFactory }) => {
80620 // This applies the HMR plugin only to the targeted compiler
80621 // It should not affect child compilations
80622 if (compilation.compiler !== compiler) return;
80623
80624 const hotUpdateChunkTemplate = compilation.hotUpdateChunkTemplate;
80625 if (!hotUpdateChunkTemplate) return;
80626
80627 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
80628 compilation.dependencyTemplates.set(
80629 ConstDependency,
80630 new ConstDependency.Template()
80631 );
80632
80633 compilation.dependencyFactories.set(
80634 ModuleHotAcceptDependency,
80635 normalModuleFactory
80636 );
80637 compilation.dependencyTemplates.set(
80638 ModuleHotAcceptDependency,
80639 new ModuleHotAcceptDependency.Template()
80640 );
80641
80642 compilation.dependencyFactories.set(
80643 ModuleHotDeclineDependency,
80644 normalModuleFactory
80645 );
80646 compilation.dependencyTemplates.set(
80647 ModuleHotDeclineDependency,
80648 new ModuleHotDeclineDependency.Template()
80649 );
80650
80651 compilation.hooks.record.tap(
80652 "HotModuleReplacementPlugin",
80653 (compilation, records) => {
80654 if (records.hash === compilation.hash) return;
80655 records.hash = compilation.hash;
80656 records.moduleHashs = {};
80657 for (const module of compilation.modules) {
80658 const identifier = module.identifier();
80659 records.moduleHashs[identifier] = module.hash;
80660 }
80661 records.chunkHashs = {};
80662 for (const chunk of compilation.chunks) {
80663 records.chunkHashs[chunk.id] = chunk.hash;
80664 }
80665 records.chunkModuleIds = {};
80666 for (const chunk of compilation.chunks) {
80667 records.chunkModuleIds[chunk.id] = Array.from(
80668 chunk.modulesIterable,
80669 m => m.id
80670 );
80671 }
80672 }
80673 );
80674 let initialPass = false;
80675 let recompilation = false;
80676 compilation.hooks.afterHash.tap("HotModuleReplacementPlugin", () => {
80677 let records = compilation.records;
80678 if (!records) {
80679 initialPass = true;
80680 return;
80681 }
80682 if (!records.hash) initialPass = true;
80683 const preHash = records.preHash || "x";
80684 const prepreHash = records.prepreHash || "x";
80685 if (preHash === compilation.hash) {
80686 recompilation = true;
80687 compilation.modifyHash(prepreHash);
80688 return;
80689 }
80690 records.prepreHash = records.hash || "x";
80691 records.preHash = compilation.hash;
80692 compilation.modifyHash(records.prepreHash);
80693 });
80694 compilation.hooks.shouldGenerateChunkAssets.tap(
80695 "HotModuleReplacementPlugin",
80696 () => {
80697 if (multiStep && !recompilation && !initialPass) return false;
80698 }
80699 );
80700 compilation.hooks.needAdditionalPass.tap(
80701 "HotModuleReplacementPlugin",
80702 () => {
80703 if (multiStep && !recompilation && !initialPass) return true;
80704 }
80705 );
80706 compilation.hooks.additionalChunkAssets.tap(
80707 "HotModuleReplacementPlugin",
80708 () => {
80709 const records = compilation.records;
80710 if (records.hash === compilation.hash) return;
80711 if (
80712 !records.moduleHashs ||
80713 !records.chunkHashs ||
80714 !records.chunkModuleIds
80715 )
80716 return;
80717 for (const module of compilation.modules) {
80718 const identifier = module.identifier();
80719 let hash = module.hash;
80720 module.hotUpdate = records.moduleHashs[identifier] !== hash;
80721 }
80722 const hotUpdateMainContent = {
80723 h: compilation.hash,
80724 c: {}
80725 };
80726 for (const key of Object.keys(records.chunkHashs)) {
80727 const chunkId = isNaN(+key) ? key : +key;
80728 const currentChunk = compilation.chunks.find(
80729 chunk => `${chunk.id}` === key
80730 );
80731 if (currentChunk) {
80732 const newModules = currentChunk
80733 .getModules()
80734 .filter(module => module.hotUpdate);
80735 const allModules = new Set();
80736 for (const module of currentChunk.modulesIterable) {
80737 allModules.add(module.id);
80738 }
80739 const removedModules = records.chunkModuleIds[chunkId].filter(
80740 id => !allModules.has(id)
80741 );
80742 if (newModules.length > 0 || removedModules.length > 0) {
80743 const source = hotUpdateChunkTemplate.render(
80744 chunkId,
80745 newModules,
80746 removedModules,
80747 compilation.hash,
80748 compilation.moduleTemplates.javascript,
80749 compilation.dependencyTemplates
80750 );
80751 const {
80752 path: filename,
80753 info: assetInfo
80754 } = compilation.getPathWithInfo(hotUpdateChunkFilename, {
80755 hash: records.hash,
80756 chunk: currentChunk
80757 });
80758 compilation.additionalChunkAssets.push(filename);
80759 compilation.emitAsset(
80760 filename,
80761 source,
80762 Object.assign({ hotModuleReplacement: true }, assetInfo)
80763 );
80764 hotUpdateMainContent.c[chunkId] = true;
80765 currentChunk.files.push(filename);
80766 compilation.hooks.chunkAsset.call(currentChunk, filename);
80767 }
80768 } else {
80769 hotUpdateMainContent.c[chunkId] = false;
80770 }
80771 }
80772 const source = new RawSource(JSON.stringify(hotUpdateMainContent));
80773 const {
80774 path: filename,
80775 info: assetInfo
80776 } = compilation.getPathWithInfo(hotUpdateMainFilename, {
80777 hash: records.hash
80778 });
80779 compilation.emitAsset(
80780 filename,
80781 source,
80782 Object.assign({ hotModuleReplacement: true }, assetInfo)
80783 );
80784 }
80785 );
80786
80787 const mainTemplate = compilation.mainTemplate;
80788
80789 mainTemplate.hooks.hash.tap("HotModuleReplacementPlugin", hash => {
80790 hash.update("HotMainTemplateDecorator");
80791 });
80792
80793 mainTemplate.hooks.moduleRequire.tap(
80794 "HotModuleReplacementPlugin",
80795 (_, chunk, hash, varModuleId) => {
80796 return `hotCreateRequire(${varModuleId})`;
80797 }
80798 );
80799
80800 mainTemplate.hooks.requireExtensions.tap(
80801 "HotModuleReplacementPlugin",
80802 source => {
80803 const buf = [source];
80804 buf.push("");
80805 buf.push("// __webpack_hash__");
80806 buf.push(
80807 mainTemplate.requireFn +
80808 ".h = function() { return hotCurrentHash; };"
80809 );
80810 return Template.asString(buf);
80811 }
80812 );
80813
80814 const needChunkLoadingCode = chunk => {
80815 for (const chunkGroup of chunk.groupsIterable) {
80816 if (chunkGroup.chunks.length > 1) return true;
80817 if (chunkGroup.getNumberOfChildren() > 0) return true;
80818 }
80819 return false;
80820 };
80821
80822 mainTemplate.hooks.bootstrap.tap(
80823 "HotModuleReplacementPlugin",
80824 (source, chunk, hash) => {
80825 source = mainTemplate.hooks.hotBootstrap.call(source, chunk, hash);
80826 return Template.asString([
80827 source,
80828 "",
80829 hotInitCode
80830 .replace(/\$require\$/g, mainTemplate.requireFn)
80831 .replace(/\$hash\$/g, JSON.stringify(hash))
80832 .replace(/\$requestTimeout\$/g, requestTimeout)
80833 .replace(
80834 /\/\*foreachInstalledChunks\*\//g,
80835 needChunkLoadingCode(chunk)
80836 ? "for(var chunkId in installedChunks)"
80837 : `var chunkId = ${JSON.stringify(chunk.id)};`
80838 )
80839 ]);
80840 }
80841 );
80842
80843 mainTemplate.hooks.globalHash.tap(
80844 "HotModuleReplacementPlugin",
80845 () => true
80846 );
80847
80848 mainTemplate.hooks.currentHash.tap(
80849 "HotModuleReplacementPlugin",
80850 (_, length) => {
80851 if (isFinite(length)) {
80852 return `hotCurrentHash.substr(0, ${length})`;
80853 } else {
80854 return "hotCurrentHash";
80855 }
80856 }
80857 );
80858
80859 mainTemplate.hooks.moduleObj.tap(
80860 "HotModuleReplacementPlugin",
80861 (source, chunk, hash, varModuleId) => {
80862 return Template.asString([
80863 `${source},`,
80864 `hot: hotCreateModule(${varModuleId}),`,
80865 "parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),",
80866 "children: []"
80867 ]);
80868 }
80869 );
80870
80871 // TODO add HMR support for javascript/esm
80872 normalModuleFactory.hooks.parser
80873 .for("javascript/auto")
80874 .tap("HotModuleReplacementPlugin", addParserPlugins);
80875 normalModuleFactory.hooks.parser
80876 .for("javascript/dynamic")
80877 .tap("HotModuleReplacementPlugin", addParserPlugins);
80878
80879 compilation.hooks.normalModuleLoader.tap(
80880 "HotModuleReplacementPlugin",
80881 context => {
80882 context.hot = true;
80883 }
80884 );
80885 }
80886 );
80887 }
80888};
80889
80890const hotInitCode = Template.getFunctionContent(
80891 __webpack_require__(65217)
80892);
80893
80894
80895/***/ }),
80896
80897/***/ 26782:
80898/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
80899
80900"use strict";
80901/*
80902 MIT License http://www.opensource.org/licenses/mit-license.php
80903 Author Tobias Koppers @sokra
80904*/
80905
80906
80907const Chunk = __webpack_require__(2919);
80908
80909class HotUpdateChunk extends Chunk {
80910 constructor() {
80911 super();
80912 /** @type {(string|number)[]} */
80913 this.removedModules = undefined;
80914 }
80915}
80916
80917module.exports = HotUpdateChunk;
80918
80919
80920/***/ }),
80921
80922/***/ 66062:
80923/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
80924
80925"use strict";
80926/*
80927 MIT License http://www.opensource.org/licenses/mit-license.php
80928 Author Tobias Koppers @sokra
80929*/
80930
80931
80932const Template = __webpack_require__(96066);
80933const HotUpdateChunk = __webpack_require__(26782);
80934const { Tapable, SyncWaterfallHook, SyncHook } = __webpack_require__(56758);
80935
80936module.exports = class HotUpdateChunkTemplate extends Tapable {
80937 constructor(outputOptions) {
80938 super();
80939 this.outputOptions = outputOptions || {};
80940 this.hooks = {
80941 modules: new SyncWaterfallHook([
80942 "source",
80943 "modules",
80944 "removedModules",
80945 "moduleTemplate",
80946 "dependencyTemplates"
80947 ]),
80948 render: new SyncWaterfallHook([
80949 "source",
80950 "modules",
80951 "removedModules",
80952 "hash",
80953 "id",
80954 "moduleTemplate",
80955 "dependencyTemplates"
80956 ]),
80957 hash: new SyncHook(["hash"])
80958 };
80959 }
80960
80961 render(
80962 id,
80963 modules,
80964 removedModules,
80965 hash,
80966 moduleTemplate,
80967 dependencyTemplates
80968 ) {
80969 const hotUpdateChunk = new HotUpdateChunk();
80970 hotUpdateChunk.id = id;
80971 hotUpdateChunk.setModules(modules);
80972 hotUpdateChunk.removedModules = removedModules;
80973 const modulesSource = Template.renderChunkModules(
80974 hotUpdateChunk,
80975 m => typeof m.source === "function",
80976 moduleTemplate,
80977 dependencyTemplates
80978 );
80979 const core = this.hooks.modules.call(
80980 modulesSource,
80981 modules,
80982 removedModules,
80983 moduleTemplate,
80984 dependencyTemplates
80985 );
80986 const source = this.hooks.render.call(
80987 core,
80988 modules,
80989 removedModules,
80990 hash,
80991 id,
80992 moduleTemplate,
80993 dependencyTemplates
80994 );
80995 return source;
80996 }
80997
80998 updateHash(hash) {
80999 hash.update("HotUpdateChunkTemplate");
81000 hash.update("1");
81001 this.hooks.hash.call(hash);
81002 }
81003};
81004
81005
81006/***/ }),
81007
81008/***/ 41364:
81009/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81010
81011"use strict";
81012/*
81013 MIT License http://www.opensource.org/licenses/mit-license.php
81014 Author Tobias Koppers @sokra
81015*/
81016
81017
81018const validateOptions = __webpack_require__(33225);
81019const schema = __webpack_require__(69667);
81020
81021/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */
81022/** @typedef {import("./Compiler")} Compiler */
81023
81024class IgnorePlugin {
81025 /**
81026 * @param {IgnorePluginOptions} options IgnorePlugin options
81027 */
81028 constructor(options) {
81029 // TODO webpack 5 remove this compat-layer
81030 if (arguments.length > 1 || options instanceof RegExp) {
81031 options = {
81032 resourceRegExp: arguments[0],
81033 contextRegExp: arguments[1]
81034 };
81035 }
81036
81037 validateOptions(schema, options, "IgnorePlugin");
81038 this.options = options;
81039
81040 /** @private @type {Function} */
81041 this.checkIgnore = this.checkIgnore.bind(this);
81042 }
81043
81044 /**
81045 * Note that if "contextRegExp" is given, both the "resourceRegExp"
81046 * and "contextRegExp" have to match.
81047 *
81048 * @param {TODO} result result
81049 * @returns {TODO|null} returns result or null if result should be ignored
81050 */
81051 checkIgnore(result) {
81052 if (!result) return result;
81053
81054 if (
81055 "checkResource" in this.options &&
81056 this.options.checkResource &&
81057 this.options.checkResource(result.request, result.context)
81058 ) {
81059 // TODO webpack 5 remove checkContext, as checkResource already gets context
81060 if ("checkContext" in this.options && this.options.checkContext) {
81061 if (this.options.checkContext(result.context)) {
81062 return null;
81063 }
81064 } else {
81065 return null;
81066 }
81067 }
81068
81069 if (
81070 "resourceRegExp" in this.options &&
81071 this.options.resourceRegExp &&
81072 this.options.resourceRegExp.test(result.request)
81073 ) {
81074 if ("contextRegExp" in this.options && this.options.contextRegExp) {
81075 // if "contextRegExp" is given,
81076 // both the "resourceRegExp" and "contextRegExp" have to match.
81077 if (this.options.contextRegExp.test(result.context)) {
81078 return null;
81079 }
81080 } else {
81081 return null;
81082 }
81083 }
81084
81085 return result;
81086 }
81087
81088 /**
81089 * @param {Compiler} compiler Webpack Compiler
81090 * @returns {void}
81091 */
81092 apply(compiler) {
81093 compiler.hooks.normalModuleFactory.tap("IgnorePlugin", nmf => {
81094 nmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore);
81095 });
81096 compiler.hooks.contextModuleFactory.tap("IgnorePlugin", cmf => {
81097 cmf.hooks.beforeResolve.tap("IgnorePlugin", this.checkIgnore);
81098 });
81099 }
81100}
81101
81102module.exports = IgnorePlugin;
81103
81104
81105/***/ }),
81106
81107/***/ 98509:
81108/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81109
81110"use strict";
81111/*
81112 MIT License http://www.opensource.org/licenses/mit-license.php
81113 Author Tobias Koppers @sokra
81114*/
81115
81116
81117const { RawSource, ReplaceSource } = __webpack_require__(53665);
81118
81119// TODO: clean up this file
81120// replace with newer constructs
81121
81122// TODO: remove DependencyVariables and replace them with something better
81123
81124class JavascriptGenerator {
81125 generate(module, dependencyTemplates, runtimeTemplate) {
81126 const originalSource = module.originalSource();
81127 if (!originalSource) {
81128 return new RawSource("throw new Error('No source available');");
81129 }
81130
81131 const source = new ReplaceSource(originalSource);
81132
81133 this.sourceBlock(
81134 module,
81135 module,
81136 [],
81137 dependencyTemplates,
81138 source,
81139 runtimeTemplate
81140 );
81141
81142 return source;
81143 }
81144
81145 sourceBlock(
81146 module,
81147 block,
81148 availableVars,
81149 dependencyTemplates,
81150 source,
81151 runtimeTemplate
81152 ) {
81153 for (const dependency of block.dependencies) {
81154 this.sourceDependency(
81155 dependency,
81156 dependencyTemplates,
81157 source,
81158 runtimeTemplate
81159 );
81160 }
81161
81162 /**
81163 * Get the variables of all blocks that we need to inject.
81164 * These will contain the variable name and its expression.
81165 * The name will be added as a parameter in a IIFE the expression as its value.
81166 */
81167 const vars = block.variables.reduce((result, value) => {
81168 const variable = this.sourceVariables(
81169 value,
81170 availableVars,
81171 dependencyTemplates,
81172 runtimeTemplate
81173 );
81174
81175 if (variable) {
81176 result.push(variable);
81177 }
81178
81179 return result;
81180 }, []);
81181
81182 /**
81183 * if we actually have variables
81184 * this is important as how #splitVariablesInUniqueNamedChunks works
81185 * it will always return an array in an array which would lead to a IIFE wrapper around
81186 * a module if we do this with an empty vars array.
81187 */
81188 if (vars.length > 0) {
81189 /**
81190 * Split all variables up into chunks of unique names.
81191 * e.g. imagine you have the following variable names that need to be injected:
81192 * [foo, bar, baz, foo, some, more]
81193 * we can not inject "foo" twice, therefore we just make two IIFEs like so:
81194 * (function(foo, bar, baz){
81195 * (function(foo, some, more){
81196 * …
81197 * }(…));
81198 * }(…));
81199 *
81200 * "splitVariablesInUniqueNamedChunks" splits the variables shown above up to this:
81201 * [[foo, bar, baz], [foo, some, more]]
81202 */
81203 const injectionVariableChunks = this.splitVariablesInUniqueNamedChunks(
81204 vars
81205 );
81206
81207 // create all the beginnings of IIFEs
81208 const functionWrapperStarts = injectionVariableChunks.map(
81209 variableChunk => {
81210 return this.variableInjectionFunctionWrapperStartCode(
81211 variableChunk.map(variable => variable.name)
81212 );
81213 }
81214 );
81215
81216 // and all the ends
81217 const functionWrapperEnds = injectionVariableChunks.map(variableChunk => {
81218 return this.variableInjectionFunctionWrapperEndCode(
81219 module,
81220 variableChunk.map(variable => variable.expression),
81221 block
81222 );
81223 });
81224
81225 // join them to one big string
81226 const varStartCode = functionWrapperStarts.join("");
81227
81228 // reverse the ends first before joining them, as the last added must be the inner most
81229 const varEndCode = functionWrapperEnds.reverse().join("");
81230
81231 // if we have anything, add it to the source
81232 if (varStartCode && varEndCode) {
81233 const start = block.range ? block.range[0] : -10;
81234 const end = block.range
81235 ? block.range[1]
81236 : module.originalSource().size() + 1;
81237 source.insert(start + 0.5, varStartCode);
81238 source.insert(end + 0.5, "\n/* WEBPACK VAR INJECTION */" + varEndCode);
81239 }
81240 }
81241
81242 for (const childBlock of block.blocks) {
81243 this.sourceBlock(
81244 module,
81245 childBlock,
81246 availableVars.concat(vars),
81247 dependencyTemplates,
81248 source,
81249 runtimeTemplate
81250 );
81251 }
81252 }
81253
81254 sourceDependency(dependency, dependencyTemplates, source, runtimeTemplate) {
81255 const template = dependencyTemplates.get(dependency.constructor);
81256 if (!template) {
81257 throw new Error(
81258 "No template for dependency: " + dependency.constructor.name
81259 );
81260 }
81261 template.apply(dependency, source, runtimeTemplate, dependencyTemplates);
81262 }
81263
81264 sourceVariables(
81265 variable,
81266 availableVars,
81267 dependencyTemplates,
81268 runtimeTemplate
81269 ) {
81270 const name = variable.name;
81271 const expr = variable.expressionSource(
81272 dependencyTemplates,
81273 runtimeTemplate
81274 );
81275
81276 if (
81277 availableVars.some(
81278 v => v.name === name && v.expression.source() === expr.source()
81279 )
81280 ) {
81281 return;
81282 }
81283 return {
81284 name: name,
81285 expression: expr
81286 };
81287 }
81288
81289 /*
81290 * creates the start part of a IIFE around the module to inject a variable name
81291 * (function(…){ <- this part
81292 * }.call(…))
81293 */
81294 variableInjectionFunctionWrapperStartCode(varNames) {
81295 const args = varNames.join(", ");
81296 return `/* WEBPACK VAR INJECTION */(function(${args}) {`;
81297 }
81298
81299 contextArgument(module, block) {
81300 if (this === block) {
81301 return module.exportsArgument;
81302 }
81303 return "this";
81304 }
81305
81306 /*
81307 * creates the end part of a IIFE around the module to inject a variable name
81308 * (function(…){
81309 * }.call(…)) <- this part
81310 */
81311 variableInjectionFunctionWrapperEndCode(module, varExpressions, block) {
81312 const firstParam = this.contextArgument(module, block);
81313 const furtherParams = varExpressions.map(e => e.source()).join(", ");
81314 return `}.call(${firstParam}, ${furtherParams}))`;
81315 }
81316
81317 splitVariablesInUniqueNamedChunks(vars) {
81318 const startState = [[]];
81319 return vars.reduce((chunks, variable) => {
81320 const current = chunks[chunks.length - 1];
81321 // check if variable with same name exists already
81322 // if so create a new chunk of variables.
81323 const variableNameAlreadyExists = current.some(
81324 v => v.name === variable.name
81325 );
81326
81327 if (variableNameAlreadyExists) {
81328 // start new chunk with current variable
81329 chunks.push([variable]);
81330 } else {
81331 // else add it to current chunk
81332 current.push(variable);
81333 }
81334 return chunks;
81335 }, startState);
81336 }
81337}
81338
81339module.exports = JavascriptGenerator;
81340
81341
81342/***/ }),
81343
81344/***/ 10339:
81345/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81346
81347"use strict";
81348/*
81349 MIT License http://www.opensource.org/licenses/mit-license.php
81350 Author Tobias Koppers @sokra
81351*/
81352
81353
81354const Parser = __webpack_require__(70558);
81355const Template = __webpack_require__(96066);
81356const { ConcatSource } = __webpack_require__(53665);
81357const JavascriptGenerator = __webpack_require__(98509);
81358const createHash = __webpack_require__(15660);
81359
81360class JavascriptModulesPlugin {
81361 apply(compiler) {
81362 compiler.hooks.compilation.tap(
81363 "JavascriptModulesPlugin",
81364 (compilation, { normalModuleFactory }) => {
81365 normalModuleFactory.hooks.createParser
81366 .for("javascript/auto")
81367 .tap("JavascriptModulesPlugin", options => {
81368 return new Parser(options, "auto");
81369 });
81370 normalModuleFactory.hooks.createParser
81371 .for("javascript/dynamic")
81372 .tap("JavascriptModulesPlugin", options => {
81373 return new Parser(options, "script");
81374 });
81375 normalModuleFactory.hooks.createParser
81376 .for("javascript/esm")
81377 .tap("JavascriptModulesPlugin", options => {
81378 return new Parser(options, "module");
81379 });
81380 normalModuleFactory.hooks.createGenerator
81381 .for("javascript/auto")
81382 .tap("JavascriptModulesPlugin", () => {
81383 return new JavascriptGenerator();
81384 });
81385 normalModuleFactory.hooks.createGenerator
81386 .for("javascript/dynamic")
81387 .tap("JavascriptModulesPlugin", () => {
81388 return new JavascriptGenerator();
81389 });
81390 normalModuleFactory.hooks.createGenerator
81391 .for("javascript/esm")
81392 .tap("JavascriptModulesPlugin", () => {
81393 return new JavascriptGenerator();
81394 });
81395 compilation.mainTemplate.hooks.renderManifest.tap(
81396 "JavascriptModulesPlugin",
81397 (result, options) => {
81398 const chunk = options.chunk;
81399 const hash = options.hash;
81400 const fullHash = options.fullHash;
81401 const outputOptions = options.outputOptions;
81402 const moduleTemplates = options.moduleTemplates;
81403 const dependencyTemplates = options.dependencyTemplates;
81404
81405 const filenameTemplate =
81406 chunk.filenameTemplate || outputOptions.filename;
81407
81408 const useChunkHash = compilation.mainTemplate.useChunkHash(chunk);
81409
81410 result.push({
81411 render: () =>
81412 compilation.mainTemplate.render(
81413 hash,
81414 chunk,
81415 moduleTemplates.javascript,
81416 dependencyTemplates
81417 ),
81418 filenameTemplate,
81419 pathOptions: {
81420 noChunkHash: !useChunkHash,
81421 contentHashType: "javascript",
81422 chunk
81423 },
81424 identifier: `chunk${chunk.id}`,
81425 hash: useChunkHash ? chunk.hash : fullHash
81426 });
81427 return result;
81428 }
81429 );
81430 compilation.mainTemplate.hooks.modules.tap(
81431 "JavascriptModulesPlugin",
81432 (source, chunk, hash, moduleTemplate, dependencyTemplates) => {
81433 return Template.renderChunkModules(
81434 chunk,
81435 m => typeof m.source === "function",
81436 moduleTemplate,
81437 dependencyTemplates,
81438 "/******/ "
81439 );
81440 }
81441 );
81442 compilation.chunkTemplate.hooks.renderManifest.tap(
81443 "JavascriptModulesPlugin",
81444 (result, options) => {
81445 const chunk = options.chunk;
81446 const outputOptions = options.outputOptions;
81447 const moduleTemplates = options.moduleTemplates;
81448 const dependencyTemplates = options.dependencyTemplates;
81449 const filenameTemplate =
81450 chunk.filenameTemplate || outputOptions.chunkFilename;
81451
81452 result.push({
81453 render: () =>
81454 this.renderJavascript(
81455 compilation.chunkTemplate,
81456 chunk,
81457 moduleTemplates.javascript,
81458 dependencyTemplates
81459 ),
81460 filenameTemplate,
81461 pathOptions: {
81462 chunk,
81463 contentHashType: "javascript"
81464 },
81465 identifier: `chunk${chunk.id}`,
81466 hash: chunk.hash
81467 });
81468
81469 return result;
81470 }
81471 );
81472 compilation.hooks.contentHash.tap("JavascriptModulesPlugin", chunk => {
81473 const outputOptions = compilation.outputOptions;
81474 const {
81475 hashSalt,
81476 hashDigest,
81477 hashDigestLength,
81478 hashFunction
81479 } = outputOptions;
81480 const hash = createHash(hashFunction);
81481 if (hashSalt) hash.update(hashSalt);
81482 const template = chunk.hasRuntime()
81483 ? compilation.mainTemplate
81484 : compilation.chunkTemplate;
81485 hash.update(`${chunk.id} `);
81486 hash.update(chunk.ids ? chunk.ids.join(",") : "");
81487 template.updateHashForChunk(
81488 hash,
81489 chunk,
81490 compilation.moduleTemplates.javascript,
81491 compilation.dependencyTemplates
81492 );
81493 for (const m of chunk.modulesIterable) {
81494 if (typeof m.source === "function") {
81495 hash.update(m.hash);
81496 }
81497 }
81498 const digest = /** @type {string} */ (hash.digest(hashDigest));
81499 chunk.contentHash.javascript = digest.substr(0, hashDigestLength);
81500 });
81501 }
81502 );
81503 }
81504
81505 renderJavascript(chunkTemplate, chunk, moduleTemplate, dependencyTemplates) {
81506 const moduleSources = Template.renderChunkModules(
81507 chunk,
81508 m => typeof m.source === "function",
81509 moduleTemplate,
81510 dependencyTemplates
81511 );
81512 const core = chunkTemplate.hooks.modules.call(
81513 moduleSources,
81514 chunk,
81515 moduleTemplate,
81516 dependencyTemplates
81517 );
81518 let source = chunkTemplate.hooks.render.call(
81519 core,
81520 chunk,
81521 moduleTemplate,
81522 dependencyTemplates
81523 );
81524 if (chunk.hasEntryModule()) {
81525 source = chunkTemplate.hooks.renderWithEntry.call(source, chunk);
81526 }
81527 chunk.rendered = true;
81528 return new ConcatSource(source, ";");
81529 }
81530}
81531
81532module.exports = JavascriptModulesPlugin;
81533
81534
81535/***/ }),
81536
81537/***/ 72806:
81538/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81539
81540"use strict";
81541/*
81542 MIT License http://www.opensource.org/licenses/mit-license.php
81543 Author Tobias Koppers @sokra
81544*/
81545
81546
81547const { ConcatSource, RawSource } = __webpack_require__(53665);
81548
81549const stringifySafe = data => {
81550 const stringified = JSON.stringify(data);
81551 if (!stringified) {
81552 return undefined; // Invalid JSON
81553 }
81554
81555 return stringified.replace(/\u2028|\u2029/g, str =>
81556 str === "\u2029" ? "\\u2029" : "\\u2028"
81557 ); // invalid in JavaScript but valid JSON
81558};
81559
81560class JsonGenerator {
81561 generate(module, dependencyTemplates, runtimeTemplate) {
81562 const source = new ConcatSource();
81563 const data = module.buildInfo.jsonData;
81564 if (data === undefined) {
81565 return new RawSource(
81566 runtimeTemplate.missingModuleStatement({
81567 request: module.rawRequest
81568 })
81569 );
81570 }
81571 let finalJson;
81572 if (
81573 Array.isArray(module.buildMeta.providedExports) &&
81574 !module.isUsed("default")
81575 ) {
81576 // Only some exports are used: We can optimize here, by only generating a part of the JSON
81577 const reducedJson = {};
81578 for (const exportName of module.buildMeta.providedExports) {
81579 if (exportName === "default") continue;
81580 const used = module.isUsed(exportName);
81581 if (used) {
81582 reducedJson[used] = data[exportName];
81583 }
81584 }
81585 finalJson = reducedJson;
81586 } else {
81587 finalJson = data;
81588 }
81589 // Use JSON because JSON.parse() is much faster than JavaScript evaluation
81590 const jsonSource = JSON.stringify(stringifySafe(finalJson));
81591 const jsonExpr = `JSON.parse(${jsonSource})`;
81592 source.add(`${module.moduleArgument}.exports = ${jsonExpr};`);
81593 return source;
81594 }
81595}
81596
81597module.exports = JsonGenerator;
81598
81599
81600/***/ }),
81601
81602/***/ 2859:
81603/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81604
81605"use strict";
81606/*
81607 MIT License http://www.opensource.org/licenses/mit-license.php
81608 Author Tobias Koppers @sokra
81609*/
81610
81611
81612const JsonParser = __webpack_require__(5807);
81613const JsonGenerator = __webpack_require__(72806);
81614
81615class JsonModulesPlugin {
81616 apply(compiler) {
81617 compiler.hooks.compilation.tap(
81618 "JsonModulesPlugin",
81619 (compilation, { normalModuleFactory }) => {
81620 normalModuleFactory.hooks.createParser
81621 .for("json")
81622 .tap("JsonModulesPlugin", () => {
81623 return new JsonParser();
81624 });
81625 normalModuleFactory.hooks.createGenerator
81626 .for("json")
81627 .tap("JsonModulesPlugin", () => {
81628 return new JsonGenerator();
81629 });
81630 }
81631 );
81632 }
81633}
81634
81635module.exports = JsonModulesPlugin;
81636
81637
81638/***/ }),
81639
81640/***/ 5807:
81641/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81642
81643"use strict";
81644/*
81645 MIT License http://www.opensource.org/licenses/mit-license.php
81646 Author Tobias Koppers @sokra
81647*/
81648
81649
81650const parseJson = __webpack_require__(48335);
81651const JsonExportsDependency = __webpack_require__(54396);
81652
81653class JsonParser {
81654 constructor(options) {
81655 this.options = options;
81656 }
81657
81658 parse(source, state) {
81659 const data = parseJson(source[0] === "\ufeff" ? source.slice(1) : source);
81660 state.module.buildInfo.jsonData = data;
81661 state.module.buildMeta.exportsType = "named";
81662 if (typeof data === "object" && data) {
81663 state.module.addDependency(new JsonExportsDependency(Object.keys(data)));
81664 }
81665 state.module.addDependency(new JsonExportsDependency(["default"]));
81666 return state;
81667 }
81668}
81669
81670module.exports = JsonParser;
81671
81672
81673/***/ }),
81674
81675/***/ 30735:
81676/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81677
81678"use strict";
81679/*
81680 MIT License http://www.opensource.org/licenses/mit-license.php
81681 Author Tobias Koppers @sokra
81682*/
81683
81684
81685const path = __webpack_require__(85622);
81686const asyncLib = __webpack_require__(36386);
81687const SingleEntryDependency = __webpack_require__(84828);
81688
81689class LibManifestPlugin {
81690 constructor(options) {
81691 this.options = options;
81692 }
81693
81694 apply(compiler) {
81695 compiler.hooks.emit.tapAsync(
81696 "LibManifestPlugin",
81697 (compilation, callback) => {
81698 asyncLib.forEach(
81699 compilation.chunks,
81700 (chunk, callback) => {
81701 if (!chunk.isOnlyInitial()) {
81702 callback();
81703 return;
81704 }
81705 const targetPath = compilation.getPath(this.options.path, {
81706 hash: compilation.hash,
81707 chunk
81708 });
81709 const name =
81710 this.options.name &&
81711 compilation.getPath(this.options.name, {
81712 hash: compilation.hash,
81713 chunk
81714 });
81715 const manifest = {
81716 name,
81717 type: this.options.type,
81718 content: Array.from(chunk.modulesIterable, module => {
81719 if (
81720 this.options.entryOnly &&
81721 !module.reasons.some(
81722 r => r.dependency instanceof SingleEntryDependency
81723 )
81724 ) {
81725 return;
81726 }
81727 if (module.libIdent) {
81728 const ident = module.libIdent({
81729 context: this.options.context || compiler.options.context
81730 });
81731 if (ident) {
81732 return {
81733 ident,
81734 data: {
81735 id: module.id,
81736 buildMeta: module.buildMeta
81737 }
81738 };
81739 }
81740 }
81741 })
81742 .filter(Boolean)
81743 .reduce((obj, item) => {
81744 obj[item.ident] = item.data;
81745 return obj;
81746 }, Object.create(null))
81747 };
81748 // Apply formatting to content if format flag is true;
81749 const manifestContent = this.options.format
81750 ? JSON.stringify(manifest, null, 2)
81751 : JSON.stringify(manifest);
81752 const content = Buffer.from(manifestContent, "utf8");
81753 compiler.outputFileSystem.mkdirp(path.dirname(targetPath), err => {
81754 if (err) return callback(err);
81755 compiler.outputFileSystem.writeFile(
81756 targetPath,
81757 content,
81758 callback
81759 );
81760 });
81761 },
81762 callback
81763 );
81764 }
81765 );
81766 }
81767}
81768module.exports = LibManifestPlugin;
81769
81770
81771/***/ }),
81772
81773/***/ 65237:
81774/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81775
81776"use strict";
81777/*
81778 MIT License http://www.opensource.org/licenses/mit-license.php
81779 Author Tobias Koppers @sokra
81780*/
81781
81782
81783const SetVarMainTemplatePlugin = __webpack_require__(37098);
81784
81785/** @typedef {import("../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */
81786/** @typedef {import("./Compiler")} Compiler */
81787
81788/**
81789 * @param {string[]} accessor the accessor to convert to path
81790 * @returns {string} the path
81791 */
81792const accessorToObjectAccess = accessor => {
81793 return accessor.map(a => `[${JSON.stringify(a)}]`).join("");
81794};
81795
81796/**
81797 * @param {string=} base the path prefix
81798 * @param {string|string[]|LibraryCustomUmdObject} accessor the accessor
81799 * @param {"amd" | "commonjs" | "root"} umdProperty property used when a custom umd object is provided
81800 * @param {string=} joinWith the element separator
81801 * @returns {string} the path
81802 */
81803const accessorAccess = (base, accessor, umdProperty, joinWith = "; ") => {
81804 const normalizedAccessor =
81805 typeof accessor === "object" && !Array.isArray(accessor)
81806 ? accessor[umdProperty]
81807 : accessor;
81808 const accessors = Array.isArray(normalizedAccessor)
81809 ? normalizedAccessor
81810 : [normalizedAccessor];
81811 return accessors
81812 .map((_, idx) => {
81813 const a = base
81814 ? base + accessorToObjectAccess(accessors.slice(0, idx + 1))
81815 : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1));
81816 if (idx === accessors.length - 1) return a;
81817 if (idx === 0 && base === undefined) {
81818 return `${a} = typeof ${a} === "object" ? ${a} : {}`;
81819 }
81820 return `${a} = ${a} || {}`;
81821 })
81822 .join(joinWith);
81823};
81824
81825class LibraryTemplatePlugin {
81826 /**
81827 * @param {string|string[]|LibraryCustomUmdObject} name name of library
81828 * @param {string} target type of library
81829 * @param {boolean} umdNamedDefine setting this to true will name the UMD module
81830 * @param {string|TODO} auxiliaryComment comment in the UMD wrapper
81831 * @param {string|string[]} exportProperty which export should be exposed as library
81832 */
81833 constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) {
81834 this.name = name;
81835 this.target = target;
81836 this.umdNamedDefine = umdNamedDefine;
81837 this.auxiliaryComment = auxiliaryComment;
81838 this.exportProperty = exportProperty;
81839 }
81840
81841 /**
81842 * @param {Compiler} compiler the compiler instance
81843 * @returns {void}
81844 */
81845 apply(compiler) {
81846 compiler.hooks.thisCompilation.tap("LibraryTemplatePlugin", compilation => {
81847 if (this.exportProperty) {
81848 const ExportPropertyMainTemplatePlugin = __webpack_require__(50471);
81849 new ExportPropertyMainTemplatePlugin(this.exportProperty).apply(
81850 compilation
81851 );
81852 }
81853 switch (this.target) {
81854 case "var":
81855 if (
81856 !this.name ||
81857 (typeof this.name === "object" && !Array.isArray(this.name))
81858 ) {
81859 throw new Error(
81860 "library name must be set and not an UMD custom object for non-UMD target"
81861 );
81862 }
81863 new SetVarMainTemplatePlugin(
81864 `var ${accessorAccess(undefined, this.name, "root")}`,
81865 false
81866 ).apply(compilation);
81867 break;
81868 case "assign":
81869 new SetVarMainTemplatePlugin(
81870 accessorAccess(undefined, this.name, "root"),
81871 false
81872 ).apply(compilation);
81873 break;
81874 case "this":
81875 case "self":
81876 case "window":
81877 if (this.name) {
81878 new SetVarMainTemplatePlugin(
81879 accessorAccess(this.target, this.name, "root"),
81880 false
81881 ).apply(compilation);
81882 } else {
81883 new SetVarMainTemplatePlugin(this.target, true).apply(compilation);
81884 }
81885 break;
81886 case "global":
81887 if (this.name) {
81888 new SetVarMainTemplatePlugin(
81889 accessorAccess(
81890 compilation.runtimeTemplate.outputOptions.globalObject,
81891 this.name,
81892 "root"
81893 ),
81894 false
81895 ).apply(compilation);
81896 } else {
81897 new SetVarMainTemplatePlugin(
81898 compilation.runtimeTemplate.outputOptions.globalObject,
81899 true
81900 ).apply(compilation);
81901 }
81902 break;
81903 case "commonjs":
81904 if (this.name) {
81905 new SetVarMainTemplatePlugin(
81906 accessorAccess("exports", this.name, "commonjs"),
81907 false
81908 ).apply(compilation);
81909 } else {
81910 new SetVarMainTemplatePlugin("exports", true).apply(compilation);
81911 }
81912 break;
81913 case "commonjs2":
81914 case "commonjs-module":
81915 new SetVarMainTemplatePlugin("module.exports", false).apply(
81916 compilation
81917 );
81918 break;
81919 case "amd":
81920 case "amd-require": {
81921 const AmdMainTemplatePlugin = __webpack_require__(9701);
81922 if (this.name && typeof this.name !== "string") {
81923 throw new Error("library name must be a string for amd target");
81924 }
81925 new AmdMainTemplatePlugin({
81926 name: this.name,
81927 requireAsWrapper: this.target === "amd-require"
81928 }).apply(compilation);
81929 break;
81930 }
81931 case "umd":
81932 case "umd2": {
81933 const UmdMainTemplatePlugin = __webpack_require__(75374);
81934 new UmdMainTemplatePlugin(this.name, {
81935 optionalAmdExternalAsGlobal: this.target === "umd2",
81936 namedDefine: this.umdNamedDefine,
81937 auxiliaryComment: this.auxiliaryComment
81938 }).apply(compilation);
81939 break;
81940 }
81941 case "jsonp": {
81942 const JsonpExportMainTemplatePlugin = __webpack_require__(13732);
81943 if (typeof this.name !== "string")
81944 throw new Error("library name must be a string for jsonp target");
81945 new JsonpExportMainTemplatePlugin(this.name).apply(compilation);
81946 break;
81947 }
81948 case "system": {
81949 const SystemMainTemplatePlugin = __webpack_require__(97365);
81950 new SystemMainTemplatePlugin({
81951 name: this.name
81952 }).apply(compilation);
81953 break;
81954 }
81955 default:
81956 throw new Error(`${this.target} is not a valid Library target`);
81957 }
81958 });
81959 }
81960}
81961
81962module.exports = LibraryTemplatePlugin;
81963
81964
81965/***/ }),
81966
81967/***/ 48775:
81968/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
81969
81970"use strict";
81971/*
81972 MIT License http://www.opensource.org/licenses/mit-license.php
81973 Author Tobias Koppers @sokra
81974*/
81975
81976
81977const ModuleFilenameHelpers = __webpack_require__(71474);
81978
81979const validateOptions = __webpack_require__(33225);
81980const schema = __webpack_require__(4994);
81981
81982/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */
81983
81984class LoaderOptionsPlugin {
81985 /**
81986 * @param {LoaderOptionsPluginOptions} options options object
81987 */
81988 constructor(options) {
81989 validateOptions(schema, options || {}, "Loader Options Plugin");
81990
81991 if (typeof options !== "object") options = {};
81992 if (!options.test) {
81993 options.test = {
81994 test: () => true
81995 };
81996 }
81997 this.options = options;
81998 }
81999
82000 apply(compiler) {
82001 const options = this.options;
82002 compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => {
82003 compilation.hooks.normalModuleLoader.tap(
82004 "LoaderOptionsPlugin",
82005 (context, module) => {
82006 const resource = module.resource;
82007 if (!resource) return;
82008 const i = resource.indexOf("?");
82009 if (
82010 ModuleFilenameHelpers.matchObject(
82011 options,
82012 i < 0 ? resource : resource.substr(0, i)
82013 )
82014 ) {
82015 for (const key of Object.keys(options)) {
82016 if (key === "include" || key === "exclude" || key === "test") {
82017 continue;
82018 }
82019 context[key] = options[key];
82020 }
82021 }
82022 }
82023 );
82024 });
82025 }
82026}
82027
82028module.exports = LoaderOptionsPlugin;
82029
82030
82031/***/ }),
82032
82033/***/ 95154:
82034/***/ (function(module) {
82035
82036"use strict";
82037/*
82038 MIT License http://www.opensource.org/licenses/mit-license.php
82039 Author Tobias Koppers @sokra
82040*/
82041
82042
82043class LoaderTargetPlugin {
82044 constructor(target) {
82045 this.target = target;
82046 }
82047
82048 apply(compiler) {
82049 compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => {
82050 compilation.hooks.normalModuleLoader.tap(
82051 "LoaderTargetPlugin",
82052 loaderContext => {
82053 loaderContext.target = this.target;
82054 }
82055 );
82056 });
82057 }
82058}
82059
82060module.exports = LoaderTargetPlugin;
82061
82062
82063/***/ }),
82064
82065/***/ 43626:
82066/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
82067
82068"use strict";
82069/*
82070 MIT License http://www.opensource.org/licenses/mit-license.php
82071 Author Tobias Koppers @sokra
82072*/
82073
82074
82075const {
82076 ConcatSource,
82077 OriginalSource,
82078 PrefixSource,
82079 RawSource
82080} = __webpack_require__(53665);
82081const {
82082 Tapable,
82083 SyncWaterfallHook,
82084 SyncHook,
82085 SyncBailHook
82086} = __webpack_require__(56758);
82087const Template = __webpack_require__(96066);
82088
82089/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */
82090/** @typedef {import("webpack-sources").Source} Source */
82091/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
82092/** @typedef {import("./Chunk")} Chunk */
82093/** @typedef {import("./Module")} Module} */
82094/** @typedef {import("./util/createHash").Hash} Hash} */
82095/** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate} */
82096
82097/**
82098 * @typedef {Object} RenderManifestOptions
82099 * @property {Chunk} chunk the chunk used to render
82100 * @property {string} hash
82101 * @property {string} fullHash
82102 * @property {TODO} outputOptions
82103 * @property {{javascript: ModuleTemplate, webassembly: ModuleTemplate}} moduleTemplates
82104 * @property {Map<TODO, TODO>} dependencyTemplates
82105 */
82106
82107// require function shortcuts:
82108// __webpack_require__.s = the module id of the entry point
82109// __webpack_require__.c = the module cache
82110// __webpack_require__.m = the module functions
82111// __webpack_require__.p = the bundle public path
82112// __webpack_require__.i = the identity function used for harmony imports
82113// __webpack_require__.e = the chunk ensure function
82114// __webpack_require__.d = the exported property define getter function
82115// __webpack_require__.o = Object.prototype.hasOwnProperty.call
82116// __webpack_require__.r = define compatibility on export
82117// __webpack_require__.t = create a fake namespace object
82118// __webpack_require__.n = compatibility get default export
82119// __webpack_require__.h = the webpack hash
82120// __webpack_require__.w = an object containing all installed WebAssembly.Instance export objects keyed by module id
82121// __webpack_require__.oe = the uncaught error handler for the webpack runtime
82122// __webpack_require__.nc = the script nonce
82123
82124module.exports = class MainTemplate extends Tapable {
82125 /**
82126 *
82127 * @param {TODO=} outputOptions output options for the MainTemplate
82128 */
82129 constructor(outputOptions) {
82130 super();
82131 /** @type {TODO?} */
82132 this.outputOptions = outputOptions || {};
82133 this.hooks = {
82134 /** @type {SyncWaterfallHook<TODO[], RenderManifestOptions>} */
82135 renderManifest: new SyncWaterfallHook(["result", "options"]),
82136 modules: new SyncWaterfallHook([
82137 "modules",
82138 "chunk",
82139 "hash",
82140 "moduleTemplate",
82141 "dependencyTemplates"
82142 ]),
82143 moduleObj: new SyncWaterfallHook([
82144 "source",
82145 "chunk",
82146 "hash",
82147 "moduleIdExpression"
82148 ]),
82149 requireEnsure: new SyncWaterfallHook([
82150 "source",
82151 "chunk",
82152 "hash",
82153 "chunkIdExpression"
82154 ]),
82155 bootstrap: new SyncWaterfallHook([
82156 "source",
82157 "chunk",
82158 "hash",
82159 "moduleTemplate",
82160 "dependencyTemplates"
82161 ]),
82162 localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
82163 require: new SyncWaterfallHook(["source", "chunk", "hash"]),
82164 requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
82165 /** @type {SyncWaterfallHook<string, Chunk, string>} */
82166 beforeStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
82167 /** @type {SyncWaterfallHook<string, Chunk, string>} */
82168 startup: new SyncWaterfallHook(["source", "chunk", "hash"]),
82169 /** @type {SyncWaterfallHook<string, Chunk, string>} */
82170 afterStartup: new SyncWaterfallHook(["source", "chunk", "hash"]),
82171 render: new SyncWaterfallHook([
82172 "source",
82173 "chunk",
82174 "hash",
82175 "moduleTemplate",
82176 "dependencyTemplates"
82177 ]),
82178 renderWithEntry: new SyncWaterfallHook(["source", "chunk", "hash"]),
82179 moduleRequire: new SyncWaterfallHook([
82180 "source",
82181 "chunk",
82182 "hash",
82183 "moduleIdExpression"
82184 ]),
82185 addModule: new SyncWaterfallHook([
82186 "source",
82187 "chunk",
82188 "hash",
82189 "moduleIdExpression",
82190 "moduleExpression"
82191 ]),
82192 currentHash: new SyncWaterfallHook(["source", "requestedLength"]),
82193 assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]),
82194 hash: new SyncHook(["hash"]),
82195 hashForChunk: new SyncHook(["hash", "chunk"]),
82196 globalHashPaths: new SyncWaterfallHook(["paths"]),
82197 globalHash: new SyncBailHook(["chunk", "paths"]),
82198
82199 // TODO this should be moved somewhere else
82200 // It's weird here
82201 hotBootstrap: new SyncWaterfallHook(["source", "chunk", "hash"])
82202 };
82203 this.hooks.startup.tap("MainTemplate", (source, chunk, hash) => {
82204 /** @type {string[]} */
82205 const buf = [];
82206 if (chunk.entryModule) {
82207 buf.push("// Load entry module and return exports");
82208 buf.push(
82209 `return ${this.renderRequireFunctionForModule(
82210 hash,
82211 chunk,
82212 JSON.stringify(chunk.entryModule.id)
82213 )}(${this.requireFn}.s = ${JSON.stringify(chunk.entryModule.id)});`
82214 );
82215 }
82216 return Template.asString(buf);
82217 });
82218 this.hooks.render.tap(
82219 "MainTemplate",
82220 (bootstrapSource, chunk, hash, moduleTemplate, dependencyTemplates) => {
82221 const source = new ConcatSource();
82222 source.add("/******/ (function(modules) { // webpackBootstrap\n");
82223 source.add(new PrefixSource("/******/", bootstrapSource));
82224 source.add("/******/ })\n");
82225 source.add(
82226 "/************************************************************************/\n"
82227 );
82228 source.add("/******/ (");
82229 source.add(
82230 this.hooks.modules.call(
82231 new RawSource(""),
82232 chunk,
82233 hash,
82234 moduleTemplate,
82235 dependencyTemplates
82236 )
82237 );
82238 source.add(")");
82239 return source;
82240 }
82241 );
82242 this.hooks.localVars.tap("MainTemplate", (source, chunk, hash) => {
82243 return Template.asString([
82244 source,
82245 "// The module cache",
82246 "var installedModules = {};"
82247 ]);
82248 });
82249 this.hooks.require.tap("MainTemplate", (source, chunk, hash) => {
82250 return Template.asString([
82251 source,
82252 "// Check if module is in cache",
82253 "if(installedModules[moduleId]) {",
82254 Template.indent("return installedModules[moduleId].exports;"),
82255 "}",
82256 "// Create a new module (and put it into the cache)",
82257 "var module = installedModules[moduleId] = {",
82258 Template.indent(this.hooks.moduleObj.call("", chunk, hash, "moduleId")),
82259 "};",
82260 "",
82261 Template.asString(
82262 outputOptions.strictModuleExceptionHandling
82263 ? [
82264 "// Execute the module function",
82265 "var threw = true;",
82266 "try {",
82267 Template.indent([
82268 `modules[moduleId].call(module.exports, module, module.exports, ${this.renderRequireFunctionForModule(
82269 hash,
82270 chunk,
82271 "moduleId"
82272 )});`,
82273 "threw = false;"
82274 ]),
82275 "} finally {",
82276 Template.indent([
82277 "if(threw) delete installedModules[moduleId];"
82278 ]),
82279 "}"
82280 ]
82281 : [
82282 "// Execute the module function",
82283 `modules[moduleId].call(module.exports, module, module.exports, ${this.renderRequireFunctionForModule(
82284 hash,
82285 chunk,
82286 "moduleId"
82287 )});`
82288 ]
82289 ),
82290 "",
82291 "// Flag the module as loaded",
82292 "module.l = true;",
82293 "",
82294 "// Return the exports of the module",
82295 "return module.exports;"
82296 ]);
82297 });
82298 this.hooks.moduleObj.tap(
82299 "MainTemplate",
82300 (source, chunk, hash, varModuleId) => {
82301 return Template.asString(["i: moduleId,", "l: false,", "exports: {}"]);
82302 }
82303 );
82304 this.hooks.requireExtensions.tap("MainTemplate", (source, chunk, hash) => {
82305 const buf = [];
82306 const chunkMaps = chunk.getChunkMaps();
82307 // Check if there are non initial chunks which need to be imported using require-ensure
82308 if (Object.keys(chunkMaps.hash).length) {
82309 buf.push("// This file contains only the entry chunk.");
82310 buf.push("// The chunk loading function for additional chunks");
82311 buf.push(`${this.requireFn}.e = function requireEnsure(chunkId) {`);
82312 buf.push(Template.indent("var promises = [];"));
82313 buf.push(
82314 Template.indent(
82315 this.hooks.requireEnsure.call("", chunk, hash, "chunkId")
82316 )
82317 );
82318 buf.push(Template.indent("return Promise.all(promises);"));
82319 buf.push("};");
82320 } else if (
82321 chunk.hasModuleInGraph(m =>
82322 m.blocks.some(b => b.chunkGroup && b.chunkGroup.chunks.length > 0)
82323 )
82324 ) {
82325 // There async blocks in the graph, so we need to add an empty requireEnsure
82326 // function anyway. This can happen with multiple entrypoints.
82327 buf.push("// The chunk loading function for additional chunks");
82328 buf.push("// Since all referenced chunks are already included");
82329 buf.push("// in this file, this function is empty here.");
82330 buf.push(`${this.requireFn}.e = function requireEnsure() {`);
82331 buf.push(Template.indent("return Promise.resolve();"));
82332 buf.push("};");
82333 }
82334 buf.push("");
82335 buf.push("// expose the modules object (__webpack_modules__)");
82336 buf.push(`${this.requireFn}.m = modules;`);
82337
82338 buf.push("");
82339 buf.push("// expose the module cache");
82340 buf.push(`${this.requireFn}.c = installedModules;`);
82341
82342 buf.push("");
82343 buf.push("// define getter function for harmony exports");
82344 buf.push(`${this.requireFn}.d = function(exports, name, getter) {`);
82345 buf.push(
82346 Template.indent([
82347 `if(!${this.requireFn}.o(exports, name)) {`,
82348 Template.indent([
82349 "Object.defineProperty(exports, name, { enumerable: true, get: getter });"
82350 ]),
82351 "}"
82352 ])
82353 );
82354 buf.push("};");
82355
82356 buf.push("");
82357 buf.push("// define __esModule on exports");
82358 buf.push(`${this.requireFn}.r = function(exports) {`);
82359 buf.push(
82360 Template.indent([
82361 "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {",
82362 Template.indent([
82363 "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });"
82364 ]),
82365 "}",
82366 "Object.defineProperty(exports, '__esModule', { value: true });"
82367 ])
82368 );
82369 buf.push("};");
82370
82371 buf.push("");
82372 buf.push("// create a fake namespace object");
82373 buf.push("// mode & 1: value is a module id, require it");
82374 buf.push("// mode & 2: merge all properties of value into the ns");
82375 buf.push("// mode & 4: return value when already ns object");
82376 buf.push("// mode & 8|1: behave like require");
82377 buf.push(`${this.requireFn}.t = function(value, mode) {`);
82378 buf.push(
82379 Template.indent([
82380 `if(mode & 1) value = ${this.requireFn}(value);`,
82381 `if(mode & 8) return value;`,
82382 "if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;",
82383 "var ns = Object.create(null);",
82384 `${this.requireFn}.r(ns);`,
82385 "Object.defineProperty(ns, 'default', { enumerable: true, value: value });",
82386 "if(mode & 2 && typeof value != 'string') for(var key in value) " +
82387 `${this.requireFn}.d(ns, key, function(key) { ` +
82388 "return value[key]; " +
82389 "}.bind(null, key));",
82390 "return ns;"
82391 ])
82392 );
82393 buf.push("};");
82394
82395 buf.push("");
82396 buf.push(
82397 "// getDefaultExport function for compatibility with non-harmony modules"
82398 );
82399 buf.push(this.requireFn + ".n = function(module) {");
82400 buf.push(
82401 Template.indent([
82402 "var getter = module && module.__esModule ?",
82403 Template.indent([
82404 "function getDefault() { return module['default']; } :",
82405 "function getModuleExports() { return module; };"
82406 ]),
82407 `${this.requireFn}.d(getter, 'a', getter);`,
82408 "return getter;"
82409 ])
82410 );
82411 buf.push("};");
82412
82413 buf.push("");
82414 buf.push("// Object.prototype.hasOwnProperty.call");
82415 buf.push(
82416 `${this.requireFn}.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };`
82417 );
82418
82419 const publicPath = this.getPublicPath({
82420 hash: hash
82421 });
82422 buf.push("");
82423 buf.push("// __webpack_public_path__");
82424 buf.push(`${this.requireFn}.p = ${JSON.stringify(publicPath)};`);
82425 return Template.asString(buf);
82426 });
82427
82428 this.requireFn = "__webpack_require__";
82429 }
82430
82431 /**
82432 *
82433 * @param {RenderManifestOptions} options render manifest options
82434 * @returns {TODO[]} returns render manifest
82435 */
82436 getRenderManifest(options) {
82437 const result = [];
82438
82439 this.hooks.renderManifest.call(result, options);
82440
82441 return result;
82442 }
82443
82444 /**
82445 * TODO webpack 5: remove moduleTemplate and dependencyTemplates
82446 * @param {string} hash hash to be used for render call
82447 * @param {Chunk} chunk Chunk instance
82448 * @param {ModuleTemplate} moduleTemplate ModuleTemplate instance for render
82449 * @param {Map<Function, DependencyTemplate>} dependencyTemplates dependency templates
82450 * @returns {string[]} the generated source of the bootstrap code
82451 */
82452 renderBootstrap(hash, chunk, moduleTemplate, dependencyTemplates) {
82453 const buf = [];
82454 buf.push(
82455 this.hooks.bootstrap.call(
82456 "",
82457 chunk,
82458 hash,
82459 moduleTemplate,
82460 dependencyTemplates
82461 )
82462 );
82463 buf.push(this.hooks.localVars.call("", chunk, hash));
82464 buf.push("");
82465 buf.push("// The require function");
82466 buf.push(`function ${this.requireFn}(moduleId) {`);
82467 buf.push(Template.indent(this.hooks.require.call("", chunk, hash)));
82468 buf.push("}");
82469 buf.push("");
82470 buf.push(
82471 Template.asString(this.hooks.requireExtensions.call("", chunk, hash))
82472 );
82473 buf.push("");
82474 buf.push(Template.asString(this.hooks.beforeStartup.call("", chunk, hash)));
82475 const afterStartupCode = Template.asString(
82476 this.hooks.afterStartup.call("", chunk, hash)
82477 );
82478 if (afterStartupCode) {
82479 // TODO webpack 5: this is a bit hacky to avoid a breaking change
82480 // change it to a better way
82481 buf.push("var startupResult = (function() {");
82482 }
82483 buf.push(Template.asString(this.hooks.startup.call("", chunk, hash)));
82484 if (afterStartupCode) {
82485 buf.push("})();");
82486 buf.push(afterStartupCode);
82487 buf.push("return startupResult;");
82488 }
82489 return buf;
82490 }
82491
82492 /**
82493 * @param {string} hash hash to be used for render call
82494 * @param {Chunk} chunk Chunk instance
82495 * @param {ModuleTemplate} moduleTemplate ModuleTemplate instance for render
82496 * @param {Map<Function, DependencyTemplate>} dependencyTemplates dependency templates
82497 * @returns {ConcatSource} the newly generated source from rendering
82498 */
82499 render(hash, chunk, moduleTemplate, dependencyTemplates) {
82500 const buf = this.renderBootstrap(
82501 hash,
82502 chunk,
82503 moduleTemplate,
82504 dependencyTemplates
82505 );
82506 let source = this.hooks.render.call(
82507 new OriginalSource(
82508 Template.prefix(buf, " \t") + "\n",
82509 "webpack/bootstrap"
82510 ),
82511 chunk,
82512 hash,
82513 moduleTemplate,
82514 dependencyTemplates
82515 );
82516 if (chunk.hasEntryModule()) {
82517 source = this.hooks.renderWithEntry.call(source, chunk, hash);
82518 }
82519 if (!source) {
82520 throw new Error(
82521 "Compiler error: MainTemplate plugin 'render' should return something"
82522 );
82523 }
82524 chunk.rendered = true;
82525 return new ConcatSource(source, ";");
82526 }
82527
82528 /**
82529 *
82530 * @param {string} hash hash for render fn
82531 * @param {Chunk} chunk Chunk instance for require
82532 * @param {(number|string)=} varModuleId module id
82533 * @returns {TODO} the moduleRequire hook call return signature
82534 */
82535 renderRequireFunctionForModule(hash, chunk, varModuleId) {
82536 return this.hooks.moduleRequire.call(
82537 this.requireFn,
82538 chunk,
82539 hash,
82540 varModuleId
82541 );
82542 }
82543
82544 /**
82545 *
82546 * @param {string} hash hash for render add fn
82547 * @param {Chunk} chunk Chunk instance for require add fn
82548 * @param {(string|number)=} varModuleId module id
82549 * @param {Module} varModule Module instance
82550 * @returns {TODO} renderAddModule call
82551 */
82552 renderAddModule(hash, chunk, varModuleId, varModule) {
82553 return this.hooks.addModule.call(
82554 `modules[${varModuleId}] = ${varModule};`,
82555 chunk,
82556 hash,
82557 varModuleId,
82558 varModule
82559 );
82560 }
82561
82562 /**
82563 *
82564 * @param {string} hash string hash
82565 * @param {number=} length length
82566 * @returns {string} call hook return
82567 */
82568 renderCurrentHashCode(hash, length) {
82569 length = length || Infinity;
82570 return this.hooks.currentHash.call(
82571 JSON.stringify(hash.substr(0, length)),
82572 length
82573 );
82574 }
82575
82576 /**
82577 *
82578 * @param {object} options get public path options
82579 * @returns {string} hook call
82580 */
82581 getPublicPath(options) {
82582 return this.hooks.assetPath.call(
82583 this.outputOptions.publicPath || "",
82584 options
82585 );
82586 }
82587
82588 getAssetPath(path, options) {
82589 return this.hooks.assetPath.call(path, options);
82590 }
82591
82592 getAssetPathWithInfo(path, options) {
82593 const assetInfo = {};
82594 // TODO webpack 5: refactor assetPath hook to receive { path, info } object
82595 const newPath = this.hooks.assetPath.call(path, options, assetInfo);
82596 return { path: newPath, info: assetInfo };
82597 }
82598
82599 /**
82600 * Updates hash with information from this template
82601 * @param {Hash} hash the hash to update
82602 * @returns {void}
82603 */
82604 updateHash(hash) {
82605 hash.update("maintemplate");
82606 hash.update("3");
82607 this.hooks.hash.call(hash);
82608 }
82609
82610 /**
82611 * TODO webpack 5: remove moduleTemplate and dependencyTemplates
82612 * Updates hash with chunk-specific information from this template
82613 * @param {Hash} hash the hash to update
82614 * @param {Chunk} chunk the chunk
82615 * @param {ModuleTemplate} moduleTemplate ModuleTemplate instance for render
82616 * @param {Map<Function, DependencyTemplate>} dependencyTemplates dependency templates
82617 * @returns {void}
82618 */
82619 updateHashForChunk(hash, chunk, moduleTemplate, dependencyTemplates) {
82620 this.updateHash(hash);
82621 this.hooks.hashForChunk.call(hash, chunk);
82622 for (const line of this.renderBootstrap(
82623 "0000",
82624 chunk,
82625 moduleTemplate,
82626 dependencyTemplates
82627 )) {
82628 hash.update(line);
82629 }
82630 }
82631
82632 useChunkHash(chunk) {
82633 const paths = this.hooks.globalHashPaths.call([]);
82634 return !this.hooks.globalHash.call(chunk, paths);
82635 }
82636};
82637
82638
82639/***/ }),
82640
82641/***/ 50332:
82642/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
82643
82644/*
82645 MIT License http://www.opensource.org/licenses/mit-license.php
82646 Author Tobias Koppers @sokra
82647*/
82648module.exports = __webpack_require__(32327);
82649
82650
82651/***/ }),
82652
82653/***/ 75993:
82654/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
82655
82656"use strict";
82657/*
82658 MIT License http://www.opensource.org/licenses/mit-license.php
82659 Author Tobias Koppers @sokra
82660*/
82661
82662
82663const util = __webpack_require__(31669);
82664
82665const DependenciesBlock = __webpack_require__(16071);
82666const ModuleReason = __webpack_require__(44576);
82667const SortableSet = __webpack_require__(50071);
82668const Template = __webpack_require__(96066);
82669
82670/** @typedef {import("./Chunk")} Chunk */
82671/** @typedef {import("./RequestShortener")} RequestShortener */
82672/** @typedef {import("./WebpackError")} WebpackError */
82673/** @typedef {import("./util/createHash").Hash} Hash */
82674
82675const EMPTY_RESOLVE_OPTIONS = {};
82676
82677let debugId = 1000;
82678
82679const sortById = (a, b) => {
82680 return a.id - b.id;
82681};
82682
82683const sortByDebugId = (a, b) => {
82684 return a.debugId - b.debugId;
82685};
82686
82687/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */
82688
82689class Module extends DependenciesBlock {
82690 constructor(type, context = null) {
82691 super();
82692 /** @type {string} */
82693 this.type = type;
82694 /** @type {string} */
82695 this.context = context;
82696
82697 // Unique Id
82698 /** @type {number} */
82699 this.debugId = debugId++;
82700
82701 // Hash
82702 /** @type {string} */
82703 this.hash = undefined;
82704 /** @type {string} */
82705 this.renderedHash = undefined;
82706
82707 // Info from Factory
82708 /** @type {TODO} */
82709 this.resolveOptions = EMPTY_RESOLVE_OPTIONS;
82710 /** @type {object} */
82711 this.factoryMeta = {};
82712
82713 // Info from Build
82714 /** @type {WebpackError[]} */
82715 this.warnings = [];
82716 /** @type {WebpackError[]} */
82717 this.errors = [];
82718 /** @type {object} */
82719 this.buildMeta = undefined;
82720 /** @type {object} */
82721 this.buildInfo = undefined;
82722
82723 // Graph (per Compilation)
82724 /** @type {ModuleReason[]} */
82725 this.reasons = [];
82726 /** @type {SortableSet<Chunk>} */
82727 this._chunks = new SortableSet(undefined, sortById);
82728
82729 // Info from Compilation (per Compilation)
82730 /** @type {number|string} */
82731 this.id = null;
82732 /** @type {number} */
82733 this.index = null;
82734 /** @type {number} */
82735 this.index2 = null;
82736 /** @type {number} */
82737 this.depth = null;
82738 /** @type {Module} */
82739 this.issuer = null;
82740 /** @type {undefined | object} */
82741 this.profile = undefined;
82742 /** @type {boolean} */
82743 this.prefetched = false;
82744 /** @type {boolean} */
82745 this.built = false;
82746
82747 // Info from Optimization (per Compilation)
82748 /** @type {null | boolean} */
82749 this.used = null;
82750 /** @type {false | true | string[]} */
82751 this.usedExports = null;
82752 /** @type {(string | OptimizationBailoutFunction)[]} */
82753 this.optimizationBailout = [];
82754
82755 // delayed operations
82756 /** @type {undefined | {oldChunk: Chunk, newChunks: Chunk[]}[] } */
82757 this._rewriteChunkInReasons = undefined;
82758
82759 /** @type {boolean} */
82760 this.useSourceMap = false;
82761
82762 // info from build
82763 this._source = null;
82764 }
82765
82766 get exportsArgument() {
82767 return (this.buildInfo && this.buildInfo.exportsArgument) || "exports";
82768 }
82769
82770 get moduleArgument() {
82771 return (this.buildInfo && this.buildInfo.moduleArgument) || "module";
82772 }
82773
82774 disconnect() {
82775 this.hash = undefined;
82776 this.renderedHash = undefined;
82777
82778 this.reasons.length = 0;
82779 this._rewriteChunkInReasons = undefined;
82780 this._chunks.clear();
82781
82782 this.id = null;
82783 this.index = null;
82784 this.index2 = null;
82785 this.depth = null;
82786 this.issuer = null;
82787 this.profile = undefined;
82788 this.prefetched = false;
82789 this.built = false;
82790
82791 this.used = null;
82792 this.usedExports = null;
82793 this.optimizationBailout.length = 0;
82794 super.disconnect();
82795 }
82796
82797 unseal() {
82798 this.id = null;
82799 this.index = null;
82800 this.index2 = null;
82801 this.depth = null;
82802 this._chunks.clear();
82803 super.unseal();
82804 }
82805
82806 setChunks(chunks) {
82807 this._chunks = new SortableSet(chunks, sortById);
82808 }
82809
82810 addChunk(chunk) {
82811 if (this._chunks.has(chunk)) return false;
82812 this._chunks.add(chunk);
82813 return true;
82814 }
82815
82816 removeChunk(chunk) {
82817 if (this._chunks.delete(chunk)) {
82818 chunk.removeModule(this);
82819 return true;
82820 }
82821 return false;
82822 }
82823
82824 isInChunk(chunk) {
82825 return this._chunks.has(chunk);
82826 }
82827
82828 isEntryModule() {
82829 for (const chunk of this._chunks) {
82830 if (chunk.entryModule === this) return true;
82831 }
82832 return false;
82833 }
82834
82835 get optional() {
82836 return (
82837 this.reasons.length > 0 &&
82838 this.reasons.every(r => r.dependency && r.dependency.optional)
82839 );
82840 }
82841
82842 /**
82843 * @returns {Chunk[]} all chunks which contain the module
82844 */
82845 getChunks() {
82846 return Array.from(this._chunks);
82847 }
82848
82849 getNumberOfChunks() {
82850 return this._chunks.size;
82851 }
82852
82853 get chunksIterable() {
82854 return this._chunks;
82855 }
82856
82857 hasEqualsChunks(otherModule) {
82858 if (this._chunks.size !== otherModule._chunks.size) return false;
82859 this._chunks.sortWith(sortByDebugId);
82860 otherModule._chunks.sortWith(sortByDebugId);
82861 const a = this._chunks[Symbol.iterator]();
82862 const b = otherModule._chunks[Symbol.iterator]();
82863 // eslint-disable-next-line no-constant-condition
82864 while (true) {
82865 const aItem = a.next();
82866 const bItem = b.next();
82867 if (aItem.done) return true;
82868 if (aItem.value !== bItem.value) return false;
82869 }
82870 }
82871
82872 addReason(module, dependency, explanation) {
82873 this.reasons.push(new ModuleReason(module, dependency, explanation));
82874 }
82875
82876 removeReason(module, dependency) {
82877 for (let i = 0; i < this.reasons.length; i++) {
82878 let r = this.reasons[i];
82879 if (r.module === module && r.dependency === dependency) {
82880 this.reasons.splice(i, 1);
82881 return true;
82882 }
82883 }
82884 return false;
82885 }
82886
82887 hasReasonForChunk(chunk) {
82888 if (this._rewriteChunkInReasons) {
82889 for (const operation of this._rewriteChunkInReasons) {
82890 this._doRewriteChunkInReasons(operation.oldChunk, operation.newChunks);
82891 }
82892 this._rewriteChunkInReasons = undefined;
82893 }
82894 for (let i = 0; i < this.reasons.length; i++) {
82895 if (this.reasons[i].hasChunk(chunk)) return true;
82896 }
82897 return false;
82898 }
82899
82900 hasReasons() {
82901 return this.reasons.length > 0;
82902 }
82903
82904 rewriteChunkInReasons(oldChunk, newChunks) {
82905 // This is expensive. Delay operation until we really need the data
82906 if (this._rewriteChunkInReasons === undefined) {
82907 this._rewriteChunkInReasons = [];
82908 }
82909 this._rewriteChunkInReasons.push({
82910 oldChunk,
82911 newChunks
82912 });
82913 }
82914
82915 _doRewriteChunkInReasons(oldChunk, newChunks) {
82916 for (let i = 0; i < this.reasons.length; i++) {
82917 this.reasons[i].rewriteChunks(oldChunk, newChunks);
82918 }
82919 }
82920
82921 /**
82922 * @param {string=} exportName the name of the export
82923 * @returns {boolean|string} false if the export isn't used, true if no exportName is provided and the module is used, or the name to access it if the export is used
82924 */
82925 isUsed(exportName) {
82926 if (!exportName) return this.used !== false;
82927 if (this.used === null || this.usedExports === null) return exportName;
82928 if (!this.used) return false;
82929 if (!this.usedExports) return false;
82930 if (this.usedExports === true) return exportName;
82931 let idx = this.usedExports.indexOf(exportName);
82932 if (idx < 0) return false;
82933
82934 // Mangle export name if possible
82935 if (this.isProvided(exportName)) {
82936 if (this.buildMeta.exportsType === "namespace") {
82937 return Template.numberToIdentifer(idx);
82938 }
82939 if (
82940 this.buildMeta.exportsType === "named" &&
82941 !this.usedExports.includes("default")
82942 ) {
82943 return Template.numberToIdentifer(idx);
82944 }
82945 }
82946 return exportName;
82947 }
82948
82949 isProvided(exportName) {
82950 if (!Array.isArray(this.buildMeta.providedExports)) return null;
82951 return this.buildMeta.providedExports.includes(exportName);
82952 }
82953
82954 toString() {
82955 return `Module[${this.id || this.debugId}]`;
82956 }
82957
82958 needRebuild(fileTimestamps, contextTimestamps) {
82959 return true;
82960 }
82961
82962 /**
82963 * @param {Hash} hash the hash used to track dependencies
82964 * @returns {void}
82965 */
82966 updateHash(hash) {
82967 hash.update(`${this.id}`);
82968 hash.update(JSON.stringify(this.usedExports));
82969 super.updateHash(hash);
82970 }
82971
82972 sortItems(sortChunks) {
82973 super.sortItems();
82974 if (sortChunks) this._chunks.sort();
82975 this.reasons.sort((a, b) => {
82976 if (a.module === b.module) return 0;
82977 if (!a.module) return -1;
82978 if (!b.module) return 1;
82979 return sortById(a.module, b.module);
82980 });
82981 if (Array.isArray(this.usedExports)) {
82982 this.usedExports.sort();
82983 }
82984 }
82985
82986 unbuild() {
82987 this.dependencies.length = 0;
82988 this.blocks.length = 0;
82989 this.variables.length = 0;
82990 this.buildMeta = undefined;
82991 this.buildInfo = undefined;
82992 this.disconnect();
82993 }
82994
82995 get arguments() {
82996 throw new Error("Module.arguments was removed, there is no replacement.");
82997 }
82998
82999 set arguments(value) {
83000 throw new Error("Module.arguments was removed, there is no replacement.");
83001 }
83002}
83003
83004// TODO remove in webpack 5
83005Object.defineProperty(Module.prototype, "forEachChunk", {
83006 configurable: false,
83007 value: util.deprecate(
83008 /**
83009 * @deprecated
83010 * @param {function(any, any, Set<any>): void} fn callback function
83011 * @returns {void}
83012 * @this {Module}
83013 */
83014 function(fn) {
83015 this._chunks.forEach(fn);
83016 },
83017 "Module.forEachChunk: Use for(const chunk of module.chunksIterable) instead"
83018 )
83019});
83020
83021// TODO remove in webpack 5
83022Object.defineProperty(Module.prototype, "mapChunks", {
83023 configurable: false,
83024 value: util.deprecate(
83025 /**
83026 * @deprecated
83027 * @param {function(any, any): void} fn Mapper function
83028 * @returns {Array<TODO>} Array of chunks mapped
83029 * @this {Module}
83030 */
83031 function(fn) {
83032 return Array.from(this._chunks, fn);
83033 },
83034 "Module.mapChunks: Use Array.from(module.chunksIterable, fn) instead"
83035 )
83036});
83037
83038// TODO remove in webpack 5
83039Object.defineProperty(Module.prototype, "entry", {
83040 configurable: false,
83041 get() {
83042 throw new Error("Module.entry was removed. Use Chunk.entryModule");
83043 },
83044 set() {
83045 throw new Error("Module.entry was removed. Use Chunk.entryModule");
83046 }
83047});
83048
83049// TODO remove in webpack 5
83050Object.defineProperty(Module.prototype, "meta", {
83051 configurable: false,
83052 get: util.deprecate(
83053 /**
83054 * @deprecated
83055 * @returns {void}
83056 * @this {Module}
83057 */
83058 function() {
83059 return this.buildMeta;
83060 },
83061 "Module.meta was renamed to Module.buildMeta"
83062 ),
83063 set: util.deprecate(
83064 /**
83065 * @deprecated
83066 * @param {TODO} value Value
83067 * @returns {void}
83068 * @this {Module}
83069 */
83070 function(value) {
83071 this.buildMeta = value;
83072 },
83073 "Module.meta was renamed to Module.buildMeta"
83074 )
83075});
83076
83077/** @type {function(): string} */
83078Module.prototype.identifier = null;
83079
83080/** @type {function(RequestShortener): string} */
83081Module.prototype.readableIdentifier = null;
83082
83083Module.prototype.build = null;
83084Module.prototype.source = null;
83085Module.prototype.size = null;
83086Module.prototype.nameForCondition = null;
83087/** @type {null | function(Chunk): boolean} */
83088Module.prototype.chunkCondition = null;
83089Module.prototype.updateCacheModule = null;
83090
83091module.exports = Module;
83092
83093
83094/***/ }),
83095
83096/***/ 12072:
83097/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83098
83099"use strict";
83100/*
83101 MIT License http://www.opensource.org/licenses/mit-license.php
83102 Author Tobias Koppers @sokra
83103*/
83104
83105
83106const WebpackError = __webpack_require__(97391);
83107const { cutOffLoaderExecution } = __webpack_require__(80140);
83108
83109class ModuleBuildError extends WebpackError {
83110 constructor(module, err, { from = null } = {}) {
83111 let message = "Module build failed";
83112 let details = undefined;
83113 if (from) {
83114 message += ` (from ${from}):\n`;
83115 } else {
83116 message += ": ";
83117 }
83118 if (err !== null && typeof err === "object") {
83119 if (typeof err.stack === "string" && err.stack) {
83120 const stack = cutOffLoaderExecution(err.stack);
83121 if (!err.hideStack) {
83122 message += stack;
83123 } else {
83124 details = stack;
83125 if (typeof err.message === "string" && err.message) {
83126 message += err.message;
83127 } else {
83128 message += err;
83129 }
83130 }
83131 } else if (typeof err.message === "string" && err.message) {
83132 message += err.message;
83133 } else {
83134 message += err;
83135 }
83136 } else {
83137 message = err;
83138 }
83139
83140 super(message);
83141
83142 this.name = "ModuleBuildError";
83143 this.details = details;
83144 this.module = module;
83145 this.error = err;
83146
83147 Error.captureStackTrace(this, this.constructor);
83148 }
83149}
83150
83151module.exports = ModuleBuildError;
83152
83153
83154/***/ }),
83155
83156/***/ 14953:
83157/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83158
83159"use strict";
83160/*
83161 MIT License http://www.opensource.org/licenses/mit-license.php
83162 Author Tobias Koppers @sokra
83163*/
83164
83165
83166const WebpackError = __webpack_require__(97391);
83167
83168/** @typedef {import("./Module")} Module */
83169
83170class ModuleDependencyError extends WebpackError {
83171 /**
83172 * Creates an instance of ModuleDependencyError.
83173 * @param {Module} module module tied to dependency
83174 * @param {Error} err error thrown
83175 * @param {TODO} loc location of dependency
83176 */
83177 constructor(module, err, loc) {
83178 super(err.message);
83179
83180 this.name = "ModuleDependencyError";
83181 this.details = err.stack
83182 .split("\n")
83183 .slice(1)
83184 .join("\n");
83185 this.module = module;
83186 this.loc = loc;
83187 this.error = err;
83188 this.origin = module.issuer;
83189
83190 Error.captureStackTrace(this, this.constructor);
83191 }
83192}
83193
83194module.exports = ModuleDependencyError;
83195
83196
83197/***/ }),
83198
83199/***/ 59136:
83200/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83201
83202"use strict";
83203/*
83204 MIT License http://www.opensource.org/licenses/mit-license.php
83205 Author Tobias Koppers @sokra
83206*/
83207
83208
83209const WebpackError = __webpack_require__(97391);
83210
83211module.exports = class ModuleDependencyWarning extends WebpackError {
83212 constructor(module, err, loc) {
83213 super(err.message);
83214
83215 this.name = "ModuleDependencyWarning";
83216 this.details = err.stack
83217 .split("\n")
83218 .slice(1)
83219 .join("\n");
83220 this.module = module;
83221 this.loc = loc;
83222 this.error = err;
83223 this.origin = module.issuer;
83224
83225 Error.captureStackTrace(this, this.constructor);
83226 }
83227};
83228
83229
83230/***/ }),
83231
83232/***/ 82528:
83233/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83234
83235"use strict";
83236/*
83237 MIT License http://www.opensource.org/licenses/mit-license.php
83238 Author Tobias Koppers @sokra
83239*/
83240
83241
83242const WebpackError = __webpack_require__(97391);
83243const { cleanUp } = __webpack_require__(80140);
83244
83245class ModuleError extends WebpackError {
83246 constructor(module, err, { from = null } = {}) {
83247 let message = "Module Error";
83248 if (from) {
83249 message += ` (from ${from}):\n`;
83250 } else {
83251 message += ": ";
83252 }
83253 if (err && typeof err === "object" && err.message) {
83254 message += err.message;
83255 } else if (err) {
83256 message += err;
83257 }
83258 super(message);
83259 this.name = "ModuleError";
83260 this.module = module;
83261 this.error = err;
83262 this.details =
83263 err && typeof err === "object" && err.stack
83264 ? cleanUp(err.stack, this.message)
83265 : undefined;
83266
83267 Error.captureStackTrace(this, this.constructor);
83268 }
83269}
83270
83271module.exports = ModuleError;
83272
83273
83274/***/ }),
83275
83276/***/ 71474:
83277/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
83278
83279"use strict";
83280/*
83281 MIT License http://www.opensource.org/licenses/mit-license.php
83282 Author Tobias Koppers @sokra
83283*/
83284
83285
83286const createHash = __webpack_require__(15660);
83287
83288const ModuleFilenameHelpers = exports;
83289
83290ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]";
83291ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = /\[all-?loaders\]\[resource\]/gi;
83292ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]";
83293ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi;
83294ModuleFilenameHelpers.RESOURCE = "[resource]";
83295ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi;
83296ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]";
83297ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH = /\[abs(olute)?-?resource-?path\]/gi;
83298ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]";
83299ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi;
83300ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]";
83301ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi;
83302ModuleFilenameHelpers.LOADERS = "[loaders]";
83303ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi;
83304ModuleFilenameHelpers.QUERY = "[query]";
83305ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi;
83306ModuleFilenameHelpers.ID = "[id]";
83307ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi;
83308ModuleFilenameHelpers.HASH = "[hash]";
83309ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi;
83310ModuleFilenameHelpers.NAMESPACE = "[namespace]";
83311ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi;
83312
83313const getAfter = (str, token) => {
83314 const idx = str.indexOf(token);
83315 return idx < 0 ? "" : str.substr(idx);
83316};
83317
83318const getBefore = (str, token) => {
83319 const idx = str.lastIndexOf(token);
83320 return idx < 0 ? "" : str.substr(0, idx);
83321};
83322
83323const getHash = str => {
83324 const hash = createHash("md4");
83325 hash.update(str);
83326 const digest = /** @type {string} */ (hash.digest("hex"));
83327 return digest.substr(0, 4);
83328};
83329
83330const asRegExp = test => {
83331 if (typeof test === "string") {
83332 test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
83333 }
83334 return test;
83335};
83336
83337ModuleFilenameHelpers.createFilename = (module, options, requestShortener) => {
83338 const opts = Object.assign(
83339 {
83340 namespace: "",
83341 moduleFilenameTemplate: ""
83342 },
83343 typeof options === "object"
83344 ? options
83345 : {
83346 moduleFilenameTemplate: options
83347 }
83348 );
83349
83350 let absoluteResourcePath;
83351 let hash;
83352 let identifier;
83353 let moduleId;
83354 let shortIdentifier;
83355 if (module === undefined) module = "";
83356 if (typeof module === "string") {
83357 shortIdentifier = requestShortener.shorten(module);
83358 identifier = shortIdentifier;
83359 moduleId = "";
83360 absoluteResourcePath = module.split("!").pop();
83361 hash = getHash(identifier);
83362 } else {
83363 shortIdentifier = module.readableIdentifier(requestShortener);
83364 identifier = requestShortener.shorten(module.identifier());
83365 moduleId = module.id;
83366 absoluteResourcePath = module
83367 .identifier()
83368 .split("!")
83369 .pop();
83370 hash = getHash(identifier);
83371 }
83372 const resource = shortIdentifier.split("!").pop();
83373 const loaders = getBefore(shortIdentifier, "!");
83374 const allLoaders = getBefore(identifier, "!");
83375 const query = getAfter(resource, "?");
83376 const resourcePath = resource.substr(0, resource.length - query.length);
83377 if (typeof opts.moduleFilenameTemplate === "function") {
83378 return opts.moduleFilenameTemplate({
83379 identifier: identifier,
83380 shortIdentifier: shortIdentifier,
83381 resource: resource,
83382 resourcePath: resourcePath,
83383 absoluteResourcePath: absoluteResourcePath,
83384 allLoaders: allLoaders,
83385 query: query,
83386 moduleId: moduleId,
83387 hash: hash,
83388 namespace: opts.namespace
83389 });
83390 }
83391 return opts.moduleFilenameTemplate
83392 .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, identifier)
83393 .replace(ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, shortIdentifier)
83394 .replace(ModuleFilenameHelpers.REGEXP_RESOURCE, resource)
83395 .replace(ModuleFilenameHelpers.REGEXP_RESOURCE_PATH, resourcePath)
83396 .replace(
83397 ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH,
83398 absoluteResourcePath
83399 )
83400 .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS, allLoaders)
83401 .replace(ModuleFilenameHelpers.REGEXP_LOADERS, loaders)
83402 .replace(ModuleFilenameHelpers.REGEXP_QUERY, query)
83403 .replace(ModuleFilenameHelpers.REGEXP_ID, moduleId)
83404 .replace(ModuleFilenameHelpers.REGEXP_HASH, hash)
83405 .replace(ModuleFilenameHelpers.REGEXP_NAMESPACE, opts.namespace);
83406};
83407
83408ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
83409 const countMap = Object.create(null);
83410 const posMap = Object.create(null);
83411 array.forEach((item, idx) => {
83412 countMap[item] = countMap[item] || [];
83413 countMap[item].push(idx);
83414 posMap[item] = 0;
83415 });
83416 if (comparator) {
83417 Object.keys(countMap).forEach(item => {
83418 countMap[item].sort(comparator);
83419 });
83420 }
83421 return array.map((item, i) => {
83422 if (countMap[item].length > 1) {
83423 if (comparator && countMap[item][0] === i) return item;
83424 return fn(item, i, posMap[item]++);
83425 } else {
83426 return item;
83427 }
83428 });
83429};
83430
83431ModuleFilenameHelpers.matchPart = (str, test) => {
83432 if (!test) return true;
83433 test = asRegExp(test);
83434 if (Array.isArray(test)) {
83435 return test.map(asRegExp).some(regExp => regExp.test(str));
83436 } else {
83437 return test.test(str);
83438 }
83439};
83440
83441ModuleFilenameHelpers.matchObject = (obj, str) => {
83442 if (obj.test) {
83443 if (!ModuleFilenameHelpers.matchPart(str, obj.test)) {
83444 return false;
83445 }
83446 }
83447 if (obj.include) {
83448 if (!ModuleFilenameHelpers.matchPart(str, obj.include)) {
83449 return false;
83450 }
83451 }
83452 if (obj.exclude) {
83453 if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) {
83454 return false;
83455 }
83456 }
83457 return true;
83458};
83459
83460
83461/***/ }),
83462
83463/***/ 71638:
83464/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83465
83466"use strict";
83467/*
83468 MIT License http://www.opensource.org/licenses/mit-license.php
83469 Author Tobias Koppers @sokra
83470*/
83471
83472
83473const WebpackError = __webpack_require__(97391);
83474
83475class ModuleNotFoundError extends WebpackError {
83476 constructor(module, err) {
83477 super("Module not found: " + err);
83478
83479 this.name = "ModuleNotFoundError";
83480 this.details = err.details;
83481 this.missing = err.missing;
83482 this.module = module;
83483 this.error = err;
83484
83485 Error.captureStackTrace(this, this.constructor);
83486 }
83487}
83488
83489module.exports = ModuleNotFoundError;
83490
83491
83492/***/ }),
83493
83494/***/ 62500:
83495/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83496
83497"use strict";
83498/*
83499 MIT License http://www.opensource.org/licenses/mit-license.php
83500 Author Tobias Koppers @sokra
83501*/
83502
83503
83504const WebpackError = __webpack_require__(97391);
83505
83506/** @typedef {import("./Module")} Module */
83507
83508class ModuleParseError extends WebpackError {
83509 /**
83510 * @param {Module} module the errored module
83511 * @param {string} source source code
83512 * @param {Error&any} err the parse error
83513 * @param {string[]} loaders the loaders used
83514 */
83515 constructor(module, source, err, loaders) {
83516 let message = "Module parse failed: " + err.message;
83517 let loc = undefined;
83518 if (loaders.length >= 1) {
83519 message += `\nFile was processed with these loaders:${loaders
83520 .map(loader => `\n * ${loader}`)
83521 .join("")}`;
83522 message +=
83523 "\nYou may need an additional loader to handle the result of these loaders.";
83524 } else {
83525 message +=
83526 "\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders";
83527 }
83528 if (
83529 err.loc &&
83530 typeof err.loc === "object" &&
83531 typeof err.loc.line === "number"
83532 ) {
83533 var lineNumber = err.loc.line;
83534 if (/[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source)) {
83535 // binary file
83536 message += "\n(Source code omitted for this binary file)";
83537 } else {
83538 const sourceLines = source.split(/\r?\n/);
83539 const start = Math.max(0, lineNumber - 3);
83540 const linesBefore = sourceLines.slice(start, lineNumber - 1);
83541 const theLine = sourceLines[lineNumber - 1];
83542 const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2);
83543 message +=
83544 linesBefore.map(l => `\n| ${l}`).join("") +
83545 `\n> ${theLine}` +
83546 linesAfter.map(l => `\n| ${l}`).join("");
83547 }
83548 loc = err.loc;
83549 } else {
83550 message += "\n" + err.stack;
83551 }
83552
83553 super(message);
83554
83555 this.name = "ModuleParseError";
83556 this.module = module;
83557 this.loc = loc;
83558 this.error = err;
83559
83560 Error.captureStackTrace(this, this.constructor);
83561 }
83562}
83563
83564module.exports = ModuleParseError;
83565
83566
83567/***/ }),
83568
83569/***/ 44576:
83570/***/ (function(module) {
83571
83572"use strict";
83573/*
83574 MIT License http://www.opensource.org/licenses/mit-license.php
83575 Author Tobias Koppers @sokra
83576*/
83577
83578
83579/** @typedef {import("./Module")} Module */
83580/** @typedef {import("./Dependency")} Dependency */
83581
83582class ModuleReason {
83583 /**
83584 * @param {Module} module the referencing module
83585 * @param {Dependency} dependency the referencing dependency
83586 * @param {string=} explanation some extra detail
83587 */
83588 constructor(module, dependency, explanation) {
83589 this.module = module;
83590 this.dependency = dependency;
83591 this.explanation = explanation;
83592 this._chunks = null;
83593 }
83594
83595 hasChunk(chunk) {
83596 if (this._chunks) {
83597 if (this._chunks.has(chunk)) return true;
83598 } else if (this.module && this.module._chunks.has(chunk)) return true;
83599 return false;
83600 }
83601
83602 rewriteChunks(oldChunk, newChunks) {
83603 if (!this._chunks) {
83604 if (this.module) {
83605 if (!this.module._chunks.has(oldChunk)) return;
83606 this._chunks = new Set(this.module._chunks);
83607 } else {
83608 this._chunks = new Set();
83609 }
83610 }
83611 if (this._chunks.has(oldChunk)) {
83612 this._chunks.delete(oldChunk);
83613 for (let i = 0; i < newChunks.length; i++) {
83614 this._chunks.add(newChunks[i]);
83615 }
83616 }
83617 }
83618}
83619
83620module.exports = ModuleReason;
83621
83622
83623/***/ }),
83624
83625/***/ 75100:
83626/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83627
83628"use strict";
83629/*
83630 MIT License http://www.opensource.org/licenses/mit-license.php
83631 Author Tobias Koppers @sokra
83632*/
83633
83634
83635const { Tapable, SyncWaterfallHook, SyncHook } = __webpack_require__(56758);
83636
83637/** @typedef {import("webpack-sources").Source} Source */
83638/** @typedef {import("./Module")} Module */
83639
83640module.exports = class ModuleTemplate extends Tapable {
83641 constructor(runtimeTemplate, type) {
83642 super();
83643 this.runtimeTemplate = runtimeTemplate;
83644 this.type = type;
83645 this.hooks = {
83646 content: new SyncWaterfallHook([
83647 "source",
83648 "module",
83649 "options",
83650 "dependencyTemplates"
83651 ]),
83652 module: new SyncWaterfallHook([
83653 "source",
83654 "module",
83655 "options",
83656 "dependencyTemplates"
83657 ]),
83658 render: new SyncWaterfallHook([
83659 "source",
83660 "module",
83661 "options",
83662 "dependencyTemplates"
83663 ]),
83664 package: new SyncWaterfallHook([
83665 "source",
83666 "module",
83667 "options",
83668 "dependencyTemplates"
83669 ]),
83670 hash: new SyncHook(["hash"])
83671 };
83672 }
83673
83674 /**
83675 * @param {Module} module the module
83676 * @param {TODO} dependencyTemplates templates for dependencies
83677 * @param {TODO} options render options
83678 * @returns {Source} the source
83679 */
83680 render(module, dependencyTemplates, options) {
83681 try {
83682 const moduleSource = module.source(
83683 dependencyTemplates,
83684 this.runtimeTemplate,
83685 this.type
83686 );
83687 const moduleSourcePostContent = this.hooks.content.call(
83688 moduleSource,
83689 module,
83690 options,
83691 dependencyTemplates
83692 );
83693 const moduleSourcePostModule = this.hooks.module.call(
83694 moduleSourcePostContent,
83695 module,
83696 options,
83697 dependencyTemplates
83698 );
83699 const moduleSourcePostRender = this.hooks.render.call(
83700 moduleSourcePostModule,
83701 module,
83702 options,
83703 dependencyTemplates
83704 );
83705 return this.hooks.package.call(
83706 moduleSourcePostRender,
83707 module,
83708 options,
83709 dependencyTemplates
83710 );
83711 } catch (e) {
83712 e.message = `${module.identifier()}\n${e.message}`;
83713 throw e;
83714 }
83715 }
83716
83717 updateHash(hash) {
83718 hash.update("1");
83719 this.hooks.hash.call(hash);
83720 }
83721};
83722
83723
83724/***/ }),
83725
83726/***/ 6372:
83727/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83728
83729"use strict";
83730/*
83731 MIT License http://www.opensource.org/licenses/mit-license.php
83732 Author Tobias Koppers @sokra
83733*/
83734
83735
83736const WebpackError = __webpack_require__(97391);
83737const { cleanUp } = __webpack_require__(80140);
83738
83739class ModuleWarning extends WebpackError {
83740 constructor(module, warning, { from = null } = {}) {
83741 let message = "Module Warning";
83742 if (from) {
83743 message += ` (from ${from}):\n`;
83744 } else {
83745 message += ": ";
83746 }
83747 if (warning && typeof warning === "object" && warning.message) {
83748 message += warning.message;
83749 } else if (warning) {
83750 message += warning;
83751 }
83752 super(message);
83753 this.name = "ModuleWarning";
83754 this.module = module;
83755 this.warning = warning;
83756 this.details =
83757 warning && typeof warning === "object" && warning.stack
83758 ? cleanUp(warning.stack, this.message)
83759 : undefined;
83760
83761 Error.captureStackTrace(this, this.constructor);
83762 }
83763}
83764
83765module.exports = ModuleWarning;
83766
83767
83768/***/ }),
83769
83770/***/ 10238:
83771/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
83772
83773"use strict";
83774/*
83775 MIT License http://www.opensource.org/licenses/mit-license.php
83776 Author Tobias Koppers @sokra
83777*/
83778
83779
83780const { Tapable, SyncHook, MultiHook } = __webpack_require__(56758);
83781const asyncLib = __webpack_require__(36386);
83782const MultiWatching = __webpack_require__(66624);
83783const MultiStats = __webpack_require__(55144);
83784const ConcurrentCompilationError = __webpack_require__(18933);
83785
83786module.exports = class MultiCompiler extends Tapable {
83787 constructor(compilers) {
83788 super();
83789 this.hooks = {
83790 done: new SyncHook(["stats"]),
83791 invalid: new MultiHook(compilers.map(c => c.hooks.invalid)),
83792 run: new MultiHook(compilers.map(c => c.hooks.run)),
83793 watchClose: new SyncHook([]),
83794 watchRun: new MultiHook(compilers.map(c => c.hooks.watchRun)),
83795 infrastructureLog: new MultiHook(
83796 compilers.map(c => c.hooks.infrastructureLog)
83797 )
83798 };
83799 if (!Array.isArray(compilers)) {
83800 compilers = Object.keys(compilers).map(name => {
83801 compilers[name].name = name;
83802 return compilers[name];
83803 });
83804 }
83805 this.compilers = compilers;
83806 let doneCompilers = 0;
83807 let compilerStats = [];
83808 let index = 0;
83809 for (const compiler of this.compilers) {
83810 let compilerDone = false;
83811 const compilerIndex = index++;
83812 // eslint-disable-next-line no-loop-func
83813 compiler.hooks.done.tap("MultiCompiler", stats => {
83814 if (!compilerDone) {
83815 compilerDone = true;
83816 doneCompilers++;
83817 }
83818 compilerStats[compilerIndex] = stats;
83819 if (doneCompilers === this.compilers.length) {
83820 this.hooks.done.call(new MultiStats(compilerStats));
83821 }
83822 });
83823 // eslint-disable-next-line no-loop-func
83824 compiler.hooks.invalid.tap("MultiCompiler", () => {
83825 if (compilerDone) {
83826 compilerDone = false;
83827 doneCompilers--;
83828 }
83829 });
83830 }
83831 this.running = false;
83832 }
83833
83834 get outputPath() {
83835 let commonPath = this.compilers[0].outputPath;
83836 for (const compiler of this.compilers) {
83837 while (
83838 compiler.outputPath.indexOf(commonPath) !== 0 &&
83839 /[/\\]/.test(commonPath)
83840 ) {
83841 commonPath = commonPath.replace(/[/\\][^/\\]*$/, "");
83842 }
83843 }
83844
83845 if (!commonPath && this.compilers[0].outputPath[0] === "/") return "/";
83846 return commonPath;
83847 }
83848
83849 get inputFileSystem() {
83850 throw new Error("Cannot read inputFileSystem of a MultiCompiler");
83851 }
83852
83853 get outputFileSystem() {
83854 throw new Error("Cannot read outputFileSystem of a MultiCompiler");
83855 }
83856
83857 set inputFileSystem(value) {
83858 for (const compiler of this.compilers) {
83859 compiler.inputFileSystem = value;
83860 }
83861 }
83862
83863 set outputFileSystem(value) {
83864 for (const compiler of this.compilers) {
83865 compiler.outputFileSystem = value;
83866 }
83867 }
83868
83869 getInfrastructureLogger(name) {
83870 return this.compilers[0].getInfrastructureLogger(name);
83871 }
83872
83873 validateDependencies(callback) {
83874 const edges = new Set();
83875 const missing = [];
83876 const targetFound = compiler => {
83877 for (const edge of edges) {
83878 if (edge.target === compiler) {
83879 return true;
83880 }
83881 }
83882 return false;
83883 };
83884 const sortEdges = (e1, e2) => {
83885 return (
83886 e1.source.name.localeCompare(e2.source.name) ||
83887 e1.target.name.localeCompare(e2.target.name)
83888 );
83889 };
83890 for (const source of this.compilers) {
83891 if (source.dependencies) {
83892 for (const dep of source.dependencies) {
83893 const target = this.compilers.find(c => c.name === dep);
83894 if (!target) {
83895 missing.push(dep);
83896 } else {
83897 edges.add({
83898 source,
83899 target
83900 });
83901 }
83902 }
83903 }
83904 }
83905 const errors = missing.map(m => `Compiler dependency \`${m}\` not found.`);
83906 const stack = this.compilers.filter(c => !targetFound(c));
83907 while (stack.length > 0) {
83908 const current = stack.pop();
83909 for (const edge of edges) {
83910 if (edge.source === current) {
83911 edges.delete(edge);
83912 const target = edge.target;
83913 if (!targetFound(target)) {
83914 stack.push(target);
83915 }
83916 }
83917 }
83918 }
83919 if (edges.size > 0) {
83920 const lines = Array.from(edges)
83921 .sort(sortEdges)
83922 .map(edge => `${edge.source.name} -> ${edge.target.name}`);
83923 lines.unshift("Circular dependency found in compiler dependencies.");
83924 errors.unshift(lines.join("\n"));
83925 }
83926 if (errors.length > 0) {
83927 const message = errors.join("\n");
83928 callback(new Error(message));
83929 return false;
83930 }
83931 return true;
83932 }
83933
83934 runWithDependencies(compilers, fn, callback) {
83935 const fulfilledNames = new Set();
83936 let remainingCompilers = compilers;
83937 const isDependencyFulfilled = d => fulfilledNames.has(d);
83938 const getReadyCompilers = () => {
83939 let readyCompilers = [];
83940 let list = remainingCompilers;
83941 remainingCompilers = [];
83942 for (const c of list) {
83943 const ready =
83944 !c.dependencies || c.dependencies.every(isDependencyFulfilled);
83945 if (ready) {
83946 readyCompilers.push(c);
83947 } else {
83948 remainingCompilers.push(c);
83949 }
83950 }
83951 return readyCompilers;
83952 };
83953 const runCompilers = callback => {
83954 if (remainingCompilers.length === 0) return callback();
83955 asyncLib.map(
83956 getReadyCompilers(),
83957 (compiler, callback) => {
83958 fn(compiler, err => {
83959 if (err) return callback(err);
83960 fulfilledNames.add(compiler.name);
83961 runCompilers(callback);
83962 });
83963 },
83964 callback
83965 );
83966 };
83967 runCompilers(callback);
83968 }
83969
83970 watch(watchOptions, handler) {
83971 if (this.running) return handler(new ConcurrentCompilationError());
83972
83973 let watchings = [];
83974 let allStats = this.compilers.map(() => null);
83975 let compilerStatus = this.compilers.map(() => false);
83976 if (this.validateDependencies(handler)) {
83977 this.running = true;
83978 this.runWithDependencies(
83979 this.compilers,
83980 (compiler, callback) => {
83981 const compilerIdx = this.compilers.indexOf(compiler);
83982 let firstRun = true;
83983 let watching = compiler.watch(
83984 Array.isArray(watchOptions)
83985 ? watchOptions[compilerIdx]
83986 : watchOptions,
83987 (err, stats) => {
83988 if (err) handler(err);
83989 if (stats) {
83990 allStats[compilerIdx] = stats;
83991 compilerStatus[compilerIdx] = "new";
83992 if (compilerStatus.every(Boolean)) {
83993 const freshStats = allStats.filter((s, idx) => {
83994 return compilerStatus[idx] === "new";
83995 });
83996 compilerStatus.fill(true);
83997 const multiStats = new MultiStats(freshStats);
83998 handler(null, multiStats);
83999 }
84000 }
84001 if (firstRun && !err) {
84002 firstRun = false;
84003 callback();
84004 }
84005 }
84006 );
84007 watchings.push(watching);
84008 },
84009 () => {
84010 // ignore
84011 }
84012 );
84013 }
84014
84015 return new MultiWatching(watchings, this);
84016 }
84017
84018 run(callback) {
84019 if (this.running) {
84020 return callback(new ConcurrentCompilationError());
84021 }
84022
84023 const finalCallback = (err, stats) => {
84024 this.running = false;
84025
84026 if (callback !== undefined) {
84027 return callback(err, stats);
84028 }
84029 };
84030
84031 const allStats = this.compilers.map(() => null);
84032 if (this.validateDependencies(callback)) {
84033 this.running = true;
84034 this.runWithDependencies(
84035 this.compilers,
84036 (compiler, callback) => {
84037 const compilerIdx = this.compilers.indexOf(compiler);
84038 compiler.run((err, stats) => {
84039 if (err) {
84040 return callback(err);
84041 }
84042 allStats[compilerIdx] = stats;
84043 callback();
84044 });
84045 },
84046 err => {
84047 if (err) {
84048 return finalCallback(err);
84049 }
84050 finalCallback(null, new MultiStats(allStats));
84051 }
84052 );
84053 }
84054 }
84055
84056 purgeInputFileSystem() {
84057 for (const compiler of this.compilers) {
84058 if (compiler.inputFileSystem && compiler.inputFileSystem.purge) {
84059 compiler.inputFileSystem.purge();
84060 }
84061 }
84062 }
84063};
84064
84065
84066/***/ }),
84067
84068/***/ 98046:
84069/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84070
84071"use strict";
84072/*
84073 MIT License http://www.opensource.org/licenses/mit-license.php
84074 Author Tobias Koppers @sokra
84075*/
84076
84077
84078const MultiEntryDependency = __webpack_require__(7791);
84079const SingleEntryDependency = __webpack_require__(84828);
84080const MultiModuleFactory = __webpack_require__(24005);
84081
84082/** @typedef {import("./Compiler")} Compiler */
84083
84084class MultiEntryPlugin {
84085 /**
84086 * The MultiEntryPlugin is invoked whenever this.options.entry value is an array of paths
84087 * @param {string} context context path
84088 * @param {string[]} entries array of entry paths
84089 * @param {string} name entry key name
84090 */
84091 constructor(context, entries, name) {
84092 this.context = context;
84093 this.entries = entries;
84094 this.name = name;
84095 }
84096
84097 /**
84098 * @param {Compiler} compiler the compiler instance
84099 * @returns {void}
84100 */
84101 apply(compiler) {
84102 compiler.hooks.compilation.tap(
84103 "MultiEntryPlugin",
84104 (compilation, { normalModuleFactory }) => {
84105 const multiModuleFactory = new MultiModuleFactory();
84106
84107 compilation.dependencyFactories.set(
84108 MultiEntryDependency,
84109 multiModuleFactory
84110 );
84111 compilation.dependencyFactories.set(
84112 SingleEntryDependency,
84113 normalModuleFactory
84114 );
84115 }
84116 );
84117
84118 compiler.hooks.make.tapAsync(
84119 "MultiEntryPlugin",
84120 (compilation, callback) => {
84121 const { context, entries, name } = this;
84122
84123 const dep = MultiEntryPlugin.createDependency(entries, name);
84124 compilation.addEntry(context, dep, name, callback);
84125 }
84126 );
84127 }
84128
84129 /**
84130 * @param {string[]} entries each entry path string
84131 * @param {string} name name of the entry
84132 * @returns {MultiEntryDependency} returns a constructed Dependency
84133 */
84134 static createDependency(entries, name) {
84135 return new MultiEntryDependency(
84136 entries.map((e, idx) => {
84137 const dep = new SingleEntryDependency(e);
84138 // Because entrypoints are not dependencies found in an
84139 // existing module, we give it a synthetic id
84140 dep.loc = {
84141 name,
84142 index: idx
84143 };
84144 return dep;
84145 }),
84146 name
84147 );
84148 }
84149}
84150
84151module.exports = MultiEntryPlugin;
84152
84153
84154/***/ }),
84155
84156/***/ 4198:
84157/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84158
84159"use strict";
84160/*
84161 MIT License http://www.opensource.org/licenses/mit-license.php
84162 Author Tobias Koppers @sokra
84163*/
84164
84165
84166const Module = __webpack_require__(75993);
84167const Template = __webpack_require__(96066);
84168const { RawSource } = __webpack_require__(53665);
84169
84170/** @typedef {import("./util/createHash").Hash} Hash */
84171
84172class MultiModule extends Module {
84173 constructor(context, dependencies, name) {
84174 super("javascript/dynamic", context);
84175
84176 // Info from Factory
84177 this.dependencies = dependencies;
84178 this.name = name;
84179 this._identifier = `multi ${this.dependencies
84180 .map(d => d.request)
84181 .join(" ")}`;
84182 }
84183
84184 identifier() {
84185 return this._identifier;
84186 }
84187
84188 readableIdentifier(requestShortener) {
84189 return `multi ${this.dependencies
84190 .map(d => requestShortener.shorten(d.request))
84191 .join(" ")}`;
84192 }
84193
84194 build(options, compilation, resolver, fs, callback) {
84195 this.built = true;
84196 this.buildMeta = {};
84197 this.buildInfo = {};
84198 return callback();
84199 }
84200
84201 needRebuild() {
84202 return false;
84203 }
84204
84205 size() {
84206 return 16 + this.dependencies.length * 12;
84207 }
84208
84209 /**
84210 * @param {Hash} hash the hash used to track dependencies
84211 * @returns {void}
84212 */
84213 updateHash(hash) {
84214 hash.update("multi module");
84215 hash.update(this.name || "");
84216 super.updateHash(hash);
84217 }
84218
84219 source(dependencyTemplates, runtimeTemplate) {
84220 const str = [];
84221 let idx = 0;
84222 for (const dep of this.dependencies) {
84223 if (dep.module) {
84224 if (idx === this.dependencies.length - 1) {
84225 str.push("module.exports = ");
84226 }
84227 str.push("__webpack_require__(");
84228 if (runtimeTemplate.outputOptions.pathinfo) {
84229 str.push(Template.toComment(dep.request));
84230 }
84231 str.push(`${JSON.stringify(dep.module.id)}`);
84232 str.push(")");
84233 } else {
84234 const content = __webpack_require__(75386).module(
84235 dep.request
84236 );
84237 str.push(content);
84238 }
84239 str.push(";\n");
84240 idx++;
84241 }
84242 return new RawSource(str.join(""));
84243 }
84244}
84245
84246module.exports = MultiModule;
84247
84248
84249/***/ }),
84250
84251/***/ 24005:
84252/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84253
84254"use strict";
84255/*
84256 MIT License http://www.opensource.org/licenses/mit-license.php
84257 Author Tobias Koppers @sokra
84258*/
84259
84260
84261const { Tapable } = __webpack_require__(56758);
84262const MultiModule = __webpack_require__(4198);
84263
84264module.exports = class MultiModuleFactory extends Tapable {
84265 constructor() {
84266 super();
84267 this.hooks = {};
84268 }
84269
84270 create(data, callback) {
84271 const dependency = data.dependencies[0];
84272 callback(
84273 null,
84274 new MultiModule(data.context, dependency.dependencies, dependency.name)
84275 );
84276 }
84277};
84278
84279
84280/***/ }),
84281
84282/***/ 55144:
84283/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84284
84285"use strict";
84286/*
84287 MIT License http://www.opensource.org/licenses/mit-license.php
84288 Author Tobias Koppers @sokra
84289*/
84290
84291
84292const Stats = __webpack_require__(99977);
84293
84294const optionOrFallback = (optionValue, fallbackValue) =>
84295 optionValue !== undefined ? optionValue : fallbackValue;
84296
84297class MultiStats {
84298 constructor(stats) {
84299 this.stats = stats;
84300 this.hash = stats.map(stat => stat.hash).join("");
84301 }
84302
84303 hasErrors() {
84304 return this.stats
84305 .map(stat => stat.hasErrors())
84306 .reduce((a, b) => a || b, false);
84307 }
84308
84309 hasWarnings() {
84310 return this.stats
84311 .map(stat => stat.hasWarnings())
84312 .reduce((a, b) => a || b, false);
84313 }
84314
84315 toJson(options, forToString) {
84316 if (typeof options === "boolean" || typeof options === "string") {
84317 options = Stats.presetToOptions(options);
84318 } else if (!options) {
84319 options = {};
84320 }
84321 const jsons = this.stats.map((stat, idx) => {
84322 const childOptions = Stats.getChildOptions(options, idx);
84323 const obj = stat.toJson(childOptions, forToString);
84324 obj.name = stat.compilation && stat.compilation.name;
84325 return obj;
84326 });
84327 const showVersion =
84328 options.version === undefined
84329 ? jsons.every(j => j.version)
84330 : options.version !== false;
84331 const showHash =
84332 options.hash === undefined
84333 ? jsons.every(j => j.hash)
84334 : options.hash !== false;
84335 if (showVersion) {
84336 for (const j of jsons) {
84337 delete j.version;
84338 }
84339 }
84340 const obj = {
84341 errors: jsons.reduce((arr, j) => {
84342 return arr.concat(
84343 j.errors.map(msg => {
84344 return `(${j.name}) ${msg}`;
84345 })
84346 );
84347 }, []),
84348 warnings: jsons.reduce((arr, j) => {
84349 return arr.concat(
84350 j.warnings.map(msg => {
84351 return `(${j.name}) ${msg}`;
84352 })
84353 );
84354 }, [])
84355 };
84356 if (showVersion) obj.version = __webpack_require__(71618)/* .version */ .i8;
84357 if (showHash) obj.hash = this.hash;
84358 if (options.children !== false) obj.children = jsons;
84359 return obj;
84360 }
84361
84362 toString(options) {
84363 if (typeof options === "boolean" || typeof options === "string") {
84364 options = Stats.presetToOptions(options);
84365 } else if (!options) {
84366 options = {};
84367 }
84368
84369 const useColors = optionOrFallback(options.colors, false);
84370
84371 const obj = this.toJson(options, true);
84372
84373 return Stats.jsonToString(obj, useColors);
84374 }
84375}
84376
84377module.exports = MultiStats;
84378
84379
84380/***/ }),
84381
84382/***/ 66624:
84383/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84384
84385"use strict";
84386/*
84387 MIT License http://www.opensource.org/licenses/mit-license.php
84388 Author Tobias Koppers @sokra
84389*/
84390
84391
84392const asyncLib = __webpack_require__(36386);
84393
84394class MultiWatching {
84395 constructor(watchings, compiler) {
84396 this.watchings = watchings;
84397 this.compiler = compiler;
84398 }
84399
84400 invalidate() {
84401 for (const watching of this.watchings) {
84402 watching.invalidate();
84403 }
84404 }
84405
84406 suspend() {
84407 for (const watching of this.watchings) {
84408 watching.suspend();
84409 }
84410 }
84411
84412 resume() {
84413 for (const watching of this.watchings) {
84414 watching.resume();
84415 }
84416 }
84417
84418 close(callback) {
84419 asyncLib.forEach(
84420 this.watchings,
84421 (watching, finishedCallback) => {
84422 watching.close(finishedCallback);
84423 },
84424 err => {
84425 this.compiler.hooks.watchClose.call();
84426 if (typeof callback === "function") {
84427 this.compiler.running = false;
84428 callback(err);
84429 }
84430 }
84431 );
84432 }
84433}
84434
84435module.exports = MultiWatching;
84436
84437
84438/***/ }),
84439
84440/***/ 70419:
84441/***/ (function(module) {
84442
84443"use strict";
84444/*
84445 MIT License http://www.opensource.org/licenses/mit-license.php
84446 Author Tobias Koppers @sokra
84447*/
84448
84449
84450class NamedChunksPlugin {
84451 static defaultNameResolver(chunk) {
84452 return chunk.name || null;
84453 }
84454
84455 constructor(nameResolver) {
84456 this.nameResolver = nameResolver || NamedChunksPlugin.defaultNameResolver;
84457 }
84458
84459 apply(compiler) {
84460 compiler.hooks.compilation.tap("NamedChunksPlugin", compilation => {
84461 compilation.hooks.beforeChunkIds.tap("NamedChunksPlugin", chunks => {
84462 for (const chunk of chunks) {
84463 if (chunk.id === null) {
84464 chunk.id = this.nameResolver(chunk);
84465 }
84466 }
84467 });
84468 });
84469 }
84470}
84471
84472module.exports = NamedChunksPlugin;
84473
84474
84475/***/ }),
84476
84477/***/ 86707:
84478/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84479
84480"use strict";
84481/*
84482 MIT License http://www.opensource.org/licenses/mit-license.php
84483 Author Tobias Koppers @sokra
84484*/
84485
84486
84487const createHash = __webpack_require__(15660);
84488const RequestShortener = __webpack_require__(54254);
84489
84490const getHash = str => {
84491 const hash = createHash("md4");
84492 hash.update(str);
84493 const digest = /** @type {string} */ (hash.digest("hex"));
84494 return digest.substr(0, 4);
84495};
84496
84497class NamedModulesPlugin {
84498 constructor(options) {
84499 this.options = options || {};
84500 }
84501
84502 apply(compiler) {
84503 compiler.hooks.compilation.tap("NamedModulesPlugin", compilation => {
84504 compilation.hooks.beforeModuleIds.tap("NamedModulesPlugin", modules => {
84505 const namedModules = new Map();
84506 const context = this.options.context || compiler.options.context;
84507
84508 for (const module of modules) {
84509 if (module.id === null && module.libIdent) {
84510 module.id = module.libIdent({ context });
84511 }
84512
84513 if (module.id !== null) {
84514 const namedModule = namedModules.get(module.id);
84515 if (namedModule !== undefined) {
84516 namedModule.push(module);
84517 } else {
84518 namedModules.set(module.id, [module]);
84519 }
84520 }
84521 }
84522
84523 for (const namedModule of namedModules.values()) {
84524 if (namedModule.length > 1) {
84525 for (const module of namedModule) {
84526 const requestShortener = new RequestShortener(context);
84527 module.id = `${module.id}?${getHash(
84528 requestShortener.shorten(module.identifier())
84529 )}`;
84530 }
84531 }
84532 }
84533 });
84534 });
84535 }
84536}
84537
84538module.exports = NamedModulesPlugin;
84539
84540
84541/***/ }),
84542
84543/***/ 22615:
84544/***/ (function(module) {
84545
84546"use strict";
84547/*
84548 MIT License http://www.opensource.org/licenses/mit-license.php
84549 Author Tobias Koppers @sokra
84550*/
84551
84552
84553class NoEmitOnErrorsPlugin {
84554 apply(compiler) {
84555 compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => {
84556 if (compilation.getStats().hasErrors()) return false;
84557 });
84558 compiler.hooks.compilation.tap("NoEmitOnErrorsPlugin", compilation => {
84559 compilation.hooks.shouldRecord.tap("NoEmitOnErrorsPlugin", () => {
84560 if (compilation.getStats().hasErrors()) return false;
84561 });
84562 });
84563 }
84564}
84565
84566module.exports = NoEmitOnErrorsPlugin;
84567
84568
84569/***/ }),
84570
84571/***/ 45759:
84572/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84573
84574"use strict";
84575/*
84576 MIT License http://www.opensource.org/licenses/mit-license.php
84577 Author Tobias Koppers @sokra
84578*/
84579
84580
84581const WebpackError = __webpack_require__(97391);
84582
84583module.exports = class NoModeWarning extends WebpackError {
84584 constructor(modules) {
84585 super();
84586
84587 this.name = "NoModeWarning";
84588 this.message =
84589 "configuration\n" +
84590 "The 'mode' option has not been set, webpack will fallback to 'production' for this value. " +
84591 "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" +
84592 "You can also set it to 'none' to disable any default behavior. " +
84593 "Learn more: https://webpack.js.org/configuration/mode/";
84594
84595 Error.captureStackTrace(this, this.constructor);
84596 }
84597};
84598
84599
84600/***/ }),
84601
84602/***/ 28386:
84603/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84604
84605"use strict";
84606/*
84607 MIT License http://www.opensource.org/licenses/mit-license.php
84608 Author Tobias Koppers @sokra
84609*/
84610
84611
84612const path = __webpack_require__(85622);
84613const ParserHelpers = __webpack_require__(23999);
84614const ConstDependency = __webpack_require__(71101);
84615
84616const NullFactory = __webpack_require__(40438);
84617
84618class NodeStuffPlugin {
84619 constructor(options) {
84620 this.options = options;
84621 }
84622
84623 apply(compiler) {
84624 const options = this.options;
84625 compiler.hooks.compilation.tap(
84626 "NodeStuffPlugin",
84627 (compilation, { normalModuleFactory }) => {
84628 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
84629 compilation.dependencyTemplates.set(
84630 ConstDependency,
84631 new ConstDependency.Template()
84632 );
84633
84634 const handler = (parser, parserOptions) => {
84635 if (parserOptions.node === false) return;
84636
84637 let localOptions = options;
84638 if (parserOptions.node) {
84639 localOptions = Object.assign({}, localOptions, parserOptions.node);
84640 }
84641
84642 const setConstant = (expressionName, value) => {
84643 parser.hooks.expression
84644 .for(expressionName)
84645 .tap("NodeStuffPlugin", () => {
84646 parser.state.current.addVariable(
84647 expressionName,
84648 JSON.stringify(value)
84649 );
84650 return true;
84651 });
84652 };
84653
84654 const setModuleConstant = (expressionName, fn) => {
84655 parser.hooks.expression
84656 .for(expressionName)
84657 .tap("NodeStuffPlugin", () => {
84658 parser.state.current.addVariable(
84659 expressionName,
84660 JSON.stringify(fn(parser.state.module))
84661 );
84662 return true;
84663 });
84664 };
84665 const context = compiler.context;
84666 if (localOptions.__filename) {
84667 if (localOptions.__filename === "mock") {
84668 setConstant("__filename", "/index.js");
84669 } else {
84670 setModuleConstant("__filename", module =>
84671 path.relative(context, module.resource)
84672 );
84673 }
84674 parser.hooks.evaluateIdentifier
84675 .for("__filename")
84676 .tap("NodeStuffPlugin", expr => {
84677 if (!parser.state.module) return;
84678 const resource = parser.state.module.resource;
84679 const i = resource.indexOf("?");
84680 return ParserHelpers.evaluateToString(
84681 i < 0 ? resource : resource.substr(0, i)
84682 )(expr);
84683 });
84684 }
84685 if (localOptions.__dirname) {
84686 if (localOptions.__dirname === "mock") {
84687 setConstant("__dirname", "/");
84688 } else {
84689 setModuleConstant("__dirname", module =>
84690 path.relative(context, module.context)
84691 );
84692 }
84693 parser.hooks.evaluateIdentifier
84694 .for("__dirname")
84695 .tap("NodeStuffPlugin", expr => {
84696 if (!parser.state.module) return;
84697 return ParserHelpers.evaluateToString(
84698 parser.state.module.context
84699 )(expr);
84700 });
84701 }
84702 parser.hooks.expression
84703 .for("require.extensions")
84704 .tap(
84705 "NodeStuffPlugin",
84706 ParserHelpers.expressionIsUnsupported(
84707 parser,
84708 "require.extensions is not supported by webpack. Use a loader instead."
84709 )
84710 );
84711 };
84712
84713 normalModuleFactory.hooks.parser
84714 .for("javascript/auto")
84715 .tap("NodeStuffPlugin", handler);
84716 normalModuleFactory.hooks.parser
84717 .for("javascript/dynamic")
84718 .tap("NodeStuffPlugin", handler);
84719 }
84720 );
84721 }
84722}
84723module.exports = NodeStuffPlugin;
84724
84725
84726/***/ }),
84727
84728/***/ 25963:
84729/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
84730
84731"use strict";
84732/*
84733 MIT License http://www.opensource.org/licenses/mit-license.php
84734 Author Tobias Koppers @sokra
84735*/
84736
84737
84738const NativeModule = __webpack_require__(32282);
84739
84740const {
84741 CachedSource,
84742 LineToLineMappedSource,
84743 OriginalSource,
84744 RawSource,
84745 SourceMapSource
84746} = __webpack_require__(53665);
84747const { getContext, runLoaders } = __webpack_require__(73278);
84748
84749const WebpackError = __webpack_require__(97391);
84750const Module = __webpack_require__(75993);
84751const ModuleParseError = __webpack_require__(62500);
84752const ModuleBuildError = __webpack_require__(12072);
84753const ModuleError = __webpack_require__(82528);
84754const ModuleWarning = __webpack_require__(6372);
84755const createHash = __webpack_require__(15660);
84756const contextify = __webpack_require__(94658).contextify;
84757
84758/** @typedef {import("./util/createHash").Hash} Hash */
84759
84760const asString = buf => {
84761 if (Buffer.isBuffer(buf)) {
84762 return buf.toString("utf-8");
84763 }
84764 return buf;
84765};
84766
84767const asBuffer = str => {
84768 if (!Buffer.isBuffer(str)) {
84769 return Buffer.from(str, "utf-8");
84770 }
84771 return str;
84772};
84773
84774class NonErrorEmittedError extends WebpackError {
84775 constructor(error) {
84776 super();
84777
84778 this.name = "NonErrorEmittedError";
84779 this.message = "(Emitted value instead of an instance of Error) " + error;
84780
84781 Error.captureStackTrace(this, this.constructor);
84782 }
84783}
84784
84785/**
84786 * @typedef {Object} CachedSourceEntry
84787 * @property {TODO} source the generated source
84788 * @property {string} hash the hash value
84789 */
84790
84791class NormalModule extends Module {
84792 constructor({
84793 type,
84794 request,
84795 userRequest,
84796 rawRequest,
84797 loaders,
84798 resource,
84799 matchResource,
84800 parser,
84801 generator,
84802 resolveOptions
84803 }) {
84804 super(type, getContext(resource));
84805
84806 // Info from Factory
84807 this.request = request;
84808 this.userRequest = userRequest;
84809 this.rawRequest = rawRequest;
84810 this.binary = type.startsWith("webassembly");
84811 this.parser = parser;
84812 this.generator = generator;
84813 this.resource = resource;
84814 this.matchResource = matchResource;
84815 this.loaders = loaders;
84816 if (resolveOptions !== undefined) this.resolveOptions = resolveOptions;
84817
84818 // Info from Build
84819 this.error = null;
84820 this._source = null;
84821 this._sourceSize = null;
84822 this._buildHash = "";
84823 this.buildTimestamp = undefined;
84824 /** @private @type {Map<string, CachedSourceEntry>} */
84825 this._cachedSources = new Map();
84826
84827 // Options for the NormalModule set by plugins
84828 // TODO refactor this -> options object filled from Factory
84829 this.useSourceMap = false;
84830 this.lineToLine = false;
84831
84832 // Cache
84833 this._lastSuccessfulBuildMeta = {};
84834 }
84835
84836 identifier() {
84837 return this.request;
84838 }
84839
84840 readableIdentifier(requestShortener) {
84841 return requestShortener.shorten(this.userRequest);
84842 }
84843
84844 libIdent(options) {
84845 return contextify(options.context, this.userRequest);
84846 }
84847
84848 nameForCondition() {
84849 const resource = this.matchResource || this.resource;
84850 const idx = resource.indexOf("?");
84851 if (idx >= 0) return resource.substr(0, idx);
84852 return resource;
84853 }
84854
84855 updateCacheModule(module) {
84856 this.type = module.type;
84857 this.request = module.request;
84858 this.userRequest = module.userRequest;
84859 this.rawRequest = module.rawRequest;
84860 this.parser = module.parser;
84861 this.generator = module.generator;
84862 this.resource = module.resource;
84863 this.matchResource = module.matchResource;
84864 this.loaders = module.loaders;
84865 this.resolveOptions = module.resolveOptions;
84866 }
84867
84868 createSourceForAsset(name, content, sourceMap) {
84869 if (!sourceMap) {
84870 return new RawSource(content);
84871 }
84872
84873 if (typeof sourceMap === "string") {
84874 return new OriginalSource(content, sourceMap);
84875 }
84876
84877 return new SourceMapSource(content, name, sourceMap);
84878 }
84879
84880 createLoaderContext(resolver, options, compilation, fs) {
84881 const requestShortener = compilation.runtimeTemplate.requestShortener;
84882 const getCurrentLoaderName = () => {
84883 const currentLoader = this.getCurrentLoader(loaderContext);
84884 if (!currentLoader) return "(not in loader scope)";
84885 return requestShortener.shorten(currentLoader.loader);
84886 };
84887 const loaderContext = {
84888 version: 2,
84889 emitWarning: warning => {
84890 if (!(warning instanceof Error)) {
84891 warning = new NonErrorEmittedError(warning);
84892 }
84893 this.warnings.push(
84894 new ModuleWarning(this, warning, {
84895 from: getCurrentLoaderName()
84896 })
84897 );
84898 },
84899 emitError: error => {
84900 if (!(error instanceof Error)) {
84901 error = new NonErrorEmittedError(error);
84902 }
84903 this.errors.push(
84904 new ModuleError(this, error, {
84905 from: getCurrentLoaderName()
84906 })
84907 );
84908 },
84909 getLogger: name => {
84910 const currentLoader = this.getCurrentLoader(loaderContext);
84911 return compilation.getLogger(() =>
84912 [currentLoader && currentLoader.loader, name, this.identifier()]
84913 .filter(Boolean)
84914 .join("|")
84915 );
84916 },
84917 // TODO remove in webpack 5
84918 exec: (code, filename) => {
84919 // @ts-ignore Argument of type 'this' is not assignable to parameter of type 'Module'.
84920 const module = new NativeModule(filename, this);
84921 // @ts-ignore _nodeModulePaths is deprecated and undocumented Node.js API
84922 module.paths = NativeModule._nodeModulePaths(this.context);
84923 module.filename = filename;
84924 module._compile(code, filename);
84925 return module.exports;
84926 },
84927 resolve(context, request, callback) {
84928 resolver.resolve({}, context, request, {}, callback);
84929 },
84930 getResolve(options) {
84931 const child = options ? resolver.withOptions(options) : resolver;
84932 return (context, request, callback) => {
84933 if (callback) {
84934 child.resolve({}, context, request, {}, callback);
84935 } else {
84936 return new Promise((resolve, reject) => {
84937 child.resolve({}, context, request, {}, (err, result) => {
84938 if (err) reject(err);
84939 else resolve(result);
84940 });
84941 });
84942 }
84943 };
84944 },
84945 emitFile: (name, content, sourceMap, assetInfo) => {
84946 if (!this.buildInfo.assets) {
84947 this.buildInfo.assets = Object.create(null);
84948 this.buildInfo.assetsInfo = new Map();
84949 }
84950 this.buildInfo.assets[name] = this.createSourceForAsset(
84951 name,
84952 content,
84953 sourceMap
84954 );
84955 this.buildInfo.assetsInfo.set(name, assetInfo);
84956 },
84957 rootContext: options.context,
84958 webpack: true,
84959 sourceMap: !!this.useSourceMap,
84960 mode: options.mode || "production",
84961 _module: this,
84962 _compilation: compilation,
84963 _compiler: compilation.compiler,
84964 fs: fs
84965 };
84966
84967 compilation.hooks.normalModuleLoader.call(loaderContext, this);
84968 if (options.loader) {
84969 Object.assign(loaderContext, options.loader);
84970 }
84971
84972 return loaderContext;
84973 }
84974
84975 getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
84976 if (
84977 this.loaders &&
84978 this.loaders.length &&
84979 index < this.loaders.length &&
84980 index >= 0 &&
84981 this.loaders[index]
84982 ) {
84983 return this.loaders[index];
84984 }
84985 return null;
84986 }
84987
84988 createSource(source, resourceBuffer, sourceMap) {
84989 // if there is no identifier return raw source
84990 if (!this.identifier) {
84991 return new RawSource(source);
84992 }
84993
84994 // from here on we assume we have an identifier
84995 const identifier = this.identifier();
84996
84997 if (this.lineToLine && resourceBuffer) {
84998 return new LineToLineMappedSource(
84999 source,
85000 identifier,
85001 asString(resourceBuffer)
85002 );
85003 }
85004
85005 if (this.useSourceMap && sourceMap) {
85006 return new SourceMapSource(source, identifier, sourceMap);
85007 }
85008
85009 if (Buffer.isBuffer(source)) {
85010 // @ts-ignore
85011 // TODO We need to fix @types/webpack-sources to allow RawSource to take a Buffer | string
85012 return new RawSource(source);
85013 }
85014
85015 return new OriginalSource(source, identifier);
85016 }
85017
85018 doBuild(options, compilation, resolver, fs, callback) {
85019 const loaderContext = this.createLoaderContext(
85020 resolver,
85021 options,
85022 compilation,
85023 fs
85024 );
85025
85026 runLoaders(
85027 {
85028 resource: this.resource,
85029 loaders: this.loaders,
85030 context: loaderContext,
85031 readResource: fs.readFile.bind(fs)
85032 },
85033 (err, result) => {
85034 if (result) {
85035 this.buildInfo.cacheable = result.cacheable;
85036 this.buildInfo.fileDependencies = new Set(result.fileDependencies);
85037 this.buildInfo.contextDependencies = new Set(
85038 result.contextDependencies
85039 );
85040 }
85041
85042 if (err) {
85043 if (!(err instanceof Error)) {
85044 err = new NonErrorEmittedError(err);
85045 }
85046 const currentLoader = this.getCurrentLoader(loaderContext);
85047 const error = new ModuleBuildError(this, err, {
85048 from:
85049 currentLoader &&
85050 compilation.runtimeTemplate.requestShortener.shorten(
85051 currentLoader.loader
85052 )
85053 });
85054 return callback(error);
85055 }
85056
85057 const resourceBuffer = result.resourceBuffer;
85058 const source = result.result[0];
85059 const sourceMap = result.result.length >= 1 ? result.result[1] : null;
85060 const extraInfo = result.result.length >= 2 ? result.result[2] : null;
85061
85062 if (!Buffer.isBuffer(source) && typeof source !== "string") {
85063 const currentLoader = this.getCurrentLoader(loaderContext, 0);
85064 const err = new Error(
85065 `Final loader (${
85066 currentLoader
85067 ? compilation.runtimeTemplate.requestShortener.shorten(
85068 currentLoader.loader
85069 )
85070 : "unknown"
85071 }) didn't return a Buffer or String`
85072 );
85073 const error = new ModuleBuildError(this, err);
85074 return callback(error);
85075 }
85076
85077 this._source = this.createSource(
85078 this.binary ? asBuffer(source) : asString(source),
85079 resourceBuffer,
85080 sourceMap
85081 );
85082 this._sourceSize = null;
85083 this._ast =
85084 typeof extraInfo === "object" &&
85085 extraInfo !== null &&
85086 extraInfo.webpackAST !== undefined
85087 ? extraInfo.webpackAST
85088 : null;
85089 return callback();
85090 }
85091 );
85092 }
85093
85094 markModuleAsErrored(error) {
85095 // Restore build meta from successful build to keep importing state
85096 this.buildMeta = Object.assign({}, this._lastSuccessfulBuildMeta);
85097 this.error = error;
85098 this.errors.push(this.error);
85099 this._source = new RawSource(
85100 "throw new Error(" + JSON.stringify(this.error.message) + ");"
85101 );
85102 this._sourceSize = null;
85103 this._ast = null;
85104 }
85105
85106 applyNoParseRule(rule, content) {
85107 // must start with "rule" if rule is a string
85108 if (typeof rule === "string") {
85109 return content.indexOf(rule) === 0;
85110 }
85111
85112 if (typeof rule === "function") {
85113 return rule(content);
85114 }
85115 // we assume rule is a regexp
85116 return rule.test(content);
85117 }
85118
85119 // check if module should not be parsed
85120 // returns "true" if the module should !not! be parsed
85121 // returns "false" if the module !must! be parsed
85122 shouldPreventParsing(noParseRule, request) {
85123 // if no noParseRule exists, return false
85124 // the module !must! be parsed.
85125 if (!noParseRule) {
85126 return false;
85127 }
85128
85129 // we only have one rule to check
85130 if (!Array.isArray(noParseRule)) {
85131 // returns "true" if the module is !not! to be parsed
85132 return this.applyNoParseRule(noParseRule, request);
85133 }
85134
85135 for (let i = 0; i < noParseRule.length; i++) {
85136 const rule = noParseRule[i];
85137 // early exit on first truthy match
85138 // this module is !not! to be parsed
85139 if (this.applyNoParseRule(rule, request)) {
85140 return true;
85141 }
85142 }
85143 // no match found, so this module !should! be parsed
85144 return false;
85145 }
85146
85147 _initBuildHash(compilation) {
85148 const hash = createHash(compilation.outputOptions.hashFunction);
85149 if (this._source) {
85150 hash.update("source");
85151 this._source.updateHash(hash);
85152 }
85153 hash.update("meta");
85154 hash.update(JSON.stringify(this.buildMeta));
85155 this._buildHash = /** @type {string} */ (hash.digest("hex"));
85156 }
85157
85158 build(options, compilation, resolver, fs, callback) {
85159 this.buildTimestamp = Date.now();
85160 this.built = true;
85161 this._source = null;
85162 this._sourceSize = null;
85163 this._ast = null;
85164 this._buildHash = "";
85165 this.error = null;
85166 this.errors.length = 0;
85167 this.warnings.length = 0;
85168 this.buildMeta = {};
85169 this.buildInfo = {
85170 cacheable: false,
85171 fileDependencies: new Set(),
85172 contextDependencies: new Set(),
85173 assets: undefined,
85174 assetsInfo: undefined
85175 };
85176
85177 return this.doBuild(options, compilation, resolver, fs, err => {
85178 this._cachedSources.clear();
85179
85180 // if we have an error mark module as failed and exit
85181 if (err) {
85182 this.markModuleAsErrored(err);
85183 this._initBuildHash(compilation);
85184 return callback();
85185 }
85186
85187 // check if this module should !not! be parsed.
85188 // if so, exit here;
85189 const noParseRule = options.module && options.module.noParse;
85190 if (this.shouldPreventParsing(noParseRule, this.request)) {
85191 this._initBuildHash(compilation);
85192 return callback();
85193 }
85194
85195 const handleParseError = e => {
85196 const source = this._source.source();
85197 const loaders = this.loaders.map(item =>
85198 contextify(options.context, item.loader)
85199 );
85200 const error = new ModuleParseError(this, source, e, loaders);
85201 this.markModuleAsErrored(error);
85202 this._initBuildHash(compilation);
85203 return callback();
85204 };
85205
85206 const handleParseResult = result => {
85207 this._lastSuccessfulBuildMeta = this.buildMeta;
85208 this._initBuildHash(compilation);
85209 return callback();
85210 };
85211
85212 try {
85213 const result = this.parser.parse(
85214 this._ast || this._source.source(),
85215 {
85216 current: this,
85217 module: this,
85218 compilation: compilation,
85219 options: options
85220 },
85221 (err, result) => {
85222 if (err) {
85223 handleParseError(err);
85224 } else {
85225 handleParseResult(result);
85226 }
85227 }
85228 );
85229 if (result !== undefined) {
85230 // parse is sync
85231 handleParseResult(result);
85232 }
85233 } catch (e) {
85234 handleParseError(e);
85235 }
85236 });
85237 }
85238
85239 getHashDigest(dependencyTemplates) {
85240 // TODO webpack 5 refactor
85241 let dtHash = dependencyTemplates.get("hash");
85242 return `${this.hash}-${dtHash}`;
85243 }
85244
85245 source(dependencyTemplates, runtimeTemplate, type = "javascript") {
85246 const hashDigest = this.getHashDigest(dependencyTemplates);
85247 const cacheEntry = this._cachedSources.get(type);
85248 if (cacheEntry !== undefined && cacheEntry.hash === hashDigest) {
85249 // We can reuse the cached source
85250 return cacheEntry.source;
85251 }
85252
85253 const source = this.generator.generate(
85254 this,
85255 dependencyTemplates,
85256 runtimeTemplate,
85257 type
85258 );
85259
85260 const cachedSource = new CachedSource(source);
85261 this._cachedSources.set(type, {
85262 source: cachedSource,
85263 hash: hashDigest
85264 });
85265 return cachedSource;
85266 }
85267
85268 originalSource() {
85269 return this._source;
85270 }
85271
85272 needRebuild(fileTimestamps, contextTimestamps) {
85273 // always try to rebuild in case of an error
85274 if (this.error) return true;
85275
85276 // always rebuild when module is not cacheable
85277 if (!this.buildInfo.cacheable) return true;
85278
85279 // Check timestamps of all dependencies
85280 // Missing timestamp -> need rebuild
85281 // Timestamp bigger than buildTimestamp -> need rebuild
85282 for (const file of this.buildInfo.fileDependencies) {
85283 const timestamp = fileTimestamps.get(file);
85284 if (!timestamp) return true;
85285 if (timestamp >= this.buildTimestamp) return true;
85286 }
85287 for (const file of this.buildInfo.contextDependencies) {
85288 const timestamp = contextTimestamps.get(file);
85289 if (!timestamp) return true;
85290 if (timestamp >= this.buildTimestamp) return true;
85291 }
85292 // elsewise -> no rebuild needed
85293 return false;
85294 }
85295
85296 size() {
85297 if (this._sourceSize === null) {
85298 this._sourceSize = this._source ? this._source.size() : -1;
85299 }
85300 return this._sourceSize;
85301 }
85302
85303 /**
85304 * @param {Hash} hash the hash used to track dependencies
85305 * @returns {void}
85306 */
85307 updateHash(hash) {
85308 hash.update(this._buildHash);
85309 super.updateHash(hash);
85310 }
85311}
85312
85313module.exports = NormalModule;
85314
85315
85316/***/ }),
85317
85318/***/ 22298:
85319/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
85320
85321"use strict";
85322/*
85323 MIT License http://www.opensource.org/licenses/mit-license.php
85324 Author Tobias Koppers @sokra
85325 */
85326
85327
85328const path = __webpack_require__(85622);
85329const asyncLib = __webpack_require__(36386);
85330const {
85331 Tapable,
85332 AsyncSeriesWaterfallHook,
85333 SyncWaterfallHook,
85334 SyncBailHook,
85335 SyncHook,
85336 HookMap
85337} = __webpack_require__(56758);
85338const NormalModule = __webpack_require__(25963);
85339const RawModule = __webpack_require__(82353);
85340const RuleSet = __webpack_require__(84247);
85341const { cachedCleverMerge } = __webpack_require__(67916);
85342
85343const EMPTY_RESOLVE_OPTIONS = {};
85344
85345const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/;
85346
85347const loaderToIdent = data => {
85348 if (!data.options) {
85349 return data.loader;
85350 }
85351 if (typeof data.options === "string") {
85352 return data.loader + "?" + data.options;
85353 }
85354 if (typeof data.options !== "object") {
85355 throw new Error("loader options must be string or object");
85356 }
85357 if (data.ident) {
85358 return data.loader + "??" + data.ident;
85359 }
85360 return data.loader + "?" + JSON.stringify(data.options);
85361};
85362
85363const identToLoaderRequest = resultString => {
85364 const idx = resultString.indexOf("?");
85365 if (idx >= 0) {
85366 const loader = resultString.substr(0, idx);
85367 const options = resultString.substr(idx + 1);
85368 return {
85369 loader,
85370 options
85371 };
85372 } else {
85373 return {
85374 loader: resultString,
85375 options: undefined
85376 };
85377 }
85378};
85379
85380const dependencyCache = new WeakMap();
85381
85382class NormalModuleFactory extends Tapable {
85383 constructor(context, resolverFactory, options) {
85384 super();
85385 this.hooks = {
85386 resolver: new SyncWaterfallHook(["resolver"]),
85387 factory: new SyncWaterfallHook(["factory"]),
85388 beforeResolve: new AsyncSeriesWaterfallHook(["data"]),
85389 afterResolve: new AsyncSeriesWaterfallHook(["data"]),
85390 createModule: new SyncBailHook(["data"]),
85391 module: new SyncWaterfallHook(["module", "data"]),
85392 createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
85393 parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
85394 createGenerator: new HookMap(
85395 () => new SyncBailHook(["generatorOptions"])
85396 ),
85397 generator: new HookMap(
85398 () => new SyncHook(["generator", "generatorOptions"])
85399 )
85400 };
85401 this._pluginCompat.tap("NormalModuleFactory", options => {
85402 switch (options.name) {
85403 case "before-resolve":
85404 case "after-resolve":
85405 options.async = true;
85406 break;
85407 case "parser":
85408 this.hooks.parser
85409 .for("javascript/auto")
85410 .tap(options.fn.name || "unnamed compat plugin", options.fn);
85411 return true;
85412 }
85413 let match;
85414 match = /^parser (.+)$/.exec(options.name);
85415 if (match) {
85416 this.hooks.parser
85417 .for(match[1])
85418 .tap(
85419 options.fn.name || "unnamed compat plugin",
85420 options.fn.bind(this)
85421 );
85422 return true;
85423 }
85424 match = /^create-parser (.+)$/.exec(options.name);
85425 if (match) {
85426 this.hooks.createParser
85427 .for(match[1])
85428 .tap(
85429 options.fn.name || "unnamed compat plugin",
85430 options.fn.bind(this)
85431 );
85432 return true;
85433 }
85434 });
85435 this.resolverFactory = resolverFactory;
85436 this.ruleSet = new RuleSet(options.defaultRules.concat(options.rules));
85437 this.cachePredicate =
85438 typeof options.unsafeCache === "function"
85439 ? options.unsafeCache
85440 : Boolean.bind(null, options.unsafeCache);
85441 this.context = context || "";
85442 this.parserCache = Object.create(null);
85443 this.generatorCache = Object.create(null);
85444 this.hooks.factory.tap("NormalModuleFactory", () => (result, callback) => {
85445 let resolver = this.hooks.resolver.call(null);
85446
85447 // Ignored
85448 if (!resolver) return callback();
85449
85450 resolver(result, (err, data) => {
85451 if (err) return callback(err);
85452
85453 // Ignored
85454 if (!data) return callback();
85455
85456 // direct module
85457 if (typeof data.source === "function") return callback(null, data);
85458
85459 this.hooks.afterResolve.callAsync(data, (err, result) => {
85460 if (err) return callback(err);
85461
85462 // Ignored
85463 if (!result) return callback();
85464
85465 let createdModule = this.hooks.createModule.call(result);
85466 if (!createdModule) {
85467 if (!result.request) {
85468 return callback(new Error("Empty dependency (no request)"));
85469 }
85470
85471 createdModule = new NormalModule(result);
85472 }
85473
85474 createdModule = this.hooks.module.call(createdModule, result);
85475
85476 return callback(null, createdModule);
85477 });
85478 });
85479 });
85480 this.hooks.resolver.tap("NormalModuleFactory", () => (data, callback) => {
85481 const contextInfo = data.contextInfo;
85482 const context = data.context;
85483 const request = data.request;
85484
85485 const loaderResolver = this.getResolver("loader");
85486 const normalResolver = this.getResolver("normal", data.resolveOptions);
85487
85488 let matchResource = undefined;
85489 let requestWithoutMatchResource = request;
85490 const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request);
85491 if (matchResourceMatch) {
85492 matchResource = matchResourceMatch[1];
85493 if (/^\.\.?\//.test(matchResource)) {
85494 matchResource = path.join(context, matchResource);
85495 }
85496 requestWithoutMatchResource = request.substr(
85497 matchResourceMatch[0].length
85498 );
85499 }
85500
85501 const noPreAutoLoaders = requestWithoutMatchResource.startsWith("-!");
85502 const noAutoLoaders =
85503 noPreAutoLoaders || requestWithoutMatchResource.startsWith("!");
85504 const noPrePostAutoLoaders = requestWithoutMatchResource.startsWith("!!");
85505 let elements = requestWithoutMatchResource
85506 .replace(/^-?!+/, "")
85507 .replace(/!!+/g, "!")
85508 .split("!");
85509 let resource = elements.pop();
85510 elements = elements.map(identToLoaderRequest);
85511
85512 asyncLib.parallel(
85513 [
85514 callback =>
85515 this.resolveRequestArray(
85516 contextInfo,
85517 context,
85518 elements,
85519 loaderResolver,
85520 callback
85521 ),
85522 callback => {
85523 if (resource === "" || resource[0] === "?") {
85524 return callback(null, {
85525 resource
85526 });
85527 }
85528
85529 normalResolver.resolve(
85530 contextInfo,
85531 context,
85532 resource,
85533 {},
85534 (err, resource, resourceResolveData) => {
85535 if (err) return callback(err);
85536 callback(null, {
85537 resourceResolveData,
85538 resource
85539 });
85540 }
85541 );
85542 }
85543 ],
85544 (err, results) => {
85545 if (err) return callback(err);
85546 let loaders = results[0];
85547 const resourceResolveData = results[1].resourceResolveData;
85548 resource = results[1].resource;
85549
85550 // translate option idents
85551 try {
85552 for (const item of loaders) {
85553 if (typeof item.options === "string" && item.options[0] === "?") {
85554 const ident = item.options.substr(1);
85555 item.options = this.ruleSet.findOptionsByIdent(ident);
85556 item.ident = ident;
85557 }
85558 }
85559 } catch (e) {
85560 return callback(e);
85561 }
85562
85563 if (resource === false) {
85564 // ignored
85565 return callback(
85566 null,
85567 new RawModule(
85568 "/* (ignored) */",
85569 `ignored ${context} ${request}`,
85570 `${request} (ignored)`
85571 )
85572 );
85573 }
85574
85575 const userRequest =
85576 (matchResource !== undefined ? `${matchResource}!=!` : "") +
85577 loaders
85578 .map(loaderToIdent)
85579 .concat([resource])
85580 .join("!");
85581
85582 let resourcePath =
85583 matchResource !== undefined ? matchResource : resource;
85584 let resourceQuery = "";
85585 const queryIndex = resourcePath.indexOf("?");
85586 if (queryIndex >= 0) {
85587 resourceQuery = resourcePath.substr(queryIndex);
85588 resourcePath = resourcePath.substr(0, queryIndex);
85589 }
85590
85591 const result = this.ruleSet.exec({
85592 resource: resourcePath,
85593 realResource:
85594 matchResource !== undefined
85595 ? resource.replace(/\?.*/, "")
85596 : resourcePath,
85597 resourceQuery,
85598 issuer: contextInfo.issuer,
85599 compiler: contextInfo.compiler
85600 });
85601 const settings = {};
85602 const useLoadersPost = [];
85603 const useLoaders = [];
85604 const useLoadersPre = [];
85605 for (const r of result) {
85606 if (r.type === "use") {
85607 if (r.enforce === "post" && !noPrePostAutoLoaders) {
85608 useLoadersPost.push(r.value);
85609 } else if (
85610 r.enforce === "pre" &&
85611 !noPreAutoLoaders &&
85612 !noPrePostAutoLoaders
85613 ) {
85614 useLoadersPre.push(r.value);
85615 } else if (
85616 !r.enforce &&
85617 !noAutoLoaders &&
85618 !noPrePostAutoLoaders
85619 ) {
85620 useLoaders.push(r.value);
85621 }
85622 } else if (
85623 typeof r.value === "object" &&
85624 r.value !== null &&
85625 typeof settings[r.type] === "object" &&
85626 settings[r.type] !== null
85627 ) {
85628 settings[r.type] = cachedCleverMerge(settings[r.type], r.value);
85629 } else {
85630 settings[r.type] = r.value;
85631 }
85632 }
85633 asyncLib.parallel(
85634 [
85635 this.resolveRequestArray.bind(
85636 this,
85637 contextInfo,
85638 this.context,
85639 useLoadersPost,
85640 loaderResolver
85641 ),
85642 this.resolveRequestArray.bind(
85643 this,
85644 contextInfo,
85645 this.context,
85646 useLoaders,
85647 loaderResolver
85648 ),
85649 this.resolveRequestArray.bind(
85650 this,
85651 contextInfo,
85652 this.context,
85653 useLoadersPre,
85654 loaderResolver
85655 )
85656 ],
85657 (err, results) => {
85658 if (err) return callback(err);
85659 if (matchResource === undefined) {
85660 loaders = results[0].concat(loaders, results[1], results[2]);
85661 } else {
85662 loaders = results[0].concat(results[1], loaders, results[2]);
85663 }
85664 process.nextTick(() => {
85665 const type = settings.type;
85666 const resolveOptions = settings.resolve;
85667 callback(null, {
85668 context: context,
85669 request: loaders
85670 .map(loaderToIdent)
85671 .concat([resource])
85672 .join("!"),
85673 dependencies: data.dependencies,
85674 userRequest,
85675 rawRequest: request,
85676 loaders,
85677 resource,
85678 matchResource,
85679 resourceResolveData,
85680 settings,
85681 type,
85682 parser: this.getParser(type, settings.parser),
85683 generator: this.getGenerator(type, settings.generator),
85684 resolveOptions
85685 });
85686 });
85687 }
85688 );
85689 }
85690 );
85691 });
85692 }
85693
85694 create(data, callback) {
85695 const dependencies = data.dependencies;
85696 const cacheEntry = dependencyCache.get(dependencies[0]);
85697 if (cacheEntry) return callback(null, cacheEntry);
85698 const context = data.context || this.context;
85699 const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS;
85700 const request = dependencies[0].request;
85701 const contextInfo = data.contextInfo || {};
85702 this.hooks.beforeResolve.callAsync(
85703 {
85704 contextInfo,
85705 resolveOptions,
85706 context,
85707 request,
85708 dependencies
85709 },
85710 (err, result) => {
85711 if (err) return callback(err);
85712
85713 // Ignored
85714 if (!result) return callback();
85715
85716 const factory = this.hooks.factory.call(null);
85717
85718 // Ignored
85719 if (!factory) return callback();
85720
85721 factory(result, (err, module) => {
85722 if (err) return callback(err);
85723
85724 if (module && this.cachePredicate(module)) {
85725 for (const d of dependencies) {
85726 dependencyCache.set(d, module);
85727 }
85728 }
85729
85730 callback(null, module);
85731 });
85732 }
85733 );
85734 }
85735
85736 resolveRequestArray(contextInfo, context, array, resolver, callback) {
85737 if (array.length === 0) return callback(null, []);
85738 asyncLib.map(
85739 array,
85740 (item, callback) => {
85741 resolver.resolve(
85742 contextInfo,
85743 context,
85744 item.loader,
85745 {},
85746 (err, result) => {
85747 if (
85748 err &&
85749 /^[^/]*$/.test(item.loader) &&
85750 !/-loader$/.test(item.loader)
85751 ) {
85752 return resolver.resolve(
85753 contextInfo,
85754 context,
85755 item.loader + "-loader",
85756 {},
85757 err2 => {
85758 if (!err2) {
85759 err.message =
85760 err.message +
85761 "\n" +
85762 "BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.\n" +
85763 ` You need to specify '${item.loader}-loader' instead of '${item.loader}',\n` +
85764 " see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed";
85765 }
85766 callback(err);
85767 }
85768 );
85769 }
85770 if (err) return callback(err);
85771
85772 const optionsOnly = item.options
85773 ? {
85774 options: item.options
85775 }
85776 : undefined;
85777 return callback(
85778 null,
85779 Object.assign({}, item, identToLoaderRequest(result), optionsOnly)
85780 );
85781 }
85782 );
85783 },
85784 callback
85785 );
85786 }
85787
85788 getParser(type, parserOptions) {
85789 let ident = type;
85790 if (parserOptions) {
85791 if (parserOptions.ident) {
85792 ident = `${type}|${parserOptions.ident}`;
85793 } else {
85794 ident = JSON.stringify([type, parserOptions]);
85795 }
85796 }
85797 if (ident in this.parserCache) {
85798 return this.parserCache[ident];
85799 }
85800 return (this.parserCache[ident] = this.createParser(type, parserOptions));
85801 }
85802
85803 createParser(type, parserOptions = {}) {
85804 const parser = this.hooks.createParser.for(type).call(parserOptions);
85805 if (!parser) {
85806 throw new Error(`No parser registered for ${type}`);
85807 }
85808 this.hooks.parser.for(type).call(parser, parserOptions);
85809 return parser;
85810 }
85811
85812 getGenerator(type, generatorOptions) {
85813 let ident = type;
85814 if (generatorOptions) {
85815 if (generatorOptions.ident) {
85816 ident = `${type}|${generatorOptions.ident}`;
85817 } else {
85818 ident = JSON.stringify([type, generatorOptions]);
85819 }
85820 }
85821 if (ident in this.generatorCache) {
85822 return this.generatorCache[ident];
85823 }
85824 return (this.generatorCache[ident] = this.createGenerator(
85825 type,
85826 generatorOptions
85827 ));
85828 }
85829
85830 createGenerator(type, generatorOptions = {}) {
85831 const generator = this.hooks.createGenerator
85832 .for(type)
85833 .call(generatorOptions);
85834 if (!generator) {
85835 throw new Error(`No generator registered for ${type}`);
85836 }
85837 this.hooks.generator.for(type).call(generator, generatorOptions);
85838 return generator;
85839 }
85840
85841 getResolver(type, resolveOptions) {
85842 return this.resolverFactory.get(
85843 type,
85844 resolveOptions || EMPTY_RESOLVE_OPTIONS
85845 );
85846 }
85847}
85848
85849module.exports = NormalModuleFactory;
85850
85851
85852/***/ }),
85853
85854/***/ 73253:
85855/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
85856
85857"use strict";
85858/*
85859 MIT License http://www.opensource.org/licenses/mit-license.php
85860 Author Tobias Koppers @sokra
85861*/
85862
85863
85864const path = __webpack_require__(85622);
85865
85866class NormalModuleReplacementPlugin {
85867 constructor(resourceRegExp, newResource) {
85868 this.resourceRegExp = resourceRegExp;
85869 this.newResource = newResource;
85870 }
85871
85872 apply(compiler) {
85873 const resourceRegExp = this.resourceRegExp;
85874 const newResource = this.newResource;
85875 compiler.hooks.normalModuleFactory.tap(
85876 "NormalModuleReplacementPlugin",
85877 nmf => {
85878 nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => {
85879 if (!result) return;
85880 if (resourceRegExp.test(result.request)) {
85881 if (typeof newResource === "function") {
85882 newResource(result);
85883 } else {
85884 result.request = newResource;
85885 }
85886 }
85887 return result;
85888 });
85889 nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => {
85890 if (!result) return;
85891 if (resourceRegExp.test(result.resource)) {
85892 if (typeof newResource === "function") {
85893 newResource(result);
85894 } else {
85895 result.resource = path.resolve(
85896 path.dirname(result.resource),
85897 newResource
85898 );
85899 }
85900 }
85901 return result;
85902 });
85903 }
85904 );
85905 }
85906}
85907
85908module.exports = NormalModuleReplacementPlugin;
85909
85910
85911/***/ }),
85912
85913/***/ 40438:
85914/***/ (function(module) {
85915
85916"use strict";
85917/*
85918 MIT License http://www.opensource.org/licenses/mit-license.php
85919 Author Tobias Koppers @sokra
85920*/
85921
85922
85923class NullFactory {
85924 create(data, callback) {
85925 return callback();
85926 }
85927}
85928module.exports = NullFactory;
85929
85930
85931/***/ }),
85932
85933/***/ 4428:
85934/***/ (function(module) {
85935
85936"use strict";
85937/*
85938 MIT License http://www.opensource.org/licenses/mit-license.php
85939 Author Tobias Koppers @sokra
85940*/
85941
85942
85943class OptionsApply {
85944 process(options, compiler) {}
85945}
85946module.exports = OptionsApply;
85947
85948
85949/***/ }),
85950
85951/***/ 3414:
85952/***/ (function(module) {
85953
85954"use strict";
85955/*
85956 MIT License http://www.opensource.org/licenses/mit-license.php
85957 Author Tobias Koppers @sokra
85958*/
85959
85960
85961/**
85962 * Gets the value at path of object
85963 * @param {object} obj object to query
85964 * @param {string} path query path
85965 * @returns {any} - if {@param path} requests element from array, then `undefined` will be returned
85966 */
85967const getProperty = (obj, path) => {
85968 let name = path.split(".");
85969 for (let i = 0; i < name.length - 1; i++) {
85970 obj = obj[name[i]];
85971 if (typeof obj !== "object" || !obj || Array.isArray(obj)) return;
85972 }
85973 return obj[name.pop()];
85974};
85975
85976/**
85977 * Sets the value at path of object. Stops execution, if {@param path} requests element from array to be set
85978 * @param {object} obj object to query
85979 * @param {string} path query path
85980 * @param {any} value value to be set
85981 * @returns {void}
85982 */
85983const setProperty = (obj, path, value) => {
85984 let name = path.split(".");
85985 for (let i = 0; i < name.length - 1; i++) {
85986 if (typeof obj[name[i]] !== "object" && obj[name[i]] !== undefined) return;
85987 if (Array.isArray(obj[name[i]])) return;
85988 if (!obj[name[i]]) obj[name[i]] = {};
85989 obj = obj[name[i]];
85990 }
85991 obj[name.pop()] = value;
85992};
85993
85994/**
85995 * @typedef {'call' | 'make' | 'append'} ConfigType
85996 */
85997/**
85998 * @typedef {(options: object) => any} MakeConfigHandler
85999 */
86000/**
86001 * @typedef {(value: any, options: object) => any} CallConfigHandler
86002 */
86003/**
86004 * @typedef {any[]} AppendConfigValues
86005 */
86006
86007class OptionsDefaulter {
86008 constructor() {
86009 /**
86010 * Stores default options settings or functions for computing them
86011 */
86012 this.defaults = {};
86013 /**
86014 * Stores configuration for options
86015 * @type {{[key: string]: ConfigType}}
86016 */
86017 this.config = {};
86018 }
86019
86020 /**
86021 * Enhancing {@param options} with default values
86022 * @param {object} options provided options
86023 * @returns {object} - enhanced options
86024 * @throws {Error} - will throw error, if configuration value is other then `undefined` or {@link ConfigType}
86025 */
86026 process(options) {
86027 options = Object.assign({}, options);
86028 for (let name in this.defaults) {
86029 switch (this.config[name]) {
86030 /**
86031 * If {@link ConfigType} doesn't specified and current value is `undefined`, then default value will be assigned
86032 */
86033 case undefined:
86034 if (getProperty(options, name) === undefined) {
86035 setProperty(options, name, this.defaults[name]);
86036 }
86037 break;
86038 /**
86039 * Assign result of {@link CallConfigHandler}
86040 */
86041 case "call":
86042 setProperty(
86043 options,
86044 name,
86045 this.defaults[name].call(this, getProperty(options, name), options)
86046 );
86047 break;
86048 /**
86049 * Assign result of {@link MakeConfigHandler}, if current value is `undefined`
86050 */
86051 case "make":
86052 if (getProperty(options, name) === undefined) {
86053 setProperty(options, name, this.defaults[name].call(this, options));
86054 }
86055 break;
86056 /**
86057 * Adding {@link AppendConfigValues} at the end of the current array
86058 */
86059 case "append": {
86060 let oldValue = getProperty(options, name);
86061 if (!Array.isArray(oldValue)) {
86062 oldValue = [];
86063 }
86064 oldValue.push(...this.defaults[name]);
86065 setProperty(options, name, oldValue);
86066 break;
86067 }
86068 default:
86069 throw new Error(
86070 "OptionsDefaulter cannot process " + this.config[name]
86071 );
86072 }
86073 }
86074 return options;
86075 }
86076
86077 /**
86078 * Builds up default values
86079 * @param {string} name option path
86080 * @param {ConfigType | any} config if {@param def} is provided, then only {@link ConfigType} is allowed
86081 * @param {MakeConfigHandler | CallConfigHandler | AppendConfigValues} [def] defaults
86082 * @returns {void}
86083 */
86084 set(name, config, def) {
86085 if (def !== undefined) {
86086 this.defaults[name] = def;
86087 this.config[name] = config;
86088 } else {
86089 this.defaults[name] = config;
86090 delete this.config[name];
86091 }
86092 }
86093}
86094
86095module.exports = OptionsDefaulter;
86096
86097
86098/***/ }),
86099
86100/***/ 70558:
86101/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
86102
86103"use strict";
86104/*
86105 MIT License http://www.opensource.org/licenses/mit-license.php
86106 Author Tobias Koppers @sokra
86107*/
86108
86109
86110// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
86111
86112const acorn = __webpack_require__(77087);
86113const { Tapable, SyncBailHook, HookMap } = __webpack_require__(56758);
86114const util = __webpack_require__(31669);
86115const vm = __webpack_require__(92184);
86116const BasicEvaluatedExpression = __webpack_require__(96770);
86117const StackedSetMap = __webpack_require__(92251);
86118
86119const acornParser = acorn.Parser;
86120
86121const joinRanges = (startRange, endRange) => {
86122 if (!endRange) return startRange;
86123 if (!startRange) return endRange;
86124 return [startRange[0], endRange[1]];
86125};
86126
86127const defaultParserOptions = {
86128 ranges: true,
86129 locations: true,
86130 ecmaVersion: 11,
86131 sourceType: "module",
86132 onComment: null
86133};
86134
86135// regexp to match at least one "magic comment"
86136const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/);
86137
86138const EMPTY_COMMENT_OPTIONS = {
86139 options: null,
86140 errors: null
86141};
86142
86143class Parser extends Tapable {
86144 constructor(options, sourceType = "auto") {
86145 super();
86146 this.hooks = {
86147 evaluateTypeof: new HookMap(() => new SyncBailHook(["expression"])),
86148 evaluate: new HookMap(() => new SyncBailHook(["expression"])),
86149 evaluateIdentifier: new HookMap(() => new SyncBailHook(["expression"])),
86150 evaluateDefinedIdentifier: new HookMap(
86151 () => new SyncBailHook(["expression"])
86152 ),
86153 evaluateCallExpressionMember: new HookMap(
86154 () => new SyncBailHook(["expression", "param"])
86155 ),
86156 statement: new SyncBailHook(["statement"]),
86157 statementIf: new SyncBailHook(["statement"]),
86158 label: new HookMap(() => new SyncBailHook(["statement"])),
86159 import: new SyncBailHook(["statement", "source"]),
86160 importSpecifier: new SyncBailHook([
86161 "statement",
86162 "source",
86163 "exportName",
86164 "identifierName"
86165 ]),
86166 export: new SyncBailHook(["statement"]),
86167 exportImport: new SyncBailHook(["statement", "source"]),
86168 exportDeclaration: new SyncBailHook(["statement", "declaration"]),
86169 exportExpression: new SyncBailHook(["statement", "declaration"]),
86170 exportSpecifier: new SyncBailHook([
86171 "statement",
86172 "identifierName",
86173 "exportName",
86174 "index"
86175 ]),
86176 exportImportSpecifier: new SyncBailHook([
86177 "statement",
86178 "source",
86179 "identifierName",
86180 "exportName",
86181 "index"
86182 ]),
86183 varDeclaration: new HookMap(() => new SyncBailHook(["declaration"])),
86184 varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])),
86185 varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])),
86186 varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])),
86187 canRename: new HookMap(() => new SyncBailHook(["initExpression"])),
86188 rename: new HookMap(() => new SyncBailHook(["initExpression"])),
86189 assigned: new HookMap(() => new SyncBailHook(["expression"])),
86190 assign: new HookMap(() => new SyncBailHook(["expression"])),
86191 typeof: new HookMap(() => new SyncBailHook(["expression"])),
86192 importCall: new SyncBailHook(["expression"]),
86193 call: new HookMap(() => new SyncBailHook(["expression"])),
86194 callAnyMember: new HookMap(() => new SyncBailHook(["expression"])),
86195 new: new HookMap(() => new SyncBailHook(["expression"])),
86196 expression: new HookMap(() => new SyncBailHook(["expression"])),
86197 expressionAnyMember: new HookMap(() => new SyncBailHook(["expression"])),
86198 expressionConditionalOperator: new SyncBailHook(["expression"]),
86199 expressionLogicalOperator: new SyncBailHook(["expression"]),
86200 program: new SyncBailHook(["ast", "comments"])
86201 };
86202 const HOOK_MAP_COMPAT_CONFIG = {
86203 evaluateTypeof: /^evaluate typeof (.+)$/,
86204 evaluateIdentifier: /^evaluate Identifier (.+)$/,
86205 evaluateDefinedIdentifier: /^evaluate defined Identifier (.+)$/,
86206 evaluateCallExpressionMember: /^evaluate CallExpression .(.+)$/,
86207 evaluate: /^evaluate (.+)$/,
86208 label: /^label (.+)$/,
86209 varDeclarationLet: /^var-let (.+)$/,
86210 varDeclarationConst: /^var-const (.+)$/,
86211 varDeclarationVar: /^var-var (.+)$/,
86212 varDeclaration: /^var (.+)$/,
86213 canRename: /^can-rename (.+)$/,
86214 rename: /^rename (.+)$/,
86215 typeof: /^typeof (.+)$/,
86216 assigned: /^assigned (.+)$/,
86217 assign: /^assign (.+)$/,
86218 callAnyMember: /^call (.+)\.\*$/,
86219 call: /^call (.+)$/,
86220 new: /^new (.+)$/,
86221 expressionConditionalOperator: /^expression \?:$/,
86222 expressionAnyMember: /^expression (.+)\.\*$/,
86223 expression: /^expression (.+)$/
86224 };
86225 this._pluginCompat.tap("Parser", options => {
86226 for (const name of Object.keys(HOOK_MAP_COMPAT_CONFIG)) {
86227 const regexp = HOOK_MAP_COMPAT_CONFIG[name];
86228 const match = regexp.exec(options.name);
86229 if (match) {
86230 if (match[1]) {
86231 this.hooks[name].tap(
86232 match[1],
86233 options.fn.name || "unnamed compat plugin",
86234 options.fn.bind(this)
86235 );
86236 } else {
86237 this.hooks[name].tap(
86238 options.fn.name || "unnamed compat plugin",
86239 options.fn.bind(this)
86240 );
86241 }
86242 return true;
86243 }
86244 }
86245 });
86246 this.options = options;
86247 this.sourceType = sourceType;
86248 this.scope = undefined;
86249 this.state = undefined;
86250 this.comments = undefined;
86251 this.initializeEvaluating();
86252 }
86253
86254 initializeEvaluating() {
86255 this.hooks.evaluate.for("Literal").tap("Parser", expr => {
86256 switch (typeof expr.value) {
86257 case "number":
86258 return new BasicEvaluatedExpression()
86259 .setNumber(expr.value)
86260 .setRange(expr.range);
86261 case "string":
86262 return new BasicEvaluatedExpression()
86263 .setString(expr.value)
86264 .setRange(expr.range);
86265 case "boolean":
86266 return new BasicEvaluatedExpression()
86267 .setBoolean(expr.value)
86268 .setRange(expr.range);
86269 }
86270 if (expr.value === null) {
86271 return new BasicEvaluatedExpression().setNull().setRange(expr.range);
86272 }
86273 if (expr.value instanceof RegExp) {
86274 return new BasicEvaluatedExpression()
86275 .setRegExp(expr.value)
86276 .setRange(expr.range);
86277 }
86278 });
86279 this.hooks.evaluate.for("LogicalExpression").tap("Parser", expr => {
86280 let left;
86281 let leftAsBool;
86282 let right;
86283 if (expr.operator === "&&") {
86284 left = this.evaluateExpression(expr.left);
86285 leftAsBool = left && left.asBool();
86286 if (leftAsBool === false) return left.setRange(expr.range);
86287 if (leftAsBool !== true) return;
86288 right = this.evaluateExpression(expr.right);
86289 return right.setRange(expr.range);
86290 } else if (expr.operator === "||") {
86291 left = this.evaluateExpression(expr.left);
86292 leftAsBool = left && left.asBool();
86293 if (leftAsBool === true) return left.setRange(expr.range);
86294 if (leftAsBool !== false) return;
86295 right = this.evaluateExpression(expr.right);
86296 return right.setRange(expr.range);
86297 }
86298 });
86299 this.hooks.evaluate.for("BinaryExpression").tap("Parser", expr => {
86300 let left;
86301 let right;
86302 let res;
86303 if (expr.operator === "+") {
86304 left = this.evaluateExpression(expr.left);
86305 right = this.evaluateExpression(expr.right);
86306 if (!left || !right) return;
86307 res = new BasicEvaluatedExpression();
86308 if (left.isString()) {
86309 if (right.isString()) {
86310 res.setString(left.string + right.string);
86311 } else if (right.isNumber()) {
86312 res.setString(left.string + right.number);
86313 } else if (
86314 right.isWrapped() &&
86315 right.prefix &&
86316 right.prefix.isString()
86317 ) {
86318 // "left" + ("prefix" + inner + "postfix")
86319 // => ("leftprefix" + inner + "postfix")
86320 res.setWrapped(
86321 new BasicEvaluatedExpression()
86322 .setString(left.string + right.prefix.string)
86323 .setRange(joinRanges(left.range, right.prefix.range)),
86324 right.postfix,
86325 right.wrappedInnerExpressions
86326 );
86327 } else if (right.isWrapped()) {
86328 // "left" + ([null] + inner + "postfix")
86329 // => ("left" + inner + "postfix")
86330 res.setWrapped(left, right.postfix, right.wrappedInnerExpressions);
86331 } else {
86332 // "left" + expr
86333 // => ("left" + expr + "")
86334 res.setWrapped(left, null, [right]);
86335 }
86336 } else if (left.isNumber()) {
86337 if (right.isString()) {
86338 res.setString(left.number + right.string);
86339 } else if (right.isNumber()) {
86340 res.setNumber(left.number + right.number);
86341 } else {
86342 return;
86343 }
86344 } else if (left.isWrapped()) {
86345 if (left.postfix && left.postfix.isString() && right.isString()) {
86346 // ("prefix" + inner + "postfix") + "right"
86347 // => ("prefix" + inner + "postfixright")
86348 res.setWrapped(
86349 left.prefix,
86350 new BasicEvaluatedExpression()
86351 .setString(left.postfix.string + right.string)
86352 .setRange(joinRanges(left.postfix.range, right.range)),
86353 left.wrappedInnerExpressions
86354 );
86355 } else if (
86356 left.postfix &&
86357 left.postfix.isString() &&
86358 right.isNumber()
86359 ) {
86360 // ("prefix" + inner + "postfix") + 123
86361 // => ("prefix" + inner + "postfix123")
86362 res.setWrapped(
86363 left.prefix,
86364 new BasicEvaluatedExpression()
86365 .setString(left.postfix.string + right.number)
86366 .setRange(joinRanges(left.postfix.range, right.range)),
86367 left.wrappedInnerExpressions
86368 );
86369 } else if (right.isString()) {
86370 // ("prefix" + inner + [null]) + "right"
86371 // => ("prefix" + inner + "right")
86372 res.setWrapped(left.prefix, right, left.wrappedInnerExpressions);
86373 } else if (right.isNumber()) {
86374 // ("prefix" + inner + [null]) + 123
86375 // => ("prefix" + inner + "123")
86376 res.setWrapped(
86377 left.prefix,
86378 new BasicEvaluatedExpression()
86379 .setString(right.number + "")
86380 .setRange(right.range),
86381 left.wrappedInnerExpressions
86382 );
86383 } else if (right.isWrapped()) {
86384 // ("prefix1" + inner1 + "postfix1") + ("prefix2" + inner2 + "postfix2")
86385 // ("prefix1" + inner1 + "postfix1" + "prefix2" + inner2 + "postfix2")
86386 res.setWrapped(
86387 left.prefix,
86388 right.postfix,
86389 left.wrappedInnerExpressions &&
86390 right.wrappedInnerExpressions &&
86391 left.wrappedInnerExpressions
86392 .concat(left.postfix ? [left.postfix] : [])
86393 .concat(right.prefix ? [right.prefix] : [])
86394 .concat(right.wrappedInnerExpressions)
86395 );
86396 } else {
86397 // ("prefix" + inner + postfix) + expr
86398 // => ("prefix" + inner + postfix + expr + [null])
86399 res.setWrapped(
86400 left.prefix,
86401 null,
86402 left.wrappedInnerExpressions &&
86403 left.wrappedInnerExpressions.concat(
86404 left.postfix ? [left.postfix, right] : [right]
86405 )
86406 );
86407 }
86408 } else {
86409 if (right.isString()) {
86410 // left + "right"
86411 // => ([null] + left + "right")
86412 res.setWrapped(null, right, [left]);
86413 } else if (right.isWrapped()) {
86414 // left + (prefix + inner + "postfix")
86415 // => ([null] + left + prefix + inner + "postfix")
86416 res.setWrapped(
86417 null,
86418 right.postfix,
86419 right.wrappedInnerExpressions &&
86420 (right.prefix ? [left, right.prefix] : [left]).concat(
86421 right.wrappedInnerExpressions
86422 )
86423 );
86424 } else {
86425 return;
86426 }
86427 }
86428 res.setRange(expr.range);
86429 return res;
86430 } else if (expr.operator === "-") {
86431 left = this.evaluateExpression(expr.left);
86432 right = this.evaluateExpression(expr.right);
86433 if (!left || !right) return;
86434 if (!left.isNumber() || !right.isNumber()) return;
86435 res = new BasicEvaluatedExpression();
86436 res.setNumber(left.number - right.number);
86437 res.setRange(expr.range);
86438 return res;
86439 } else if (expr.operator === "*") {
86440 left = this.evaluateExpression(expr.left);
86441 right = this.evaluateExpression(expr.right);
86442 if (!left || !right) return;
86443 if (!left.isNumber() || !right.isNumber()) return;
86444 res = new BasicEvaluatedExpression();
86445 res.setNumber(left.number * right.number);
86446 res.setRange(expr.range);
86447 return res;
86448 } else if (expr.operator === "/") {
86449 left = this.evaluateExpression(expr.left);
86450 right = this.evaluateExpression(expr.right);
86451 if (!left || !right) return;
86452 if (!left.isNumber() || !right.isNumber()) return;
86453 res = new BasicEvaluatedExpression();
86454 res.setNumber(left.number / right.number);
86455 res.setRange(expr.range);
86456 return res;
86457 } else if (expr.operator === "**") {
86458 left = this.evaluateExpression(expr.left);
86459 right = this.evaluateExpression(expr.right);
86460 if (!left || !right) return;
86461 if (!left.isNumber() || !right.isNumber()) return;
86462 res = new BasicEvaluatedExpression();
86463 res.setNumber(Math.pow(left.number, right.number));
86464 res.setRange(expr.range);
86465 return res;
86466 } else if (expr.operator === "==" || expr.operator === "===") {
86467 left = this.evaluateExpression(expr.left);
86468 right = this.evaluateExpression(expr.right);
86469 if (!left || !right) return;
86470 res = new BasicEvaluatedExpression();
86471 res.setRange(expr.range);
86472 if (left.isString() && right.isString()) {
86473 return res.setBoolean(left.string === right.string);
86474 } else if (left.isNumber() && right.isNumber()) {
86475 return res.setBoolean(left.number === right.number);
86476 } else if (left.isBoolean() && right.isBoolean()) {
86477 return res.setBoolean(left.bool === right.bool);
86478 }
86479 } else if (expr.operator === "!=" || expr.operator === "!==") {
86480 left = this.evaluateExpression(expr.left);
86481 right = this.evaluateExpression(expr.right);
86482 if (!left || !right) return;
86483 res = new BasicEvaluatedExpression();
86484 res.setRange(expr.range);
86485 if (left.isString() && right.isString()) {
86486 return res.setBoolean(left.string !== right.string);
86487 } else if (left.isNumber() && right.isNumber()) {
86488 return res.setBoolean(left.number !== right.number);
86489 } else if (left.isBoolean() && right.isBoolean()) {
86490 return res.setBoolean(left.bool !== right.bool);
86491 }
86492 } else if (expr.operator === "&") {
86493 left = this.evaluateExpression(expr.left);
86494 right = this.evaluateExpression(expr.right);
86495 if (!left || !right) return;
86496 if (!left.isNumber() || !right.isNumber()) return;
86497 res = new BasicEvaluatedExpression();
86498 res.setNumber(left.number & right.number);
86499 res.setRange(expr.range);
86500 return res;
86501 } else if (expr.operator === "|") {
86502 left = this.evaluateExpression(expr.left);
86503 right = this.evaluateExpression(expr.right);
86504 if (!left || !right) return;
86505 if (!left.isNumber() || !right.isNumber()) return;
86506 res = new BasicEvaluatedExpression();
86507 res.setNumber(left.number | right.number);
86508 res.setRange(expr.range);
86509 return res;
86510 } else if (expr.operator === "^") {
86511 left = this.evaluateExpression(expr.left);
86512 right = this.evaluateExpression(expr.right);
86513 if (!left || !right) return;
86514 if (!left.isNumber() || !right.isNumber()) return;
86515 res = new BasicEvaluatedExpression();
86516 res.setNumber(left.number ^ right.number);
86517 res.setRange(expr.range);
86518 return res;
86519 } else if (expr.operator === ">>>") {
86520 left = this.evaluateExpression(expr.left);
86521 right = this.evaluateExpression(expr.right);
86522 if (!left || !right) return;
86523 if (!left.isNumber() || !right.isNumber()) return;
86524 res = new BasicEvaluatedExpression();
86525 res.setNumber(left.number >>> right.number);
86526 res.setRange(expr.range);
86527 return res;
86528 } else if (expr.operator === ">>") {
86529 left = this.evaluateExpression(expr.left);
86530 right = this.evaluateExpression(expr.right);
86531 if (!left || !right) return;
86532 if (!left.isNumber() || !right.isNumber()) return;
86533 res = new BasicEvaluatedExpression();
86534 res.setNumber(left.number >> right.number);
86535 res.setRange(expr.range);
86536 return res;
86537 } else if (expr.operator === "<<") {
86538 left = this.evaluateExpression(expr.left);
86539 right = this.evaluateExpression(expr.right);
86540 if (!left || !right) return;
86541 if (!left.isNumber() || !right.isNumber()) return;
86542 res = new BasicEvaluatedExpression();
86543 res.setNumber(left.number << right.number);
86544 res.setRange(expr.range);
86545 return res;
86546 }
86547 });
86548 this.hooks.evaluate.for("UnaryExpression").tap("Parser", expr => {
86549 if (expr.operator === "typeof") {
86550 let res;
86551 let name;
86552 if (expr.argument.type === "Identifier") {
86553 name =
86554 this.scope.renames.get(expr.argument.name) || expr.argument.name;
86555 if (!this.scope.definitions.has(name)) {
86556 const hook = this.hooks.evaluateTypeof.get(name);
86557 if (hook !== undefined) {
86558 res = hook.call(expr);
86559 if (res !== undefined) return res;
86560 }
86561 }
86562 }
86563 if (expr.argument.type === "MemberExpression") {
86564 const exprName = this.getNameForExpression(expr.argument);
86565 if (exprName && exprName.free) {
86566 const hook = this.hooks.evaluateTypeof.get(exprName.name);
86567 if (hook !== undefined) {
86568 res = hook.call(expr);
86569 if (res !== undefined) return res;
86570 }
86571 }
86572 }
86573 if (expr.argument.type === "FunctionExpression") {
86574 return new BasicEvaluatedExpression()
86575 .setString("function")
86576 .setRange(expr.range);
86577 }
86578 const arg = this.evaluateExpression(expr.argument);
86579 if (arg.isString() || arg.isWrapped()) {
86580 return new BasicEvaluatedExpression()
86581 .setString("string")
86582 .setRange(expr.range);
86583 }
86584 if (arg.isNumber()) {
86585 return new BasicEvaluatedExpression()
86586 .setString("number")
86587 .setRange(expr.range);
86588 }
86589 if (arg.isBoolean()) {
86590 return new BasicEvaluatedExpression()
86591 .setString("boolean")
86592 .setRange(expr.range);
86593 }
86594 if (arg.isArray() || arg.isConstArray() || arg.isRegExp()) {
86595 return new BasicEvaluatedExpression()
86596 .setString("object")
86597 .setRange(expr.range);
86598 }
86599 } else if (expr.operator === "!") {
86600 const argument = this.evaluateExpression(expr.argument);
86601 if (!argument) return;
86602 if (argument.isBoolean()) {
86603 return new BasicEvaluatedExpression()
86604 .setBoolean(!argument.bool)
86605 .setRange(expr.range);
86606 }
86607 if (argument.isTruthy()) {
86608 return new BasicEvaluatedExpression()
86609 .setBoolean(false)
86610 .setRange(expr.range);
86611 }
86612 if (argument.isFalsy()) {
86613 return new BasicEvaluatedExpression()
86614 .setBoolean(true)
86615 .setRange(expr.range);
86616 }
86617 if (argument.isString()) {
86618 return new BasicEvaluatedExpression()
86619 .setBoolean(!argument.string)
86620 .setRange(expr.range);
86621 }
86622 if (argument.isNumber()) {
86623 return new BasicEvaluatedExpression()
86624 .setBoolean(!argument.number)
86625 .setRange(expr.range);
86626 }
86627 } else if (expr.operator === "~") {
86628 const argument = this.evaluateExpression(expr.argument);
86629 if (!argument) return;
86630 if (!argument.isNumber()) return;
86631 const res = new BasicEvaluatedExpression();
86632 res.setNumber(~argument.number);
86633 res.setRange(expr.range);
86634 return res;
86635 }
86636 });
86637 this.hooks.evaluateTypeof.for("undefined").tap("Parser", expr => {
86638 return new BasicEvaluatedExpression()
86639 .setString("undefined")
86640 .setRange(expr.range);
86641 });
86642 this.hooks.evaluate.for("Identifier").tap("Parser", expr => {
86643 const name = this.scope.renames.get(expr.name) || expr.name;
86644 if (!this.scope.definitions.has(expr.name)) {
86645 const hook = this.hooks.evaluateIdentifier.get(name);
86646 if (hook !== undefined) {
86647 const result = hook.call(expr);
86648 if (result) return result;
86649 }
86650 return new BasicEvaluatedExpression()
86651 .setIdentifier(name)
86652 .setRange(expr.range);
86653 } else {
86654 const hook = this.hooks.evaluateDefinedIdentifier.get(name);
86655 if (hook !== undefined) {
86656 return hook.call(expr);
86657 }
86658 }
86659 });
86660 this.hooks.evaluate.for("ThisExpression").tap("Parser", expr => {
86661 const name = this.scope.renames.get("this");
86662 if (name) {
86663 const hook = this.hooks.evaluateIdentifier.get(name);
86664 if (hook !== undefined) {
86665 const result = hook.call(expr);
86666 if (result) return result;
86667 }
86668 return new BasicEvaluatedExpression()
86669 .setIdentifier(name)
86670 .setRange(expr.range);
86671 }
86672 });
86673 this.hooks.evaluate.for("MemberExpression").tap("Parser", expression => {
86674 let exprName = this.getNameForExpression(expression);
86675 if (exprName) {
86676 if (exprName.free) {
86677 const hook = this.hooks.evaluateIdentifier.get(exprName.name);
86678 if (hook !== undefined) {
86679 const result = hook.call(expression);
86680 if (result) return result;
86681 }
86682 return new BasicEvaluatedExpression()
86683 .setIdentifier(exprName.name)
86684 .setRange(expression.range);
86685 } else {
86686 const hook = this.hooks.evaluateDefinedIdentifier.get(exprName.name);
86687 if (hook !== undefined) {
86688 return hook.call(expression);
86689 }
86690 }
86691 }
86692 });
86693 this.hooks.evaluate.for("CallExpression").tap("Parser", expr => {
86694 if (expr.callee.type !== "MemberExpression") return;
86695 if (
86696 expr.callee.property.type !==
86697 (expr.callee.computed ? "Literal" : "Identifier")
86698 )
86699 return;
86700 const param = this.evaluateExpression(expr.callee.object);
86701 if (!param) return;
86702 const property = expr.callee.property.name || expr.callee.property.value;
86703 const hook = this.hooks.evaluateCallExpressionMember.get(property);
86704 if (hook !== undefined) {
86705 return hook.call(expr, param);
86706 }
86707 });
86708 this.hooks.evaluateCallExpressionMember
86709 .for("replace")
86710 .tap("Parser", (expr, param) => {
86711 if (!param.isString()) return;
86712 if (expr.arguments.length !== 2) return;
86713 let arg1 = this.evaluateExpression(expr.arguments[0]);
86714 let arg2 = this.evaluateExpression(expr.arguments[1]);
86715 if (!arg1.isString() && !arg1.isRegExp()) return;
86716 arg1 = arg1.regExp || arg1.string;
86717 if (!arg2.isString()) return;
86718 arg2 = arg2.string;
86719 return new BasicEvaluatedExpression()
86720 .setString(param.string.replace(arg1, arg2))
86721 .setRange(expr.range);
86722 });
86723 ["substr", "substring"].forEach(fn => {
86724 this.hooks.evaluateCallExpressionMember
86725 .for(fn)
86726 .tap("Parser", (expr, param) => {
86727 if (!param.isString()) return;
86728 let arg1;
86729 let result,
86730 str = param.string;
86731 switch (expr.arguments.length) {
86732 case 1:
86733 arg1 = this.evaluateExpression(expr.arguments[0]);
86734 if (!arg1.isNumber()) return;
86735 result = str[fn](arg1.number);
86736 break;
86737 case 2: {
86738 arg1 = this.evaluateExpression(expr.arguments[0]);
86739 const arg2 = this.evaluateExpression(expr.arguments[1]);
86740 if (!arg1.isNumber()) return;
86741 if (!arg2.isNumber()) return;
86742 result = str[fn](arg1.number, arg2.number);
86743 break;
86744 }
86745 default:
86746 return;
86747 }
86748 return new BasicEvaluatedExpression()
86749 .setString(result)
86750 .setRange(expr.range);
86751 });
86752 });
86753
86754 /**
86755 * @param {string} kind "cooked" | "raw"
86756 * @param {TODO} templateLiteralExpr TemplateLiteral expr
86757 * @returns {{quasis: BasicEvaluatedExpression[], parts: BasicEvaluatedExpression[]}} Simplified template
86758 */
86759 const getSimplifiedTemplateResult = (kind, templateLiteralExpr) => {
86760 const quasis = [];
86761 const parts = [];
86762
86763 for (let i = 0; i < templateLiteralExpr.quasis.length; i++) {
86764 const quasiExpr = templateLiteralExpr.quasis[i];
86765 const quasi = quasiExpr.value[kind];
86766
86767 if (i > 0) {
86768 const prevExpr = parts[parts.length - 1];
86769 const expr = this.evaluateExpression(
86770 templateLiteralExpr.expressions[i - 1]
86771 );
86772 const exprAsString = expr.asString();
86773 if (typeof exprAsString === "string") {
86774 // We can merge quasi + expr + quasi when expr
86775 // is a const string
86776
86777 prevExpr.setString(prevExpr.string + exprAsString + quasi);
86778 prevExpr.setRange([prevExpr.range[0], quasiExpr.range[1]]);
86779 // We unset the expression as it doesn't match to a single expression
86780 prevExpr.setExpression(undefined);
86781 continue;
86782 }
86783 parts.push(expr);
86784 }
86785
86786 const part = new BasicEvaluatedExpression()
86787 .setString(quasi)
86788 .setRange(quasiExpr.range)
86789 .setExpression(quasiExpr);
86790 quasis.push(part);
86791 parts.push(part);
86792 }
86793 return {
86794 quasis,
86795 parts
86796 };
86797 };
86798
86799 this.hooks.evaluate.for("TemplateLiteral").tap("Parser", node => {
86800 const { quasis, parts } = getSimplifiedTemplateResult("cooked", node);
86801 if (parts.length === 1) {
86802 return parts[0].setRange(node.range);
86803 }
86804 return new BasicEvaluatedExpression()
86805 .setTemplateString(quasis, parts, "cooked")
86806 .setRange(node.range);
86807 });
86808 this.hooks.evaluate.for("TaggedTemplateExpression").tap("Parser", node => {
86809 if (this.evaluateExpression(node.tag).identifier !== "String.raw") return;
86810 const { quasis, parts } = getSimplifiedTemplateResult("raw", node.quasi);
86811 if (parts.length === 1) {
86812 return parts[0].setRange(node.range);
86813 }
86814 return new BasicEvaluatedExpression()
86815 .setTemplateString(quasis, parts, "raw")
86816 .setRange(node.range);
86817 });
86818
86819 this.hooks.evaluateCallExpressionMember
86820 .for("concat")
86821 .tap("Parser", (expr, param) => {
86822 if (!param.isString() && !param.isWrapped()) return;
86823
86824 let stringSuffix = null;
86825 let hasUnknownParams = false;
86826 for (let i = expr.arguments.length - 1; i >= 0; i--) {
86827 const argExpr = this.evaluateExpression(expr.arguments[i]);
86828 if (!argExpr.isString() && !argExpr.isNumber()) {
86829 hasUnknownParams = true;
86830 break;
86831 }
86832
86833 const value = argExpr.isString()
86834 ? argExpr.string
86835 : "" + argExpr.number;
86836
86837 const newString = value + (stringSuffix ? stringSuffix.string : "");
86838 const newRange = [
86839 argExpr.range[0],
86840 (stringSuffix || argExpr).range[1]
86841 ];
86842 stringSuffix = new BasicEvaluatedExpression()
86843 .setString(newString)
86844 .setRange(newRange);
86845 }
86846
86847 if (hasUnknownParams) {
86848 const prefix = param.isString() ? param : param.prefix;
86849 return new BasicEvaluatedExpression()
86850 .setWrapped(prefix, stringSuffix)
86851 .setRange(expr.range);
86852 } else if (param.isWrapped()) {
86853 const postfix = stringSuffix || param.postfix;
86854 return new BasicEvaluatedExpression()
86855 .setWrapped(param.prefix, postfix)
86856 .setRange(expr.range);
86857 } else {
86858 const newString =
86859 param.string + (stringSuffix ? stringSuffix.string : "");
86860 return new BasicEvaluatedExpression()
86861 .setString(newString)
86862 .setRange(expr.range);
86863 }
86864 });
86865 this.hooks.evaluateCallExpressionMember
86866 .for("split")
86867 .tap("Parser", (expr, param) => {
86868 if (!param.isString()) return;
86869 if (expr.arguments.length !== 1) return;
86870 let result;
86871 const arg = this.evaluateExpression(expr.arguments[0]);
86872 if (arg.isString()) {
86873 result = param.string.split(arg.string);
86874 } else if (arg.isRegExp()) {
86875 result = param.string.split(arg.regExp);
86876 } else {
86877 return;
86878 }
86879 return new BasicEvaluatedExpression()
86880 .setArray(result)
86881 .setRange(expr.range);
86882 });
86883 this.hooks.evaluate.for("ConditionalExpression").tap("Parser", expr => {
86884 const condition = this.evaluateExpression(expr.test);
86885 const conditionValue = condition.asBool();
86886 let res;
86887 if (conditionValue === undefined) {
86888 const consequent = this.evaluateExpression(expr.consequent);
86889 const alternate = this.evaluateExpression(expr.alternate);
86890 if (!consequent || !alternate) return;
86891 res = new BasicEvaluatedExpression();
86892 if (consequent.isConditional()) {
86893 res.setOptions(consequent.options);
86894 } else {
86895 res.setOptions([consequent]);
86896 }
86897 if (alternate.isConditional()) {
86898 res.addOptions(alternate.options);
86899 } else {
86900 res.addOptions([alternate]);
86901 }
86902 } else {
86903 res = this.evaluateExpression(
86904 conditionValue ? expr.consequent : expr.alternate
86905 );
86906 }
86907 res.setRange(expr.range);
86908 return res;
86909 });
86910 this.hooks.evaluate.for("ArrayExpression").tap("Parser", expr => {
86911 const items = expr.elements.map(element => {
86912 return element !== null && this.evaluateExpression(element);
86913 });
86914 if (!items.every(Boolean)) return;
86915 return new BasicEvaluatedExpression()
86916 .setItems(items)
86917 .setRange(expr.range);
86918 });
86919 }
86920
86921 getRenameIdentifier(expr) {
86922 const result = this.evaluateExpression(expr);
86923 if (result && result.isIdentifier()) {
86924 return result.identifier;
86925 }
86926 }
86927
86928 walkClass(classy) {
86929 if (classy.superClass) this.walkExpression(classy.superClass);
86930 if (classy.body && classy.body.type === "ClassBody") {
86931 const wasTopLevel = this.scope.topLevelScope;
86932 this.scope.topLevelScope = false;
86933 for (const methodDefinition of classy.body.body) {
86934 if (methodDefinition.type === "MethodDefinition") {
86935 this.walkMethodDefinition(methodDefinition);
86936 }
86937 }
86938 this.scope.topLevelScope = wasTopLevel;
86939 }
86940 }
86941
86942 walkMethodDefinition(methodDefinition) {
86943 if (methodDefinition.computed && methodDefinition.key) {
86944 this.walkExpression(methodDefinition.key);
86945 }
86946 if (methodDefinition.value) {
86947 this.walkExpression(methodDefinition.value);
86948 }
86949 }
86950
86951 // Prewalking iterates the scope for variable declarations
86952 prewalkStatements(statements) {
86953 for (let index = 0, len = statements.length; index < len; index++) {
86954 const statement = statements[index];
86955 this.prewalkStatement(statement);
86956 }
86957 }
86958
86959 // Block-Prewalking iterates the scope for block variable declarations
86960 blockPrewalkStatements(statements) {
86961 for (let index = 0, len = statements.length; index < len; index++) {
86962 const statement = statements[index];
86963 this.blockPrewalkStatement(statement);
86964 }
86965 }
86966
86967 // Walking iterates the statements and expressions and processes them
86968 walkStatements(statements) {
86969 for (let index = 0, len = statements.length; index < len; index++) {
86970 const statement = statements[index];
86971 this.walkStatement(statement);
86972 }
86973 }
86974
86975 prewalkStatement(statement) {
86976 switch (statement.type) {
86977 case "BlockStatement":
86978 this.prewalkBlockStatement(statement);
86979 break;
86980 case "DoWhileStatement":
86981 this.prewalkDoWhileStatement(statement);
86982 break;
86983 case "ExportAllDeclaration":
86984 this.prewalkExportAllDeclaration(statement);
86985 break;
86986 case "ExportDefaultDeclaration":
86987 this.prewalkExportDefaultDeclaration(statement);
86988 break;
86989 case "ExportNamedDeclaration":
86990 this.prewalkExportNamedDeclaration(statement);
86991 break;
86992 case "ForInStatement":
86993 this.prewalkForInStatement(statement);
86994 break;
86995 case "ForOfStatement":
86996 this.prewalkForOfStatement(statement);
86997 break;
86998 case "ForStatement":
86999 this.prewalkForStatement(statement);
87000 break;
87001 case "FunctionDeclaration":
87002 this.prewalkFunctionDeclaration(statement);
87003 break;
87004 case "IfStatement":
87005 this.prewalkIfStatement(statement);
87006 break;
87007 case "ImportDeclaration":
87008 this.prewalkImportDeclaration(statement);
87009 break;
87010 case "LabeledStatement":
87011 this.prewalkLabeledStatement(statement);
87012 break;
87013 case "SwitchStatement":
87014 this.prewalkSwitchStatement(statement);
87015 break;
87016 case "TryStatement":
87017 this.prewalkTryStatement(statement);
87018 break;
87019 case "VariableDeclaration":
87020 this.prewalkVariableDeclaration(statement);
87021 break;
87022 case "WhileStatement":
87023 this.prewalkWhileStatement(statement);
87024 break;
87025 case "WithStatement":
87026 this.prewalkWithStatement(statement);
87027 break;
87028 }
87029 }
87030
87031 blockPrewalkStatement(statement) {
87032 switch (statement.type) {
87033 case "VariableDeclaration":
87034 this.blockPrewalkVariableDeclaration(statement);
87035 break;
87036 case "ExportDefaultDeclaration":
87037 this.blockPrewalkExportDefaultDeclaration(statement);
87038 break;
87039 case "ExportNamedDeclaration":
87040 this.blockPrewalkExportNamedDeclaration(statement);
87041 break;
87042 case "ClassDeclaration":
87043 this.blockPrewalkClassDeclaration(statement);
87044 break;
87045 }
87046 }
87047
87048 walkStatement(statement) {
87049 if (this.hooks.statement.call(statement) !== undefined) return;
87050 switch (statement.type) {
87051 case "BlockStatement":
87052 this.walkBlockStatement(statement);
87053 break;
87054 case "ClassDeclaration":
87055 this.walkClassDeclaration(statement);
87056 break;
87057 case "DoWhileStatement":
87058 this.walkDoWhileStatement(statement);
87059 break;
87060 case "ExportDefaultDeclaration":
87061 this.walkExportDefaultDeclaration(statement);
87062 break;
87063 case "ExportNamedDeclaration":
87064 this.walkExportNamedDeclaration(statement);
87065 break;
87066 case "ExpressionStatement":
87067 this.walkExpressionStatement(statement);
87068 break;
87069 case "ForInStatement":
87070 this.walkForInStatement(statement);
87071 break;
87072 case "ForOfStatement":
87073 this.walkForOfStatement(statement);
87074 break;
87075 case "ForStatement":
87076 this.walkForStatement(statement);
87077 break;
87078 case "FunctionDeclaration":
87079 this.walkFunctionDeclaration(statement);
87080 break;
87081 case "IfStatement":
87082 this.walkIfStatement(statement);
87083 break;
87084 case "LabeledStatement":
87085 this.walkLabeledStatement(statement);
87086 break;
87087 case "ReturnStatement":
87088 this.walkReturnStatement(statement);
87089 break;
87090 case "SwitchStatement":
87091 this.walkSwitchStatement(statement);
87092 break;
87093 case "ThrowStatement":
87094 this.walkThrowStatement(statement);
87095 break;
87096 case "TryStatement":
87097 this.walkTryStatement(statement);
87098 break;
87099 case "VariableDeclaration":
87100 this.walkVariableDeclaration(statement);
87101 break;
87102 case "WhileStatement":
87103 this.walkWhileStatement(statement);
87104 break;
87105 case "WithStatement":
87106 this.walkWithStatement(statement);
87107 break;
87108 }
87109 }
87110
87111 // Real Statements
87112 prewalkBlockStatement(statement) {
87113 this.prewalkStatements(statement.body);
87114 }
87115
87116 walkBlockStatement(statement) {
87117 this.inBlockScope(() => {
87118 const body = statement.body;
87119 this.blockPrewalkStatements(body);
87120 this.walkStatements(body);
87121 });
87122 }
87123
87124 walkExpressionStatement(statement) {
87125 this.walkExpression(statement.expression);
87126 }
87127
87128 prewalkIfStatement(statement) {
87129 this.prewalkStatement(statement.consequent);
87130 if (statement.alternate) {
87131 this.prewalkStatement(statement.alternate);
87132 }
87133 }
87134
87135 walkIfStatement(statement) {
87136 const result = this.hooks.statementIf.call(statement);
87137 if (result === undefined) {
87138 this.walkExpression(statement.test);
87139 this.walkStatement(statement.consequent);
87140 if (statement.alternate) {
87141 this.walkStatement(statement.alternate);
87142 }
87143 } else {
87144 if (result) {
87145 this.walkStatement(statement.consequent);
87146 } else if (statement.alternate) {
87147 this.walkStatement(statement.alternate);
87148 }
87149 }
87150 }
87151
87152 prewalkLabeledStatement(statement) {
87153 this.prewalkStatement(statement.body);
87154 }
87155
87156 walkLabeledStatement(statement) {
87157 const hook = this.hooks.label.get(statement.label.name);
87158 if (hook !== undefined) {
87159 const result = hook.call(statement);
87160 if (result === true) return;
87161 }
87162 this.walkStatement(statement.body);
87163 }
87164
87165 prewalkWithStatement(statement) {
87166 this.prewalkStatement(statement.body);
87167 }
87168
87169 walkWithStatement(statement) {
87170 this.walkExpression(statement.object);
87171 this.walkStatement(statement.body);
87172 }
87173
87174 prewalkSwitchStatement(statement) {
87175 this.prewalkSwitchCases(statement.cases);
87176 }
87177
87178 walkSwitchStatement(statement) {
87179 this.walkExpression(statement.discriminant);
87180 this.walkSwitchCases(statement.cases);
87181 }
87182
87183 walkTerminatingStatement(statement) {
87184 if (statement.argument) this.walkExpression(statement.argument);
87185 }
87186
87187 walkReturnStatement(statement) {
87188 this.walkTerminatingStatement(statement);
87189 }
87190
87191 walkThrowStatement(statement) {
87192 this.walkTerminatingStatement(statement);
87193 }
87194
87195 prewalkTryStatement(statement) {
87196 this.prewalkStatement(statement.block);
87197 }
87198
87199 walkTryStatement(statement) {
87200 if (this.scope.inTry) {
87201 this.walkStatement(statement.block);
87202 } else {
87203 this.scope.inTry = true;
87204 this.walkStatement(statement.block);
87205 this.scope.inTry = false;
87206 }
87207 if (statement.handler) this.walkCatchClause(statement.handler);
87208 if (statement.finalizer) this.walkStatement(statement.finalizer);
87209 }
87210
87211 prewalkWhileStatement(statement) {
87212 this.prewalkStatement(statement.body);
87213 }
87214
87215 walkWhileStatement(statement) {
87216 this.walkExpression(statement.test);
87217 this.walkStatement(statement.body);
87218 }
87219
87220 prewalkDoWhileStatement(statement) {
87221 this.prewalkStatement(statement.body);
87222 }
87223
87224 walkDoWhileStatement(statement) {
87225 this.walkStatement(statement.body);
87226 this.walkExpression(statement.test);
87227 }
87228
87229 prewalkForStatement(statement) {
87230 if (statement.init) {
87231 if (statement.init.type === "VariableDeclaration") {
87232 this.prewalkStatement(statement.init);
87233 }
87234 }
87235 this.prewalkStatement(statement.body);
87236 }
87237
87238 walkForStatement(statement) {
87239 this.inBlockScope(() => {
87240 if (statement.init) {
87241 if (statement.init.type === "VariableDeclaration") {
87242 this.blockPrewalkVariableDeclaration(statement.init);
87243 this.walkStatement(statement.init);
87244 } else {
87245 this.walkExpression(statement.init);
87246 }
87247 }
87248 if (statement.test) {
87249 this.walkExpression(statement.test);
87250 }
87251 if (statement.update) {
87252 this.walkExpression(statement.update);
87253 }
87254 const body = statement.body;
87255 if (body.type === "BlockStatement") {
87256 // no need to add additional scope
87257 this.blockPrewalkStatements(body.body);
87258 this.walkStatements(body.body);
87259 } else {
87260 this.walkStatement(body);
87261 }
87262 });
87263 }
87264
87265 prewalkForInStatement(statement) {
87266 if (statement.left.type === "VariableDeclaration") {
87267 this.prewalkVariableDeclaration(statement.left);
87268 }
87269 this.prewalkStatement(statement.body);
87270 }
87271
87272 walkForInStatement(statement) {
87273 this.inBlockScope(() => {
87274 if (statement.left.type === "VariableDeclaration") {
87275 this.blockPrewalkVariableDeclaration(statement.left);
87276 this.walkVariableDeclaration(statement.left);
87277 } else {
87278 this.walkPattern(statement.left);
87279 }
87280 this.walkExpression(statement.right);
87281 const body = statement.body;
87282 if (body.type === "BlockStatement") {
87283 // no need to add additional scope
87284 this.blockPrewalkStatements(body.body);
87285 this.walkStatements(body.body);
87286 } else {
87287 this.walkStatement(body);
87288 }
87289 });
87290 }
87291
87292 prewalkForOfStatement(statement) {
87293 if (statement.left.type === "VariableDeclaration") {
87294 this.prewalkVariableDeclaration(statement.left);
87295 }
87296 this.prewalkStatement(statement.body);
87297 }
87298
87299 walkForOfStatement(statement) {
87300 this.inBlockScope(() => {
87301 if (statement.left.type === "VariableDeclaration") {
87302 this.blockPrewalkVariableDeclaration(statement.left);
87303 this.walkVariableDeclaration(statement.left);
87304 } else {
87305 this.walkPattern(statement.left);
87306 }
87307 this.walkExpression(statement.right);
87308 const body = statement.body;
87309 if (body.type === "BlockStatement") {
87310 // no need to add additional scope
87311 this.blockPrewalkStatements(body.body);
87312 this.walkStatements(body.body);
87313 } else {
87314 this.walkStatement(body);
87315 }
87316 });
87317 }
87318
87319 // Declarations
87320 prewalkFunctionDeclaration(statement) {
87321 if (statement.id) {
87322 this.scope.renames.set(statement.id.name, null);
87323 this.scope.definitions.add(statement.id.name);
87324 }
87325 }
87326
87327 walkFunctionDeclaration(statement) {
87328 const wasTopLevel = this.scope.topLevelScope;
87329 this.scope.topLevelScope = false;
87330 this.inFunctionScope(true, statement.params, () => {
87331 for (const param of statement.params) {
87332 this.walkPattern(param);
87333 }
87334 if (statement.body.type === "BlockStatement") {
87335 this.detectMode(statement.body.body);
87336 this.prewalkStatement(statement.body);
87337 this.walkStatement(statement.body);
87338 } else {
87339 this.walkExpression(statement.body);
87340 }
87341 });
87342 this.scope.topLevelScope = wasTopLevel;
87343 }
87344
87345 prewalkImportDeclaration(statement) {
87346 const source = statement.source.value;
87347 this.hooks.import.call(statement, source);
87348 for (const specifier of statement.specifiers) {
87349 const name = specifier.local.name;
87350 this.scope.renames.set(name, null);
87351 this.scope.definitions.add(name);
87352 switch (specifier.type) {
87353 case "ImportDefaultSpecifier":
87354 this.hooks.importSpecifier.call(statement, source, "default", name);
87355 break;
87356 case "ImportSpecifier":
87357 this.hooks.importSpecifier.call(
87358 statement,
87359 source,
87360 specifier.imported.name,
87361 name
87362 );
87363 break;
87364 case "ImportNamespaceSpecifier":
87365 this.hooks.importSpecifier.call(statement, source, null, name);
87366 break;
87367 }
87368 }
87369 }
87370
87371 enterDeclaration(declaration, onIdent) {
87372 switch (declaration.type) {
87373 case "VariableDeclaration":
87374 for (const declarator of declaration.declarations) {
87375 switch (declarator.type) {
87376 case "VariableDeclarator": {
87377 this.enterPattern(declarator.id, onIdent);
87378 break;
87379 }
87380 }
87381 }
87382 break;
87383 case "FunctionDeclaration":
87384 this.enterPattern(declaration.id, onIdent);
87385 break;
87386 case "ClassDeclaration":
87387 this.enterPattern(declaration.id, onIdent);
87388 break;
87389 }
87390 }
87391
87392 blockPrewalkExportNamedDeclaration(statement) {
87393 if (statement.declaration) {
87394 this.blockPrewalkStatement(statement.declaration);
87395 }
87396 }
87397
87398 prewalkExportNamedDeclaration(statement) {
87399 let source;
87400 if (statement.source) {
87401 source = statement.source.value;
87402 this.hooks.exportImport.call(statement, source);
87403 } else {
87404 this.hooks.export.call(statement);
87405 }
87406 if (statement.declaration) {
87407 if (
87408 !this.hooks.exportDeclaration.call(statement, statement.declaration)
87409 ) {
87410 this.prewalkStatement(statement.declaration);
87411 let index = 0;
87412 this.enterDeclaration(statement.declaration, def => {
87413 this.hooks.exportSpecifier.call(statement, def, def, index++);
87414 });
87415 }
87416 }
87417 if (statement.specifiers) {
87418 for (
87419 let specifierIndex = 0;
87420 specifierIndex < statement.specifiers.length;
87421 specifierIndex++
87422 ) {
87423 const specifier = statement.specifiers[specifierIndex];
87424 switch (specifier.type) {
87425 case "ExportSpecifier": {
87426 const name = specifier.exported.name;
87427 if (source) {
87428 this.hooks.exportImportSpecifier.call(
87429 statement,
87430 source,
87431 specifier.local.name,
87432 name,
87433 specifierIndex
87434 );
87435 } else {
87436 this.hooks.exportSpecifier.call(
87437 statement,
87438 specifier.local.name,
87439 name,
87440 specifierIndex
87441 );
87442 }
87443 break;
87444 }
87445 }
87446 }
87447 }
87448 }
87449
87450 walkExportNamedDeclaration(statement) {
87451 if (statement.declaration) {
87452 this.walkStatement(statement.declaration);
87453 }
87454 }
87455
87456 blockPrewalkExportDefaultDeclaration(statement) {
87457 if (statement.declaration.type === "ClassDeclaration") {
87458 this.blockPrewalkClassDeclaration(statement.declaration);
87459 }
87460 }
87461
87462 prewalkExportDefaultDeclaration(statement) {
87463 this.prewalkStatement(statement.declaration);
87464 if (
87465 statement.declaration.id &&
87466 statement.declaration.type !== "FunctionExpression" &&
87467 statement.declaration.type !== "ClassExpression"
87468 ) {
87469 this.hooks.exportSpecifier.call(
87470 statement,
87471 statement.declaration.id.name,
87472 "default"
87473 );
87474 }
87475 }
87476
87477 walkExportDefaultDeclaration(statement) {
87478 this.hooks.export.call(statement);
87479 if (
87480 statement.declaration.id &&
87481 statement.declaration.type !== "FunctionExpression" &&
87482 statement.declaration.type !== "ClassExpression"
87483 ) {
87484 if (
87485 !this.hooks.exportDeclaration.call(statement, statement.declaration)
87486 ) {
87487 this.walkStatement(statement.declaration);
87488 }
87489 } else {
87490 // Acorn parses `export default function() {}` as `FunctionDeclaration` and
87491 // `export default class {}` as `ClassDeclaration`, both with `id = null`.
87492 // These nodes must be treated as expressions.
87493 if (statement.declaration.type === "FunctionDeclaration") {
87494 this.walkFunctionDeclaration(statement.declaration);
87495 } else if (statement.declaration.type === "ClassDeclaration") {
87496 this.walkClassDeclaration(statement.declaration);
87497 } else {
87498 this.walkExpression(statement.declaration);
87499 }
87500 if (!this.hooks.exportExpression.call(statement, statement.declaration)) {
87501 this.hooks.exportSpecifier.call(
87502 statement,
87503 statement.declaration,
87504 "default"
87505 );
87506 }
87507 }
87508 }
87509
87510 prewalkExportAllDeclaration(statement) {
87511 const source = statement.source.value;
87512 this.hooks.exportImport.call(statement, source);
87513 this.hooks.exportImportSpecifier.call(statement, source, null, null, 0);
87514 }
87515
87516 prewalkVariableDeclaration(statement) {
87517 if (statement.kind !== "var") return;
87518 this._prewalkVariableDeclaration(statement, this.hooks.varDeclarationVar);
87519 }
87520
87521 blockPrewalkVariableDeclaration(statement) {
87522 if (statement.kind === "var") return;
87523 const hookMap =
87524 statement.kind === "const"
87525 ? this.hooks.varDeclarationConst
87526 : this.hooks.varDeclarationLet;
87527 this._prewalkVariableDeclaration(statement, hookMap);
87528 }
87529
87530 _prewalkVariableDeclaration(statement, hookMap) {
87531 for (const declarator of statement.declarations) {
87532 switch (declarator.type) {
87533 case "VariableDeclarator": {
87534 this.enterPattern(declarator.id, (name, decl) => {
87535 let hook = hookMap.get(name);
87536 if (hook === undefined || !hook.call(decl)) {
87537 hook = this.hooks.varDeclaration.get(name);
87538 if (hook === undefined || !hook.call(decl)) {
87539 this.scope.renames.set(name, null);
87540 this.scope.definitions.add(name);
87541 }
87542 }
87543 });
87544 break;
87545 }
87546 }
87547 }
87548 }
87549
87550 walkVariableDeclaration(statement) {
87551 for (const declarator of statement.declarations) {
87552 switch (declarator.type) {
87553 case "VariableDeclarator": {
87554 const renameIdentifier =
87555 declarator.init && this.getRenameIdentifier(declarator.init);
87556 if (renameIdentifier && declarator.id.type === "Identifier") {
87557 const hook = this.hooks.canRename.get(renameIdentifier);
87558 if (hook !== undefined && hook.call(declarator.init)) {
87559 // renaming with "var a = b;"
87560 const hook = this.hooks.rename.get(renameIdentifier);
87561 if (hook === undefined || !hook.call(declarator.init)) {
87562 this.scope.renames.set(
87563 declarator.id.name,
87564 this.scope.renames.get(renameIdentifier) || renameIdentifier
87565 );
87566 this.scope.definitions.delete(declarator.id.name);
87567 }
87568 break;
87569 }
87570 }
87571 this.walkPattern(declarator.id);
87572 if (declarator.init) this.walkExpression(declarator.init);
87573 break;
87574 }
87575 }
87576 }
87577 }
87578
87579 blockPrewalkClassDeclaration(statement) {
87580 if (statement.id) {
87581 this.scope.renames.set(statement.id.name, null);
87582 this.scope.definitions.add(statement.id.name);
87583 }
87584 }
87585
87586 walkClassDeclaration(statement) {
87587 this.walkClass(statement);
87588 }
87589
87590 prewalkSwitchCases(switchCases) {
87591 for (let index = 0, len = switchCases.length; index < len; index++) {
87592 const switchCase = switchCases[index];
87593 this.prewalkStatements(switchCase.consequent);
87594 }
87595 }
87596
87597 walkSwitchCases(switchCases) {
87598 for (let index = 0, len = switchCases.length; index < len; index++) {
87599 const switchCase = switchCases[index];
87600
87601 if (switchCase.test) {
87602 this.walkExpression(switchCase.test);
87603 }
87604 this.walkStatements(switchCase.consequent);
87605 }
87606 }
87607
87608 walkCatchClause(catchClause) {
87609 this.inBlockScope(() => {
87610 // Error binding is optional in catch clause since ECMAScript 2019
87611 if (catchClause.param !== null) {
87612 this.enterPattern(catchClause.param, ident => {
87613 this.scope.renames.set(ident, null);
87614 this.scope.definitions.add(ident);
87615 });
87616 this.walkPattern(catchClause.param);
87617 }
87618 this.prewalkStatement(catchClause.body);
87619 this.walkStatement(catchClause.body);
87620 });
87621 }
87622
87623 walkPattern(pattern) {
87624 switch (pattern.type) {
87625 case "ArrayPattern":
87626 this.walkArrayPattern(pattern);
87627 break;
87628 case "AssignmentPattern":
87629 this.walkAssignmentPattern(pattern);
87630 break;
87631 case "MemberExpression":
87632 this.walkMemberExpression(pattern);
87633 break;
87634 case "ObjectPattern":
87635 this.walkObjectPattern(pattern);
87636 break;
87637 case "RestElement":
87638 this.walkRestElement(pattern);
87639 break;
87640 }
87641 }
87642
87643 walkAssignmentPattern(pattern) {
87644 this.walkExpression(pattern.right);
87645 this.walkPattern(pattern.left);
87646 }
87647
87648 walkObjectPattern(pattern) {
87649 for (let i = 0, len = pattern.properties.length; i < len; i++) {
87650 const prop = pattern.properties[i];
87651 if (prop) {
87652 if (prop.computed) this.walkExpression(prop.key);
87653 if (prop.value) this.walkPattern(prop.value);
87654 }
87655 }
87656 }
87657
87658 walkArrayPattern(pattern) {
87659 for (let i = 0, len = pattern.elements.length; i < len; i++) {
87660 const element = pattern.elements[i];
87661 if (element) this.walkPattern(element);
87662 }
87663 }
87664
87665 walkRestElement(pattern) {
87666 this.walkPattern(pattern.argument);
87667 }
87668
87669 walkExpressions(expressions) {
87670 for (const expression of expressions) {
87671 if (expression) {
87672 this.walkExpression(expression);
87673 }
87674 }
87675 }
87676
87677 walkExpression(expression) {
87678 switch (expression.type) {
87679 case "ArrayExpression":
87680 this.walkArrayExpression(expression);
87681 break;
87682 case "ArrowFunctionExpression":
87683 this.walkArrowFunctionExpression(expression);
87684 break;
87685 case "AssignmentExpression":
87686 this.walkAssignmentExpression(expression);
87687 break;
87688 case "AwaitExpression":
87689 this.walkAwaitExpression(expression);
87690 break;
87691 case "BinaryExpression":
87692 this.walkBinaryExpression(expression);
87693 break;
87694 case "CallExpression":
87695 this.walkCallExpression(expression);
87696 break;
87697 case "ClassExpression":
87698 this.walkClassExpression(expression);
87699 break;
87700 case "ConditionalExpression":
87701 this.walkConditionalExpression(expression);
87702 break;
87703 case "FunctionExpression":
87704 this.walkFunctionExpression(expression);
87705 break;
87706 case "Identifier":
87707 this.walkIdentifier(expression);
87708 break;
87709 case "LogicalExpression":
87710 this.walkLogicalExpression(expression);
87711 break;
87712 case "MemberExpression":
87713 this.walkMemberExpression(expression);
87714 break;
87715 case "NewExpression":
87716 this.walkNewExpression(expression);
87717 break;
87718 case "ObjectExpression":
87719 this.walkObjectExpression(expression);
87720 break;
87721 case "SequenceExpression":
87722 this.walkSequenceExpression(expression);
87723 break;
87724 case "SpreadElement":
87725 this.walkSpreadElement(expression);
87726 break;
87727 case "TaggedTemplateExpression":
87728 this.walkTaggedTemplateExpression(expression);
87729 break;
87730 case "TemplateLiteral":
87731 this.walkTemplateLiteral(expression);
87732 break;
87733 case "ThisExpression":
87734 this.walkThisExpression(expression);
87735 break;
87736 case "UnaryExpression":
87737 this.walkUnaryExpression(expression);
87738 break;
87739 case "UpdateExpression":
87740 this.walkUpdateExpression(expression);
87741 break;
87742 case "YieldExpression":
87743 this.walkYieldExpression(expression);
87744 break;
87745 }
87746 }
87747
87748 walkAwaitExpression(expression) {
87749 this.walkExpression(expression.argument);
87750 }
87751
87752 walkArrayExpression(expression) {
87753 if (expression.elements) {
87754 this.walkExpressions(expression.elements);
87755 }
87756 }
87757
87758 walkSpreadElement(expression) {
87759 if (expression.argument) {
87760 this.walkExpression(expression.argument);
87761 }
87762 }
87763
87764 walkObjectExpression(expression) {
87765 for (
87766 let propIndex = 0, len = expression.properties.length;
87767 propIndex < len;
87768 propIndex++
87769 ) {
87770 const prop = expression.properties[propIndex];
87771 if (prop.type === "SpreadElement") {
87772 this.walkExpression(prop.argument);
87773 continue;
87774 }
87775 if (prop.computed) {
87776 this.walkExpression(prop.key);
87777 }
87778 if (prop.shorthand) {
87779 this.scope.inShorthand = true;
87780 }
87781 this.walkExpression(prop.value);
87782 if (prop.shorthand) {
87783 this.scope.inShorthand = false;
87784 }
87785 }
87786 }
87787
87788 walkFunctionExpression(expression) {
87789 const wasTopLevel = this.scope.topLevelScope;
87790 this.scope.topLevelScope = false;
87791 const scopeParams = expression.params;
87792
87793 // Add function name in scope for recursive calls
87794 if (expression.id) {
87795 scopeParams.push(expression.id.name);
87796 }
87797
87798 this.inFunctionScope(true, scopeParams, () => {
87799 for (const param of expression.params) {
87800 this.walkPattern(param);
87801 }
87802 if (expression.body.type === "BlockStatement") {
87803 this.detectMode(expression.body.body);
87804 this.prewalkStatement(expression.body);
87805 this.walkStatement(expression.body);
87806 } else {
87807 this.walkExpression(expression.body);
87808 }
87809 });
87810 this.scope.topLevelScope = wasTopLevel;
87811 }
87812
87813 walkArrowFunctionExpression(expression) {
87814 this.inFunctionScope(false, expression.params, () => {
87815 for (const param of expression.params) {
87816 this.walkPattern(param);
87817 }
87818 if (expression.body.type === "BlockStatement") {
87819 this.detectMode(expression.body.body);
87820 this.prewalkStatement(expression.body);
87821 this.walkStatement(expression.body);
87822 } else {
87823 this.walkExpression(expression.body);
87824 }
87825 });
87826 }
87827
87828 walkSequenceExpression(expression) {
87829 if (expression.expressions) this.walkExpressions(expression.expressions);
87830 }
87831
87832 walkUpdateExpression(expression) {
87833 this.walkExpression(expression.argument);
87834 }
87835
87836 walkUnaryExpression(expression) {
87837 if (expression.operator === "typeof") {
87838 const exprName = this.getNameForExpression(expression.argument);
87839 if (exprName && exprName.free) {
87840 const hook = this.hooks.typeof.get(exprName.name);
87841 if (hook !== undefined) {
87842 const result = hook.call(expression);
87843 if (result === true) return;
87844 }
87845 }
87846 }
87847 this.walkExpression(expression.argument);
87848 }
87849
87850 walkLeftRightExpression(expression) {
87851 this.walkExpression(expression.left);
87852 this.walkExpression(expression.right);
87853 }
87854
87855 walkBinaryExpression(expression) {
87856 this.walkLeftRightExpression(expression);
87857 }
87858
87859 walkLogicalExpression(expression) {
87860 const result = this.hooks.expressionLogicalOperator.call(expression);
87861 if (result === undefined) {
87862 this.walkLeftRightExpression(expression);
87863 } else {
87864 if (result) {
87865 this.walkExpression(expression.right);
87866 }
87867 }
87868 }
87869
87870 walkAssignmentExpression(expression) {
87871 const renameIdentifier = this.getRenameIdentifier(expression.right);
87872 if (expression.left.type === "Identifier" && renameIdentifier) {
87873 const hook = this.hooks.canRename.get(renameIdentifier);
87874 if (hook !== undefined && hook.call(expression.right)) {
87875 // renaming "a = b;"
87876 const hook = this.hooks.rename.get(renameIdentifier);
87877 if (hook === undefined || !hook.call(expression.right)) {
87878 this.scope.renames.set(expression.left.name, renameIdentifier);
87879 this.scope.definitions.delete(expression.left.name);
87880 }
87881 return;
87882 }
87883 }
87884 if (expression.left.type === "Identifier") {
87885 const assignedHook = this.hooks.assigned.get(expression.left.name);
87886 if (assignedHook === undefined || !assignedHook.call(expression)) {
87887 this.walkExpression(expression.right);
87888 }
87889 this.scope.renames.set(expression.left.name, null);
87890 const assignHook = this.hooks.assign.get(expression.left.name);
87891 if (assignHook === undefined || !assignHook.call(expression)) {
87892 this.walkExpression(expression.left);
87893 }
87894 return;
87895 }
87896 this.walkExpression(expression.right);
87897 this.walkPattern(expression.left);
87898 this.enterPattern(expression.left, (name, decl) => {
87899 this.scope.renames.set(name, null);
87900 });
87901 }
87902
87903 walkConditionalExpression(expression) {
87904 const result = this.hooks.expressionConditionalOperator.call(expression);
87905 if (result === undefined) {
87906 this.walkExpression(expression.test);
87907 this.walkExpression(expression.consequent);
87908 if (expression.alternate) {
87909 this.walkExpression(expression.alternate);
87910 }
87911 } else {
87912 if (result) {
87913 this.walkExpression(expression.consequent);
87914 } else if (expression.alternate) {
87915 this.walkExpression(expression.alternate);
87916 }
87917 }
87918 }
87919
87920 walkNewExpression(expression) {
87921 const callee = this.evaluateExpression(expression.callee);
87922 if (callee.isIdentifier()) {
87923 const hook = this.hooks.new.get(callee.identifier);
87924 if (hook !== undefined) {
87925 const result = hook.call(expression);
87926 if (result === true) {
87927 return;
87928 }
87929 }
87930 }
87931
87932 this.walkExpression(expression.callee);
87933 if (expression.arguments) {
87934 this.walkExpressions(expression.arguments);
87935 }
87936 }
87937
87938 walkYieldExpression(expression) {
87939 if (expression.argument) {
87940 this.walkExpression(expression.argument);
87941 }
87942 }
87943
87944 walkTemplateLiteral(expression) {
87945 if (expression.expressions) {
87946 this.walkExpressions(expression.expressions);
87947 }
87948 }
87949
87950 walkTaggedTemplateExpression(expression) {
87951 if (expression.tag) {
87952 this.walkExpression(expression.tag);
87953 }
87954 if (expression.quasi && expression.quasi.expressions) {
87955 this.walkExpressions(expression.quasi.expressions);
87956 }
87957 }
87958
87959 walkClassExpression(expression) {
87960 this.walkClass(expression);
87961 }
87962
87963 _walkIIFE(functionExpression, options, currentThis) {
87964 const renameArgOrThis = argOrThis => {
87965 const renameIdentifier = this.getRenameIdentifier(argOrThis);
87966 if (renameIdentifier) {
87967 const hook = this.hooks.canRename.get(renameIdentifier);
87968 if (hook !== undefined && hook.call(argOrThis)) {
87969 const hook = this.hooks.rename.get(renameIdentifier);
87970 if (hook === undefined || !hook.call(argOrThis)) {
87971 return renameIdentifier;
87972 }
87973 }
87974 }
87975 this.walkExpression(argOrThis);
87976 };
87977 const params = functionExpression.params;
87978 const renameThis = currentThis ? renameArgOrThis(currentThis) : null;
87979 const args = options.map(renameArgOrThis);
87980 const wasTopLevel = this.scope.topLevelScope;
87981 this.scope.topLevelScope = false;
87982 const scopeParams = params.filter((identifier, idx) => !args[idx]);
87983
87984 // Add function name in scope for recursive calls
87985 if (functionExpression.id) {
87986 scopeParams.push(functionExpression.id.name);
87987 }
87988
87989 this.inFunctionScope(true, scopeParams, () => {
87990 if (renameThis) {
87991 this.scope.renames.set("this", renameThis);
87992 }
87993 for (let i = 0; i < args.length; i++) {
87994 const param = args[i];
87995 if (!param) continue;
87996 if (!params[i] || params[i].type !== "Identifier") continue;
87997 this.scope.renames.set(params[i].name, param);
87998 }
87999 if (functionExpression.body.type === "BlockStatement") {
88000 this.detectMode(functionExpression.body.body);
88001 this.prewalkStatement(functionExpression.body);
88002 this.walkStatement(functionExpression.body);
88003 } else {
88004 this.walkExpression(functionExpression.body);
88005 }
88006 });
88007 this.scope.topLevelScope = wasTopLevel;
88008 }
88009
88010 walkCallExpression(expression) {
88011 if (
88012 expression.callee.type === "MemberExpression" &&
88013 expression.callee.object.type === "FunctionExpression" &&
88014 !expression.callee.computed &&
88015 (expression.callee.property.name === "call" ||
88016 expression.callee.property.name === "bind") &&
88017 expression.arguments.length > 0
88018 ) {
88019 // (function(…) { }.call/bind(?, …))
88020 this._walkIIFE(
88021 expression.callee.object,
88022 expression.arguments.slice(1),
88023 expression.arguments[0]
88024 );
88025 } else if (expression.callee.type === "FunctionExpression") {
88026 // (function(…) { }(…))
88027 this._walkIIFE(expression.callee, expression.arguments, null);
88028 } else if (expression.callee.type === "Import") {
88029 let result = this.hooks.importCall.call(expression);
88030 if (result === true) return;
88031
88032 if (expression.arguments) this.walkExpressions(expression.arguments);
88033 } else {
88034 const callee = this.evaluateExpression(expression.callee);
88035 if (callee.isIdentifier()) {
88036 const callHook = this.hooks.call.get(callee.identifier);
88037 if (callHook !== undefined) {
88038 let result = callHook.call(expression);
88039 if (result === true) return;
88040 }
88041 let identifier = callee.identifier.replace(/\.[^.]+$/, "");
88042 if (identifier !== callee.identifier) {
88043 const callAnyHook = this.hooks.callAnyMember.get(identifier);
88044 if (callAnyHook !== undefined) {
88045 let result = callAnyHook.call(expression);
88046 if (result === true) return;
88047 }
88048 }
88049 }
88050
88051 if (expression.callee) this.walkExpression(expression.callee);
88052 if (expression.arguments) this.walkExpressions(expression.arguments);
88053 }
88054 }
88055
88056 walkMemberExpression(expression) {
88057 const exprName = this.getNameForExpression(expression);
88058 if (exprName && exprName.free) {
88059 const expressionHook = this.hooks.expression.get(exprName.name);
88060 if (expressionHook !== undefined) {
88061 const result = expressionHook.call(expression);
88062 if (result === true) return;
88063 }
88064 const expressionAnyMemberHook = this.hooks.expressionAnyMember.get(
88065 exprName.nameGeneral
88066 );
88067 if (expressionAnyMemberHook !== undefined) {
88068 const result = expressionAnyMemberHook.call(expression);
88069 if (result === true) return;
88070 }
88071 }
88072 this.walkExpression(expression.object);
88073 if (expression.computed === true) this.walkExpression(expression.property);
88074 }
88075
88076 walkThisExpression(expression) {
88077 const expressionHook = this.hooks.expression.get("this");
88078 if (expressionHook !== undefined) {
88079 expressionHook.call(expression);
88080 }
88081 }
88082
88083 walkIdentifier(expression) {
88084 if (!this.scope.definitions.has(expression.name)) {
88085 const hook = this.hooks.expression.get(
88086 this.scope.renames.get(expression.name) || expression.name
88087 );
88088 if (hook !== undefined) {
88089 const result = hook.call(expression);
88090 if (result === true) return;
88091 }
88092 }
88093 }
88094
88095 /**
88096 * @deprecated
88097 * @param {any} params scope params
88098 * @param {function(): void} fn inner function
88099 * @returns {void}
88100 */
88101 inScope(params, fn) {
88102 const oldScope = this.scope;
88103 this.scope = {
88104 topLevelScope: oldScope.topLevelScope,
88105 inTry: false,
88106 inShorthand: false,
88107 isStrict: oldScope.isStrict,
88108 isAsmJs: oldScope.isAsmJs,
88109 definitions: oldScope.definitions.createChild(),
88110 renames: oldScope.renames.createChild()
88111 };
88112
88113 this.scope.renames.set("this", null);
88114
88115 this.enterPatterns(params, ident => {
88116 this.scope.renames.set(ident, null);
88117 this.scope.definitions.add(ident);
88118 });
88119
88120 fn();
88121
88122 this.scope = oldScope;
88123 }
88124
88125 inFunctionScope(hasThis, params, fn) {
88126 const oldScope = this.scope;
88127 this.scope = {
88128 topLevelScope: oldScope.topLevelScope,
88129 inTry: false,
88130 inShorthand: false,
88131 isStrict: oldScope.isStrict,
88132 isAsmJs: oldScope.isAsmJs,
88133 definitions: oldScope.definitions.createChild(),
88134 renames: oldScope.renames.createChild()
88135 };
88136
88137 if (hasThis) {
88138 this.scope.renames.set("this", null);
88139 }
88140
88141 this.enterPatterns(params, ident => {
88142 this.scope.renames.set(ident, null);
88143 this.scope.definitions.add(ident);
88144 });
88145
88146 fn();
88147
88148 this.scope = oldScope;
88149 }
88150
88151 inBlockScope(fn) {
88152 const oldScope = this.scope;
88153 this.scope = {
88154 topLevelScope: oldScope.topLevelScope,
88155 inTry: oldScope.inTry,
88156 inShorthand: false,
88157 isStrict: oldScope.isStrict,
88158 isAsmJs: oldScope.isAsmJs,
88159 definitions: oldScope.definitions.createChild(),
88160 renames: oldScope.renames.createChild()
88161 };
88162
88163 fn();
88164
88165 this.scope = oldScope;
88166 }
88167
88168 // TODO webpack 5: remove this methods
88169 // only for backward-compat
88170 detectStrictMode(statements) {
88171 this.detectMode(statements);
88172 }
88173
88174 detectMode(statements) {
88175 const isLiteral =
88176 statements.length >= 1 &&
88177 statements[0].type === "ExpressionStatement" &&
88178 statements[0].expression.type === "Literal";
88179 if (isLiteral && statements[0].expression.value === "use strict") {
88180 this.scope.isStrict = true;
88181 }
88182 if (isLiteral && statements[0].expression.value === "use asm") {
88183 this.scope.isAsmJs = true;
88184 }
88185 }
88186
88187 enterPatterns(patterns, onIdent) {
88188 for (const pattern of patterns) {
88189 if (typeof pattern !== "string") {
88190 this.enterPattern(pattern, onIdent);
88191 } else if (pattern) {
88192 onIdent(pattern);
88193 }
88194 }
88195 }
88196
88197 enterPattern(pattern, onIdent) {
88198 if (!pattern) return;
88199 switch (pattern.type) {
88200 case "ArrayPattern":
88201 this.enterArrayPattern(pattern, onIdent);
88202 break;
88203 case "AssignmentPattern":
88204 this.enterAssignmentPattern(pattern, onIdent);
88205 break;
88206 case "Identifier":
88207 this.enterIdentifier(pattern, onIdent);
88208 break;
88209 case "ObjectPattern":
88210 this.enterObjectPattern(pattern, onIdent);
88211 break;
88212 case "RestElement":
88213 this.enterRestElement(pattern, onIdent);
88214 break;
88215 case "Property":
88216 this.enterPattern(pattern.value, onIdent);
88217 break;
88218 }
88219 }
88220
88221 enterIdentifier(pattern, onIdent) {
88222 onIdent(pattern.name, pattern);
88223 }
88224
88225 enterObjectPattern(pattern, onIdent) {
88226 for (
88227 let propIndex = 0, len = pattern.properties.length;
88228 propIndex < len;
88229 propIndex++
88230 ) {
88231 const prop = pattern.properties[propIndex];
88232 this.enterPattern(prop, onIdent);
88233 }
88234 }
88235
88236 enterArrayPattern(pattern, onIdent) {
88237 for (
88238 let elementIndex = 0, len = pattern.elements.length;
88239 elementIndex < len;
88240 elementIndex++
88241 ) {
88242 const element = pattern.elements[elementIndex];
88243 this.enterPattern(element, onIdent);
88244 }
88245 }
88246
88247 enterRestElement(pattern, onIdent) {
88248 this.enterPattern(pattern.argument, onIdent);
88249 }
88250
88251 enterAssignmentPattern(pattern, onIdent) {
88252 this.enterPattern(pattern.left, onIdent);
88253 }
88254
88255 evaluateExpression(expression) {
88256 try {
88257 const hook = this.hooks.evaluate.get(expression.type);
88258 if (hook !== undefined) {
88259 const result = hook.call(expression);
88260 if (result !== undefined) {
88261 if (result) {
88262 result.setExpression(expression);
88263 }
88264 return result;
88265 }
88266 }
88267 } catch (e) {
88268 console.warn(e);
88269 // ignore error
88270 }
88271 return new BasicEvaluatedExpression()
88272 .setRange(expression.range)
88273 .setExpression(expression);
88274 }
88275
88276 parseString(expression) {
88277 switch (expression.type) {
88278 case "BinaryExpression":
88279 if (expression.operator === "+") {
88280 return (
88281 this.parseString(expression.left) +
88282 this.parseString(expression.right)
88283 );
88284 }
88285 break;
88286 case "Literal":
88287 return expression.value + "";
88288 }
88289 throw new Error(
88290 expression.type + " is not supported as parameter for require"
88291 );
88292 }
88293
88294 parseCalculatedString(expression) {
88295 switch (expression.type) {
88296 case "BinaryExpression":
88297 if (expression.operator === "+") {
88298 const left = this.parseCalculatedString(expression.left);
88299 const right = this.parseCalculatedString(expression.right);
88300 if (left.code) {
88301 return {
88302 range: left.range,
88303 value: left.value,
88304 code: true,
88305 conditional: false
88306 };
88307 } else if (right.code) {
88308 return {
88309 range: [
88310 left.range[0],
88311 right.range ? right.range[1] : left.range[1]
88312 ],
88313 value: left.value + right.value,
88314 code: true,
88315 conditional: false
88316 };
88317 } else {
88318 return {
88319 range: [left.range[0], right.range[1]],
88320 value: left.value + right.value,
88321 code: false,
88322 conditional: false
88323 };
88324 }
88325 }
88326 break;
88327 case "ConditionalExpression": {
88328 const consequent = this.parseCalculatedString(expression.consequent);
88329 const alternate = this.parseCalculatedString(expression.alternate);
88330 const items = [];
88331 if (consequent.conditional) {
88332 items.push(...consequent.conditional);
88333 } else if (!consequent.code) {
88334 items.push(consequent);
88335 } else {
88336 break;
88337 }
88338 if (alternate.conditional) {
88339 items.push(...alternate.conditional);
88340 } else if (!alternate.code) {
88341 items.push(alternate);
88342 } else {
88343 break;
88344 }
88345 return {
88346 range: undefined,
88347 value: "",
88348 code: true,
88349 conditional: items
88350 };
88351 }
88352 case "Literal":
88353 return {
88354 range: expression.range,
88355 value: expression.value + "",
88356 code: false,
88357 conditional: false
88358 };
88359 }
88360 return {
88361 range: undefined,
88362 value: "",
88363 code: true,
88364 conditional: false
88365 };
88366 }
88367
88368 parse(source, initialState) {
88369 let ast;
88370 let comments;
88371 if (typeof source === "object" && source !== null) {
88372 ast = source;
88373 comments = source.comments;
88374 } else {
88375 comments = [];
88376 ast = Parser.parse(source, {
88377 sourceType: this.sourceType,
88378 onComment: comments
88379 });
88380 }
88381
88382 const oldScope = this.scope;
88383 const oldState = this.state;
88384 const oldComments = this.comments;
88385 this.scope = {
88386 topLevelScope: true,
88387 inTry: false,
88388 inShorthand: false,
88389 isStrict: false,
88390 isAsmJs: false,
88391 definitions: new StackedSetMap(),
88392 renames: new StackedSetMap()
88393 };
88394 const state = (this.state = initialState || {});
88395 this.comments = comments;
88396 if (this.hooks.program.call(ast, comments) === undefined) {
88397 this.detectMode(ast.body);
88398 this.prewalkStatements(ast.body);
88399 this.blockPrewalkStatements(ast.body);
88400 this.walkStatements(ast.body);
88401 }
88402 this.scope = oldScope;
88403 this.state = oldState;
88404 this.comments = oldComments;
88405 return state;
88406 }
88407
88408 evaluate(source) {
88409 const ast = Parser.parse("(" + source + ")", {
88410 sourceType: this.sourceType,
88411 locations: false
88412 });
88413 // TODO(https://github.com/acornjs/acorn/issues/741)
88414 // @ts-ignore
88415 if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") {
88416 throw new Error("evaluate: Source is not a expression");
88417 }
88418 // TODO(https://github.com/acornjs/acorn/issues/741)
88419 // @ts-ignore
88420 return this.evaluateExpression(ast.body[0].expression);
88421 }
88422
88423 getComments(range) {
88424 return this.comments.filter(
88425 comment => comment.range[0] >= range[0] && comment.range[1] <= range[1]
88426 );
88427 }
88428
88429 parseCommentOptions(range) {
88430 const comments = this.getComments(range);
88431 if (comments.length === 0) {
88432 return EMPTY_COMMENT_OPTIONS;
88433 }
88434 let options = {};
88435 let errors = [];
88436 for (const comment of comments) {
88437 const { value } = comment;
88438 if (value && webpackCommentRegExp.test(value)) {
88439 // try compile only if webpack options comment is present
88440 try {
88441 const val = vm.runInNewContext(`(function(){return {${value}};})()`);
88442 Object.assign(options, val);
88443 } catch (e) {
88444 e.comment = comment;
88445 errors.push(e);
88446 }
88447 }
88448 }
88449 return { options, errors };
88450 }
88451
88452 getNameForExpression(expression) {
88453 let expr = expression;
88454 const exprName = [];
88455 while (
88456 expr.type === "MemberExpression" &&
88457 expr.property.type === (expr.computed ? "Literal" : "Identifier")
88458 ) {
88459 exprName.push(expr.computed ? expr.property.value : expr.property.name);
88460 expr = expr.object;
88461 }
88462 let free;
88463 if (expr.type === "Identifier") {
88464 free = !this.scope.definitions.has(expr.name);
88465 exprName.push(this.scope.renames.get(expr.name) || expr.name);
88466 } else if (
88467 expr.type === "ThisExpression" &&
88468 this.scope.renames.get("this")
88469 ) {
88470 free = true;
88471 exprName.push(this.scope.renames.get("this"));
88472 } else if (expr.type === "ThisExpression") {
88473 free = this.scope.topLevelScope;
88474 exprName.push("this");
88475 } else {
88476 return null;
88477 }
88478 let prefix = "";
88479 for (let i = exprName.length - 1; i >= 2; i--) {
88480 prefix += exprName[i] + ".";
88481 }
88482 if (exprName.length > 1) {
88483 prefix += exprName[1];
88484 }
88485 const name = prefix ? prefix + "." + exprName[0] : exprName[0];
88486 const nameGeneral = prefix;
88487 return {
88488 name,
88489 nameGeneral,
88490 free
88491 };
88492 }
88493
88494 static parse(code, options) {
88495 const type = options ? options.sourceType : "module";
88496 const parserOptions = Object.assign(
88497 Object.create(null),
88498 defaultParserOptions,
88499 options
88500 );
88501
88502 if (type === "auto") {
88503 parserOptions.sourceType = "module";
88504 } else if (parserOptions.sourceType === "script") {
88505 parserOptions.allowReturnOutsideFunction = true;
88506 }
88507
88508 let ast;
88509 let error;
88510 let threw = false;
88511 try {
88512 ast = acornParser.parse(code, parserOptions);
88513 } catch (e) {
88514 error = e;
88515 threw = true;
88516 }
88517
88518 if (threw && type === "auto") {
88519 parserOptions.sourceType = "script";
88520 parserOptions.allowReturnOutsideFunction = true;
88521 if (Array.isArray(parserOptions.onComment)) {
88522 parserOptions.onComment.length = 0;
88523 }
88524 try {
88525 ast = acornParser.parse(code, parserOptions);
88526 threw = false;
88527 } catch (e) {
88528 threw = true;
88529 }
88530 }
88531
88532 if (threw) {
88533 throw error;
88534 }
88535
88536 return ast;
88537 }
88538}
88539
88540// TODO remove in webpack 5
88541Object.defineProperty(Parser.prototype, "getCommentOptions", {
88542 configurable: false,
88543 value: util.deprecate(
88544 /**
88545 * @deprecated
88546 * @param {TODO} range Range
88547 * @returns {void}
88548 * @this {Parser}
88549 */
88550 function(range) {
88551 return this.parseCommentOptions(range).options;
88552 },
88553 "Parser.getCommentOptions: Use Parser.parseCommentOptions(range) instead"
88554 )
88555});
88556
88557module.exports = Parser;
88558
88559
88560/***/ }),
88561
88562/***/ 23999:
88563/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
88564
88565"use strict";
88566/*
88567 MIT License http://www.opensource.org/licenses/mit-license.php
88568 Author Tobias Koppers @sokra
88569*/
88570
88571const path = __webpack_require__(85622);
88572
88573const BasicEvaluatedExpression = __webpack_require__(96770);
88574const ConstDependency = __webpack_require__(71101);
88575const UnsupportedFeatureWarning = __webpack_require__(99953);
88576
88577const ParserHelpers = exports;
88578
88579ParserHelpers.addParsedVariableToModule = (parser, name, expression) => {
88580 if (!parser.state.current.addVariable) return false;
88581 var deps = [];
88582 parser.parse(expression, {
88583 current: {
88584 addDependency: dep => {
88585 dep.userRequest = name;
88586 deps.push(dep);
88587 }
88588 },
88589 module: parser.state.module
88590 });
88591 parser.state.current.addVariable(name, expression, deps);
88592 return true;
88593};
88594
88595ParserHelpers.requireFileAsExpression = (context, pathToModule) => {
88596 var moduleJsPath = path.relative(context, pathToModule);
88597 if (!/^[A-Z]:/i.test(moduleJsPath)) {
88598 moduleJsPath = "./" + moduleJsPath.replace(/\\/g, "/");
88599 }
88600 return "require(" + JSON.stringify(moduleJsPath) + ")";
88601};
88602
88603ParserHelpers.toConstantDependency = (parser, value) => {
88604 return function constDependency(expr) {
88605 var dep = new ConstDependency(value, expr.range, false);
88606 dep.loc = expr.loc;
88607 parser.state.current.addDependency(dep);
88608 return true;
88609 };
88610};
88611
88612ParserHelpers.toConstantDependencyWithWebpackRequire = (parser, value) => {
88613 return function constDependencyWithWebpackRequire(expr) {
88614 var dep = new ConstDependency(value, expr.range, true);
88615 dep.loc = expr.loc;
88616 parser.state.current.addDependency(dep);
88617 return true;
88618 };
88619};
88620
88621ParserHelpers.evaluateToString = value => {
88622 return function stringExpression(expr) {
88623 return new BasicEvaluatedExpression().setString(value).setRange(expr.range);
88624 };
88625};
88626
88627ParserHelpers.evaluateToBoolean = value => {
88628 return function booleanExpression(expr) {
88629 return new BasicEvaluatedExpression()
88630 .setBoolean(value)
88631 .setRange(expr.range);
88632 };
88633};
88634
88635ParserHelpers.evaluateToIdentifier = (identifier, truthy) => {
88636 return function identifierExpression(expr) {
88637 let evex = new BasicEvaluatedExpression()
88638 .setIdentifier(identifier)
88639 .setRange(expr.range);
88640 if (truthy === true) {
88641 evex = evex.setTruthy();
88642 } else if (truthy === false) {
88643 evex = evex.setFalsy();
88644 }
88645 return evex;
88646 };
88647};
88648
88649ParserHelpers.expressionIsUnsupported = (parser, message) => {
88650 return function unsupportedExpression(expr) {
88651 var dep = new ConstDependency("(void 0)", expr.range, false);
88652 dep.loc = expr.loc;
88653 parser.state.current.addDependency(dep);
88654 if (!parser.state.module) return;
88655 parser.state.module.warnings.push(
88656 new UnsupportedFeatureWarning(parser.state.module, message, expr.loc)
88657 );
88658 return true;
88659 };
88660};
88661
88662ParserHelpers.skipTraversal = function skipTraversal() {
88663 return true;
88664};
88665
88666ParserHelpers.approve = function approve() {
88667 return true;
88668};
88669
88670
88671/***/ }),
88672
88673/***/ 27850:
88674/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
88675
88676"use strict";
88677/*
88678 MIT License http://www.opensource.org/licenses/mit-license.php
88679 Author Tobias Koppers @sokra
88680*/
88681
88682const PrefetchDependency = __webpack_require__(14237);
88683
88684class PrefetchPlugin {
88685 constructor(context, request) {
88686 if (!request) {
88687 this.request = context;
88688 } else {
88689 this.context = context;
88690 this.request = request;
88691 }
88692 }
88693
88694 apply(compiler) {
88695 compiler.hooks.compilation.tap(
88696 "PrefetchPlugin",
88697 (compilation, { normalModuleFactory }) => {
88698 compilation.dependencyFactories.set(
88699 PrefetchDependency,
88700 normalModuleFactory
88701 );
88702 }
88703 );
88704 compiler.hooks.make.tapAsync("PrefetchPlugin", (compilation, callback) => {
88705 compilation.prefetch(
88706 this.context || compiler.context,
88707 new PrefetchDependency(this.request),
88708 callback
88709 );
88710 });
88711 }
88712}
88713module.exports = PrefetchPlugin;
88714
88715
88716/***/ }),
88717
88718/***/ 63123:
88719/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
88720
88721"use strict";
88722/*
88723 MIT License http://www.opensource.org/licenses/mit-license.php
88724 Author Tobias Koppers @sokra
88725*/
88726
88727
88728const validateOptions = __webpack_require__(33225);
88729const schema = __webpack_require__(26336);
88730
88731/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginArgument} ProgressPluginArgument */
88732/** @typedef {import("../declarations/plugins/ProgressPlugin").ProgressPluginOptions} ProgressPluginOptions */
88733
88734const createDefaultHandler = (profile, logger) => {
88735 let lastState;
88736 let lastStateTime;
88737
88738 const defaultHandler = (percentage, msg, ...args) => {
88739 logger.status(`${Math.floor(percentage * 100)}%`, msg, ...args);
88740 if (profile) {
88741 let state = msg;
88742 state = state.replace(/^\d+\/\d+\s+/, "");
88743 if (percentage === 0) {
88744 lastState = null;
88745 lastStateTime = Date.now();
88746 } else if (state !== lastState || percentage === 1) {
88747 const now = Date.now();
88748 if (lastState) {
88749 const diff = now - lastStateTime;
88750 const stateMsg = `${diff}ms ${lastState}`;
88751 if (diff > 1000) {
88752 logger.warn(stateMsg);
88753 } else if (diff > 10) {
88754 logger.info(stateMsg);
88755 } else if (diff > 0) {
88756 logger.log(stateMsg);
88757 } else {
88758 logger.debug(stateMsg);
88759 }
88760 }
88761 lastState = state;
88762 lastStateTime = now;
88763 }
88764 }
88765 if (percentage === 1) logger.status();
88766 };
88767
88768 return defaultHandler;
88769};
88770
88771class ProgressPlugin {
88772 /**
88773 * @param {ProgressPluginArgument} options options
88774 */
88775 constructor(options) {
88776 if (typeof options === "function") {
88777 options = {
88778 handler: options
88779 };
88780 }
88781
88782 options = options || {};
88783 validateOptions(schema, options, "Progress Plugin");
88784 options = Object.assign({}, ProgressPlugin.defaultOptions, options);
88785
88786 this.profile = options.profile;
88787 this.handler = options.handler;
88788 this.modulesCount = options.modulesCount;
88789 this.showEntries = options.entries;
88790 this.showModules = options.modules;
88791 this.showActiveModules = options.activeModules;
88792 }
88793
88794 apply(compiler) {
88795 const { modulesCount } = this;
88796 const handler =
88797 this.handler ||
88798 createDefaultHandler(
88799 this.profile,
88800 compiler.getInfrastructureLogger("webpack.Progress")
88801 );
88802 const showEntries = this.showEntries;
88803 const showModules = this.showModules;
88804 const showActiveModules = this.showActiveModules;
88805 if (compiler.compilers) {
88806 const states = new Array(compiler.compilers.length);
88807 compiler.compilers.forEach((compiler, idx) => {
88808 new ProgressPlugin((p, msg, ...args) => {
88809 states[idx] = [p, msg, ...args];
88810 handler(
88811 states
88812 .map(state => (state && state[0]) || 0)
88813 .reduce((a, b) => a + b) / states.length,
88814 `[${idx}] ${msg}`,
88815 ...args
88816 );
88817 }).apply(compiler);
88818 });
88819 } else {
88820 let lastModulesCount = 0;
88821 let lastEntriesCount = 0;
88822 let moduleCount = modulesCount;
88823 let entriesCount = 1;
88824 let doneModules = 0;
88825 let doneEntries = 0;
88826 const activeModules = new Set();
88827 let lastActiveModule = "";
88828
88829 const update = () => {
88830 const percentByModules =
88831 doneModules / Math.max(lastModulesCount, moduleCount);
88832 const percentByEntries =
88833 doneEntries / Math.max(lastEntriesCount, entriesCount);
88834
88835 const items = [
88836 0.1 + Math.max(percentByModules, percentByEntries) * 0.6,
88837 "building"
88838 ];
88839 if (showEntries) {
88840 items.push(`${doneEntries}/${entriesCount} entries`);
88841 }
88842 if (showModules) {
88843 items.push(`${doneModules}/${moduleCount} modules`);
88844 }
88845 if (showActiveModules) {
88846 items.push(`${activeModules.size} active`);
88847 items.push(lastActiveModule);
88848 }
88849 handler(...items);
88850 };
88851
88852 const moduleAdd = module => {
88853 moduleCount++;
88854 if (showActiveModules) {
88855 const ident = module.identifier();
88856 if (ident) {
88857 activeModules.add(ident);
88858 lastActiveModule = ident;
88859 }
88860 }
88861 update();
88862 };
88863
88864 const entryAdd = (entry, name) => {
88865 entriesCount++;
88866 update();
88867 };
88868
88869 const moduleDone = module => {
88870 doneModules++;
88871 if (showActiveModules) {
88872 const ident = module.identifier();
88873 if (ident) {
88874 activeModules.delete(ident);
88875 if (lastActiveModule === ident) {
88876 lastActiveModule = "";
88877 for (const m of activeModules) {
88878 lastActiveModule = m;
88879 }
88880 }
88881 }
88882 }
88883 update();
88884 };
88885
88886 const entryDone = (entry, name) => {
88887 doneEntries++;
88888 update();
88889 };
88890
88891 compiler.hooks.compilation.tap("ProgressPlugin", compilation => {
88892 if (compilation.compiler.isChild()) return;
88893 lastModulesCount = moduleCount;
88894 lastEntriesCount = entriesCount;
88895 moduleCount = entriesCount = 0;
88896 doneModules = doneEntries = 0;
88897 handler(0, "compiling");
88898
88899 compilation.hooks.buildModule.tap("ProgressPlugin", moduleAdd);
88900 compilation.hooks.failedModule.tap("ProgressPlugin", moduleDone);
88901 compilation.hooks.succeedModule.tap("ProgressPlugin", moduleDone);
88902
88903 compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd);
88904 compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone);
88905 compilation.hooks.succeedEntry.tap("ProgressPlugin", entryDone);
88906
88907 const hooks = {
88908 finishModules: "finish module graph",
88909 seal: "sealing",
88910 beforeChunks: "chunk graph",
88911 afterChunks: "after chunk graph",
88912 optimizeDependenciesBasic: "basic dependencies optimization",
88913 optimizeDependencies: "dependencies optimization",
88914 optimizeDependenciesAdvanced: "advanced dependencies optimization",
88915 afterOptimizeDependencies: "after dependencies optimization",
88916 optimize: "optimizing",
88917 optimizeModulesBasic: "basic module optimization",
88918 optimizeModules: "module optimization",
88919 optimizeModulesAdvanced: "advanced module optimization",
88920 afterOptimizeModules: "after module optimization",
88921 optimizeChunksBasic: "basic chunk optimization",
88922 optimizeChunks: "chunk optimization",
88923 optimizeChunksAdvanced: "advanced chunk optimization",
88924 afterOptimizeChunks: "after chunk optimization",
88925 optimizeTree: "module and chunk tree optimization",
88926 afterOptimizeTree: "after module and chunk tree optimization",
88927 optimizeChunkModulesBasic: "basic chunk modules optimization",
88928 optimizeChunkModules: "chunk modules optimization",
88929 optimizeChunkModulesAdvanced: "advanced chunk modules optimization",
88930 afterOptimizeChunkModules: "after chunk modules optimization",
88931 reviveModules: "module reviving",
88932 optimizeModuleOrder: "module order optimization",
88933 advancedOptimizeModuleOrder: "advanced module order optimization",
88934 beforeModuleIds: "before module ids",
88935 moduleIds: "module ids",
88936 optimizeModuleIds: "module id optimization",
88937 afterOptimizeModuleIds: "module id optimization",
88938 reviveChunks: "chunk reviving",
88939 optimizeChunkOrder: "chunk order optimization",
88940 beforeChunkIds: "before chunk ids",
88941 optimizeChunkIds: "chunk id optimization",
88942 afterOptimizeChunkIds: "after chunk id optimization",
88943 recordModules: "record modules",
88944 recordChunks: "record chunks",
88945 beforeHash: "hashing",
88946 afterHash: "after hashing",
88947 recordHash: "record hash",
88948 beforeModuleAssets: "module assets processing",
88949 beforeChunkAssets: "chunk assets processing",
88950 additionalChunkAssets: "additional chunk assets processing",
88951 record: "recording",
88952 additionalAssets: "additional asset processing",
88953 optimizeChunkAssets: "chunk asset optimization",
88954 afterOptimizeChunkAssets: "after chunk asset optimization",
88955 optimizeAssets: "asset optimization",
88956 afterOptimizeAssets: "after asset optimization",
88957 afterSeal: "after seal"
88958 };
88959 const numberOfHooks = Object.keys(hooks).length;
88960 Object.keys(hooks).forEach((name, idx) => {
88961 const title = hooks[name];
88962 const percentage = (idx / numberOfHooks) * 0.25 + 0.7;
88963 compilation.hooks[name].intercept({
88964 name: "ProgressPlugin",
88965 context: true,
88966 call: () => {
88967 handler(percentage, title);
88968 },
88969 tap: (context, tap) => {
88970 if (context) {
88971 // p is percentage from 0 to 1
88972 // args is any number of messages in a hierarchical matter
88973 context.reportProgress = (p, ...args) => {
88974 handler(percentage, title, tap.name, ...args);
88975 };
88976 }
88977 handler(percentage, title, tap.name);
88978 }
88979 });
88980 });
88981 });
88982 compiler.hooks.emit.intercept({
88983 name: "ProgressPlugin",
88984 context: true,
88985 call: () => {
88986 handler(0.95, "emitting");
88987 },
88988 tap: (context, tap) => {
88989 if (context) {
88990 context.reportProgress = (p, ...args) => {
88991 handler(0.95, "emitting", tap.name, ...args);
88992 };
88993 }
88994 handler(0.95, "emitting", tap.name);
88995 }
88996 });
88997 compiler.hooks.afterEmit.intercept({
88998 name: "ProgressPlugin",
88999 context: true,
89000 call: () => {
89001 handler(0.98, "after emitting");
89002 },
89003 tap: (context, tap) => {
89004 if (context) {
89005 context.reportProgress = (p, ...args) => {
89006 handler(0.98, "after emitting", tap.name, ...args);
89007 };
89008 }
89009 handler(0.98, "after emitting", tap.name);
89010 }
89011 });
89012 compiler.hooks.done.tap("ProgressPlugin", () => {
89013 handler(1, "");
89014 });
89015 }
89016 }
89017}
89018
89019ProgressPlugin.defaultOptions = {
89020 profile: false,
89021 modulesCount: 500,
89022 modules: true,
89023 activeModules: true,
89024 // TODO webpack 5 default this to true
89025 entries: false
89026};
89027
89028module.exports = ProgressPlugin;
89029
89030
89031/***/ }),
89032
89033/***/ 72861:
89034/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89035
89036"use strict";
89037/*
89038 MIT License http://www.opensource.org/licenses/mit-license.php
89039 Author Tobias Koppers @sokra
89040*/
89041
89042
89043const ParserHelpers = __webpack_require__(23999);
89044const ConstDependency = __webpack_require__(71101);
89045
89046const NullFactory = __webpack_require__(40438);
89047
89048class ProvidePlugin {
89049 constructor(definitions) {
89050 this.definitions = definitions;
89051 }
89052
89053 apply(compiler) {
89054 const definitions = this.definitions;
89055 compiler.hooks.compilation.tap(
89056 "ProvidePlugin",
89057 (compilation, { normalModuleFactory }) => {
89058 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
89059 compilation.dependencyTemplates.set(
89060 ConstDependency,
89061 new ConstDependency.Template()
89062 );
89063 const handler = (parser, parserOptions) => {
89064 Object.keys(definitions).forEach(name => {
89065 var request = [].concat(definitions[name]);
89066 var splittedName = name.split(".");
89067 if (splittedName.length > 0) {
89068 splittedName.slice(1).forEach((_, i) => {
89069 const name = splittedName.slice(0, i + 1).join(".");
89070 parser.hooks.canRename
89071 .for(name)
89072 .tap("ProvidePlugin", ParserHelpers.approve);
89073 });
89074 }
89075 parser.hooks.expression.for(name).tap("ProvidePlugin", expr => {
89076 let nameIdentifier = name;
89077 const scopedName = name.includes(".");
89078 let expression = `require(${JSON.stringify(request[0])})`;
89079 if (scopedName) {
89080 nameIdentifier = `__webpack_provided_${name.replace(
89081 /\./g,
89082 "_dot_"
89083 )}`;
89084 }
89085 if (request.length > 1) {
89086 expression += request
89087 .slice(1)
89088 .map(r => `[${JSON.stringify(r)}]`)
89089 .join("");
89090 }
89091 if (
89092 !ParserHelpers.addParsedVariableToModule(
89093 parser,
89094 nameIdentifier,
89095 expression
89096 )
89097 ) {
89098 return false;
89099 }
89100 if (scopedName) {
89101 ParserHelpers.toConstantDependency(
89102 parser,
89103 nameIdentifier
89104 )(expr);
89105 }
89106 return true;
89107 });
89108 });
89109 };
89110 normalModuleFactory.hooks.parser
89111 .for("javascript/auto")
89112 .tap("ProvidePlugin", handler);
89113 normalModuleFactory.hooks.parser
89114 .for("javascript/dynamic")
89115 .tap("ProvidePlugin", handler);
89116
89117 // Disable ProvidePlugin for javascript/esm, see https://github.com/webpack/webpack/issues/7032
89118 }
89119 );
89120 }
89121}
89122module.exports = ProvidePlugin;
89123
89124
89125/***/ }),
89126
89127/***/ 82353:
89128/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89129
89130"use strict";
89131/*
89132 MIT License http://www.opensource.org/licenses/mit-license.php
89133 Author Tobias Koppers @sokra
89134*/
89135
89136
89137const Module = __webpack_require__(75993);
89138const { OriginalSource, RawSource } = __webpack_require__(53665);
89139
89140module.exports = class RawModule extends Module {
89141 constructor(source, identifier, readableIdentifier) {
89142 super("javascript/dynamic", null);
89143 this.sourceStr = source;
89144 this.identifierStr = identifier || this.sourceStr;
89145 this.readableIdentifierStr = readableIdentifier || this.identifierStr;
89146 this.built = false;
89147 }
89148
89149 identifier() {
89150 return this.identifierStr;
89151 }
89152
89153 size() {
89154 return this.sourceStr.length;
89155 }
89156
89157 readableIdentifier(requestShortener) {
89158 return requestShortener.shorten(this.readableIdentifierStr);
89159 }
89160
89161 needRebuild() {
89162 return false;
89163 }
89164
89165 build(options, compilations, resolver, fs, callback) {
89166 this.built = true;
89167 this.buildMeta = {};
89168 this.buildInfo = {
89169 cacheable: true
89170 };
89171 callback();
89172 }
89173
89174 source() {
89175 if (this.useSourceMap) {
89176 return new OriginalSource(this.sourceStr, this.identifier());
89177 } else {
89178 return new RawSource(this.sourceStr);
89179 }
89180 }
89181
89182 updateHash(hash) {
89183 hash.update(this.sourceStr);
89184 super.updateHash(hash);
89185 }
89186};
89187
89188
89189/***/ }),
89190
89191/***/ 40355:
89192/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89193
89194"use strict";
89195/*
89196 MIT License http://www.opensource.org/licenses/mit-license.php
89197 Author Tobias Koppers @sokra
89198*/
89199
89200
89201const identifierUtils = __webpack_require__(94658);
89202
89203/** @typedef {import("./Compiler")} Compiler */
89204/** @typedef {import("./Chunk")} Chunk */
89205/** @typedef {import("./Module")} Module */
89206
89207/**
89208 * @typedef {Object} RecordsChunks
89209 * @property {Record<string, number>=} byName
89210 * @property {Record<string, number>=} bySource
89211 * @property {number[]=} usedIds
89212 */
89213
89214/**
89215 * @typedef {Object} RecordsModules
89216 * @property {Record<string, number>=} byIdentifier
89217 * @property {Record<string, number>=} bySource
89218 * @property {Record<number, number>=} usedIds
89219 */
89220
89221/**
89222 * @typedef {Object} Records
89223 * @property {RecordsChunks=} chunks
89224 * @property {RecordsModules=} modules
89225 */
89226
89227class RecordIdsPlugin {
89228 /**
89229 * @param {Object} options Options object
89230 * @param {boolean=} options.portableIds true, when ids need to be portable
89231 */
89232 constructor(options) {
89233 this.options = options || {};
89234 }
89235
89236 /**
89237 * @param {Compiler} compiler the Compiler
89238 * @returns {void}
89239 */
89240 apply(compiler) {
89241 const portableIds = this.options.portableIds;
89242 compiler.hooks.compilation.tap("RecordIdsPlugin", compilation => {
89243 compilation.hooks.recordModules.tap(
89244 "RecordIdsPlugin",
89245 /**
89246 * @param {Module[]} modules the modules array
89247 * @param {Records} records the records object
89248 * @returns {void}
89249 */
89250 (modules, records) => {
89251 if (!records.modules) records.modules = {};
89252 if (!records.modules.byIdentifier) records.modules.byIdentifier = {};
89253 if (!records.modules.usedIds) records.modules.usedIds = {};
89254 for (const module of modules) {
89255 if (typeof module.id !== "number") continue;
89256 const identifier = portableIds
89257 ? identifierUtils.makePathsRelative(
89258 compiler.context,
89259 module.identifier(),
89260 compilation.cache
89261 )
89262 : module.identifier();
89263 records.modules.byIdentifier[identifier] = module.id;
89264 records.modules.usedIds[module.id] = module.id;
89265 }
89266 }
89267 );
89268 compilation.hooks.reviveModules.tap(
89269 "RecordIdsPlugin",
89270 /**
89271 * @param {Module[]} modules the modules array
89272 * @param {Records} records the records object
89273 * @returns {void}
89274 */
89275 (modules, records) => {
89276 if (!records.modules) return;
89277 if (records.modules.byIdentifier) {
89278 /** @type {Set<number>} */
89279 const usedIds = new Set();
89280 for (const module of modules) {
89281 if (module.id !== null) continue;
89282 const identifier = portableIds
89283 ? identifierUtils.makePathsRelative(
89284 compiler.context,
89285 module.identifier(),
89286 compilation.cache
89287 )
89288 : module.identifier();
89289 const id = records.modules.byIdentifier[identifier];
89290 if (id === undefined) continue;
89291 if (usedIds.has(id)) continue;
89292 usedIds.add(id);
89293 module.id = id;
89294 }
89295 }
89296 if (Array.isArray(records.modules.usedIds)) {
89297 compilation.usedModuleIds = new Set(records.modules.usedIds);
89298 }
89299 }
89300 );
89301
89302 /**
89303 * @param {Module} module the module
89304 * @returns {string} the (portable) identifier
89305 */
89306 const getModuleIdentifier = module => {
89307 if (portableIds) {
89308 return identifierUtils.makePathsRelative(
89309 compiler.context,
89310 module.identifier(),
89311 compilation.cache
89312 );
89313 }
89314 return module.identifier();
89315 };
89316
89317 /**
89318 * @param {Chunk} chunk the chunk
89319 * @returns {string[]} sources of the chunk
89320 */
89321 const getChunkSources = chunk => {
89322 /** @type {string[]} */
89323 const sources = [];
89324 for (const chunkGroup of chunk.groupsIterable) {
89325 const index = chunkGroup.chunks.indexOf(chunk);
89326 if (chunkGroup.name) {
89327 sources.push(`${index} ${chunkGroup.name}`);
89328 } else {
89329 for (const origin of chunkGroup.origins) {
89330 if (origin.module) {
89331 if (origin.request) {
89332 sources.push(
89333 `${index} ${getModuleIdentifier(origin.module)} ${
89334 origin.request
89335 }`
89336 );
89337 } else if (typeof origin.loc === "string") {
89338 sources.push(
89339 `${index} ${getModuleIdentifier(origin.module)} ${
89340 origin.loc
89341 }`
89342 );
89343 } else if (
89344 origin.loc &&
89345 typeof origin.loc === "object" &&
89346 origin.loc.start
89347 ) {
89348 sources.push(
89349 `${index} ${getModuleIdentifier(
89350 origin.module
89351 )} ${JSON.stringify(origin.loc.start)}`
89352 );
89353 }
89354 }
89355 }
89356 }
89357 }
89358 return sources;
89359 };
89360
89361 compilation.hooks.recordChunks.tap(
89362 "RecordIdsPlugin",
89363 /**
89364 * @param {Chunk[]} chunks the chunks array
89365 * @param {Records} records the records object
89366 * @returns {void}
89367 */
89368 (chunks, records) => {
89369 if (!records.chunks) records.chunks = {};
89370 if (!records.chunks.byName) records.chunks.byName = {};
89371 if (!records.chunks.bySource) records.chunks.bySource = {};
89372 /** @type {Set<number>} */
89373 const usedIds = new Set();
89374 for (const chunk of chunks) {
89375 if (typeof chunk.id !== "number") continue;
89376 const name = chunk.name;
89377 if (name) records.chunks.byName[name] = chunk.id;
89378 const sources = getChunkSources(chunk);
89379 for (const source of sources) {
89380 records.chunks.bySource[source] = chunk.id;
89381 }
89382 usedIds.add(chunk.id);
89383 }
89384 records.chunks.usedIds = Array.from(usedIds).sort();
89385 }
89386 );
89387 compilation.hooks.reviveChunks.tap(
89388 "RecordIdsPlugin",
89389 /**
89390 * @param {Chunk[]} chunks the chunks array
89391 * @param {Records} records the records object
89392 * @returns {void}
89393 */
89394 (chunks, records) => {
89395 if (!records.chunks) return;
89396 /** @type {Set<number>} */
89397 const usedIds = new Set();
89398 if (records.chunks.byName) {
89399 for (const chunk of chunks) {
89400 if (chunk.id !== null) continue;
89401 if (!chunk.name) continue;
89402 const id = records.chunks.byName[chunk.name];
89403 if (id === undefined) continue;
89404 if (usedIds.has(id)) continue;
89405 usedIds.add(id);
89406 chunk.id = id;
89407 }
89408 }
89409 if (records.chunks.bySource) {
89410 for (const chunk of chunks) {
89411 const sources = getChunkSources(chunk);
89412 for (const source of sources) {
89413 const id = records.chunks.bySource[source];
89414 if (id === undefined) continue;
89415 if (usedIds.has(id)) continue;
89416 usedIds.add(id);
89417 chunk.id = id;
89418 break;
89419 }
89420 }
89421 }
89422 if (Array.isArray(records.chunks.usedIds)) {
89423 compilation.usedChunkIds = new Set(records.chunks.usedIds);
89424 }
89425 }
89426 );
89427 });
89428 }
89429}
89430module.exports = RecordIdsPlugin;
89431
89432
89433/***/ }),
89434
89435/***/ 15377:
89436/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89437
89438"use strict";
89439
89440
89441const WebpackError = __webpack_require__(97391);
89442
89443module.exports = class RemovedPluginError extends WebpackError {
89444 constructor(message) {
89445 super(message);
89446
89447 Error.captureStackTrace(this, this.constructor);
89448 }
89449};
89450
89451
89452/***/ }),
89453
89454/***/ 54254:
89455/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89456
89457"use strict";
89458/*
89459 MIT License http://www.opensource.org/licenses/mit-license.php
89460 Author Tobias Koppers @sokra
89461*/
89462
89463
89464const path = __webpack_require__(85622);
89465const NORMALIZE_SLASH_DIRECTION_REGEXP = /\\/g;
89466const PATH_CHARS_REGEXP = /[-[\]{}()*+?.,\\^$|#\s]/g;
89467const SEPARATOR_REGEXP = /[/\\]$/;
89468const FRONT_OR_BACK_BANG_REGEXP = /^!|!$/g;
89469const INDEX_JS_REGEXP = /\/index.js(!|\?|\(query\))/g;
89470const MATCH_RESOURCE_REGEXP = /!=!/;
89471
89472const normalizeBackSlashDirection = request => {
89473 return request.replace(NORMALIZE_SLASH_DIRECTION_REGEXP, "/");
89474};
89475
89476const createRegExpForPath = path => {
89477 const regexpTypePartial = path.replace(PATH_CHARS_REGEXP, "\\$&");
89478 return new RegExp(`(^|!)${regexpTypePartial}`, "g");
89479};
89480
89481class RequestShortener {
89482 constructor(directory) {
89483 directory = normalizeBackSlashDirection(directory);
89484 if (SEPARATOR_REGEXP.test(directory)) {
89485 directory = directory.substr(0, directory.length - 1);
89486 }
89487
89488 if (directory) {
89489 this.currentDirectoryRegExp = createRegExpForPath(directory);
89490 }
89491
89492 const dirname = path.dirname(directory);
89493 const endsWithSeparator = SEPARATOR_REGEXP.test(dirname);
89494 const parentDirectory = endsWithSeparator
89495 ? dirname.substr(0, dirname.length - 1)
89496 : dirname;
89497 if (parentDirectory && parentDirectory !== directory) {
89498 this.parentDirectoryRegExp = createRegExpForPath(`${parentDirectory}/`);
89499 }
89500
89501 if (__dirname.length >= 2) {
89502 const buildins = normalizeBackSlashDirection(path.join(__dirname, ".."));
89503 const buildinsAsModule =
89504 this.currentDirectoryRegExp &&
89505 this.currentDirectoryRegExp.test(buildins);
89506 this.buildinsAsModule = buildinsAsModule;
89507 this.buildinsRegExp = createRegExpForPath(buildins);
89508 }
89509
89510 this.cache = new Map();
89511 }
89512
89513 shorten(request) {
89514 if (!request) return request;
89515 const cacheEntry = this.cache.get(request);
89516 if (cacheEntry !== undefined) {
89517 return cacheEntry;
89518 }
89519 let result = normalizeBackSlashDirection(request);
89520 if (this.buildinsAsModule && this.buildinsRegExp) {
89521 result = result.replace(this.buildinsRegExp, "!(webpack)");
89522 }
89523 if (this.currentDirectoryRegExp) {
89524 result = result.replace(this.currentDirectoryRegExp, "!.");
89525 }
89526 if (this.parentDirectoryRegExp) {
89527 result = result.replace(this.parentDirectoryRegExp, "!../");
89528 }
89529 if (!this.buildinsAsModule && this.buildinsRegExp) {
89530 result = result.replace(this.buildinsRegExp, "!(webpack)");
89531 }
89532 result = result.replace(INDEX_JS_REGEXP, "$1");
89533 result = result.replace(FRONT_OR_BACK_BANG_REGEXP, "");
89534 result = result.replace(MATCH_RESOURCE_REGEXP, " = ");
89535 this.cache.set(request, result);
89536 return result;
89537 }
89538}
89539
89540module.exports = RequestShortener;
89541
89542
89543/***/ }),
89544
89545/***/ 88226:
89546/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89547
89548"use strict";
89549/*
89550 MIT License http://www.opensource.org/licenses/mit-license.php
89551 Author Tobias Koppers @sokra
89552*/
89553
89554
89555const ParserHelpers = __webpack_require__(23999);
89556const ConstDependency = __webpack_require__(71101);
89557const NullFactory = __webpack_require__(40438);
89558
89559module.exports = class RequireJsStuffPlugin {
89560 apply(compiler) {
89561 compiler.hooks.compilation.tap(
89562 "RequireJsStuffPlugin",
89563 (compilation, { normalModuleFactory }) => {
89564 compilation.dependencyFactories.set(ConstDependency, new NullFactory());
89565 compilation.dependencyTemplates.set(
89566 ConstDependency,
89567 new ConstDependency.Template()
89568 );
89569 const handler = (parser, parserOptions) => {
89570 if (parserOptions.requireJs !== undefined && !parserOptions.requireJs)
89571 return;
89572
89573 parser.hooks.call
89574 .for("require.config")
89575 .tap(
89576 "RequireJsStuffPlugin",
89577 ParserHelpers.toConstantDependency(parser, "undefined")
89578 );
89579 parser.hooks.call
89580 .for("requirejs.config")
89581 .tap(
89582 "RequireJsStuffPlugin",
89583 ParserHelpers.toConstantDependency(parser, "undefined")
89584 );
89585
89586 parser.hooks.expression
89587 .for("require.version")
89588 .tap(
89589 "RequireJsStuffPlugin",
89590 ParserHelpers.toConstantDependency(
89591 parser,
89592 JSON.stringify("0.0.0")
89593 )
89594 );
89595 parser.hooks.expression
89596 .for("requirejs.onError")
89597 .tap(
89598 "RequireJsStuffPlugin",
89599 ParserHelpers.toConstantDependencyWithWebpackRequire(
89600 parser,
89601 "__webpack_require__.oe"
89602 )
89603 );
89604 };
89605 normalModuleFactory.hooks.parser
89606 .for("javascript/auto")
89607 .tap("RequireJsStuffPlugin", handler);
89608 normalModuleFactory.hooks.parser
89609 .for("javascript/dynamic")
89610 .tap("RequireJsStuffPlugin", handler);
89611 }
89612 );
89613 }
89614};
89615
89616
89617/***/ }),
89618
89619/***/ 50588:
89620/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
89621
89622"use strict";
89623/*
89624 MIT License http://www.opensource.org/licenses/mit-license.php
89625 Author Tobias Koppers @sokra
89626 */
89627
89628
89629const { Tapable, HookMap, SyncHook, SyncWaterfallHook } = __webpack_require__(56758);
89630const Factory = __webpack_require__(87450).ResolverFactory;
89631const { cachedCleverMerge } = __webpack_require__(67916);
89632
89633/** @typedef {import("enhanced-resolve").Resolver} Resolver */
89634
89635const EMTPY_RESOLVE_OPTIONS = {};
89636
89637module.exports = class ResolverFactory extends Tapable {
89638 constructor() {
89639 super();
89640 this.hooks = {
89641 resolveOptions: new HookMap(
89642 () => new SyncWaterfallHook(["resolveOptions"])
89643 ),
89644 resolver: new HookMap(() => new SyncHook(["resolver", "resolveOptions"]))
89645 };
89646 this._pluginCompat.tap("ResolverFactory", options => {
89647 let match;
89648 match = /^resolve-options (.+)$/.exec(options.name);
89649 if (match) {
89650 this.hooks.resolveOptions
89651 .for(match[1])
89652 .tap(options.fn.name || "unnamed compat plugin", options.fn);
89653 return true;
89654 }
89655 match = /^resolver (.+)$/.exec(options.name);
89656 if (match) {
89657 this.hooks.resolver
89658 .for(match[1])
89659 .tap(options.fn.name || "unnamed compat plugin", options.fn);
89660 return true;
89661 }
89662 });
89663 this.cache2 = new Map();
89664 }
89665
89666 get(type, resolveOptions) {
89667 resolveOptions = resolveOptions || EMTPY_RESOLVE_OPTIONS;
89668 const ident = `${type}|${JSON.stringify(resolveOptions)}`;
89669 const resolver = this.cache2.get(ident);
89670 if (resolver) return resolver;
89671 const newResolver = this._create(type, resolveOptions);
89672 this.cache2.set(ident, newResolver);
89673 return newResolver;
89674 }
89675
89676 _create(type, resolveOptions) {
89677 const originalResolveOptions = Object.assign({}, resolveOptions);
89678 resolveOptions = this.hooks.resolveOptions.for(type).call(resolveOptions);
89679 const resolver = Factory.createResolver(resolveOptions);
89680 if (!resolver) {
89681 throw new Error("No resolver created");
89682 }
89683 /** @type {Map<Object, Resolver>} */
89684 const childCache = new Map();
89685 resolver.withOptions = options => {
89686 const cacheEntry = childCache.get(options);
89687 if (cacheEntry !== undefined) return cacheEntry;
89688 const mergedOptions = cachedCleverMerge(originalResolveOptions, options);
89689 const resolver = this.get(type, mergedOptions);
89690 childCache.set(options, resolver);
89691 return resolver;
89692 };
89693 this.hooks.resolver.for(type).call(resolver, resolveOptions);
89694 return resolver;
89695 }
89696};
89697
89698
89699/***/ }),
89700
89701/***/ 84247:
89702/***/ (function(module) {
89703
89704"use strict";
89705/*
89706 MIT License http://www.opensource.org/licenses/mit-license.php
89707 Author Tobias Koppers @sokra
89708*/
89709/*
89710<rules>: <rule>
89711<rules>: [<rule>]
89712<rule>: {
89713 resource: {
89714 test: <condition>,
89715 include: <condition>,
89716 exclude: <condition>,
89717 },
89718 resource: <condition>, -> resource.test
89719 test: <condition>, -> resource.test
89720 include: <condition>, -> resource.include
89721 exclude: <condition>, -> resource.exclude
89722 resourceQuery: <condition>,
89723 compiler: <condition>,
89724 issuer: <condition>,
89725 use: "loader", -> use[0].loader
89726 loader: <>, -> use[0].loader
89727 loaders: <>, -> use
89728 options: {}, -> use[0].options,
89729 query: {}, -> options
89730 parser: {},
89731 use: [
89732 "loader" -> use[x].loader
89733 ],
89734 use: [
89735 {
89736 loader: "loader",
89737 options: {}
89738 }
89739 ],
89740 rules: [
89741 <rule>
89742 ],
89743 oneOf: [
89744 <rule>
89745 ]
89746}
89747
89748<condition>: /regExp/
89749<condition>: function(arg) {}
89750<condition>: "starting"
89751<condition>: [<condition>] // or
89752<condition>: { and: [<condition>] }
89753<condition>: { or: [<condition>] }
89754<condition>: { not: [<condition>] }
89755<condition>: { test: <condition>, include: <condition>, exclude: <condition> }
89756
89757
89758normalized:
89759
89760{
89761 resource: function(),
89762 resourceQuery: function(),
89763 compiler: function(),
89764 issuer: function(),
89765 use: [
89766 {
89767 loader: string,
89768 options: string,
89769 <any>: <any>
89770 }
89771 ],
89772 rules: [<rule>],
89773 oneOf: [<rule>],
89774 <any>: <any>,
89775}
89776
89777*/
89778
89779
89780
89781const notMatcher = matcher => {
89782 return str => {
89783 return !matcher(str);
89784 };
89785};
89786
89787const orMatcher = items => {
89788 return str => {
89789 for (let i = 0; i < items.length; i++) {
89790 if (items[i](str)) return true;
89791 }
89792 return false;
89793 };
89794};
89795
89796const andMatcher = items => {
89797 return str => {
89798 for (let i = 0; i < items.length; i++) {
89799 if (!items[i](str)) return false;
89800 }
89801 return true;
89802 };
89803};
89804
89805module.exports = class RuleSet {
89806 constructor(rules) {
89807 this.references = Object.create(null);
89808 this.rules = RuleSet.normalizeRules(rules, this.references, "ref-");
89809 }
89810
89811 static normalizeRules(rules, refs, ident) {
89812 if (Array.isArray(rules)) {
89813 return rules.map((rule, idx) => {
89814 return RuleSet.normalizeRule(rule, refs, `${ident}-${idx}`);
89815 });
89816 } else if (rules) {
89817 return [RuleSet.normalizeRule(rules, refs, ident)];
89818 } else {
89819 return [];
89820 }
89821 }
89822
89823 static normalizeRule(rule, refs, ident) {
89824 if (typeof rule === "string") {
89825 return {
89826 use: [
89827 {
89828 loader: rule
89829 }
89830 ]
89831 };
89832 }
89833 if (!rule) {
89834 throw new Error("Unexcepted null when object was expected as rule");
89835 }
89836 if (typeof rule !== "object") {
89837 throw new Error(
89838 "Unexcepted " +
89839 typeof rule +
89840 " when object was expected as rule (" +
89841 rule +
89842 ")"
89843 );
89844 }
89845
89846 const newRule = {};
89847 let useSource;
89848 let resourceSource;
89849 let condition;
89850
89851 const checkUseSource = newSource => {
89852 if (useSource && useSource !== newSource) {
89853 throw new Error(
89854 RuleSet.buildErrorMessage(
89855 rule,
89856 new Error(
89857 "Rule can only have one result source (provided " +
89858 newSource +
89859 " and " +
89860 useSource +
89861 ")"
89862 )
89863 )
89864 );
89865 }
89866 useSource = newSource;
89867 };
89868
89869 const checkResourceSource = newSource => {
89870 if (resourceSource && resourceSource !== newSource) {
89871 throw new Error(
89872 RuleSet.buildErrorMessage(
89873 rule,
89874 new Error(
89875 "Rule can only have one resource source (provided " +
89876 newSource +
89877 " and " +
89878 resourceSource +
89879 ")"
89880 )
89881 )
89882 );
89883 }
89884 resourceSource = newSource;
89885 };
89886
89887 if (rule.test || rule.include || rule.exclude) {
89888 checkResourceSource("test + include + exclude");
89889 condition = {
89890 test: rule.test,
89891 include: rule.include,
89892 exclude: rule.exclude
89893 };
89894 try {
89895 newRule.resource = RuleSet.normalizeCondition(condition);
89896 } catch (error) {
89897 throw new Error(RuleSet.buildErrorMessage(condition, error));
89898 }
89899 }
89900
89901 if (rule.resource) {
89902 checkResourceSource("resource");
89903 try {
89904 newRule.resource = RuleSet.normalizeCondition(rule.resource);
89905 } catch (error) {
89906 throw new Error(RuleSet.buildErrorMessage(rule.resource, error));
89907 }
89908 }
89909
89910 if (rule.realResource) {
89911 try {
89912 newRule.realResource = RuleSet.normalizeCondition(rule.realResource);
89913 } catch (error) {
89914 throw new Error(RuleSet.buildErrorMessage(rule.realResource, error));
89915 }
89916 }
89917
89918 if (rule.resourceQuery) {
89919 try {
89920 newRule.resourceQuery = RuleSet.normalizeCondition(rule.resourceQuery);
89921 } catch (error) {
89922 throw new Error(RuleSet.buildErrorMessage(rule.resourceQuery, error));
89923 }
89924 }
89925
89926 if (rule.compiler) {
89927 try {
89928 newRule.compiler = RuleSet.normalizeCondition(rule.compiler);
89929 } catch (error) {
89930 throw new Error(RuleSet.buildErrorMessage(rule.compiler, error));
89931 }
89932 }
89933
89934 if (rule.issuer) {
89935 try {
89936 newRule.issuer = RuleSet.normalizeCondition(rule.issuer);
89937 } catch (error) {
89938 throw new Error(RuleSet.buildErrorMessage(rule.issuer, error));
89939 }
89940 }
89941
89942 if (rule.loader && rule.loaders) {
89943 throw new Error(
89944 RuleSet.buildErrorMessage(
89945 rule,
89946 new Error(
89947 "Provided loader and loaders for rule (use only one of them)"
89948 )
89949 )
89950 );
89951 }
89952
89953 const loader = rule.loaders || rule.loader;
89954 if (typeof loader === "string" && !rule.options && !rule.query) {
89955 checkUseSource("loader");
89956 newRule.use = RuleSet.normalizeUse(loader.split("!"), ident);
89957 } else if (typeof loader === "string" && (rule.options || rule.query)) {
89958 checkUseSource("loader + options/query");
89959 newRule.use = RuleSet.normalizeUse(
89960 {
89961 loader: loader,
89962 options: rule.options,
89963 query: rule.query
89964 },
89965 ident
89966 );
89967 } else if (loader && (rule.options || rule.query)) {
89968 throw new Error(
89969 RuleSet.buildErrorMessage(
89970 rule,
89971 new Error(
89972 "options/query cannot be used with loaders (use options for each array item)"
89973 )
89974 )
89975 );
89976 } else if (loader) {
89977 checkUseSource("loaders");
89978 newRule.use = RuleSet.normalizeUse(loader, ident);
89979 } else if (rule.options || rule.query) {
89980 throw new Error(
89981 RuleSet.buildErrorMessage(
89982 rule,
89983 new Error(
89984 "options/query provided without loader (use loader + options)"
89985 )
89986 )
89987 );
89988 }
89989
89990 if (rule.use) {
89991 checkUseSource("use");
89992 newRule.use = RuleSet.normalizeUse(rule.use, ident);
89993 }
89994
89995 if (rule.rules) {
89996 newRule.rules = RuleSet.normalizeRules(
89997 rule.rules,
89998 refs,
89999 `${ident}-rules`
90000 );
90001 }
90002
90003 if (rule.oneOf) {
90004 newRule.oneOf = RuleSet.normalizeRules(
90005 rule.oneOf,
90006 refs,
90007 `${ident}-oneOf`
90008 );
90009 }
90010
90011 const keys = Object.keys(rule).filter(key => {
90012 return ![
90013 "resource",
90014 "resourceQuery",
90015 "compiler",
90016 "test",
90017 "include",
90018 "exclude",
90019 "issuer",
90020 "loader",
90021 "options",
90022 "query",
90023 "loaders",
90024 "use",
90025 "rules",
90026 "oneOf"
90027 ].includes(key);
90028 });
90029 for (const key of keys) {
90030 newRule[key] = rule[key];
90031 }
90032
90033 if (Array.isArray(newRule.use)) {
90034 for (const item of newRule.use) {
90035 if (item.ident) {
90036 refs[item.ident] = item.options;
90037 }
90038 }
90039 }
90040
90041 return newRule;
90042 }
90043
90044 static buildErrorMessage(condition, error) {
90045 const conditionAsText = JSON.stringify(
90046 condition,
90047 (key, value) => {
90048 return value === undefined ? "undefined" : value;
90049 },
90050 2
90051 );
90052 return error.message + " in " + conditionAsText;
90053 }
90054
90055 static normalizeUse(use, ident) {
90056 if (typeof use === "function") {
90057 return data => RuleSet.normalizeUse(use(data), ident);
90058 }
90059 if (Array.isArray(use)) {
90060 return use
90061 .map((item, idx) => RuleSet.normalizeUse(item, `${ident}-${idx}`))
90062 .reduce((arr, items) => arr.concat(items), []);
90063 }
90064 return [RuleSet.normalizeUseItem(use, ident)];
90065 }
90066
90067 static normalizeUseItemString(useItemString) {
90068 const idx = useItemString.indexOf("?");
90069 if (idx >= 0) {
90070 return {
90071 loader: useItemString.substr(0, idx),
90072 options: useItemString.substr(idx + 1)
90073 };
90074 }
90075 return {
90076 loader: useItemString,
90077 options: undefined
90078 };
90079 }
90080
90081 static normalizeUseItem(item, ident) {
90082 if (typeof item === "string") {
90083 return RuleSet.normalizeUseItemString(item);
90084 }
90085
90086 const newItem = {};
90087
90088 if (item.options && item.query) {
90089 throw new Error("Provided options and query in use");
90090 }
90091
90092 if (!item.loader) {
90093 throw new Error("No loader specified");
90094 }
90095
90096 newItem.options = item.options || item.query;
90097
90098 if (typeof newItem.options === "object" && newItem.options) {
90099 if (newItem.options.ident) {
90100 newItem.ident = newItem.options.ident;
90101 } else {
90102 newItem.ident = ident;
90103 }
90104 }
90105
90106 const keys = Object.keys(item).filter(function(key) {
90107 return !["options", "query"].includes(key);
90108 });
90109
90110 for (const key of keys) {
90111 newItem[key] = item[key];
90112 }
90113
90114 return newItem;
90115 }
90116
90117 static normalizeCondition(condition) {
90118 if (!condition) throw new Error("Expected condition but got falsy value");
90119 if (typeof condition === "string") {
90120 return str => str.indexOf(condition) === 0;
90121 }
90122 if (typeof condition === "function") {
90123 return condition;
90124 }
90125 if (condition instanceof RegExp) {
90126 return condition.test.bind(condition);
90127 }
90128 if (Array.isArray(condition)) {
90129 const items = condition.map(c => RuleSet.normalizeCondition(c));
90130 return orMatcher(items);
90131 }
90132 if (typeof condition !== "object") {
90133 throw Error(
90134 "Unexcepted " +
90135 typeof condition +
90136 " when condition was expected (" +
90137 condition +
90138 ")"
90139 );
90140 }
90141
90142 const matchers = [];
90143 Object.keys(condition).forEach(key => {
90144 const value = condition[key];
90145 switch (key) {
90146 case "or":
90147 case "include":
90148 case "test":
90149 if (value) matchers.push(RuleSet.normalizeCondition(value));
90150 break;
90151 case "and":
90152 if (value) {
90153 const items = value.map(c => RuleSet.normalizeCondition(c));
90154 matchers.push(andMatcher(items));
90155 }
90156 break;
90157 case "not":
90158 case "exclude":
90159 if (value) {
90160 const matcher = RuleSet.normalizeCondition(value);
90161 matchers.push(notMatcher(matcher));
90162 }
90163 break;
90164 default:
90165 throw new Error("Unexcepted property " + key + " in condition");
90166 }
90167 });
90168 if (matchers.length === 0) {
90169 throw new Error("Excepted condition but got " + condition);
90170 }
90171 if (matchers.length === 1) {
90172 return matchers[0];
90173 }
90174 return andMatcher(matchers);
90175 }
90176
90177 exec(data) {
90178 const result = [];
90179 this._run(
90180 data,
90181 {
90182 rules: this.rules
90183 },
90184 result
90185 );
90186 return result;
90187 }
90188
90189 _run(data, rule, result) {
90190 // test conditions
90191 if (rule.resource && !data.resource) return false;
90192 if (rule.realResource && !data.realResource) return false;
90193 if (rule.resourceQuery && !data.resourceQuery) return false;
90194 if (rule.compiler && !data.compiler) return false;
90195 if (rule.issuer && !data.issuer) return false;
90196 if (rule.resource && !rule.resource(data.resource)) return false;
90197 if (rule.realResource && !rule.realResource(data.realResource))
90198 return false;
90199 if (data.issuer && rule.issuer && !rule.issuer(data.issuer)) return false;
90200 if (
90201 data.resourceQuery &&
90202 rule.resourceQuery &&
90203 !rule.resourceQuery(data.resourceQuery)
90204 ) {
90205 return false;
90206 }
90207 if (data.compiler && rule.compiler && !rule.compiler(data.compiler)) {
90208 return false;
90209 }
90210
90211 // apply
90212 const keys = Object.keys(rule).filter(key => {
90213 return ![
90214 "resource",
90215 "realResource",
90216 "resourceQuery",
90217 "compiler",
90218 "issuer",
90219 "rules",
90220 "oneOf",
90221 "use",
90222 "enforce"
90223 ].includes(key);
90224 });
90225 for (const key of keys) {
90226 result.push({
90227 type: key,
90228 value: rule[key]
90229 });
90230 }
90231
90232 if (rule.use) {
90233 const process = use => {
90234 if (typeof use === "function") {
90235 process(use(data));
90236 } else if (Array.isArray(use)) {
90237 use.forEach(process);
90238 } else {
90239 result.push({
90240 type: "use",
90241 value: use,
90242 enforce: rule.enforce
90243 });
90244 }
90245 };
90246 process(rule.use);
90247 }
90248
90249 if (rule.rules) {
90250 for (let i = 0; i < rule.rules.length; i++) {
90251 this._run(data, rule.rules[i], result);
90252 }
90253 }
90254
90255 if (rule.oneOf) {
90256 for (let i = 0; i < rule.oneOf.length; i++) {
90257 if (this._run(data, rule.oneOf[i], result)) break;
90258 }
90259 }
90260
90261 return true;
90262 }
90263
90264 findOptionsByIdent(ident) {
90265 const options = this.references[ident];
90266 if (!options) {
90267 throw new Error("Can't find options with ident '" + ident + "'");
90268 }
90269 return options;
90270 }
90271};
90272
90273
90274/***/ }),
90275
90276/***/ 44006:
90277/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
90278
90279"use strict";
90280/*
90281 MIT License http://www.opensource.org/licenses/mit-license.php
90282 Author Tobias Koppers @sokra
90283*/
90284
90285
90286const Template = __webpack_require__(96066);
90287
90288/** @typedef {import("./Module")} Module */
90289
90290module.exports = class RuntimeTemplate {
90291 constructor(outputOptions, requestShortener) {
90292 this.outputOptions = outputOptions || {};
90293 this.requestShortener = requestShortener;
90294 }
90295
90296 /**
90297 * Add a comment
90298 * @param {object} options Information content of the comment
90299 * @param {string=} options.request request string used originally
90300 * @param {string=} options.chunkName name of the chunk referenced
90301 * @param {string=} options.chunkReason reason information of the chunk
90302 * @param {string=} options.message additional message
90303 * @param {string=} options.exportName name of the export
90304 * @returns {string} comment
90305 */
90306 comment({ request, chunkName, chunkReason, message, exportName }) {
90307 let content;
90308 if (this.outputOptions.pathinfo) {
90309 content = [message, request, chunkName, chunkReason]
90310 .filter(Boolean)
90311 .map(item => this.requestShortener.shorten(item))
90312 .join(" | ");
90313 } else {
90314 content = [message, chunkName, chunkReason]
90315 .filter(Boolean)
90316 .map(item => this.requestShortener.shorten(item))
90317 .join(" | ");
90318 }
90319 if (!content) return "";
90320 if (this.outputOptions.pathinfo) {
90321 return Template.toComment(content) + " ";
90322 } else {
90323 return Template.toNormalComment(content) + " ";
90324 }
90325 }
90326
90327 throwMissingModuleErrorFunction({ request }) {
90328 const err = `Cannot find module '${request}'`;
90329 return `function webpackMissingModule() { var e = new Error(${JSON.stringify(
90330 err
90331 )}); e.code = 'MODULE_NOT_FOUND'; throw e; }`;
90332 }
90333
90334 missingModule({ request }) {
90335 return `!(${this.throwMissingModuleErrorFunction({ request })}())`;
90336 }
90337
90338 missingModuleStatement({ request }) {
90339 return `${this.missingModule({ request })};\n`;
90340 }
90341
90342 missingModulePromise({ request }) {
90343 return `Promise.resolve().then(${this.throwMissingModuleErrorFunction({
90344 request
90345 })})`;
90346 }
90347
90348 moduleId({ module, request }) {
90349 if (!module) {
90350 return this.missingModule({
90351 request
90352 });
90353 }
90354 if (module.id === null) {
90355 throw new Error(
90356 `RuntimeTemplate.moduleId(): Module ${module.identifier()} has no id. This should not happen.`
90357 );
90358 }
90359 return `${this.comment({ request })}${JSON.stringify(module.id)}`;
90360 }
90361
90362 moduleRaw({ module, request }) {
90363 if (!module) {
90364 return this.missingModule({
90365 request
90366 });
90367 }
90368 return `__webpack_require__(${this.moduleId({ module, request })})`;
90369 }
90370
90371 moduleExports({ module, request }) {
90372 return this.moduleRaw({
90373 module,
90374 request
90375 });
90376 }
90377
90378 moduleNamespace({ module, request, strict }) {
90379 if (!module) {
90380 return this.missingModule({
90381 request
90382 });
90383 }
90384 const moduleId = this.moduleId({
90385 module,
90386 request
90387 });
90388 const exportsType = module.buildMeta && module.buildMeta.exportsType;
90389 if (exportsType === "namespace") {
90390 const rawModule = this.moduleRaw({
90391 module,
90392 request
90393 });
90394 return rawModule;
90395 } else if (exportsType === "named") {
90396 return `__webpack_require__.t(${moduleId}, 3)`;
90397 } else if (strict) {
90398 return `__webpack_require__.t(${moduleId}, 1)`;
90399 } else {
90400 return `__webpack_require__.t(${moduleId}, 7)`;
90401 }
90402 }
90403
90404 moduleNamespacePromise({ block, module, request, message, strict, weak }) {
90405 if (!module) {
90406 return this.missingModulePromise({
90407 request
90408 });
90409 }
90410 if (module.id === null) {
90411 throw new Error(
90412 `RuntimeTemplate.moduleNamespacePromise(): Module ${module.identifier()} has no id. This should not happen.`
90413 );
90414 }
90415 const promise = this.blockPromise({
90416 block,
90417 message
90418 });
90419
90420 let getModuleFunction;
90421 let idExpr = JSON.stringify(module.id);
90422 const comment = this.comment({
90423 request
90424 });
90425 let header = "";
90426 if (weak) {
90427 if (idExpr.length > 8) {
90428 // 'var x="nnnnnn";x,"+x+",x' vs '"nnnnnn",nnnnnn,"nnnnnn"'
90429 header += `var id = ${idExpr}; `;
90430 idExpr = "id";
90431 }
90432 header += `if(!__webpack_require__.m[${idExpr}]) { var e = new Error("Module '" + ${idExpr} + "' is not available (weak dependency)"); e.code = 'MODULE_NOT_FOUND'; throw e; } `;
90433 }
90434 const moduleId = this.moduleId({
90435 module,
90436 request
90437 });
90438 const exportsType = module.buildMeta && module.buildMeta.exportsType;
90439 if (exportsType === "namespace") {
90440 if (header) {
90441 const rawModule = this.moduleRaw({
90442 module,
90443 request
90444 });
90445 getModuleFunction = `function() { ${header}return ${rawModule}; }`;
90446 } else {
90447 getModuleFunction = `__webpack_require__.bind(null, ${comment}${idExpr})`;
90448 }
90449 } else if (exportsType === "named") {
90450 if (header) {
90451 getModuleFunction = `function() { ${header}return __webpack_require__.t(${moduleId}, 3); }`;
90452 } else {
90453 getModuleFunction = `__webpack_require__.t.bind(null, ${comment}${idExpr}, 3)`;
90454 }
90455 } else if (strict) {
90456 if (header) {
90457 getModuleFunction = `function() { ${header}return __webpack_require__.t(${moduleId}, 1); }`;
90458 } else {
90459 getModuleFunction = `__webpack_require__.t.bind(null, ${comment}${idExpr}, 1)`;
90460 }
90461 } else {
90462 if (header) {
90463 getModuleFunction = `function() { ${header}return __webpack_require__.t(${moduleId}, 7); }`;
90464 } else {
90465 getModuleFunction = `__webpack_require__.t.bind(null, ${comment}${idExpr}, 7)`;
90466 }
90467 }
90468
90469 return `${promise || "Promise.resolve()"}.then(${getModuleFunction})`;
90470 }
90471
90472 /**
90473 *
90474 * @param {Object} options options object
90475 * @param {boolean=} options.update whether a new variable should be created or the existing one updated
90476 * @param {Module} options.module the module
90477 * @param {string} options.request the request that should be printed as comment
90478 * @param {string} options.importVar name of the import variable
90479 * @param {Module} options.originModule module in which the statement is emitted
90480 * @returns {string} the import statement
90481 */
90482 importStatement({ update, module, request, importVar, originModule }) {
90483 if (!module) {
90484 return this.missingModuleStatement({
90485 request
90486 });
90487 }
90488 const moduleId = this.moduleId({
90489 module,
90490 request
90491 });
90492 const optDeclaration = update ? "" : "var ";
90493
90494 const exportsType = module.buildMeta && module.buildMeta.exportsType;
90495 let content = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${moduleId});\n`;
90496
90497 if (!exportsType && !originModule.buildMeta.strictHarmonyModule) {
90498 content += `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/__webpack_require__.n(${importVar});\n`;
90499 }
90500 if (exportsType === "named") {
90501 if (Array.isArray(module.buildMeta.providedExports)) {
90502 content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/__webpack_require__.t(${moduleId}, 1);\n`;
90503 } else {
90504 content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/__webpack_require__.t(${moduleId});\n`;
90505 }
90506 }
90507 return content;
90508 }
90509
90510 exportFromImport({
90511 module,
90512 request,
90513 exportName,
90514 originModule,
90515 asiSafe,
90516 isCall,
90517 callContext,
90518 importVar
90519 }) {
90520 if (!module) {
90521 return this.missingModule({
90522 request
90523 });
90524 }
90525 const exportsType = module.buildMeta && module.buildMeta.exportsType;
90526
90527 if (!exportsType) {
90528 if (exportName === "default") {
90529 if (!originModule.buildMeta.strictHarmonyModule) {
90530 if (isCall) {
90531 return `${importVar}_default()`;
90532 } else if (asiSafe) {
90533 return `(${importVar}_default())`;
90534 } else {
90535 return `${importVar}_default.a`;
90536 }
90537 } else {
90538 return importVar;
90539 }
90540 } else if (originModule.buildMeta.strictHarmonyModule) {
90541 if (exportName) {
90542 return "/* non-default import from non-esm module */undefined";
90543 } else {
90544 return `/*#__PURE__*/__webpack_require__.t(${importVar})`;
90545 }
90546 }
90547 }
90548
90549 if (exportsType === "named") {
90550 if (exportName === "default") {
90551 return importVar;
90552 } else if (!exportName) {
90553 return `${importVar}_namespace`;
90554 }
90555 }
90556
90557 if (exportName) {
90558 const used = module.isUsed(exportName);
90559 if (!used) {
90560 const comment = Template.toNormalComment(`unused export ${exportName}`);
90561 return `${comment} undefined`;
90562 }
90563 const comment =
90564 used !== exportName ? Template.toNormalComment(exportName) + " " : "";
90565 const access = `${importVar}[${comment}${JSON.stringify(used)}]`;
90566 if (isCall) {
90567 if (callContext === false && asiSafe) {
90568 return `(0,${access})`;
90569 } else if (callContext === false) {
90570 return `Object(${access})`;
90571 }
90572 }
90573 return access;
90574 } else {
90575 return importVar;
90576 }
90577 }
90578
90579 blockPromise({ block, message }) {
90580 if (!block || !block.chunkGroup || block.chunkGroup.chunks.length === 0) {
90581 const comment = this.comment({
90582 message
90583 });
90584 return `Promise.resolve(${comment.trim()})`;
90585 }
90586 const chunks = block.chunkGroup.chunks.filter(
90587 chunk => !chunk.hasRuntime() && chunk.id !== null
90588 );
90589 const comment = this.comment({
90590 message,
90591 chunkName: block.chunkName,
90592 chunkReason: block.chunkReason
90593 });
90594 if (chunks.length === 1) {
90595 const chunkId = JSON.stringify(chunks[0].id);
90596 return `__webpack_require__.e(${comment}${chunkId})`;
90597 } else if (chunks.length > 0) {
90598 const requireChunkId = chunk =>
90599 `__webpack_require__.e(${JSON.stringify(chunk.id)})`;
90600 return `Promise.all(${comment.trim()}[${chunks
90601 .map(requireChunkId)
90602 .join(", ")}])`;
90603 } else {
90604 return `Promise.resolve(${comment.trim()})`;
90605 }
90606 }
90607
90608 onError() {
90609 return "__webpack_require__.oe";
90610 }
90611
90612 defineEsModuleFlagStatement({ exportsArgument }) {
90613 return `__webpack_require__.r(${exportsArgument});\n`;
90614 }
90615};
90616
90617
90618/***/ }),
90619
90620/***/ 37098:
90621/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
90622
90623"use strict";
90624/*
90625 MIT License http://www.opensource.org/licenses/mit-license.php
90626 Author Tobias Koppers @sokra
90627*/
90628
90629
90630const { ConcatSource } = __webpack_require__(53665);
90631
90632/** @typedef {import("./Compilation")} Compilation */
90633
90634class SetVarMainTemplatePlugin {
90635 /**
90636 * @param {string} varExpression the accessor where the library is exported
90637 * @param {boolean} copyObject specify copying the exports
90638 */
90639 constructor(varExpression, copyObject) {
90640 /** @type {string} */
90641 this.varExpression = varExpression;
90642 /** @type {boolean} */
90643 this.copyObject = copyObject;
90644 }
90645
90646 /**
90647 * @param {Compilation} compilation the compilation instance
90648 * @returns {void}
90649 */
90650 apply(compilation) {
90651 const { mainTemplate, chunkTemplate } = compilation;
90652
90653 const onRenderWithEntry = (source, chunk, hash) => {
90654 const varExpression = mainTemplate.getAssetPath(this.varExpression, {
90655 hash,
90656 chunk
90657 });
90658 if (this.copyObject) {
90659 return new ConcatSource(
90660 `(function(e, a) { for(var i in a) e[i] = a[i]; }(${varExpression}, `,
90661 source,
90662 "))"
90663 );
90664 } else {
90665 const prefix = `${varExpression} =\n`;
90666 return new ConcatSource(prefix, source);
90667 }
90668 };
90669
90670 for (const template of [mainTemplate, chunkTemplate]) {
90671 template.hooks.renderWithEntry.tap(
90672 "SetVarMainTemplatePlugin",
90673 onRenderWithEntry
90674 );
90675 }
90676
90677 mainTemplate.hooks.globalHashPaths.tap(
90678 "SetVarMainTemplatePlugin",
90679 paths => {
90680 if (this.varExpression) paths.push(this.varExpression);
90681 return paths;
90682 }
90683 );
90684 mainTemplate.hooks.hash.tap("SetVarMainTemplatePlugin", hash => {
90685 hash.update("set var");
90686 hash.update(`${this.varExpression}`);
90687 hash.update(`${this.copyObject}`);
90688 });
90689 }
90690}
90691
90692module.exports = SetVarMainTemplatePlugin;
90693
90694
90695/***/ }),
90696
90697/***/ 19070:
90698/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
90699
90700"use strict";
90701/*
90702 MIT License http://www.opensource.org/licenses/mit-license.php
90703 Author Tobias Koppers @sokra
90704*/
90705
90706const SingleEntryDependency = __webpack_require__(84828);
90707
90708/** @typedef {import("./Compiler")} Compiler */
90709
90710class SingleEntryPlugin {
90711 /**
90712 * An entry plugin which will handle
90713 * creation of the SingleEntryDependency
90714 *
90715 * @param {string} context context path
90716 * @param {string} entry entry path
90717 * @param {string} name entry key name
90718 */
90719 constructor(context, entry, name) {
90720 this.context = context;
90721 this.entry = entry;
90722 this.name = name;
90723 }
90724
90725 /**
90726 * @param {Compiler} compiler the compiler instance
90727 * @returns {void}
90728 */
90729 apply(compiler) {
90730 compiler.hooks.compilation.tap(
90731 "SingleEntryPlugin",
90732 (compilation, { normalModuleFactory }) => {
90733 compilation.dependencyFactories.set(
90734 SingleEntryDependency,
90735 normalModuleFactory
90736 );
90737 }
90738 );
90739
90740 compiler.hooks.make.tapAsync(
90741 "SingleEntryPlugin",
90742 (compilation, callback) => {
90743 const { entry, name, context } = this;
90744
90745 const dep = SingleEntryPlugin.createDependency(entry, name);
90746 compilation.addEntry(context, dep, name, callback);
90747 }
90748 );
90749 }
90750
90751 /**
90752 * @param {string} entry entry request
90753 * @param {string} name entry name
90754 * @returns {SingleEntryDependency} the dependency
90755 */
90756 static createDependency(entry, name) {
90757 const dep = new SingleEntryDependency(entry);
90758 dep.loc = { name };
90759 return dep;
90760 }
90761}
90762
90763module.exports = SingleEntryPlugin;
90764
90765
90766/***/ }),
90767
90768/***/ 12496:
90769/***/ (function(__unused_webpack_module, exports) {
90770
90771"use strict";
90772/*
90773 MIT License http://www.opensource.org/licenses/mit-license.php
90774 Author Sean Larkin @thelarkinn
90775*/
90776
90777
90778const SizeFormatHelpers = exports;
90779
90780SizeFormatHelpers.formatSize = size => {
90781 if (typeof size !== "number" || Number.isNaN(size) === true) {
90782 return "unknown size";
90783 }
90784
90785 if (size <= 0) {
90786 return "0 bytes";
90787 }
90788
90789 const abbreviations = ["bytes", "KiB", "MiB", "GiB"];
90790 const index = Math.floor(Math.log(size) / Math.log(1024));
90791
90792 return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${
90793 abbreviations[index]
90794 }`;
90795};
90796
90797
90798/***/ }),
90799
90800/***/ 24113:
90801/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
90802
90803"use strict";
90804/*
90805 MIT License http://www.opensource.org/licenses/mit-license.php
90806 Author Tobias Koppers @sokra
90807*/
90808
90809
90810const ModuleFilenameHelpers = __webpack_require__(71474);
90811
90812class SourceMapDevToolModuleOptionsPlugin {
90813 constructor(options) {
90814 this.options = options;
90815 }
90816
90817 apply(compilation) {
90818 const options = this.options;
90819 if (options.module !== false) {
90820 compilation.hooks.buildModule.tap(
90821 "SourceMapDevToolModuleOptionsPlugin",
90822 module => {
90823 module.useSourceMap = true;
90824 }
90825 );
90826 }
90827 if (options.lineToLine === true) {
90828 compilation.hooks.buildModule.tap(
90829 "SourceMapDevToolModuleOptionsPlugin",
90830 module => {
90831 module.lineToLine = true;
90832 }
90833 );
90834 } else if (options.lineToLine) {
90835 compilation.hooks.buildModule.tap(
90836 "SourceMapDevToolModuleOptionsPlugin",
90837 module => {
90838 if (!module.resource) return;
90839 let resourcePath = module.resource;
90840 const idx = resourcePath.indexOf("?");
90841 if (idx >= 0) resourcePath = resourcePath.substr(0, idx);
90842 module.lineToLine = ModuleFilenameHelpers.matchObject(
90843 options.lineToLine,
90844 resourcePath
90845 );
90846 }
90847 );
90848 }
90849 }
90850}
90851
90852module.exports = SourceMapDevToolModuleOptionsPlugin;
90853
90854
90855/***/ }),
90856
90857/***/ 11851:
90858/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
90859
90860"use strict";
90861/*
90862 MIT License http://www.opensource.org/licenses/mit-license.php
90863 Author Tobias Koppers @sokra
90864*/
90865
90866
90867const path = __webpack_require__(85622);
90868const { ConcatSource, RawSource } = __webpack_require__(53665);
90869const ModuleFilenameHelpers = __webpack_require__(71474);
90870const SourceMapDevToolModuleOptionsPlugin = __webpack_require__(24113);
90871const createHash = __webpack_require__(15660);
90872const { absolutify } = __webpack_require__(94658);
90873
90874const validateOptions = __webpack_require__(33225);
90875const schema = __webpack_require__(7368);
90876
90877/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
90878/** @typedef {import("./Chunk")} Chunk */
90879/** @typedef {import("webpack-sources").Source} Source */
90880/** @typedef {import("source-map").RawSourceMap} SourceMap */
90881/** @typedef {import("./Module")} Module */
90882/** @typedef {import("./Compilation")} Compilation */
90883/** @typedef {import("./Compiler")} Compiler */
90884/** @typedef {import("./Compilation")} SourceMapDefinition */
90885
90886/**
90887 * @typedef {object} SourceMapTask
90888 * @property {Source} asset
90889 * @property {Array<string | Module>} [modules]
90890 * @property {string} source
90891 * @property {string} file
90892 * @property {SourceMap} sourceMap
90893 * @property {Chunk} chunk
90894 */
90895
90896/**
90897 * @param {string} name file path
90898 * @returns {string} file name
90899 */
90900const basename = name => {
90901 if (!name.includes("/")) return name;
90902 return name.substr(name.lastIndexOf("/") + 1);
90903};
90904
90905/**
90906 * @type {WeakMap<Source, {file: string, assets: {[k: string]: ConcatSource | RawSource}}>}
90907 */
90908const assetsCache = new WeakMap();
90909
90910/**
90911 * Creating {@link SourceMapTask} for given file
90912 * @param {string} file current compiled file
90913 * @param {Source} asset the asset
90914 * @param {Chunk} chunk related chunk
90915 * @param {SourceMapDevToolPluginOptions} options source map options
90916 * @param {Compilation} compilation compilation instance
90917 * @returns {SourceMapTask | undefined} created task instance or `undefined`
90918 */
90919const getTaskForFile = (file, asset, chunk, options, compilation) => {
90920 let source, sourceMap;
90921 /**
90922 * Check if asset can build source map
90923 */
90924 if (asset.sourceAndMap) {
90925 const sourceAndMap = asset.sourceAndMap(options);
90926 sourceMap = sourceAndMap.map;
90927 source = sourceAndMap.source;
90928 } else {
90929 sourceMap = asset.map(options);
90930 source = asset.source();
90931 }
90932 if (!sourceMap || typeof source !== "string") return;
90933 const context = compilation.options.context;
90934 const modules = sourceMap.sources.map(source => {
90935 if (source.startsWith("webpack://")) {
90936 source = absolutify(context, source.slice(10));
90937 }
90938 const module = compilation.findModule(source);
90939 return module || source;
90940 });
90941
90942 return {
90943 chunk,
90944 file,
90945 asset,
90946 source,
90947 sourceMap,
90948 modules
90949 };
90950};
90951
90952class SourceMapDevToolPlugin {
90953 /**
90954 * @param {SourceMapDevToolPluginOptions} [options] options object
90955 * @throws {Error} throws error, if got more than 1 arguments
90956 */
90957 constructor(options) {
90958 if (arguments.length > 1) {
90959 throw new Error(
90960 "SourceMapDevToolPlugin only takes one argument (pass an options object)"
90961 );
90962 }
90963
90964 if (!options) options = {};
90965
90966 validateOptions(schema, options, "SourceMap DevTool Plugin");
90967
90968 /** @type {string | false} */
90969 this.sourceMapFilename = options.filename;
90970 /** @type {string | false} */
90971 this.sourceMappingURLComment =
90972 options.append === false
90973 ? false
90974 : options.append || "\n//# sourceMappingURL=[url]";
90975 /** @type {string | Function} */
90976 this.moduleFilenameTemplate =
90977 options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]";
90978 /** @type {string | Function} */
90979 this.fallbackModuleFilenameTemplate =
90980 options.fallbackModuleFilenameTemplate ||
90981 "webpack://[namespace]/[resourcePath]?[hash]";
90982 /** @type {string} */
90983 this.namespace = options.namespace || "";
90984 /** @type {SourceMapDevToolPluginOptions} */
90985 this.options = options;
90986 }
90987
90988 /**
90989 * Apply compiler
90990 * @param {Compiler} compiler compiler instance
90991 * @returns {void}
90992 */
90993 apply(compiler) {
90994 const sourceMapFilename = this.sourceMapFilename;
90995 const sourceMappingURLComment = this.sourceMappingURLComment;
90996 const moduleFilenameTemplate = this.moduleFilenameTemplate;
90997 const namespace = this.namespace;
90998 const fallbackModuleFilenameTemplate = this.fallbackModuleFilenameTemplate;
90999 const requestShortener = compiler.requestShortener;
91000 const options = this.options;
91001 options.test = options.test || /\.(m?js|css)($|\?)/i;
91002
91003 const matchObject = ModuleFilenameHelpers.matchObject.bind(
91004 undefined,
91005 options
91006 );
91007
91008 compiler.hooks.compilation.tap("SourceMapDevToolPlugin", compilation => {
91009 new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
91010
91011 compilation.hooks.afterOptimizeChunkAssets.tap(
91012 /** @type {TODO} */
91013 ({ name: "SourceMapDevToolPlugin", context: true }),
91014 /**
91015 * @param {object} context hook context
91016 * @param {Array<Chunk>} chunks resulted chunks
91017 * @throws {Error} throws error, if `sourceMapFilename === false && sourceMappingURLComment === false`
91018 * @returns {void}
91019 */
91020 (context, chunks) => {
91021 /** @type {Map<string | Module, string>} */
91022 const moduleToSourceNameMapping = new Map();
91023 /**
91024 * @type {Function}
91025 * @returns {void}
91026 */
91027 const reportProgress =
91028 context && context.reportProgress
91029 ? context.reportProgress
91030 : () => {};
91031
91032 const files = [];
91033 for (const chunk of chunks) {
91034 for (const file of chunk.files) {
91035 if (matchObject(file)) {
91036 files.push({
91037 file,
91038 chunk
91039 });
91040 }
91041 }
91042 }
91043
91044 reportProgress(0.0);
91045 const tasks = [];
91046 files.forEach(({ file, chunk }, idx) => {
91047 const asset = compilation.getAsset(file).source;
91048 const cache = assetsCache.get(asset);
91049 /**
91050 * If presented in cache, reassigns assets. Cache assets already have source maps.
91051 */
91052 if (cache && cache.file === file) {
91053 for (const cachedFile in cache.assets) {
91054 if (cachedFile === file) {
91055 compilation.updateAsset(cachedFile, cache.assets[cachedFile]);
91056 } else {
91057 compilation.emitAsset(cachedFile, cache.assets[cachedFile], {
91058 development: true
91059 });
91060 }
91061 /**
91062 * Add file to chunk, if not presented there
91063 */
91064 if (cachedFile !== file) chunk.files.push(cachedFile);
91065 }
91066 return;
91067 }
91068
91069 reportProgress(
91070 (0.5 * idx) / files.length,
91071 file,
91072 "generate SourceMap"
91073 );
91074 /** @type {SourceMapTask | undefined} */
91075 const task = getTaskForFile(
91076 file,
91077 asset,
91078 chunk,
91079 options,
91080 compilation
91081 );
91082
91083 if (task) {
91084 const modules = task.modules;
91085
91086 for (let idx = 0; idx < modules.length; idx++) {
91087 const module = modules[idx];
91088 if (!moduleToSourceNameMapping.get(module)) {
91089 moduleToSourceNameMapping.set(
91090 module,
91091 ModuleFilenameHelpers.createFilename(
91092 module,
91093 {
91094 moduleFilenameTemplate: moduleFilenameTemplate,
91095 namespace: namespace
91096 },
91097 requestShortener
91098 )
91099 );
91100 }
91101 }
91102
91103 tasks.push(task);
91104 }
91105 });
91106
91107 reportProgress(0.5, "resolve sources");
91108 /** @type {Set<string>} */
91109 const usedNamesSet = new Set(moduleToSourceNameMapping.values());
91110 /** @type {Set<string>} */
91111 const conflictDetectionSet = new Set();
91112
91113 /**
91114 * all modules in defined order (longest identifier first)
91115 * @type {Array<string | Module>}
91116 */
91117 const allModules = Array.from(moduleToSourceNameMapping.keys()).sort(
91118 (a, b) => {
91119 const ai = typeof a === "string" ? a : a.identifier();
91120 const bi = typeof b === "string" ? b : b.identifier();
91121 return ai.length - bi.length;
91122 }
91123 );
91124
91125 // find modules with conflicting source names
91126 for (let idx = 0; idx < allModules.length; idx++) {
91127 const module = allModules[idx];
91128 let sourceName = moduleToSourceNameMapping.get(module);
91129 let hasName = conflictDetectionSet.has(sourceName);
91130 if (!hasName) {
91131 conflictDetectionSet.add(sourceName);
91132 continue;
91133 }
91134
91135 // try the fallback name first
91136 sourceName = ModuleFilenameHelpers.createFilename(
91137 module,
91138 {
91139 moduleFilenameTemplate: fallbackModuleFilenameTemplate,
91140 namespace: namespace
91141 },
91142 requestShortener
91143 );
91144 hasName = usedNamesSet.has(sourceName);
91145 if (!hasName) {
91146 moduleToSourceNameMapping.set(module, sourceName);
91147 usedNamesSet.add(sourceName);
91148 continue;
91149 }
91150
91151 // elsewise just append stars until we have a valid name
91152 while (hasName) {
91153 sourceName += "*";
91154 hasName = usedNamesSet.has(sourceName);
91155 }
91156 moduleToSourceNameMapping.set(module, sourceName);
91157 usedNamesSet.add(sourceName);
91158 }
91159 tasks.forEach((task, index) => {
91160 reportProgress(
91161 0.5 + (0.5 * index) / tasks.length,
91162 task.file,
91163 "attach SourceMap"
91164 );
91165 const assets = Object.create(null);
91166 const chunk = task.chunk;
91167 const file = task.file;
91168 const asset = task.asset;
91169 const sourceMap = task.sourceMap;
91170 const source = task.source;
91171 const modules = task.modules;
91172 const moduleFilenames = modules.map(m =>
91173 moduleToSourceNameMapping.get(m)
91174 );
91175 sourceMap.sources = moduleFilenames;
91176 if (options.noSources) {
91177 sourceMap.sourcesContent = undefined;
91178 }
91179 sourceMap.sourceRoot = options.sourceRoot || "";
91180 sourceMap.file = file;
91181 assetsCache.set(asset, { file, assets });
91182 /** @type {string | false} */
91183 let currentSourceMappingURLComment = sourceMappingURLComment;
91184 if (
91185 currentSourceMappingURLComment !== false &&
91186 /\.css($|\?)/i.test(file)
91187 ) {
91188 currentSourceMappingURLComment = currentSourceMappingURLComment.replace(
91189 /^\n\/\/(.*)$/,
91190 "\n/*$1*/"
91191 );
91192 }
91193 const sourceMapString = JSON.stringify(sourceMap);
91194 if (sourceMapFilename) {
91195 let filename = file;
91196 let query = "";
91197 const idx = filename.indexOf("?");
91198 if (idx >= 0) {
91199 query = filename.substr(idx);
91200 filename = filename.substr(0, idx);
91201 }
91202 const pathParams = {
91203 chunk,
91204 filename: options.fileContext
91205 ? path.relative(options.fileContext, filename)
91206 : filename,
91207 query,
91208 basename: basename(filename),
91209 contentHash: createHash("md4")
91210 .update(sourceMapString)
91211 .digest("hex")
91212 };
91213 let sourceMapFile = compilation.getPath(
91214 sourceMapFilename,
91215 pathParams
91216 );
91217 const sourceMapUrl = options.publicPath
91218 ? options.publicPath + sourceMapFile.replace(/\\/g, "/")
91219 : path
91220 .relative(path.dirname(file), sourceMapFile)
91221 .replace(/\\/g, "/");
91222 /**
91223 * Add source map url to compilation asset, if {@link currentSourceMappingURLComment} presented
91224 */
91225 if (currentSourceMappingURLComment !== false) {
91226 const asset = new ConcatSource(
91227 new RawSource(source),
91228 compilation.getPath(
91229 currentSourceMappingURLComment,
91230 Object.assign({ url: sourceMapUrl }, pathParams)
91231 )
91232 );
91233 assets[file] = asset;
91234 compilation.updateAsset(file, asset);
91235 }
91236 /**
91237 * Add source map file to compilation assets and chunk files
91238 */
91239 const asset = new RawSource(sourceMapString);
91240 assets[sourceMapFile] = asset;
91241 compilation.emitAsset(sourceMapFile, asset, {
91242 development: true
91243 });
91244 chunk.files.push(sourceMapFile);
91245 } else {
91246 if (currentSourceMappingURLComment === false) {
91247 throw new Error(
91248 "SourceMapDevToolPlugin: append can't be false when no filename is provided"
91249 );
91250 }
91251 /**
91252 * Add source map as data url to asset
91253 */
91254 const asset = new ConcatSource(
91255 new RawSource(source),
91256 currentSourceMappingURLComment
91257 .replace(/\[map\]/g, () => sourceMapString)
91258 .replace(
91259 /\[url\]/g,
91260 () =>
91261 `data:application/json;charset=utf-8;base64,${Buffer.from(
91262 sourceMapString,
91263 "utf-8"
91264 ).toString("base64")}`
91265 )
91266 );
91267 assets[file] = asset;
91268 compilation.updateAsset(file, asset);
91269 }
91270 });
91271 reportProgress(1.0);
91272 }
91273 );
91274 });
91275 }
91276}
91277
91278module.exports = SourceMapDevToolPlugin;
91279
91280
91281/***/ }),
91282
91283/***/ 99977:
91284/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
91285
91286"use strict";
91287/*
91288 MIT License http://www.opensource.org/licenses/mit-license.php
91289 Author Tobias Koppers @sokra
91290*/
91291
91292
91293const RequestShortener = __webpack_require__(54254);
91294const SizeFormatHelpers = __webpack_require__(12496);
91295const formatLocation = __webpack_require__(49);
91296const identifierUtils = __webpack_require__(94658);
91297const compareLocations = __webpack_require__(22562);
91298const { LogType } = __webpack_require__(47194);
91299
91300const optionsOrFallback = (...args) => {
91301 let optionValues = [];
91302 optionValues.push(...args);
91303 return optionValues.find(optionValue => optionValue !== undefined);
91304};
91305
91306const compareId = (a, b) => {
91307 if (typeof a !== typeof b) {
91308 return typeof a < typeof b ? -1 : 1;
91309 }
91310 if (a < b) return -1;
91311 if (a > b) return 1;
91312 return 0;
91313};
91314
91315class Stats {
91316 constructor(compilation) {
91317 this.compilation = compilation;
91318 this.hash = compilation.hash;
91319 this.startTime = undefined;
91320 this.endTime = undefined;
91321 }
91322
91323 static filterWarnings(warnings, warningsFilter) {
91324 // we dont have anything to filter so all warnings can be shown
91325 if (!warningsFilter) {
91326 return warnings;
91327 }
91328
91329 // create a chain of filters
91330 // if they return "true" a warning should be suppressed
91331 const normalizedWarningsFilters = [].concat(warningsFilter).map(filter => {
91332 if (typeof filter === "string") {
91333 return warning => warning.includes(filter);
91334 }
91335
91336 if (filter instanceof RegExp) {
91337 return warning => filter.test(warning);
91338 }
91339
91340 if (typeof filter === "function") {
91341 return filter;
91342 }
91343
91344 throw new Error(
91345 `Can only filter warnings with Strings or RegExps. (Given: ${filter})`
91346 );
91347 });
91348 return warnings.filter(warning => {
91349 return !normalizedWarningsFilters.some(check => check(warning));
91350 });
91351 }
91352
91353 formatFilePath(filePath) {
91354 const OPTIONS_REGEXP = /^(\s|\S)*!/;
91355 return filePath.includes("!")
91356 ? `${filePath.replace(OPTIONS_REGEXP, "")} (${filePath})`
91357 : `${filePath}`;
91358 }
91359
91360 hasWarnings() {
91361 return (
91362 this.compilation.warnings.length > 0 ||
91363 this.compilation.children.some(child => child.getStats().hasWarnings())
91364 );
91365 }
91366
91367 hasErrors() {
91368 return (
91369 this.compilation.errors.length > 0 ||
91370 this.compilation.children.some(child => child.getStats().hasErrors())
91371 );
91372 }
91373
91374 // remove a prefixed "!" that can be specified to reverse sort order
91375 normalizeFieldKey(field) {
91376 if (field[0] === "!") {
91377 return field.substr(1);
91378 }
91379 return field;
91380 }
91381
91382 // if a field is prefixed by a "!" reverse sort order
91383 sortOrderRegular(field) {
91384 if (field[0] === "!") {
91385 return false;
91386 }
91387 return true;
91388 }
91389
91390 toJson(options, forToString) {
91391 if (typeof options === "boolean" || typeof options === "string") {
91392 options = Stats.presetToOptions(options);
91393 } else if (!options) {
91394 options = {};
91395 }
91396
91397 const optionOrLocalFallback = (v, def) =>
91398 v !== undefined ? v : options.all !== undefined ? options.all : def;
91399
91400 const testAgainstGivenOption = item => {
91401 if (typeof item === "string") {
91402 const regExp = new RegExp(
91403 `[\\\\/]${item.replace(
91404 // eslint-disable-next-line no-useless-escape
91405 /[-[\]{}()*+?.\\^$|]/g,
91406 "\\$&"
91407 )}([\\\\/]|$|!|\\?)`
91408 );
91409 return ident => regExp.test(ident);
91410 }
91411 if (item && typeof item === "object" && typeof item.test === "function") {
91412 return ident => item.test(ident);
91413 }
91414 if (typeof item === "function") {
91415 return item;
91416 }
91417 if (typeof item === "boolean") {
91418 return () => item;
91419 }
91420 };
91421
91422 const compilation = this.compilation;
91423 const context = optionsOrFallback(
91424 options.context,
91425 compilation.compiler.context
91426 );
91427 const requestShortener =
91428 compilation.compiler.context === context
91429 ? compilation.requestShortener
91430 : new RequestShortener(context);
91431 const showPerformance = optionOrLocalFallback(options.performance, true);
91432 const showHash = optionOrLocalFallback(options.hash, true);
91433 const showEnv = optionOrLocalFallback(options.env, false);
91434 const showVersion = optionOrLocalFallback(options.version, true);
91435 const showTimings = optionOrLocalFallback(options.timings, true);
91436 const showBuiltAt = optionOrLocalFallback(options.builtAt, true);
91437 const showAssets = optionOrLocalFallback(options.assets, true);
91438 const showEntrypoints = optionOrLocalFallback(options.entrypoints, true);
91439 const showChunkGroups = optionOrLocalFallback(
91440 options.chunkGroups,
91441 !forToString
91442 );
91443 const showChunks = optionOrLocalFallback(options.chunks, !forToString);
91444 const showChunkModules = optionOrLocalFallback(options.chunkModules, true);
91445 const showChunkOrigins = optionOrLocalFallback(
91446 options.chunkOrigins,
91447 !forToString
91448 );
91449 const showModules = optionOrLocalFallback(options.modules, true);
91450 const showNestedModules = optionOrLocalFallback(
91451 options.nestedModules,
91452 true
91453 );
91454 const showModuleAssets = optionOrLocalFallback(
91455 options.moduleAssets,
91456 !forToString
91457 );
91458 const showDepth = optionOrLocalFallback(options.depth, !forToString);
91459 const showCachedModules = optionOrLocalFallback(options.cached, true);
91460 const showCachedAssets = optionOrLocalFallback(options.cachedAssets, true);
91461 const showReasons = optionOrLocalFallback(options.reasons, !forToString);
91462 const showUsedExports = optionOrLocalFallback(
91463 options.usedExports,
91464 !forToString
91465 );
91466 const showProvidedExports = optionOrLocalFallback(
91467 options.providedExports,
91468 !forToString
91469 );
91470 const showOptimizationBailout = optionOrLocalFallback(
91471 options.optimizationBailout,
91472 !forToString
91473 );
91474 const showChildren = optionOrLocalFallback(options.children, true);
91475 const showSource = optionOrLocalFallback(options.source, !forToString);
91476 const showModuleTrace = optionOrLocalFallback(options.moduleTrace, true);
91477 const showErrors = optionOrLocalFallback(options.errors, true);
91478 const showErrorDetails = optionOrLocalFallback(
91479 options.errorDetails,
91480 !forToString
91481 );
91482 const showWarnings = optionOrLocalFallback(options.warnings, true);
91483 const warningsFilter = optionsOrFallback(options.warningsFilter, null);
91484 const showPublicPath = optionOrLocalFallback(
91485 options.publicPath,
91486 !forToString
91487 );
91488 const showLogging = optionOrLocalFallback(
91489 options.logging,
91490 forToString ? "info" : true
91491 );
91492 const showLoggingTrace = optionOrLocalFallback(
91493 options.loggingTrace,
91494 !forToString
91495 );
91496 const loggingDebug = []
91497 .concat(optionsOrFallback(options.loggingDebug, []))
91498 .map(testAgainstGivenOption);
91499
91500 const excludeModules = []
91501 .concat(optionsOrFallback(options.excludeModules, options.exclude, []))
91502 .map(testAgainstGivenOption);
91503 const excludeAssets = []
91504 .concat(optionsOrFallback(options.excludeAssets, []))
91505 .map(testAgainstGivenOption);
91506 const maxModules = optionsOrFallback(
91507 options.maxModules,
91508 forToString ? 15 : Infinity
91509 );
91510 const sortModules = optionsOrFallback(options.modulesSort, "id");
91511 const sortChunks = optionsOrFallback(options.chunksSort, "id");
91512 const sortAssets = optionsOrFallback(options.assetsSort, "");
91513 const showOutputPath = optionOrLocalFallback(
91514 options.outputPath,
91515 !forToString
91516 );
91517
91518 if (!showCachedModules) {
91519 excludeModules.push((ident, module) => !module.built);
91520 }
91521
91522 const createModuleFilter = () => {
91523 let i = 0;
91524 return module => {
91525 if (excludeModules.length > 0) {
91526 const ident = requestShortener.shorten(module.resource);
91527 const excluded = excludeModules.some(fn => fn(ident, module));
91528 if (excluded) return false;
91529 }
91530 const result = i < maxModules;
91531 i++;
91532 return result;
91533 };
91534 };
91535
91536 const createAssetFilter = () => {
91537 return asset => {
91538 if (excludeAssets.length > 0) {
91539 const ident = asset.name;
91540 const excluded = excludeAssets.some(fn => fn(ident, asset));
91541 if (excluded) return false;
91542 }
91543 return showCachedAssets || asset.emitted;
91544 };
91545 };
91546
91547 const sortByFieldAndOrder = (fieldKey, a, b) => {
91548 if (a[fieldKey] === null && b[fieldKey] === null) return 0;
91549 if (a[fieldKey] === null) return 1;
91550 if (b[fieldKey] === null) return -1;
91551 if (a[fieldKey] === b[fieldKey]) return 0;
91552 if (typeof a[fieldKey] !== typeof b[fieldKey])
91553 return typeof a[fieldKey] < typeof b[fieldKey] ? -1 : 1;
91554 return a[fieldKey] < b[fieldKey] ? -1 : 1;
91555 };
91556
91557 const sortByField = (field, originalArray) => {
91558 const originalMap = originalArray.reduce((map, v, i) => {
91559 map.set(v, i);
91560 return map;
91561 }, new Map());
91562 return (a, b) => {
91563 if (field) {
91564 const fieldKey = this.normalizeFieldKey(field);
91565
91566 // if a field is prefixed with a "!" the sort is reversed!
91567 const sortIsRegular = this.sortOrderRegular(field);
91568
91569 const cmp = sortByFieldAndOrder(
91570 fieldKey,
91571 sortIsRegular ? a : b,
91572 sortIsRegular ? b : a
91573 );
91574 if (cmp) return cmp;
91575 }
91576 return originalMap.get(a) - originalMap.get(b);
91577 };
91578 };
91579
91580 const formatError = e => {
91581 let text = "";
91582 if (typeof e === "string") {
91583 e = { message: e };
91584 }
91585 if (e.chunk) {
91586 text += `chunk ${e.chunk.name || e.chunk.id}${
91587 e.chunk.hasRuntime()
91588 ? " [entry]"
91589 : e.chunk.canBeInitial()
91590 ? " [initial]"
91591 : ""
91592 }\n`;
91593 }
91594 if (e.file) {
91595 text += `${e.file}\n`;
91596 }
91597 if (
91598 e.module &&
91599 e.module.readableIdentifier &&
91600 typeof e.module.readableIdentifier === "function"
91601 ) {
91602 text += this.formatFilePath(
91603 e.module.readableIdentifier(requestShortener)
91604 );
91605 if (typeof e.loc === "object") {
91606 const locInfo = formatLocation(e.loc);
91607 if (locInfo) text += ` ${locInfo}`;
91608 }
91609 text += "\n";
91610 }
91611 text += e.message;
91612 if (showErrorDetails && e.details) {
91613 text += `\n${e.details}`;
91614 }
91615 if (showErrorDetails && e.missing) {
91616 text += e.missing.map(item => `\n[${item}]`).join("");
91617 }
91618 if (showModuleTrace && e.origin) {
91619 text += `\n @ ${this.formatFilePath(
91620 e.origin.readableIdentifier(requestShortener)
91621 )}`;
91622 if (typeof e.originLoc === "object") {
91623 const locInfo = formatLocation(e.originLoc);
91624 if (locInfo) text += ` ${locInfo}`;
91625 }
91626 if (e.dependencies) {
91627 for (const dep of e.dependencies) {
91628 if (!dep.loc) continue;
91629 if (typeof dep.loc === "string") continue;
91630 const locInfo = formatLocation(dep.loc);
91631 if (!locInfo) continue;
91632 text += ` ${locInfo}`;
91633 }
91634 }
91635 let current = e.origin;
91636 while (current.issuer) {
91637 current = current.issuer;
91638 text += `\n @ ${current.readableIdentifier(requestShortener)}`;
91639 }
91640 }
91641 return text;
91642 };
91643
91644 const obj = {
91645 errors: compilation.errors.map(formatError),
91646 warnings: Stats.filterWarnings(
91647 compilation.warnings.map(formatError),
91648 warningsFilter
91649 )
91650 };
91651
91652 //We just hint other renderers since actually omitting
91653 //errors/warnings from the JSON would be kind of weird.
91654 Object.defineProperty(obj, "_showWarnings", {
91655 value: showWarnings,
91656 enumerable: false
91657 });
91658 Object.defineProperty(obj, "_showErrors", {
91659 value: showErrors,
91660 enumerable: false
91661 });
91662
91663 if (showVersion) {
91664 obj.version = __webpack_require__(71618)/* .version */ .i8;
91665 }
91666
91667 if (showHash) obj.hash = this.hash;
91668 if (showTimings && this.startTime && this.endTime) {
91669 obj.time = this.endTime - this.startTime;
91670 }
91671
91672 if (showBuiltAt && this.endTime) {
91673 obj.builtAt = this.endTime;
91674 }
91675
91676 if (showEnv && options._env) {
91677 obj.env = options._env;
91678 }
91679
91680 if (compilation.needAdditionalPass) {
91681 obj.needAdditionalPass = true;
91682 }
91683 if (showPublicPath) {
91684 obj.publicPath = this.compilation.mainTemplate.getPublicPath({
91685 hash: this.compilation.hash
91686 });
91687 }
91688 if (showOutputPath) {
91689 obj.outputPath = this.compilation.mainTemplate.outputOptions.path;
91690 }
91691 if (showAssets) {
91692 const assetsByFile = {};
91693 const compilationAssets = compilation
91694 .getAssets()
91695 .sort((a, b) => (a.name < b.name ? -1 : 1));
91696 obj.assetsByChunkName = {};
91697 obj.assets = compilationAssets
91698 .map(({ name, source, info }) => {
91699 const obj = {
91700 name,
91701 size: source.size(),
91702 chunks: [],
91703 chunkNames: [],
91704 info,
91705 // TODO webpack 5: remove .emitted
91706 emitted: source.emitted || compilation.emittedAssets.has(name)
91707 };
91708
91709 if (showPerformance) {
91710 obj.isOverSizeLimit = source.isOverSizeLimit;
91711 }
91712
91713 assetsByFile[name] = obj;
91714 return obj;
91715 })
91716 .filter(createAssetFilter());
91717 obj.filteredAssets = compilationAssets.length - obj.assets.length;
91718
91719 for (const chunk of compilation.chunks) {
91720 for (const asset of chunk.files) {
91721 if (assetsByFile[asset]) {
91722 for (const id of chunk.ids) {
91723 assetsByFile[asset].chunks.push(id);
91724 }
91725 if (chunk.name) {
91726 assetsByFile[asset].chunkNames.push(chunk.name);
91727 if (obj.assetsByChunkName[chunk.name]) {
91728 obj.assetsByChunkName[chunk.name] = []
91729 .concat(obj.assetsByChunkName[chunk.name])
91730 .concat([asset]);
91731 } else {
91732 obj.assetsByChunkName[chunk.name] = asset;
91733 }
91734 }
91735 }
91736 }
91737 }
91738 obj.assets.sort(sortByField(sortAssets, obj.assets));
91739 }
91740
91741 const fnChunkGroup = groupMap => {
91742 const obj = {};
91743 for (const keyValuePair of groupMap) {
91744 const name = keyValuePair[0];
91745 const cg = keyValuePair[1];
91746 const children = cg.getChildrenByOrders();
91747 obj[name] = {
91748 chunks: cg.chunks.map(c => c.id),
91749 assets: cg.chunks.reduce(
91750 (array, c) => array.concat(c.files || []),
91751 []
91752 ),
91753 children: Object.keys(children).reduce((obj, key) => {
91754 const groups = children[key];
91755 obj[key] = groups.map(group => ({
91756 name: group.name,
91757 chunks: group.chunks.map(c => c.id),
91758 assets: group.chunks.reduce(
91759 (array, c) => array.concat(c.files || []),
91760 []
91761 )
91762 }));
91763 return obj;
91764 }, Object.create(null)),
91765 childAssets: Object.keys(children).reduce((obj, key) => {
91766 const groups = children[key];
91767 obj[key] = Array.from(
91768 groups.reduce((set, group) => {
91769 for (const chunk of group.chunks) {
91770 for (const asset of chunk.files) {
91771 set.add(asset);
91772 }
91773 }
91774 return set;
91775 }, new Set())
91776 );
91777 return obj;
91778 }, Object.create(null))
91779 };
91780 if (showPerformance) {
91781 obj[name].isOverSizeLimit = cg.isOverSizeLimit;
91782 }
91783 }
91784
91785 return obj;
91786 };
91787
91788 if (showEntrypoints) {
91789 obj.entrypoints = fnChunkGroup(compilation.entrypoints);
91790 }
91791
91792 if (showChunkGroups) {
91793 obj.namedChunkGroups = fnChunkGroup(compilation.namedChunkGroups);
91794 }
91795
91796 const fnModule = module => {
91797 const path = [];
91798 let current = module;
91799 while (current.issuer) {
91800 path.push((current = current.issuer));
91801 }
91802 path.reverse();
91803 const obj = {
91804 id: module.id,
91805 identifier: module.identifier(),
91806 name: module.readableIdentifier(requestShortener),
91807 index: module.index,
91808 index2: module.index2,
91809 size: module.size(),
91810 cacheable: module.buildInfo.cacheable,
91811 built: !!module.built,
91812 optional: module.optional,
91813 prefetched: module.prefetched,
91814 chunks: Array.from(module.chunksIterable, chunk => chunk.id),
91815 issuer: module.issuer && module.issuer.identifier(),
91816 issuerId: module.issuer && module.issuer.id,
91817 issuerName:
91818 module.issuer && module.issuer.readableIdentifier(requestShortener),
91819 issuerPath:
91820 module.issuer &&
91821 path.map(module => ({
91822 id: module.id,
91823 identifier: module.identifier(),
91824 name: module.readableIdentifier(requestShortener),
91825 profile: module.profile
91826 })),
91827 profile: module.profile,
91828 failed: !!module.error,
91829 errors: module.errors ? module.errors.length : 0,
91830 warnings: module.warnings ? module.warnings.length : 0
91831 };
91832 if (showModuleAssets) {
91833 obj.assets = Object.keys(module.buildInfo.assets || {});
91834 }
91835 if (showReasons) {
91836 obj.reasons = module.reasons
91837 .sort((a, b) => {
91838 if (a.module && !b.module) return -1;
91839 if (!a.module && b.module) return 1;
91840 if (a.module && b.module) {
91841 const cmp = compareId(a.module.id, b.module.id);
91842 if (cmp) return cmp;
91843 }
91844 if (a.dependency && !b.dependency) return -1;
91845 if (!a.dependency && b.dependency) return 1;
91846 if (a.dependency && b.dependency) {
91847 const cmp = compareLocations(a.dependency.loc, b.dependency.loc);
91848 if (cmp) return cmp;
91849 if (a.dependency.type < b.dependency.type) return -1;
91850 if (a.dependency.type > b.dependency.type) return 1;
91851 }
91852 return 0;
91853 })
91854 .map(reason => {
91855 const obj = {
91856 moduleId: reason.module ? reason.module.id : null,
91857 moduleIdentifier: reason.module
91858 ? reason.module.identifier()
91859 : null,
91860 module: reason.module
91861 ? reason.module.readableIdentifier(requestShortener)
91862 : null,
91863 moduleName: reason.module
91864 ? reason.module.readableIdentifier(requestShortener)
91865 : null,
91866 type: reason.dependency ? reason.dependency.type : null,
91867 explanation: reason.explanation,
91868 userRequest: reason.dependency
91869 ? reason.dependency.userRequest
91870 : null
91871 };
91872 if (reason.dependency) {
91873 const locInfo = formatLocation(reason.dependency.loc);
91874 if (locInfo) {
91875 obj.loc = locInfo;
91876 }
91877 }
91878 return obj;
91879 });
91880 }
91881 if (showUsedExports) {
91882 if (module.used === true) {
91883 obj.usedExports = module.usedExports;
91884 } else if (module.used === false) {
91885 obj.usedExports = false;
91886 }
91887 }
91888 if (showProvidedExports) {
91889 obj.providedExports = Array.isArray(module.buildMeta.providedExports)
91890 ? module.buildMeta.providedExports
91891 : null;
91892 }
91893 if (showOptimizationBailout) {
91894 obj.optimizationBailout = module.optimizationBailout.map(item => {
91895 if (typeof item === "function") return item(requestShortener);
91896 return item;
91897 });
91898 }
91899 if (showDepth) {
91900 obj.depth = module.depth;
91901 }
91902 if (showNestedModules) {
91903 if (module.modules) {
91904 const modules = module.modules;
91905 obj.modules = modules
91906 .sort(sortByField("depth", modules))
91907 .filter(createModuleFilter())
91908 .map(fnModule);
91909 obj.filteredModules = modules.length - obj.modules.length;
91910 obj.modules.sort(sortByField(sortModules, obj.modules));
91911 }
91912 }
91913 if (showSource && module._source) {
91914 obj.source = module._source.source();
91915 }
91916 return obj;
91917 };
91918 if (showChunks) {
91919 obj.chunks = compilation.chunks.map(chunk => {
91920 const parents = new Set();
91921 const children = new Set();
91922 const siblings = new Set();
91923 const childIdByOrder = chunk.getChildIdsByOrders();
91924 for (const chunkGroup of chunk.groupsIterable) {
91925 for (const parentGroup of chunkGroup.parentsIterable) {
91926 for (const chunk of parentGroup.chunks) {
91927 parents.add(chunk.id);
91928 }
91929 }
91930 for (const childGroup of chunkGroup.childrenIterable) {
91931 for (const chunk of childGroup.chunks) {
91932 children.add(chunk.id);
91933 }
91934 }
91935 for (const sibling of chunkGroup.chunks) {
91936 if (sibling !== chunk) siblings.add(sibling.id);
91937 }
91938 }
91939 const obj = {
91940 id: chunk.id,
91941 rendered: chunk.rendered,
91942 initial: chunk.canBeInitial(),
91943 entry: chunk.hasRuntime(),
91944 recorded: chunk.recorded,
91945 reason: chunk.chunkReason,
91946 size: chunk.modulesSize(),
91947 names: chunk.name ? [chunk.name] : [],
91948 files: chunk.files.slice(),
91949 hash: chunk.renderedHash,
91950 siblings: Array.from(siblings).sort(compareId),
91951 parents: Array.from(parents).sort(compareId),
91952 children: Array.from(children).sort(compareId),
91953 childrenByOrder: childIdByOrder
91954 };
91955 if (showChunkModules) {
91956 const modules = chunk.getModules();
91957 obj.modules = modules
91958 .slice()
91959 .sort(sortByField("depth", modules))
91960 .filter(createModuleFilter())
91961 .map(fnModule);
91962 obj.filteredModules = chunk.getNumberOfModules() - obj.modules.length;
91963 obj.modules.sort(sortByField(sortModules, obj.modules));
91964 }
91965 if (showChunkOrigins) {
91966 obj.origins = Array.from(chunk.groupsIterable, g => g.origins)
91967 .reduce((a, b) => a.concat(b), [])
91968 .map(origin => ({
91969 moduleId: origin.module ? origin.module.id : undefined,
91970 module: origin.module ? origin.module.identifier() : "",
91971 moduleIdentifier: origin.module ? origin.module.identifier() : "",
91972 moduleName: origin.module
91973 ? origin.module.readableIdentifier(requestShortener)
91974 : "",
91975 loc: formatLocation(origin.loc),
91976 request: origin.request,
91977 reasons: origin.reasons || []
91978 }))
91979 .sort((a, b) => {
91980 const cmp1 = compareId(a.moduleId, b.moduleId);
91981 if (cmp1) return cmp1;
91982 const cmp2 = compareId(a.loc, b.loc);
91983 if (cmp2) return cmp2;
91984 const cmp3 = compareId(a.request, b.request);
91985 if (cmp3) return cmp3;
91986 return 0;
91987 });
91988 }
91989 return obj;
91990 });
91991 obj.chunks.sort(sortByField(sortChunks, obj.chunks));
91992 }
91993 if (showModules) {
91994 obj.modules = compilation.modules
91995 .slice()
91996 .sort(sortByField("depth", compilation.modules))
91997 .filter(createModuleFilter())
91998 .map(fnModule);
91999 obj.filteredModules = compilation.modules.length - obj.modules.length;
92000 obj.modules.sort(sortByField(sortModules, obj.modules));
92001 }
92002 if (showLogging) {
92003 const util = __webpack_require__(31669);
92004 obj.logging = {};
92005 let acceptedTypes;
92006 let collapsedGroups = false;
92007 switch (showLogging) {
92008 case "none":
92009 acceptedTypes = new Set([]);
92010 break;
92011 case "error":
92012 acceptedTypes = new Set([LogType.error]);
92013 break;
92014 case "warn":
92015 acceptedTypes = new Set([LogType.error, LogType.warn]);
92016 break;
92017 case "info":
92018 acceptedTypes = new Set([LogType.error, LogType.warn, LogType.info]);
92019 break;
92020 case true:
92021 case "log":
92022 acceptedTypes = new Set([
92023 LogType.error,
92024 LogType.warn,
92025 LogType.info,
92026 LogType.log,
92027 LogType.group,
92028 LogType.groupEnd,
92029 LogType.groupCollapsed,
92030 LogType.clear
92031 ]);
92032 break;
92033 case "verbose":
92034 acceptedTypes = new Set([
92035 LogType.error,
92036 LogType.warn,
92037 LogType.info,
92038 LogType.log,
92039 LogType.group,
92040 LogType.groupEnd,
92041 LogType.groupCollapsed,
92042 LogType.profile,
92043 LogType.profileEnd,
92044 LogType.time,
92045 LogType.status,
92046 LogType.clear
92047 ]);
92048 collapsedGroups = true;
92049 break;
92050 }
92051 for (const [origin, logEntries] of compilation.logging) {
92052 const debugMode = loggingDebug.some(fn => fn(origin));
92053 let collapseCounter = 0;
92054 let processedLogEntries = logEntries;
92055 if (!debugMode) {
92056 processedLogEntries = processedLogEntries.filter(entry => {
92057 if (!acceptedTypes.has(entry.type)) return false;
92058 if (!collapsedGroups) {
92059 switch (entry.type) {
92060 case LogType.groupCollapsed:
92061 collapseCounter++;
92062 return collapseCounter === 1;
92063 case LogType.group:
92064 if (collapseCounter > 0) collapseCounter++;
92065 return collapseCounter === 0;
92066 case LogType.groupEnd:
92067 if (collapseCounter > 0) {
92068 collapseCounter--;
92069 return false;
92070 }
92071 return true;
92072 default:
92073 return collapseCounter === 0;
92074 }
92075 }
92076 return true;
92077 });
92078 }
92079 processedLogEntries = processedLogEntries.map(entry => {
92080 let message = undefined;
92081 if (entry.type === LogType.time) {
92082 message = `${entry.args[0]}: ${entry.args[1] * 1000 +
92083 entry.args[2] / 1000000}ms`;
92084 } else if (entry.args && entry.args.length > 0) {
92085 message = util.format(entry.args[0], ...entry.args.slice(1));
92086 }
92087 return {
92088 type:
92089 (debugMode || collapsedGroups) &&
92090 entry.type === LogType.groupCollapsed
92091 ? LogType.group
92092 : entry.type,
92093 message,
92094 trace: showLoggingTrace && entry.trace ? entry.trace : undefined
92095 };
92096 });
92097 let name = identifierUtils
92098 .makePathsRelative(context, origin, compilation.cache)
92099 .replace(/\|/g, " ");
92100 if (name in obj.logging) {
92101 let i = 1;
92102 while (`${name}#${i}` in obj.logging) {
92103 i++;
92104 }
92105 name = `${name}#${i}`;
92106 }
92107 obj.logging[name] = {
92108 entries: processedLogEntries,
92109 filteredEntries: logEntries.length - processedLogEntries.length,
92110 debug: debugMode
92111 };
92112 }
92113 }
92114 if (showChildren) {
92115 obj.children = compilation.children.map((child, idx) => {
92116 const childOptions = Stats.getChildOptions(options, idx);
92117 const obj = new Stats(child).toJson(childOptions, forToString);
92118 delete obj.hash;
92119 delete obj.version;
92120 if (child.name) {
92121 obj.name = identifierUtils.makePathsRelative(
92122 context,
92123 child.name,
92124 compilation.cache
92125 );
92126 }
92127 return obj;
92128 });
92129 }
92130
92131 return obj;
92132 }
92133
92134 toString(options) {
92135 if (typeof options === "boolean" || typeof options === "string") {
92136 options = Stats.presetToOptions(options);
92137 } else if (!options) {
92138 options = {};
92139 }
92140
92141 const useColors = optionsOrFallback(options.colors, false);
92142
92143 const obj = this.toJson(options, true);
92144
92145 return Stats.jsonToString(obj, useColors);
92146 }
92147
92148 static jsonToString(obj, useColors) {
92149 const buf = [];
92150
92151 const defaultColors = {
92152 bold: "\u001b[1m",
92153 yellow: "\u001b[1m\u001b[33m",
92154 red: "\u001b[1m\u001b[31m",
92155 green: "\u001b[1m\u001b[32m",
92156 cyan: "\u001b[1m\u001b[36m",
92157 magenta: "\u001b[1m\u001b[35m"
92158 };
92159
92160 const colors = Object.keys(defaultColors).reduce(
92161 (obj, color) => {
92162 obj[color] = str => {
92163 if (useColors) {
92164 buf.push(
92165 useColors === true || useColors[color] === undefined
92166 ? defaultColors[color]
92167 : useColors[color]
92168 );
92169 }
92170 buf.push(str);
92171 if (useColors) {
92172 buf.push("\u001b[39m\u001b[22m");
92173 }
92174 };
92175 return obj;
92176 },
92177 {
92178 normal: str => buf.push(str)
92179 }
92180 );
92181
92182 const coloredTime = time => {
92183 let times = [800, 400, 200, 100];
92184 if (obj.time) {
92185 times = [obj.time / 2, obj.time / 4, obj.time / 8, obj.time / 16];
92186 }
92187 if (time < times[3]) colors.normal(`${time}ms`);
92188 else if (time < times[2]) colors.bold(`${time}ms`);
92189 else if (time < times[1]) colors.green(`${time}ms`);
92190 else if (time < times[0]) colors.yellow(`${time}ms`);
92191 else colors.red(`${time}ms`);
92192 };
92193
92194 const newline = () => buf.push("\n");
92195
92196 const getText = (arr, row, col) => {
92197 return arr[row][col].value;
92198 };
92199
92200 const table = (array, align, splitter) => {
92201 const rows = array.length;
92202 const cols = array[0].length;
92203 const colSizes = new Array(cols);
92204 for (let col = 0; col < cols; col++) {
92205 colSizes[col] = 0;
92206 }
92207 for (let row = 0; row < rows; row++) {
92208 for (let col = 0; col < cols; col++) {
92209 const value = `${getText(array, row, col)}`;
92210 if (value.length > colSizes[col]) {
92211 colSizes[col] = value.length;
92212 }
92213 }
92214 }
92215 for (let row = 0; row < rows; row++) {
92216 for (let col = 0; col < cols; col++) {
92217 const format = array[row][col].color;
92218 const value = `${getText(array, row, col)}`;
92219 let l = value.length;
92220 if (align[col] === "l") {
92221 format(value);
92222 }
92223 for (; l < colSizes[col] && col !== cols - 1; l++) {
92224 colors.normal(" ");
92225 }
92226 if (align[col] === "r") {
92227 format(value);
92228 }
92229 if (col + 1 < cols && colSizes[col] !== 0) {
92230 colors.normal(splitter || " ");
92231 }
92232 }
92233 newline();
92234 }
92235 };
92236
92237 const getAssetColor = (asset, defaultColor) => {
92238 if (asset.isOverSizeLimit) {
92239 return colors.yellow;
92240 }
92241
92242 return defaultColor;
92243 };
92244
92245 if (obj.hash) {
92246 colors.normal("Hash: ");
92247 colors.bold(obj.hash);
92248 newline();
92249 }
92250 if (obj.version) {
92251 colors.normal("Version: webpack ");
92252 colors.bold(obj.version);
92253 newline();
92254 }
92255 if (typeof obj.time === "number") {
92256 colors.normal("Time: ");
92257 colors.bold(obj.time);
92258 colors.normal("ms");
92259 newline();
92260 }
92261 if (typeof obj.builtAt === "number") {
92262 const builtAtDate = new Date(obj.builtAt);
92263 let timeZone = undefined;
92264
92265 try {
92266 builtAtDate.toLocaleTimeString();
92267 } catch (err) {
92268 // Force UTC if runtime timezone is unsupported
92269 timeZone = "UTC";
92270 }
92271
92272 colors.normal("Built at: ");
92273 colors.normal(
92274 builtAtDate.toLocaleDateString(undefined, {
92275 day: "2-digit",
92276 month: "2-digit",
92277 year: "numeric",
92278 timeZone
92279 })
92280 );
92281 colors.normal(" ");
92282 colors.bold(builtAtDate.toLocaleTimeString(undefined, { timeZone }));
92283 newline();
92284 }
92285 if (obj.env) {
92286 colors.normal("Environment (--env): ");
92287 colors.bold(JSON.stringify(obj.env, null, 2));
92288 newline();
92289 }
92290 if (obj.publicPath) {
92291 colors.normal("PublicPath: ");
92292 colors.bold(obj.publicPath);
92293 newline();
92294 }
92295
92296 if (obj.assets && obj.assets.length > 0) {
92297 const t = [
92298 [
92299 {
92300 value: "Asset",
92301 color: colors.bold
92302 },
92303 {
92304 value: "Size",
92305 color: colors.bold
92306 },
92307 {
92308 value: "Chunks",
92309 color: colors.bold
92310 },
92311 {
92312 value: "",
92313 color: colors.bold
92314 },
92315 {
92316 value: "",
92317 color: colors.bold
92318 },
92319 {
92320 value: "Chunk Names",
92321 color: colors.bold
92322 }
92323 ]
92324 ];
92325 for (const asset of obj.assets) {
92326 t.push([
92327 {
92328 value: asset.name,
92329 color: getAssetColor(asset, colors.green)
92330 },
92331 {
92332 value: SizeFormatHelpers.formatSize(asset.size),
92333 color: getAssetColor(asset, colors.normal)
92334 },
92335 {
92336 value: asset.chunks.join(", "),
92337 color: colors.bold
92338 },
92339 {
92340 value: [
92341 asset.emitted && "[emitted]",
92342 asset.info.immutable && "[immutable]",
92343 asset.info.development && "[dev]",
92344 asset.info.hotModuleReplacement && "[hmr]"
92345 ]
92346 .filter(Boolean)
92347 .join(" "),
92348 color: colors.green
92349 },
92350 {
92351 value: asset.isOverSizeLimit ? "[big]" : "",
92352 color: getAssetColor(asset, colors.normal)
92353 },
92354 {
92355 value: asset.chunkNames.join(", "),
92356 color: colors.normal
92357 }
92358 ]);
92359 }
92360 table(t, "rrrlll");
92361 }
92362 if (obj.filteredAssets > 0) {
92363 colors.normal(" ");
92364 if (obj.assets.length > 0) colors.normal("+ ");
92365 colors.normal(obj.filteredAssets);
92366 if (obj.assets.length > 0) colors.normal(" hidden");
92367 colors.normal(obj.filteredAssets !== 1 ? " assets" : " asset");
92368 newline();
92369 }
92370
92371 const processChunkGroups = (namedGroups, prefix) => {
92372 for (const name of Object.keys(namedGroups)) {
92373 const cg = namedGroups[name];
92374 colors.normal(`${prefix} `);
92375 colors.bold(name);
92376 if (cg.isOverSizeLimit) {
92377 colors.normal(" ");
92378 colors.yellow("[big]");
92379 }
92380 colors.normal(" =");
92381 for (const asset of cg.assets) {
92382 colors.normal(" ");
92383 colors.green(asset);
92384 }
92385 for (const name of Object.keys(cg.childAssets)) {
92386 const assets = cg.childAssets[name];
92387 if (assets && assets.length > 0) {
92388 colors.normal(" ");
92389 colors.magenta(`(${name}:`);
92390 for (const asset of assets) {
92391 colors.normal(" ");
92392 colors.green(asset);
92393 }
92394 colors.magenta(")");
92395 }
92396 }
92397 newline();
92398 }
92399 };
92400
92401 if (obj.entrypoints) {
92402 processChunkGroups(obj.entrypoints, "Entrypoint");
92403 }
92404
92405 if (obj.namedChunkGroups) {
92406 let outputChunkGroups = obj.namedChunkGroups;
92407 if (obj.entrypoints) {
92408 outputChunkGroups = Object.keys(outputChunkGroups)
92409 .filter(name => !obj.entrypoints[name])
92410 .reduce((result, name) => {
92411 result[name] = obj.namedChunkGroups[name];
92412 return result;
92413 }, {});
92414 }
92415 processChunkGroups(outputChunkGroups, "Chunk Group");
92416 }
92417
92418 const modulesByIdentifier = {};
92419 if (obj.modules) {
92420 for (const module of obj.modules) {
92421 modulesByIdentifier[`$${module.identifier}`] = module;
92422 }
92423 } else if (obj.chunks) {
92424 for (const chunk of obj.chunks) {
92425 if (chunk.modules) {
92426 for (const module of chunk.modules) {
92427 modulesByIdentifier[`$${module.identifier}`] = module;
92428 }
92429 }
92430 }
92431 }
92432
92433 const processModuleAttributes = module => {
92434 colors.normal(" ");
92435 colors.normal(SizeFormatHelpers.formatSize(module.size));
92436 if (module.chunks) {
92437 for (const chunk of module.chunks) {
92438 colors.normal(" {");
92439 colors.yellow(chunk);
92440 colors.normal("}");
92441 }
92442 }
92443 if (typeof module.depth === "number") {
92444 colors.normal(` [depth ${module.depth}]`);
92445 }
92446 if (module.cacheable === false) {
92447 colors.red(" [not cacheable]");
92448 }
92449 if (module.optional) {
92450 colors.yellow(" [optional]");
92451 }
92452 if (module.built) {
92453 colors.green(" [built]");
92454 }
92455 if (module.assets && module.assets.length) {
92456 colors.magenta(
92457 ` [${module.assets.length} asset${
92458 module.assets.length === 1 ? "" : "s"
92459 }]`
92460 );
92461 }
92462 if (module.prefetched) {
92463 colors.magenta(" [prefetched]");
92464 }
92465 if (module.failed) colors.red(" [failed]");
92466 if (module.warnings) {
92467 colors.yellow(
92468 ` [${module.warnings} warning${module.warnings === 1 ? "" : "s"}]`
92469 );
92470 }
92471 if (module.errors) {
92472 colors.red(
92473 ` [${module.errors} error${module.errors === 1 ? "" : "s"}]`
92474 );
92475 }
92476 };
92477
92478 const processModuleContent = (module, prefix) => {
92479 if (Array.isArray(module.providedExports)) {
92480 colors.normal(prefix);
92481 if (module.providedExports.length === 0) {
92482 colors.cyan("[no exports]");
92483 } else {
92484 colors.cyan(`[exports: ${module.providedExports.join(", ")}]`);
92485 }
92486 newline();
92487 }
92488 if (module.usedExports !== undefined) {
92489 if (module.usedExports !== true) {
92490 colors.normal(prefix);
92491 if (module.usedExports === null) {
92492 colors.cyan("[used exports unknown]");
92493 } else if (module.usedExports === false) {
92494 colors.cyan("[no exports used]");
92495 } else if (
92496 Array.isArray(module.usedExports) &&
92497 module.usedExports.length === 0
92498 ) {
92499 colors.cyan("[no exports used]");
92500 } else if (Array.isArray(module.usedExports)) {
92501 const providedExportsCount = Array.isArray(module.providedExports)
92502 ? module.providedExports.length
92503 : null;
92504 if (
92505 providedExportsCount !== null &&
92506 providedExportsCount === module.usedExports.length
92507 ) {
92508 colors.cyan("[all exports used]");
92509 } else {
92510 colors.cyan(
92511 `[only some exports used: ${module.usedExports.join(", ")}]`
92512 );
92513 }
92514 }
92515 newline();
92516 }
92517 }
92518 if (Array.isArray(module.optimizationBailout)) {
92519 for (const item of module.optimizationBailout) {
92520 colors.normal(prefix);
92521 colors.yellow(item);
92522 newline();
92523 }
92524 }
92525 if (module.reasons) {
92526 for (const reason of module.reasons) {
92527 colors.normal(prefix);
92528 if (reason.type) {
92529 colors.normal(reason.type);
92530 colors.normal(" ");
92531 }
92532 if (reason.userRequest) {
92533 colors.cyan(reason.userRequest);
92534 colors.normal(" ");
92535 }
92536 if (reason.moduleId !== null) {
92537 colors.normal("[");
92538 colors.normal(reason.moduleId);
92539 colors.normal("]");
92540 }
92541 if (reason.module && reason.module !== reason.moduleId) {
92542 colors.normal(" ");
92543 colors.magenta(reason.module);
92544 }
92545 if (reason.loc) {
92546 colors.normal(" ");
92547 colors.normal(reason.loc);
92548 }
92549 if (reason.explanation) {
92550 colors.normal(" ");
92551 colors.cyan(reason.explanation);
92552 }
92553 newline();
92554 }
92555 }
92556 if (module.profile) {
92557 colors.normal(prefix);
92558 let sum = 0;
92559 if (module.issuerPath) {
92560 for (const m of module.issuerPath) {
92561 colors.normal("[");
92562 colors.normal(m.id);
92563 colors.normal("] ");
92564 if (m.profile) {
92565 const time = (m.profile.factory || 0) + (m.profile.building || 0);
92566 coloredTime(time);
92567 sum += time;
92568 colors.normal(" ");
92569 }
92570 colors.normal("-> ");
92571 }
92572 }
92573 for (const key of Object.keys(module.profile)) {
92574 colors.normal(`${key}:`);
92575 const time = module.profile[key];
92576 coloredTime(time);
92577 colors.normal(" ");
92578 sum += time;
92579 }
92580 colors.normal("= ");
92581 coloredTime(sum);
92582 newline();
92583 }
92584 if (module.modules) {
92585 processModulesList(module, prefix + "| ");
92586 }
92587 };
92588
92589 const processModulesList = (obj, prefix) => {
92590 if (obj.modules) {
92591 let maxModuleId = 0;
92592 for (const module of obj.modules) {
92593 if (typeof module.id === "number") {
92594 if (maxModuleId < module.id) maxModuleId = module.id;
92595 }
92596 }
92597 let contentPrefix = prefix + " ";
92598 if (maxModuleId >= 10) contentPrefix += " ";
92599 if (maxModuleId >= 100) contentPrefix += " ";
92600 if (maxModuleId >= 1000) contentPrefix += " ";
92601 for (const module of obj.modules) {
92602 colors.normal(prefix);
92603 const name = module.name || module.identifier;
92604 if (typeof module.id === "string" || typeof module.id === "number") {
92605 if (typeof module.id === "number") {
92606 if (module.id < 1000 && maxModuleId >= 1000) colors.normal(" ");
92607 if (module.id < 100 && maxModuleId >= 100) colors.normal(" ");
92608 if (module.id < 10 && maxModuleId >= 10) colors.normal(" ");
92609 } else {
92610 if (maxModuleId >= 1000) colors.normal(" ");
92611 if (maxModuleId >= 100) colors.normal(" ");
92612 if (maxModuleId >= 10) colors.normal(" ");
92613 }
92614 if (name !== module.id) {
92615 colors.normal("[");
92616 colors.normal(module.id);
92617 colors.normal("]");
92618 colors.normal(" ");
92619 } else {
92620 colors.normal("[");
92621 colors.bold(module.id);
92622 colors.normal("]");
92623 }
92624 }
92625 if (name !== module.id) {
92626 colors.bold(name);
92627 }
92628 processModuleAttributes(module);
92629 newline();
92630 processModuleContent(module, contentPrefix);
92631 }
92632 if (obj.filteredModules > 0) {
92633 colors.normal(prefix);
92634 colors.normal(" ");
92635 if (obj.modules.length > 0) colors.normal(" + ");
92636 colors.normal(obj.filteredModules);
92637 if (obj.modules.length > 0) colors.normal(" hidden");
92638 colors.normal(obj.filteredModules !== 1 ? " modules" : " module");
92639 newline();
92640 }
92641 }
92642 };
92643
92644 if (obj.chunks) {
92645 for (const chunk of obj.chunks) {
92646 colors.normal("chunk ");
92647 if (chunk.id < 1000) colors.normal(" ");
92648 if (chunk.id < 100) colors.normal(" ");
92649 if (chunk.id < 10) colors.normal(" ");
92650 colors.normal("{");
92651 colors.yellow(chunk.id);
92652 colors.normal("} ");
92653 colors.green(chunk.files.join(", "));
92654 if (chunk.names && chunk.names.length > 0) {
92655 colors.normal(" (");
92656 colors.normal(chunk.names.join(", "));
92657 colors.normal(")");
92658 }
92659 colors.normal(" ");
92660 colors.normal(SizeFormatHelpers.formatSize(chunk.size));
92661 for (const id of chunk.parents) {
92662 colors.normal(" <{");
92663 colors.yellow(id);
92664 colors.normal("}>");
92665 }
92666 for (const id of chunk.siblings) {
92667 colors.normal(" ={");
92668 colors.yellow(id);
92669 colors.normal("}=");
92670 }
92671 for (const id of chunk.children) {
92672 colors.normal(" >{");
92673 colors.yellow(id);
92674 colors.normal("}<");
92675 }
92676 if (chunk.childrenByOrder) {
92677 for (const name of Object.keys(chunk.childrenByOrder)) {
92678 const children = chunk.childrenByOrder[name];
92679 colors.normal(" ");
92680 colors.magenta(`(${name}:`);
92681 for (const id of children) {
92682 colors.normal(" {");
92683 colors.yellow(id);
92684 colors.normal("}");
92685 }
92686 colors.magenta(")");
92687 }
92688 }
92689 if (chunk.entry) {
92690 colors.yellow(" [entry]");
92691 } else if (chunk.initial) {
92692 colors.yellow(" [initial]");
92693 }
92694 if (chunk.rendered) {
92695 colors.green(" [rendered]");
92696 }
92697 if (chunk.recorded) {
92698 colors.green(" [recorded]");
92699 }
92700 if (chunk.reason) {
92701 colors.yellow(` ${chunk.reason}`);
92702 }
92703 newline();
92704 if (chunk.origins) {
92705 for (const origin of chunk.origins) {
92706 colors.normal(" > ");
92707 if (origin.reasons && origin.reasons.length) {
92708 colors.yellow(origin.reasons.join(" "));
92709 colors.normal(" ");
92710 }
92711 if (origin.request) {
92712 colors.normal(origin.request);
92713 colors.normal(" ");
92714 }
92715 if (origin.module) {
92716 colors.normal("[");
92717 colors.normal(origin.moduleId);
92718 colors.normal("] ");
92719 const module = modulesByIdentifier[`$${origin.module}`];
92720 if (module) {
92721 colors.bold(module.name);
92722 colors.normal(" ");
92723 }
92724 }
92725 if (origin.loc) {
92726 colors.normal(origin.loc);
92727 }
92728 newline();
92729 }
92730 }
92731 processModulesList(chunk, " ");
92732 }
92733 }
92734
92735 processModulesList(obj, "");
92736
92737 if (obj.logging) {
92738 for (const origin of Object.keys(obj.logging)) {
92739 const logData = obj.logging[origin];
92740 if (logData.entries.length > 0) {
92741 newline();
92742 if (logData.debug) {
92743 colors.red("DEBUG ");
92744 }
92745 colors.bold("LOG from " + origin);
92746 newline();
92747 let indent = "";
92748 for (const entry of logData.entries) {
92749 let color = colors.normal;
92750 let prefix = " ";
92751 switch (entry.type) {
92752 case LogType.clear:
92753 colors.normal(`${indent}-------`);
92754 newline();
92755 continue;
92756 case LogType.error:
92757 color = colors.red;
92758 prefix = "<e> ";
92759 break;
92760 case LogType.warn:
92761 color = colors.yellow;
92762 prefix = "<w> ";
92763 break;
92764 case LogType.info:
92765 color = colors.green;
92766 prefix = "<i> ";
92767 break;
92768 case LogType.log:
92769 color = colors.bold;
92770 break;
92771 case LogType.trace:
92772 case LogType.debug:
92773 color = colors.normal;
92774 break;
92775 case LogType.status:
92776 color = colors.magenta;
92777 prefix = "<s> ";
92778 break;
92779 case LogType.profile:
92780 color = colors.magenta;
92781 prefix = "<p> ";
92782 break;
92783 case LogType.profileEnd:
92784 color = colors.magenta;
92785 prefix = "</p> ";
92786 break;
92787 case LogType.time:
92788 color = colors.magenta;
92789 prefix = "<t> ";
92790 break;
92791 case LogType.group:
92792 color = colors.cyan;
92793 prefix = "<-> ";
92794 break;
92795 case LogType.groupCollapsed:
92796 color = colors.cyan;
92797 prefix = "<+> ";
92798 break;
92799 case LogType.groupEnd:
92800 if (indent.length >= 2)
92801 indent = indent.slice(0, indent.length - 2);
92802 continue;
92803 }
92804 if (entry.message) {
92805 for (const line of entry.message.split("\n")) {
92806 colors.normal(`${indent}${prefix}`);
92807 color(line);
92808 newline();
92809 }
92810 }
92811 if (entry.trace) {
92812 for (const line of entry.trace) {
92813 colors.normal(`${indent}| ${line}`);
92814 newline();
92815 }
92816 }
92817 switch (entry.type) {
92818 case LogType.group:
92819 indent += " ";
92820 break;
92821 }
92822 }
92823 if (logData.filteredEntries) {
92824 colors.normal(`+ ${logData.filteredEntries} hidden lines`);
92825 newline();
92826 }
92827 }
92828 }
92829 }
92830
92831 if (obj._showWarnings && obj.warnings) {
92832 for (const warning of obj.warnings) {
92833 newline();
92834 colors.yellow(`WARNING in ${warning}`);
92835 newline();
92836 }
92837 }
92838 if (obj._showErrors && obj.errors) {
92839 for (const error of obj.errors) {
92840 newline();
92841 colors.red(`ERROR in ${error}`);
92842 newline();
92843 }
92844 }
92845 if (obj.children) {
92846 for (const child of obj.children) {
92847 const childString = Stats.jsonToString(child, useColors);
92848 if (childString) {
92849 if (child.name) {
92850 colors.normal("Child ");
92851 colors.bold(child.name);
92852 colors.normal(":");
92853 } else {
92854 colors.normal("Child");
92855 }
92856 newline();
92857 buf.push(" ");
92858 buf.push(childString.replace(/\n/g, "\n "));
92859 newline();
92860 }
92861 }
92862 }
92863 if (obj.needAdditionalPass) {
92864 colors.yellow(
92865 "Compilation needs an additional pass and will compile again."
92866 );
92867 }
92868
92869 while (buf[buf.length - 1] === "\n") {
92870 buf.pop();
92871 }
92872 return buf.join("");
92873 }
92874
92875 static presetToOptions(name) {
92876 // Accepted values: none, errors-only, minimal, normal, detailed, verbose
92877 // Any other falsy value will behave as 'none', truthy values as 'normal'
92878 const pn =
92879 (typeof name === "string" && name.toLowerCase()) || name || "none";
92880 switch (pn) {
92881 case "none":
92882 return {
92883 all: false
92884 };
92885 case "verbose":
92886 return {
92887 entrypoints: true,
92888 chunkGroups: true,
92889 modules: false,
92890 chunks: true,
92891 chunkModules: true,
92892 chunkOrigins: true,
92893 depth: true,
92894 env: true,
92895 reasons: true,
92896 usedExports: true,
92897 providedExports: true,
92898 optimizationBailout: true,
92899 errorDetails: true,
92900 publicPath: true,
92901 logging: "verbose",
92902 exclude: false,
92903 maxModules: Infinity
92904 };
92905 case "detailed":
92906 return {
92907 entrypoints: true,
92908 chunkGroups: true,
92909 chunks: true,
92910 chunkModules: false,
92911 chunkOrigins: true,
92912 depth: true,
92913 usedExports: true,
92914 providedExports: true,
92915 optimizationBailout: true,
92916 errorDetails: true,
92917 publicPath: true,
92918 logging: true,
92919 exclude: false,
92920 maxModules: Infinity
92921 };
92922 case "minimal":
92923 return {
92924 all: false,
92925 modules: true,
92926 maxModules: 0,
92927 errors: true,
92928 warnings: true,
92929 logging: "warn"
92930 };
92931 case "errors-only":
92932 return {
92933 all: false,
92934 errors: true,
92935 moduleTrace: true,
92936 logging: "error"
92937 };
92938 case "errors-warnings":
92939 return {
92940 all: false,
92941 errors: true,
92942 warnings: true,
92943 logging: "warn"
92944 };
92945 default:
92946 return {};
92947 }
92948 }
92949
92950 static getChildOptions(options, idx) {
92951 let innerOptions;
92952 if (Array.isArray(options.children)) {
92953 if (idx < options.children.length) {
92954 innerOptions = options.children[idx];
92955 }
92956 } else if (typeof options.children === "object" && options.children) {
92957 innerOptions = options.children;
92958 }
92959 if (typeof innerOptions === "boolean" || typeof innerOptions === "string") {
92960 innerOptions = Stats.presetToOptions(innerOptions);
92961 }
92962 if (!innerOptions) {
92963 return options;
92964 }
92965 const childOptions = Object.assign({}, options);
92966 delete childOptions.children; // do not inherit children
92967 return Object.assign(childOptions, innerOptions);
92968 }
92969}
92970
92971module.exports = Stats;
92972
92973
92974/***/ }),
92975
92976/***/ 97365:
92977/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
92978
92979"use strict";
92980/*
92981 MIT License http://www.opensource.org/licenses/mit-license.php
92982 Author Joel Denning @joeldenning
92983 */
92984
92985
92986
92987const { ConcatSource } = __webpack_require__(53665);
92988const Template = __webpack_require__(96066);
92989
92990/** @typedef {import("./Compilation")} Compilation */
92991
92992/**
92993 * @typedef {Object} SystemMainTemplatePluginOptions
92994 * @param {string=} name the library name
92995 */
92996
92997class SystemMainTemplatePlugin {
92998 /**
92999 * @param {SystemMainTemplatePluginOptions} options the plugin options
93000 */
93001 constructor(options) {
93002 this.name = options.name;
93003 }
93004
93005 /**
93006 * @param {Compilation} compilation the compilation instance
93007 * @returns {void}
93008 */
93009 apply(compilation) {
93010 const { mainTemplate, chunkTemplate } = compilation;
93011
93012 const onRenderWithEntry = (source, chunk, hash) => {
93013 const externals = chunk.getModules().filter(m => m.external);
93014
93015 // The name this bundle should be registered as with System
93016 const name = this.name
93017 ? `${JSON.stringify(
93018 mainTemplate.getAssetPath(this.name, { hash, chunk })
93019 )}, `
93020 : "";
93021
93022 // The array of dependencies that are external to webpack and will be provided by System
93023 const systemDependencies = JSON.stringify(
93024 externals.map(m =>
93025 typeof m.request === "object" ? m.request.amd : m.request
93026 )
93027 );
93028
93029 // The name of the variable provided by System for exporting
93030 const dynamicExport = "__WEBPACK_DYNAMIC_EXPORT__";
93031
93032 // An array of the internal variable names for the webpack externals
93033 const externalWebpackNames = externals.map(
93034 m => `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(`${m.id}`)}__`
93035 );
93036
93037 // Declaring variables for the internal variable names for the webpack externals
93038 const externalVarDeclarations =
93039 externalWebpackNames.length > 0
93040 ? `var ${externalWebpackNames.join(", ")};`
93041 : "";
93042
93043 // The system.register format requires an array of setter functions for externals.
93044 const setters =
93045 externalWebpackNames.length === 0
93046 ? ""
93047 : Template.asString([
93048 "setters: [",
93049 Template.indent(
93050 externalWebpackNames
93051 .map(external =>
93052 Template.asString([
93053 "function(module) {",
93054 Template.indent(`${external} = module;`),
93055 "}"
93056 ])
93057 )
93058 .join(",\n")
93059 ),
93060 "],"
93061 ]);
93062
93063 return new ConcatSource(
93064 Template.asString([
93065 `System.register(${name}${systemDependencies}, function(${dynamicExport}) {`,
93066 Template.indent([
93067 externalVarDeclarations,
93068 "return {",
93069 Template.indent([
93070 setters,
93071 "execute: function() {",
93072 Template.indent(`${dynamicExport}(`)
93073 ])
93074 ])
93075 ]) + "\n",
93076 source,
93077 "\n" +
93078 Template.asString([
93079 Template.indent([
93080 Template.indent([Template.indent([");"]), "}"]),
93081 "};"
93082 ]),
93083 "})"
93084 ])
93085 );
93086 };
93087
93088 for (const template of [mainTemplate, chunkTemplate]) {
93089 template.hooks.renderWithEntry.tap(
93090 "SystemMainTemplatePlugin",
93091 onRenderWithEntry
93092 );
93093 }
93094
93095 mainTemplate.hooks.globalHashPaths.tap(
93096 "SystemMainTemplatePlugin",
93097 paths => {
93098 if (this.name) {
93099 paths.push(this.name);
93100 }
93101 return paths;
93102 }
93103 );
93104
93105 mainTemplate.hooks.hash.tap("SystemMainTemplatePlugin", hash => {
93106 hash.update("exports system");
93107 if (this.name) {
93108 hash.update(this.name);
93109 }
93110 });
93111 }
93112}
93113
93114module.exports = SystemMainTemplatePlugin;
93115
93116
93117/***/ }),
93118
93119/***/ 96066:
93120/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
93121
93122/*
93123 MIT License http://www.opensource.org/licenses/mit-license.php
93124 Author Tobias Koppers @sokra
93125*/
93126/** @typedef {import("./Module")} Module */
93127/** @typedef {import("./Chunk")} Chunk */
93128/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
93129/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */
93130
93131const { ConcatSource } = __webpack_require__(53665);
93132const HotUpdateChunk = __webpack_require__(26782);
93133
93134const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0);
93135const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0);
93136const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1;
93137const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g;
93138const INDENT_MULTILINE_REGEX = /^\t/gm;
93139const LINE_SEPARATOR_REGEX = /\r?\n/g;
93140const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/;
93141const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g;
93142const COMMENT_END_REGEX = /\*\//g;
93143const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g;
93144const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
93145
93146/** @typedef {import("webpack-sources").Source} Source */
93147
93148/**
93149 * @typedef {Object} HasId
93150 * @property {number | string} id
93151 */
93152
93153/**
93154 * @typedef {function(Module, number): boolean} ModuleFilterPredicate
93155 */
93156
93157/**
93158 * @param {HasId} a first id object to be sorted
93159 * @param {HasId} b second id object to be sorted against
93160 * @returns {-1|0|1} the sort value
93161 */
93162const stringifyIdSortPredicate = (a, b) => {
93163 const aId = a.id + "";
93164 const bId = b.id + "";
93165 if (aId < bId) return -1;
93166 if (aId > bId) return 1;
93167 return 0;
93168};
93169
93170class Template {
93171 /**
93172 *
93173 * @param {Function} fn a runtime function (.runtime.js) "template"
93174 * @returns {string} the updated and normalized function string
93175 */
93176 static getFunctionContent(fn) {
93177 return fn
93178 .toString()
93179 .replace(FUNCTION_CONTENT_REGEX, "")
93180 .replace(INDENT_MULTILINE_REGEX, "")
93181 .replace(LINE_SEPARATOR_REGEX, "\n");
93182 }
93183
93184 /**
93185 * @param {string} str the string converted to identifier
93186 * @returns {string} created identifier
93187 */
93188 static toIdentifier(str) {
93189 if (typeof str !== "string") return "";
93190 return str
93191 .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1")
93192 .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_");
93193 }
93194 /**
93195 *
93196 * @param {string} str string to be converted to commented in bundle code
93197 * @returns {string} returns a commented version of string
93198 */
93199 static toComment(str) {
93200 if (!str) return "";
93201 return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`;
93202 }
93203
93204 /**
93205 *
93206 * @param {string} str string to be converted to "normal comment"
93207 * @returns {string} returns a commented version of string
93208 */
93209 static toNormalComment(str) {
93210 if (!str) return "";
93211 return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`;
93212 }
93213
93214 /**
93215 * @param {string} str string path to be normalized
93216 * @returns {string} normalized bundle-safe path
93217 */
93218 static toPath(str) {
93219 if (typeof str !== "string") return "";
93220 return str
93221 .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-")
93222 .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, "");
93223 }
93224
93225 // map number to a single character a-z, A-Z or <_ + number> if number is too big
93226 /**
93227 *
93228 * @param {number} n number to convert to ident
93229 * @returns {string} returns single character ident
93230 */
93231 static numberToIdentifer(n) {
93232 // lower case
93233 if (n < DELTA_A_TO_Z) {
93234 return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n);
93235 }
93236
93237 // upper case
93238 if (n < DELTA_A_TO_Z * 2) {
93239 return String.fromCharCode(
93240 START_UPPERCASE_ALPHABET_CODE + n - DELTA_A_TO_Z
93241 );
93242 }
93243
93244 // use multiple letters
93245 return (
93246 Template.numberToIdentifer(n % (2 * DELTA_A_TO_Z)) +
93247 Template.numberToIdentifer(Math.floor(n / (2 * DELTA_A_TO_Z)))
93248 );
93249 }
93250
93251 /**
93252 *
93253 * @param {string | string[]} s string to convert to identity
93254 * @returns {string} converted identity
93255 */
93256 static indent(s) {
93257 if (Array.isArray(s)) {
93258 return s.map(Template.indent).join("\n");
93259 } else {
93260 const str = s.trimRight();
93261 if (!str) return "";
93262 const ind = str[0] === "\n" ? "" : "\t";
93263 return ind + str.replace(/\n([^\n])/g, "\n\t$1");
93264 }
93265 }
93266
93267 /**
93268 *
93269 * @param {string|string[]} s string to create prefix for
93270 * @param {string} prefix prefix to compose
93271 * @returns {string} returns new prefix string
93272 */
93273 static prefix(s, prefix) {
93274 const str = Template.asString(s).trim();
93275 if (!str) return "";
93276 const ind = str[0] === "\n" ? "" : prefix;
93277 return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
93278 }
93279
93280 /**
93281 *
93282 * @param {string|string[]} str string or string collection
93283 * @returns {string} returns a single string from array
93284 */
93285 static asString(str) {
93286 if (Array.isArray(str)) {
93287 return str.join("\n");
93288 }
93289 return str;
93290 }
93291
93292 /**
93293 * @typedef {Object} WithId
93294 * @property {string|number} id
93295 */
93296
93297 /**
93298 * @param {WithId[]} modules a collection of modules to get array bounds for
93299 * @returns {[number, number] | false} returns the upper and lower array bounds
93300 * or false if not every module has a number based id
93301 */
93302 static getModulesArrayBounds(modules) {
93303 let maxId = -Infinity;
93304 let minId = Infinity;
93305 for (const module of modules) {
93306 if (typeof module.id !== "number") return false;
93307 if (maxId < module.id) maxId = /** @type {number} */ (module.id);
93308 if (minId > module.id) minId = /** @type {number} */ (module.id);
93309 }
93310 if (minId < 16 + ("" + minId).length) {
93311 // add minId x ',' instead of 'Array(minId).concat(…)'
93312 minId = 0;
93313 }
93314 const objectOverhead = modules
93315 .map(module => (module.id + "").length + 2)
93316 .reduce((a, b) => a + b, -1);
93317 const arrayOverhead =
93318 minId === 0 ? maxId : 16 + ("" + minId).length + maxId;
93319 return arrayOverhead < objectOverhead ? [minId, maxId] : false;
93320 }
93321
93322 /**
93323 * @param {Chunk} chunk chunk whose modules will be rendered
93324 * @param {ModuleFilterPredicate} filterFn function used to filter modules from chunk to render
93325 * @param {ModuleTemplate} moduleTemplate ModuleTemplate instance used to render modules
93326 * @param {TODO | TODO[]} dependencyTemplates templates needed for each module to render dependencies
93327 * @param {string=} prefix applying prefix strings
93328 * @returns {ConcatSource} rendered chunk modules in a Source object
93329 */
93330 static renderChunkModules(
93331 chunk,
93332 filterFn,
93333 moduleTemplate,
93334 dependencyTemplates,
93335 prefix = ""
93336 ) {
93337 const source = new ConcatSource();
93338 const modules = chunk.getModules().filter(filterFn);
93339 let removedModules;
93340 if (chunk instanceof HotUpdateChunk) {
93341 removedModules = chunk.removedModules;
93342 }
93343 if (
93344 modules.length === 0 &&
93345 (!removedModules || removedModules.length === 0)
93346 ) {
93347 source.add("[]");
93348 return source;
93349 }
93350 /** @type {{id: string|number, source: Source|string}[]} */
93351 const allModules = modules.map(module => {
93352 return {
93353 id: module.id,
93354 source: moduleTemplate.render(module, dependencyTemplates, {
93355 chunk
93356 })
93357 };
93358 });
93359 if (removedModules && removedModules.length > 0) {
93360 for (const id of removedModules) {
93361 allModules.push({
93362 id,
93363 source: "false"
93364 });
93365 }
93366 }
93367 const bounds = Template.getModulesArrayBounds(allModules);
93368 if (bounds) {
93369 // Render a spare array
93370 const minId = bounds[0];
93371 const maxId = bounds[1];
93372 if (minId !== 0) {
93373 source.add(`Array(${minId}).concat(`);
93374 }
93375 source.add("[\n");
93376 /** @type {Map<string|number, {id: string|number, source: Source|string}>} */
93377 const modules = new Map();
93378 for (const module of allModules) {
93379 modules.set(module.id, module);
93380 }
93381 for (let idx = minId; idx <= maxId; idx++) {
93382 const module = modules.get(idx);
93383 if (idx !== minId) {
93384 source.add(",\n");
93385 }
93386 source.add(`/* ${idx} */`);
93387 if (module) {
93388 source.add("\n");
93389 source.add(module.source);
93390 }
93391 }
93392 source.add("\n" + prefix + "]");
93393 if (minId !== 0) {
93394 source.add(")");
93395 }
93396 } else {
93397 // Render an object
93398 source.add("{\n");
93399 allModules.sort(stringifyIdSortPredicate).forEach((module, idx) => {
93400 if (idx !== 0) {
93401 source.add(",\n");
93402 }
93403 source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`);
93404 source.add(module.source);
93405 });
93406 source.add(`\n\n${prefix}}`);
93407 }
93408 return source;
93409 }
93410}
93411
93412module.exports = Template;
93413
93414
93415/***/ }),
93416
93417/***/ 76032:
93418/***/ (function(module) {
93419
93420"use strict";
93421/*
93422 MIT License http://www.opensource.org/licenses/mit-license.php
93423 Author Jason Anderson @diurnalist
93424*/
93425
93426
93427const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi,
93428 REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi,
93429 REGEXP_MODULEHASH = /\[modulehash(?::(\d+))?\]/gi,
93430 REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/gi,
93431 REGEXP_NAME = /\[name\]/gi,
93432 REGEXP_ID = /\[id\]/gi,
93433 REGEXP_MODULEID = /\[moduleid\]/gi,
93434 REGEXP_FILE = /\[file\]/gi,
93435 REGEXP_QUERY = /\[query\]/gi,
93436 REGEXP_FILEBASE = /\[filebase\]/gi,
93437 REGEXP_URL = /\[url\]/gi;
93438
93439// Using global RegExp for .test is dangerous
93440// We use a normal RegExp instead of .test
93441const REGEXP_HASH_FOR_TEST = new RegExp(REGEXP_HASH.source, "i"),
93442 REGEXP_CHUNKHASH_FOR_TEST = new RegExp(REGEXP_CHUNKHASH.source, "i"),
93443 REGEXP_CONTENTHASH_FOR_TEST = new RegExp(REGEXP_CONTENTHASH.source, "i"),
93444 REGEXP_NAME_FOR_TEST = new RegExp(REGEXP_NAME.source, "i");
93445
93446const withHashLength = (replacer, handlerFn, assetInfo) => {
93447 const fn = (match, hashLength, ...args) => {
93448 if (assetInfo) assetInfo.immutable = true;
93449 const length = hashLength && parseInt(hashLength, 10);
93450 if (length && handlerFn) {
93451 return handlerFn(length);
93452 }
93453 const hash = replacer(match, hashLength, ...args);
93454 return length ? hash.slice(0, length) : hash;
93455 };
93456 return fn;
93457};
93458
93459const getReplacer = (value, allowEmpty) => {
93460 const fn = (match, ...args) => {
93461 // last argument in replacer is the entire input string
93462 const input = args[args.length - 1];
93463 if (value === null || value === undefined) {
93464 if (!allowEmpty) {
93465 throw new Error(
93466 `Path variable ${match} not implemented in this context: ${input}`
93467 );
93468 }
93469 return "";
93470 } else {
93471 return `${escapePathVariables(value)}`;
93472 }
93473 };
93474 return fn;
93475};
93476
93477const escapePathVariables = value => {
93478 return typeof value === "string"
93479 ? value.replace(/\[(\\*[\w:]+\\*)\]/gi, "[\\$1\\]")
93480 : value;
93481};
93482
93483const replacePathVariables = (path, data, assetInfo) => {
93484 const chunk = data.chunk;
93485 const chunkId = chunk && chunk.id;
93486 const chunkName = chunk && (chunk.name || chunk.id);
93487 const chunkHash = chunk && (chunk.renderedHash || chunk.hash);
93488 const chunkHashWithLength = chunk && chunk.hashWithLength;
93489 const contentHashType = data.contentHashType;
93490 const contentHash =
93491 (chunk && chunk.contentHash && chunk.contentHash[contentHashType]) ||
93492 data.contentHash;
93493 const contentHashWithLength =
93494 (chunk &&
93495 chunk.contentHashWithLength &&
93496 chunk.contentHashWithLength[contentHashType]) ||
93497 data.contentHashWithLength;
93498 const module = data.module;
93499 const moduleId = module && module.id;
93500 const moduleHash = module && (module.renderedHash || module.hash);
93501 const moduleHashWithLength = module && module.hashWithLength;
93502
93503 if (typeof path === "function") {
93504 path = path(data);
93505 }
93506
93507 if (
93508 data.noChunkHash &&
93509 (REGEXP_CHUNKHASH_FOR_TEST.test(path) ||
93510 REGEXP_CONTENTHASH_FOR_TEST.test(path))
93511 ) {
93512 throw new Error(
93513 `Cannot use [chunkhash] or [contenthash] for chunk in '${path}' (use [hash] instead)`
93514 );
93515 }
93516
93517 return (
93518 path
93519 .replace(
93520 REGEXP_HASH,
93521 withHashLength(getReplacer(data.hash), data.hashWithLength, assetInfo)
93522 )
93523 .replace(
93524 REGEXP_CHUNKHASH,
93525 withHashLength(getReplacer(chunkHash), chunkHashWithLength, assetInfo)
93526 )
93527 .replace(
93528 REGEXP_CONTENTHASH,
93529 withHashLength(
93530 getReplacer(contentHash),
93531 contentHashWithLength,
93532 assetInfo
93533 )
93534 )
93535 .replace(
93536 REGEXP_MODULEHASH,
93537 withHashLength(getReplacer(moduleHash), moduleHashWithLength, assetInfo)
93538 )
93539 .replace(REGEXP_ID, getReplacer(chunkId))
93540 .replace(REGEXP_MODULEID, getReplacer(moduleId))
93541 .replace(REGEXP_NAME, getReplacer(chunkName))
93542 .replace(REGEXP_FILE, getReplacer(data.filename))
93543 .replace(REGEXP_FILEBASE, getReplacer(data.basename))
93544 // query is optional, it's OK if it's in a path but there's nothing to replace it with
93545 .replace(REGEXP_QUERY, getReplacer(data.query, true))
93546 // only available in sourceMappingURLComment
93547 .replace(REGEXP_URL, getReplacer(data.url))
93548 .replace(/\[\\(\\*[\w:]+\\*)\\\]/gi, "[$1]")
93549 );
93550};
93551
93552class TemplatedPathPlugin {
93553 apply(compiler) {
93554 compiler.hooks.compilation.tap("TemplatedPathPlugin", compilation => {
93555 const mainTemplate = compilation.mainTemplate;
93556
93557 mainTemplate.hooks.assetPath.tap(
93558 "TemplatedPathPlugin",
93559 replacePathVariables
93560 );
93561
93562 mainTemplate.hooks.globalHash.tap(
93563 "TemplatedPathPlugin",
93564 (chunk, paths) => {
93565 const outputOptions = mainTemplate.outputOptions;
93566 const publicPath = outputOptions.publicPath || "";
93567 const filename = outputOptions.filename || "";
93568 const chunkFilename =
93569 outputOptions.chunkFilename || outputOptions.filename;
93570 if (
93571 REGEXP_HASH_FOR_TEST.test(publicPath) ||
93572 REGEXP_CHUNKHASH_FOR_TEST.test(publicPath) ||
93573 REGEXP_CONTENTHASH_FOR_TEST.test(publicPath) ||
93574 REGEXP_NAME_FOR_TEST.test(publicPath)
93575 )
93576 return true;
93577 if (REGEXP_HASH_FOR_TEST.test(filename)) return true;
93578 if (REGEXP_HASH_FOR_TEST.test(chunkFilename)) return true;
93579 if (REGEXP_HASH_FOR_TEST.test(paths.join("|"))) return true;
93580 }
93581 );
93582
93583 mainTemplate.hooks.hashForChunk.tap(
93584 "TemplatedPathPlugin",
93585 (hash, chunk) => {
93586 const outputOptions = mainTemplate.outputOptions;
93587 const chunkFilename =
93588 outputOptions.chunkFilename || outputOptions.filename;
93589 if (REGEXP_CHUNKHASH_FOR_TEST.test(chunkFilename)) {
93590 hash.update(JSON.stringify(chunk.getChunkMaps(true).hash));
93591 }
93592 if (REGEXP_CONTENTHASH_FOR_TEST.test(chunkFilename)) {
93593 hash.update(
93594 JSON.stringify(
93595 chunk.getChunkMaps(true).contentHash.javascript || {}
93596 )
93597 );
93598 }
93599 if (REGEXP_NAME_FOR_TEST.test(chunkFilename)) {
93600 hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
93601 }
93602 }
93603 );
93604 });
93605 }
93606}
93607
93608module.exports = TemplatedPathPlugin;
93609
93610
93611/***/ }),
93612
93613/***/ 75374:
93614/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
93615
93616"use strict";
93617/*
93618 MIT License http://www.opensource.org/licenses/mit-license.php
93619 Author Tobias Koppers @sokra
93620*/
93621
93622
93623const { ConcatSource, OriginalSource } = __webpack_require__(53665);
93624const Template = __webpack_require__(96066);
93625
93626/** @typedef {import("../declarations/WebpackOptions").LibraryCustomUmdObject} LibraryCustomUmdObject */
93627/** @typedef {import("./Compilation")} Compilation */
93628
93629/**
93630 * @param {string[]} accessor the accessor to convert to path
93631 * @returns {string} the path
93632 */
93633const accessorToObjectAccess = accessor => {
93634 return accessor.map(a => `[${JSON.stringify(a)}]`).join("");
93635};
93636
93637/**
93638 * @param {string=} base the path prefix
93639 * @param {string|string[]} accessor the accessor
93640 * @param {string=} joinWith the element separator
93641 * @returns {string} the path
93642 */
93643const accessorAccess = (base, accessor, joinWith = ", ") => {
93644 const accessors = Array.isArray(accessor) ? accessor : [accessor];
93645 return accessors
93646 .map((_, idx) => {
93647 const a = base
93648 ? base + accessorToObjectAccess(accessors.slice(0, idx + 1))
93649 : accessors[0] + accessorToObjectAccess(accessors.slice(1, idx + 1));
93650 if (idx === accessors.length - 1) return a;
93651 if (idx === 0 && base === undefined)
93652 return `${a} = typeof ${a} === "object" ? ${a} : {}`;
93653 return `${a} = ${a} || {}`;
93654 })
93655 .join(joinWith);
93656};
93657
93658/** @typedef {string | string[] | LibraryCustomUmdObject} UmdMainTemplatePluginName */
93659
93660/**
93661 * @typedef {Object} AuxiliaryCommentObject
93662 * @property {string} root
93663 * @property {string} commonjs
93664 * @property {string} commonjs2
93665 * @property {string} amd
93666 */
93667
93668/**
93669 * @typedef {Object} UmdMainTemplatePluginOption
93670 * @property {boolean=} optionalAmdExternalAsGlobal
93671 * @property {boolean} namedDefine
93672 * @property {string | AuxiliaryCommentObject} auxiliaryComment
93673 */
93674
93675class UmdMainTemplatePlugin {
93676 /**
93677 * @param {UmdMainTemplatePluginName} name the name of the UMD library
93678 * @param {UmdMainTemplatePluginOption} options the plugin option
93679 */
93680 constructor(name, options) {
93681 if (typeof name === "object" && !Array.isArray(name)) {
93682 this.name = name.root || name.amd || name.commonjs;
93683 this.names = name;
93684 } else {
93685 this.name = name;
93686 this.names = {
93687 commonjs: name,
93688 root: name,
93689 amd: name
93690 };
93691 }
93692 this.optionalAmdExternalAsGlobal = options.optionalAmdExternalAsGlobal;
93693 this.namedDefine = options.namedDefine;
93694 this.auxiliaryComment = options.auxiliaryComment;
93695 }
93696
93697 /**
93698 * @param {Compilation} compilation the compilation instance
93699 * @returns {void}
93700 */
93701 apply(compilation) {
93702 const { mainTemplate, chunkTemplate, runtimeTemplate } = compilation;
93703
93704 const onRenderWithEntry = (source, chunk, hash) => {
93705 let externals = chunk
93706 .getModules()
93707 .filter(
93708 m =>
93709 m.external &&
93710 (m.externalType === "umd" || m.externalType === "umd2")
93711 );
93712 const optionalExternals = [];
93713 let requiredExternals = [];
93714 if (this.optionalAmdExternalAsGlobal) {
93715 for (const m of externals) {
93716 if (m.optional) {
93717 optionalExternals.push(m);
93718 } else {
93719 requiredExternals.push(m);
93720 }
93721 }
93722 externals = requiredExternals.concat(optionalExternals);
93723 } else {
93724 requiredExternals = externals;
93725 }
93726
93727 const replaceKeys = str => {
93728 return mainTemplate.getAssetPath(str, {
93729 hash,
93730 chunk
93731 });
93732 };
93733
93734 const externalsDepsArray = modules => {
93735 return `[${replaceKeys(
93736 modules
93737 .map(m =>
93738 JSON.stringify(
93739 typeof m.request === "object" ? m.request.amd : m.request
93740 )
93741 )
93742 .join(", ")
93743 )}]`;
93744 };
93745
93746 const externalsRootArray = modules => {
93747 return replaceKeys(
93748 modules
93749 .map(m => {
93750 let request = m.request;
93751 if (typeof request === "object") request = request.root;
93752 return `root${accessorToObjectAccess([].concat(request))}`;
93753 })
93754 .join(", ")
93755 );
93756 };
93757
93758 const externalsRequireArray = type => {
93759 return replaceKeys(
93760 externals
93761 .map(m => {
93762 let expr;
93763 let request = m.request;
93764 if (typeof request === "object") {
93765 request = request[type];
93766 }
93767 if (request === undefined) {
93768 throw new Error(
93769 "Missing external configuration for type:" + type
93770 );
93771 }
93772 if (Array.isArray(request)) {
93773 expr = `require(${JSON.stringify(
93774 request[0]
93775 )})${accessorToObjectAccess(request.slice(1))}`;
93776 } else {
93777 expr = `require(${JSON.stringify(request)})`;
93778 }
93779 if (m.optional) {
93780 expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`;
93781 }
93782 return expr;
93783 })
93784 .join(", ")
93785 );
93786 };
93787
93788 const externalsArguments = modules => {
93789 return modules
93790 .map(
93791 m =>
93792 `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(`${m.id}`)}__`
93793 )
93794 .join(", ");
93795 };
93796
93797 const libraryName = library => {
93798 return JSON.stringify(replaceKeys([].concat(library).pop()));
93799 };
93800
93801 let amdFactory;
93802 if (optionalExternals.length > 0) {
93803 const wrapperArguments = externalsArguments(requiredExternals);
93804 const factoryArguments =
93805 requiredExternals.length > 0
93806 ? externalsArguments(requiredExternals) +
93807 ", " +
93808 externalsRootArray(optionalExternals)
93809 : externalsRootArray(optionalExternals);
93810 amdFactory =
93811 `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` +
93812 ` return factory(${factoryArguments});\n` +
93813 " }";
93814 } else {
93815 amdFactory = "factory";
93816 }
93817
93818 const auxiliaryComment = this.auxiliaryComment;
93819
93820 const getAuxilaryComment = type => {
93821 if (auxiliaryComment) {
93822 if (typeof auxiliaryComment === "string")
93823 return "\t//" + auxiliaryComment + "\n";
93824 if (auxiliaryComment[type])
93825 return "\t//" + auxiliaryComment[type] + "\n";
93826 }
93827 return "";
93828 };
93829
93830 return new ConcatSource(
93831 new OriginalSource(
93832 "(function webpackUniversalModuleDefinition(root, factory) {\n" +
93833 getAuxilaryComment("commonjs2") +
93834 " if(typeof exports === 'object' && typeof module === 'object')\n" +
93835 " module.exports = factory(" +
93836 externalsRequireArray("commonjs2") +
93837 ");\n" +
93838 getAuxilaryComment("amd") +
93839 " else if(typeof define === 'function' && define.amd)\n" +
93840 (requiredExternals.length > 0
93841 ? this.names.amd && this.namedDefine === true
93842 ? " define(" +
93843 libraryName(this.names.amd) +
93844 ", " +
93845 externalsDepsArray(requiredExternals) +
93846 ", " +
93847 amdFactory +
93848 ");\n"
93849 : " define(" +
93850 externalsDepsArray(requiredExternals) +
93851 ", " +
93852 amdFactory +
93853 ");\n"
93854 : this.names.amd && this.namedDefine === true
93855 ? " define(" +
93856 libraryName(this.names.amd) +
93857 ", [], " +
93858 amdFactory +
93859 ");\n"
93860 : " define([], " + amdFactory + ");\n") +
93861 (this.names.root || this.names.commonjs
93862 ? getAuxilaryComment("commonjs") +
93863 " else if(typeof exports === 'object')\n" +
93864 " exports[" +
93865 libraryName(this.names.commonjs || this.names.root) +
93866 "] = factory(" +
93867 externalsRequireArray("commonjs") +
93868 ");\n" +
93869 getAuxilaryComment("root") +
93870 " else\n" +
93871 " " +
93872 replaceKeys(
93873 accessorAccess("root", this.names.root || this.names.commonjs)
93874 ) +
93875 " = factory(" +
93876 externalsRootArray(externals) +
93877 ");\n"
93878 : " else {\n" +
93879 (externals.length > 0
93880 ? " var a = typeof exports === 'object' ? factory(" +
93881 externalsRequireArray("commonjs") +
93882 ") : factory(" +
93883 externalsRootArray(externals) +
93884 ");\n"
93885 : " var a = factory();\n") +
93886 " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
93887 " }\n") +
93888 `})(${
93889 runtimeTemplate.outputOptions.globalObject
93890 }, function(${externalsArguments(externals)}) {\nreturn `,
93891 "webpack/universalModuleDefinition"
93892 ),
93893 source,
93894 ";\n})"
93895 );
93896 };
93897
93898 for (const template of [mainTemplate, chunkTemplate]) {
93899 template.hooks.renderWithEntry.tap(
93900 "UmdMainTemplatePlugin",
93901 onRenderWithEntry
93902 );
93903 }
93904
93905 mainTemplate.hooks.globalHashPaths.tap("UmdMainTemplatePlugin", paths => {
93906 if (this.names.root) paths = paths.concat(this.names.root);
93907 if (this.names.amd) paths = paths.concat(this.names.amd);
93908 if (this.names.commonjs) paths = paths.concat(this.names.commonjs);
93909 return paths;
93910 });
93911
93912 mainTemplate.hooks.hash.tap("UmdMainTemplatePlugin", hash => {
93913 hash.update("umd");
93914 hash.update(`${this.names.root}`);
93915 hash.update(`${this.names.amd}`);
93916 hash.update(`${this.names.commonjs}`);
93917 });
93918 }
93919}
93920
93921module.exports = UmdMainTemplatePlugin;
93922
93923
93924/***/ }),
93925
93926/***/ 99953:
93927/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
93928
93929"use strict";
93930/*
93931 MIT License http://www.opensource.org/licenses/mit-license.php
93932 Author Tobias Koppers @sokra
93933*/
93934
93935
93936const WebpackError = __webpack_require__(97391);
93937
93938/** @typedef {import("./Module")} Module */
93939/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
93940
93941class UnsupportedFeatureWarning extends WebpackError {
93942 /**
93943 * @param {Module} module module relevant to warning
93944 * @param {string} message description of warning
93945 * @param {DependencyLocation} loc location start and end positions of the module
93946 */
93947 constructor(module, message, loc) {
93948 super(message);
93949
93950 this.name = "UnsupportedFeatureWarning";
93951 this.module = module;
93952 this.loc = loc;
93953 this.hideStack = true;
93954
93955 Error.captureStackTrace(this, this.constructor);
93956 }
93957}
93958
93959module.exports = UnsupportedFeatureWarning;
93960
93961
93962/***/ }),
93963
93964/***/ 73554:
93965/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
93966
93967"use strict";
93968/*
93969 MIT License http://www.opensource.org/licenses/mit-license.php
93970 Author Tobias Koppers @sokra
93971*/
93972
93973
93974const ConstDependency = __webpack_require__(71101);
93975
93976/** @typedef {import("./Compiler")} Compiler */
93977
93978class UseStrictPlugin {
93979 /**
93980 * @param {Compiler} compiler Webpack Compiler
93981 * @returns {void}
93982 */
93983 apply(compiler) {
93984 compiler.hooks.compilation.tap(
93985 "UseStrictPlugin",
93986 (compilation, { normalModuleFactory }) => {
93987 const handler = parser => {
93988 parser.hooks.program.tap("UseStrictPlugin", ast => {
93989 const firstNode = ast.body[0];
93990 if (
93991 firstNode &&
93992 firstNode.type === "ExpressionStatement" &&
93993 firstNode.expression.type === "Literal" &&
93994 firstNode.expression.value === "use strict"
93995 ) {
93996 // Remove "use strict" expression. It will be added later by the renderer again.
93997 // This is necessary in order to not break the strict mode when webpack prepends code.
93998 // @see https://github.com/webpack/webpack/issues/1970
93999 const dep = new ConstDependency("", firstNode.range);
94000 dep.loc = firstNode.loc;
94001 parser.state.current.addDependency(dep);
94002 parser.state.module.buildInfo.strict = true;
94003 }
94004 });
94005 };
94006
94007 normalModuleFactory.hooks.parser
94008 .for("javascript/auto")
94009 .tap("UseStrictPlugin", handler);
94010 normalModuleFactory.hooks.parser
94011 .for("javascript/dynamic")
94012 .tap("UseStrictPlugin", handler);
94013 normalModuleFactory.hooks.parser
94014 .for("javascript/esm")
94015 .tap("UseStrictPlugin", handler);
94016 }
94017 );
94018 }
94019}
94020
94021module.exports = UseStrictPlugin;
94022
94023
94024/***/ }),
94025
94026/***/ 40269:
94027/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94028
94029"use strict";
94030/*
94031 MIT License http://www.opensource.org/licenses/mit-license.php
94032 Author Tobias Koppers @sokra
94033*/
94034
94035
94036const CaseSensitiveModulesWarning = __webpack_require__(8335);
94037
94038class WarnCaseSensitiveModulesPlugin {
94039 apply(compiler) {
94040 compiler.hooks.compilation.tap(
94041 "WarnCaseSensitiveModulesPlugin",
94042 compilation => {
94043 compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => {
94044 const moduleWithoutCase = new Map();
94045 for (const module of compilation.modules) {
94046 const identifier = module.identifier().toLowerCase();
94047 const array = moduleWithoutCase.get(identifier);
94048 if (array) {
94049 array.push(module);
94050 } else {
94051 moduleWithoutCase.set(identifier, [module]);
94052 }
94053 }
94054 for (const pair of moduleWithoutCase) {
94055 const array = pair[1];
94056 if (array.length > 1) {
94057 compilation.warnings.push(new CaseSensitiveModulesWarning(array));
94058 }
94059 }
94060 });
94061 }
94062 );
94063 }
94064}
94065
94066module.exports = WarnCaseSensitiveModulesPlugin;
94067
94068
94069/***/ }),
94070
94071/***/ 71245:
94072/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94073
94074"use strict";
94075/*
94076 MIT License http://www.opensource.org/licenses/mit-license.php
94077 Author Tobias Koppers @sokra
94078*/
94079
94080
94081const NoModeWarning = __webpack_require__(45759);
94082
94083class WarnNoModeSetPlugin {
94084 apply(compiler) {
94085 compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => {
94086 compilation.warnings.push(new NoModeWarning());
94087 });
94088 }
94089}
94090
94091module.exports = WarnNoModeSetPlugin;
94092
94093
94094/***/ }),
94095
94096/***/ 88015:
94097/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94098
94099"use strict";
94100/*
94101 MIT License http://www.opensource.org/licenses/mit-license.php
94102 Author Tobias Koppers @sokra
94103*/
94104
94105
94106const validateOptions = __webpack_require__(33225);
94107const schema = __webpack_require__(97009);
94108
94109/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
94110
94111class IgnoringWatchFileSystem {
94112 constructor(wfs, paths) {
94113 this.wfs = wfs;
94114 this.paths = paths;
94115 }
94116
94117 watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
94118 const ignored = path =>
94119 this.paths.some(p =>
94120 p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
94121 );
94122
94123 const notIgnored = path => !ignored(path);
94124
94125 const ignoredFiles = files.filter(ignored);
94126 const ignoredDirs = dirs.filter(ignored);
94127
94128 const watcher = this.wfs.watch(
94129 files.filter(notIgnored),
94130 dirs.filter(notIgnored),
94131 missing,
94132 startTime,
94133 options,
94134 (
94135 err,
94136 filesModified,
94137 dirsModified,
94138 missingModified,
94139 fileTimestamps,
94140 dirTimestamps,
94141 removedFiles
94142 ) => {
94143 if (err) return callback(err);
94144 for (const path of ignoredFiles) {
94145 fileTimestamps.set(path, 1);
94146 }
94147
94148 for (const path of ignoredDirs) {
94149 dirTimestamps.set(path, 1);
94150 }
94151
94152 callback(
94153 err,
94154 filesModified,
94155 dirsModified,
94156 missingModified,
94157 fileTimestamps,
94158 dirTimestamps,
94159 removedFiles
94160 );
94161 },
94162 callbackUndelayed
94163 );
94164
94165 return {
94166 close: () => watcher.close(),
94167 pause: () => watcher.pause(),
94168 getContextTimestamps: () => {
94169 const dirTimestamps = watcher.getContextTimestamps();
94170 for (const path of ignoredDirs) {
94171 dirTimestamps.set(path, 1);
94172 }
94173 return dirTimestamps;
94174 },
94175 getFileTimestamps: () => {
94176 const fileTimestamps = watcher.getFileTimestamps();
94177 for (const path of ignoredFiles) {
94178 fileTimestamps.set(path, 1);
94179 }
94180 return fileTimestamps;
94181 }
94182 };
94183 }
94184}
94185
94186class WatchIgnorePlugin {
94187 /**
94188 * @param {WatchIgnorePluginOptions} paths list of paths
94189 */
94190 constructor(paths) {
94191 validateOptions(schema, paths, "Watch Ignore Plugin");
94192 this.paths = paths;
94193 }
94194
94195 apply(compiler) {
94196 compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => {
94197 compiler.watchFileSystem = new IgnoringWatchFileSystem(
94198 compiler.watchFileSystem,
94199 this.paths
94200 );
94201 });
94202 }
94203}
94204
94205module.exports = WatchIgnorePlugin;
94206
94207
94208/***/ }),
94209
94210/***/ 29580:
94211/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94212
94213"use strict";
94214/*
94215 MIT License http://www.opensource.org/licenses/mit-license.php
94216 Author Tobias Koppers @sokra
94217*/
94218
94219
94220const Stats = __webpack_require__(99977);
94221
94222class Watching {
94223 constructor(compiler, watchOptions, handler) {
94224 this.startTime = null;
94225 this.invalid = false;
94226 this.handler = handler;
94227 this.callbacks = [];
94228 this.closed = false;
94229 this.suspended = false;
94230 if (typeof watchOptions === "number") {
94231 this.watchOptions = {
94232 aggregateTimeout: watchOptions
94233 };
94234 } else if (watchOptions && typeof watchOptions === "object") {
94235 this.watchOptions = Object.assign({}, watchOptions);
94236 } else {
94237 this.watchOptions = {};
94238 }
94239 this.watchOptions.aggregateTimeout =
94240 this.watchOptions.aggregateTimeout || 200;
94241 this.compiler = compiler;
94242 this.running = true;
94243 this.compiler.readRecords(err => {
94244 if (err) return this._done(err);
94245
94246 this._go();
94247 });
94248 }
94249
94250 _go() {
94251 this.startTime = Date.now();
94252 this.running = true;
94253 this.invalid = false;
94254 this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
94255 if (err) return this._done(err);
94256 const onCompiled = (err, compilation) => {
94257 if (err) return this._done(err);
94258 if (this.invalid) return this._done();
94259
94260 if (this.compiler.hooks.shouldEmit.call(compilation) === false) {
94261 return this._done(null, compilation);
94262 }
94263
94264 this.compiler.emitAssets(compilation, err => {
94265 if (err) return this._done(err);
94266 if (this.invalid) return this._done();
94267 this.compiler.emitRecords(err => {
94268 if (err) return this._done(err);
94269
94270 if (compilation.hooks.needAdditionalPass.call()) {
94271 compilation.needAdditionalPass = true;
94272
94273 const stats = new Stats(compilation);
94274 stats.startTime = this.startTime;
94275 stats.endTime = Date.now();
94276 this.compiler.hooks.done.callAsync(stats, err => {
94277 if (err) return this._done(err);
94278
94279 this.compiler.hooks.additionalPass.callAsync(err => {
94280 if (err) return this._done(err);
94281 this.compiler.compile(onCompiled);
94282 });
94283 });
94284 return;
94285 }
94286 return this._done(null, compilation);
94287 });
94288 });
94289 };
94290 this.compiler.compile(onCompiled);
94291 });
94292 }
94293
94294 _getStats(compilation) {
94295 const stats = new Stats(compilation);
94296 stats.startTime = this.startTime;
94297 stats.endTime = Date.now();
94298 return stats;
94299 }
94300
94301 _done(err, compilation) {
94302 this.running = false;
94303 if (this.invalid) return this._go();
94304
94305 const stats = compilation ? this._getStats(compilation) : null;
94306 if (err) {
94307 this.compiler.hooks.failed.call(err);
94308 this.handler(err, stats);
94309 return;
94310 }
94311 this.compiler.hooks.done.callAsync(stats, () => {
94312 this.handler(null, stats);
94313 if (!this.closed) {
94314 this.watch(
94315 Array.from(compilation.fileDependencies),
94316 Array.from(compilation.contextDependencies),
94317 Array.from(compilation.missingDependencies)
94318 );
94319 }
94320 for (const cb of this.callbacks) cb();
94321 this.callbacks.length = 0;
94322 });
94323 }
94324
94325 watch(files, dirs, missing) {
94326 this.pausedWatcher = null;
94327 this.watcher = this.compiler.watchFileSystem.watch(
94328 files,
94329 dirs,
94330 missing,
94331 this.startTime,
94332 this.watchOptions,
94333 (
94334 err,
94335 filesModified,
94336 contextModified,
94337 missingModified,
94338 fileTimestamps,
94339 contextTimestamps,
94340 removedFiles
94341 ) => {
94342 this.pausedWatcher = this.watcher;
94343 this.watcher = null;
94344 if (err) {
94345 return this.handler(err);
94346 }
94347 this.compiler.fileTimestamps = fileTimestamps;
94348 this.compiler.contextTimestamps = contextTimestamps;
94349 this.compiler.removedFiles = removedFiles;
94350 if (!this.suspended) {
94351 this._invalidate();
94352 }
94353 },
94354 (fileName, changeTime) => {
94355 this.compiler.hooks.invalid.call(fileName, changeTime);
94356 }
94357 );
94358 }
94359
94360 invalidate(callback) {
94361 if (callback) {
94362 this.callbacks.push(callback);
94363 }
94364 if (this.watcher) {
94365 this.compiler.fileTimestamps = this.watcher.getFileTimestamps();
94366 this.compiler.contextTimestamps = this.watcher.getContextTimestamps();
94367 }
94368 return this._invalidate();
94369 }
94370
94371 _invalidate() {
94372 if (this.watcher) {
94373 this.pausedWatcher = this.watcher;
94374 this.watcher.pause();
94375 this.watcher = null;
94376 }
94377
94378 if (this.running) {
94379 this.invalid = true;
94380 return false;
94381 } else {
94382 this._go();
94383 }
94384 }
94385
94386 suspend() {
94387 this.suspended = true;
94388 this.invalid = false;
94389 }
94390
94391 resume() {
94392 if (this.suspended) {
94393 this.suspended = false;
94394 this._invalidate();
94395 }
94396 }
94397
94398 close(callback) {
94399 const finalCallback = () => {
94400 this.compiler.hooks.watchClose.call();
94401 this.compiler.running = false;
94402 this.compiler.watchMode = false;
94403 if (callback !== undefined) callback();
94404 };
94405
94406 this.closed = true;
94407 if (this.watcher) {
94408 this.watcher.close();
94409 this.watcher = null;
94410 }
94411 if (this.pausedWatcher) {
94412 this.pausedWatcher.close();
94413 this.pausedWatcher = null;
94414 }
94415 if (this.running) {
94416 this.invalid = true;
94417 this._done = finalCallback;
94418 } else {
94419 finalCallback();
94420 }
94421 }
94422}
94423
94424module.exports = Watching;
94425
94426
94427/***/ }),
94428
94429/***/ 97391:
94430/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94431
94432"use strict";
94433/*
94434 MIT License http://www.opensource.org/licenses/mit-license.php
94435 Author Jarid Margolin @jaridmargolin
94436*/
94437
94438
94439const inspect = __webpack_require__(31669).inspect.custom;
94440
94441class WebpackError extends Error {
94442 /**
94443 * Creates an instance of WebpackError.
94444 * @param {string=} message error message
94445 */
94446 constructor(message) {
94447 super(message);
94448
94449 this.details = undefined;
94450 this.missing = undefined;
94451 this.origin = undefined;
94452 this.dependencies = undefined;
94453 this.module = undefined;
94454
94455 Error.captureStackTrace(this, this.constructor);
94456 }
94457
94458 [inspect]() {
94459 return this.stack + (this.details ? `\n${this.details}` : "");
94460 }
94461}
94462
94463module.exports = WebpackError;
94464
94465
94466/***/ }),
94467
94468/***/ 2779:
94469/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
94470
94471"use strict";
94472/*
94473 MIT License http://www.opensource.org/licenses/mit-license.php
94474 Author Tobias Koppers @sokra
94475*/
94476
94477
94478const OptionsApply = __webpack_require__(4428);
94479
94480const JavascriptModulesPlugin = __webpack_require__(10339);
94481const JsonModulesPlugin = __webpack_require__(2859);
94482const WebAssemblyModulesPlugin = __webpack_require__(99510);
94483
94484const LoaderTargetPlugin = __webpack_require__(95154);
94485const FunctionModulePlugin = __webpack_require__(31221);
94486const EvalDevToolModulePlugin = __webpack_require__(65200);
94487const SourceMapDevToolPlugin = __webpack_require__(11851);
94488const EvalSourceMapDevToolPlugin = __webpack_require__(99994);
94489
94490const EntryOptionPlugin = __webpack_require__(14604);
94491const RecordIdsPlugin = __webpack_require__(40355);
94492
94493const APIPlugin = __webpack_require__(71118);
94494const ConstPlugin = __webpack_require__(84072);
94495const CommonJsStuffPlugin = __webpack_require__(85736);
94496const CompatibilityPlugin = __webpack_require__(85918);
94497
94498const TemplatedPathPlugin = __webpack_require__(76032);
94499const WarnCaseSensitiveModulesPlugin = __webpack_require__(40269);
94500const UseStrictPlugin = __webpack_require__(73554);
94501
94502const LoaderPlugin = __webpack_require__(31559);
94503const CommonJsPlugin = __webpack_require__(85358);
94504const HarmonyModulesPlugin = __webpack_require__(66792);
94505const SystemPlugin = __webpack_require__(68166);
94506const ImportPlugin = __webpack_require__(58839);
94507const RequireContextPlugin = __webpack_require__(89042);
94508const RequireEnsurePlugin = __webpack_require__(98655);
94509const RequireIncludePlugin = __webpack_require__(16522);
94510
94511const { cachedCleverMerge } = __webpack_require__(67916);
94512
94513/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
94514/** @typedef {import("./Compiler")} Compiler */
94515
94516class WebpackOptionsApply extends OptionsApply {
94517 constructor() {
94518 super();
94519 }
94520
94521 /**
94522 * @param {WebpackOptions} options options object
94523 * @param {Compiler} compiler compiler object
94524 * @returns {WebpackOptions} options object
94525 */
94526 process(options, compiler) {
94527 let ExternalsPlugin;
94528 compiler.outputPath = options.output.path;
94529 compiler.recordsInputPath = options.recordsInputPath || options.recordsPath;
94530 compiler.recordsOutputPath =
94531 options.recordsOutputPath || options.recordsPath;
94532 compiler.name = options.name;
94533 // TODO webpack 5 refactor this to MultiCompiler.setDependencies() with a WeakMap
94534 // @ts-ignore TODO
94535 compiler.dependencies = options.dependencies;
94536 if (typeof options.target === "string") {
94537 let JsonpTemplatePlugin;
94538 let FetchCompileWasmTemplatePlugin;
94539 let ReadFileCompileWasmTemplatePlugin;
94540 let NodeSourcePlugin;
94541 let NodeTargetPlugin;
94542 let NodeTemplatePlugin;
94543
94544 switch (options.target) {
94545 case "web":
94546 JsonpTemplatePlugin = __webpack_require__(92764);
94547 FetchCompileWasmTemplatePlugin = __webpack_require__(52669);
94548 NodeSourcePlugin = __webpack_require__(9128);
94549 new JsonpTemplatePlugin().apply(compiler);
94550 new FetchCompileWasmTemplatePlugin({
94551 mangleImports: options.optimization.mangleWasmImports
94552 }).apply(compiler);
94553 new FunctionModulePlugin().apply(compiler);
94554 new NodeSourcePlugin(options.node).apply(compiler);
94555 new LoaderTargetPlugin(options.target).apply(compiler);
94556 break;
94557 case "webworker": {
94558 let WebWorkerTemplatePlugin = __webpack_require__(21328);
94559 FetchCompileWasmTemplatePlugin = __webpack_require__(52669);
94560 NodeSourcePlugin = __webpack_require__(9128);
94561 new WebWorkerTemplatePlugin().apply(compiler);
94562 new FetchCompileWasmTemplatePlugin({
94563 mangleImports: options.optimization.mangleWasmImports
94564 }).apply(compiler);
94565 new FunctionModulePlugin().apply(compiler);
94566 new NodeSourcePlugin(options.node).apply(compiler);
94567 new LoaderTargetPlugin(options.target).apply(compiler);
94568 break;
94569 }
94570 case "node":
94571 case "async-node":
94572 NodeTemplatePlugin = __webpack_require__(90010);
94573 ReadFileCompileWasmTemplatePlugin = __webpack_require__(73839);
94574 NodeTargetPlugin = __webpack_require__(59743);
94575 new NodeTemplatePlugin({
94576 asyncChunkLoading: options.target === "async-node"
94577 }).apply(compiler);
94578 new ReadFileCompileWasmTemplatePlugin({
94579 mangleImports: options.optimization.mangleWasmImports
94580 }).apply(compiler);
94581 new FunctionModulePlugin().apply(compiler);
94582 new NodeTargetPlugin().apply(compiler);
94583 new LoaderTargetPlugin("node").apply(compiler);
94584 break;
94585 case "node-webkit":
94586 JsonpTemplatePlugin = __webpack_require__(92764);
94587 NodeTargetPlugin = __webpack_require__(59743);
94588 ExternalsPlugin = __webpack_require__(75705);
94589 new JsonpTemplatePlugin().apply(compiler);
94590 new FunctionModulePlugin().apply(compiler);
94591 new NodeTargetPlugin().apply(compiler);
94592 new ExternalsPlugin("commonjs", "nw.gui").apply(compiler);
94593 new LoaderTargetPlugin(options.target).apply(compiler);
94594 break;
94595 case "electron-main":
94596 NodeTemplatePlugin = __webpack_require__(90010);
94597 NodeTargetPlugin = __webpack_require__(59743);
94598 ExternalsPlugin = __webpack_require__(75705);
94599 new NodeTemplatePlugin({
94600 asyncChunkLoading: true
94601 }).apply(compiler);
94602 new FunctionModulePlugin().apply(compiler);
94603 new NodeTargetPlugin().apply(compiler);
94604 new ExternalsPlugin("commonjs", [
94605 "app",
94606 "auto-updater",
94607 "browser-window",
94608 "clipboard",
94609 "content-tracing",
94610 "crash-reporter",
94611 "dialog",
94612 "electron",
94613 "global-shortcut",
94614 "ipc",
94615 "ipc-main",
94616 "menu",
94617 "menu-item",
94618 "native-image",
94619 "original-fs",
94620 "power-monitor",
94621 "power-save-blocker",
94622 "protocol",
94623 "screen",
94624 "session",
94625 "shell",
94626 "tray",
94627 "web-contents"
94628 ]).apply(compiler);
94629 new LoaderTargetPlugin(options.target).apply(compiler);
94630 break;
94631 case "electron-renderer":
94632 case "electron-preload":
94633 FetchCompileWasmTemplatePlugin = __webpack_require__(52669);
94634 NodeTargetPlugin = __webpack_require__(59743);
94635 ExternalsPlugin = __webpack_require__(75705);
94636 if (options.target === "electron-renderer") {
94637 JsonpTemplatePlugin = __webpack_require__(92764);
94638 new JsonpTemplatePlugin().apply(compiler);
94639 } else if (options.target === "electron-preload") {
94640 NodeTemplatePlugin = __webpack_require__(90010);
94641 new NodeTemplatePlugin({
94642 asyncChunkLoading: true
94643 }).apply(compiler);
94644 }
94645 new FetchCompileWasmTemplatePlugin({
94646 mangleImports: options.optimization.mangleWasmImports
94647 }).apply(compiler);
94648 new FunctionModulePlugin().apply(compiler);
94649 new NodeTargetPlugin().apply(compiler);
94650 new ExternalsPlugin("commonjs", [
94651 "clipboard",
94652 "crash-reporter",
94653 "desktop-capturer",
94654 "electron",
94655 "ipc",
94656 "ipc-renderer",
94657 "native-image",
94658 "original-fs",
94659 "remote",
94660 "screen",
94661 "shell",
94662 "web-frame"
94663 ]).apply(compiler);
94664 new LoaderTargetPlugin(options.target).apply(compiler);
94665 break;
94666 default:
94667 throw new Error("Unsupported target '" + options.target + "'.");
94668 }
94669 }
94670 // @ts-ignore This is always true, which is good this way
94671 else if (options.target !== false) {
94672 options.target(compiler);
94673 } else {
94674 throw new Error("Unsupported target '" + options.target + "'.");
94675 }
94676
94677 if (options.output.library || options.output.libraryTarget !== "var") {
94678 const LibraryTemplatePlugin = __webpack_require__(65237);
94679 new LibraryTemplatePlugin(
94680 options.output.library,
94681 options.output.libraryTarget,
94682 options.output.umdNamedDefine,
94683 options.output.auxiliaryComment || "",
94684 options.output.libraryExport
94685 ).apply(compiler);
94686 }
94687 if (options.externals) {
94688 ExternalsPlugin = __webpack_require__(75705);
94689 new ExternalsPlugin(
94690 options.output.libraryTarget,
94691 options.externals
94692 ).apply(compiler);
94693 }
94694
94695 let noSources;
94696 let legacy;
94697 let modern;
94698 let comment;
94699 if (
94700 options.devtool &&
94701 (options.devtool.includes("sourcemap") ||
94702 options.devtool.includes("source-map"))
94703 ) {
94704 const hidden = options.devtool.includes("hidden");
94705 const inline = options.devtool.includes("inline");
94706 const evalWrapped = options.devtool.includes("eval");
94707 const cheap = options.devtool.includes("cheap");
94708 const moduleMaps = options.devtool.includes("module");
94709 noSources = options.devtool.includes("nosources");
94710 legacy = options.devtool.includes("@");
94711 modern = options.devtool.includes("#");
94712 comment =
94713 legacy && modern
94714 ? "\n/*\n//@ source" +
94715 "MappingURL=[url]\n//# source" +
94716 "MappingURL=[url]\n*/"
94717 : legacy
94718 ? "\n/*\n//@ source" + "MappingURL=[url]\n*/"
94719 : modern
94720 ? "\n//# source" + "MappingURL=[url]"
94721 : null;
94722 const Plugin = evalWrapped
94723 ? EvalSourceMapDevToolPlugin
94724 : SourceMapDevToolPlugin;
94725 new Plugin({
94726 filename: inline ? null : options.output.sourceMapFilename,
94727 moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
94728 fallbackModuleFilenameTemplate:
94729 options.output.devtoolFallbackModuleFilenameTemplate,
94730 append: hidden ? false : comment,
94731 module: moduleMaps ? true : cheap ? false : true,
94732 columns: cheap ? false : true,
94733 lineToLine: options.output.devtoolLineToLine,
94734 noSources: noSources,
94735 namespace: options.output.devtoolNamespace
94736 }).apply(compiler);
94737 } else if (options.devtool && options.devtool.includes("eval")) {
94738 legacy = options.devtool.includes("@");
94739 modern = options.devtool.includes("#");
94740 comment =
94741 legacy && modern
94742 ? "\n//@ sourceURL=[url]\n//# sourceURL=[url]"
94743 : legacy
94744 ? "\n//@ sourceURL=[url]"
94745 : modern
94746 ? "\n//# sourceURL=[url]"
94747 : null;
94748 new EvalDevToolModulePlugin({
94749 sourceUrlComment: comment,
94750 moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
94751 namespace: options.output.devtoolNamespace
94752 }).apply(compiler);
94753 }
94754
94755 new JavascriptModulesPlugin().apply(compiler);
94756 new JsonModulesPlugin().apply(compiler);
94757 new WebAssemblyModulesPlugin({
94758 mangleImports: options.optimization.mangleWasmImports
94759 }).apply(compiler);
94760
94761 new EntryOptionPlugin().apply(compiler);
94762 compiler.hooks.entryOption.call(options.context, options.entry);
94763
94764 new CompatibilityPlugin().apply(compiler);
94765 new HarmonyModulesPlugin(options.module).apply(compiler);
94766 if (options.amd !== false) {
94767 const AMDPlugin = __webpack_require__(85812);
94768 const RequireJsStuffPlugin = __webpack_require__(88226);
94769 new AMDPlugin(options.module, options.amd || {}).apply(compiler);
94770 new RequireJsStuffPlugin().apply(compiler);
94771 }
94772 new CommonJsPlugin(options.module).apply(compiler);
94773 new LoaderPlugin().apply(compiler);
94774 if (options.node !== false) {
94775 const NodeStuffPlugin = __webpack_require__(28386);
94776 new NodeStuffPlugin(options.node).apply(compiler);
94777 }
94778 new CommonJsStuffPlugin().apply(compiler);
94779 new APIPlugin().apply(compiler);
94780 new ConstPlugin().apply(compiler);
94781 new UseStrictPlugin().apply(compiler);
94782 new RequireIncludePlugin().apply(compiler);
94783 new RequireEnsurePlugin().apply(compiler);
94784 new RequireContextPlugin(
94785 options.resolve.modules,
94786 options.resolve.extensions,
94787 options.resolve.mainFiles
94788 ).apply(compiler);
94789 new ImportPlugin(options.module).apply(compiler);
94790 new SystemPlugin(options.module).apply(compiler);
94791
94792 if (typeof options.mode !== "string") {
94793 const WarnNoModeSetPlugin = __webpack_require__(71245);
94794 new WarnNoModeSetPlugin().apply(compiler);
94795 }
94796
94797 const EnsureChunkConditionsPlugin = __webpack_require__(29720);
94798 new EnsureChunkConditionsPlugin().apply(compiler);
94799 if (options.optimization.removeAvailableModules) {
94800 const RemoveParentModulesPlugin = __webpack_require__(58142);
94801 new RemoveParentModulesPlugin().apply(compiler);
94802 }
94803 if (options.optimization.removeEmptyChunks) {
94804 const RemoveEmptyChunksPlugin = __webpack_require__(78085);
94805 new RemoveEmptyChunksPlugin().apply(compiler);
94806 }
94807 if (options.optimization.mergeDuplicateChunks) {
94808 const MergeDuplicateChunksPlugin = __webpack_require__(46214);
94809 new MergeDuplicateChunksPlugin().apply(compiler);
94810 }
94811 if (options.optimization.flagIncludedChunks) {
94812 const FlagIncludedChunksPlugin = __webpack_require__(25850);
94813 new FlagIncludedChunksPlugin().apply(compiler);
94814 }
94815 if (options.optimization.sideEffects) {
94816 const SideEffectsFlagPlugin = __webpack_require__(83654);
94817 new SideEffectsFlagPlugin().apply(compiler);
94818 }
94819 if (options.optimization.providedExports) {
94820 const FlagDependencyExportsPlugin = __webpack_require__(73599);
94821 new FlagDependencyExportsPlugin().apply(compiler);
94822 }
94823 if (options.optimization.usedExports) {
94824 const FlagDependencyUsagePlugin = __webpack_require__(33632);
94825 new FlagDependencyUsagePlugin().apply(compiler);
94826 }
94827 if (options.optimization.concatenateModules) {
94828 const ModuleConcatenationPlugin = __webpack_require__(45184);
94829 new ModuleConcatenationPlugin().apply(compiler);
94830 }
94831 if (options.optimization.splitChunks) {
94832 const SplitChunksPlugin = __webpack_require__(60474);
94833 new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler);
94834 }
94835 if (options.optimization.runtimeChunk) {
94836 const RuntimeChunkPlugin = __webpack_require__(76894);
94837 new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler);
94838 }
94839 if (options.optimization.noEmitOnErrors) {
94840 const NoEmitOnErrorsPlugin = __webpack_require__(22615);
94841 new NoEmitOnErrorsPlugin().apply(compiler);
94842 }
94843 if (options.optimization.checkWasmTypes) {
94844 const WasmFinalizeExportsPlugin = __webpack_require__(10557);
94845 new WasmFinalizeExportsPlugin().apply(compiler);
94846 }
94847 let moduleIds = options.optimization.moduleIds;
94848 if (moduleIds === undefined) {
94849 // TODO webpack 5 remove all these options
94850 if (options.optimization.occurrenceOrder) {
94851 moduleIds = "size";
94852 }
94853 if (options.optimization.namedModules) {
94854 moduleIds = "named";
94855 }
94856 if (options.optimization.hashedModuleIds) {
94857 moduleIds = "hashed";
94858 }
94859 if (moduleIds === undefined) {
94860 moduleIds = "natural";
94861 }
94862 }
94863 if (moduleIds) {
94864 const NamedModulesPlugin = __webpack_require__(86707);
94865 const HashedModuleIdsPlugin = __webpack_require__(50268);
94866 const OccurrenceModuleOrderPlugin = __webpack_require__(62000);
94867 switch (moduleIds) {
94868 case "natural":
94869 // TODO webpack 5: see hint in Compilation.sortModules
94870 break;
94871 case "named":
94872 new NamedModulesPlugin().apply(compiler);
94873 break;
94874 case "hashed":
94875 new HashedModuleIdsPlugin().apply(compiler);
94876 break;
94877 case "size":
94878 new OccurrenceModuleOrderPlugin({
94879 prioritiseInitial: true
94880 }).apply(compiler);
94881 break;
94882 case "total-size":
94883 new OccurrenceModuleOrderPlugin({
94884 prioritiseInitial: false
94885 }).apply(compiler);
94886 break;
94887 default:
94888 throw new Error(
94889 `webpack bug: moduleIds: ${moduleIds} is not implemented`
94890 );
94891 }
94892 }
94893 let chunkIds = options.optimization.chunkIds;
94894 if (chunkIds === undefined) {
94895 // TODO webpack 5 remove all these options
94896 if (options.optimization.occurrenceOrder) {
94897 // This looks weird but it's for backward-compat
94898 // This bug already existed before adding this feature
94899 chunkIds = "total-size";
94900 }
94901 if (options.optimization.namedChunks) {
94902 chunkIds = "named";
94903 }
94904 if (chunkIds === undefined) {
94905 chunkIds = "natural";
94906 }
94907 }
94908 if (chunkIds) {
94909 const NaturalChunkOrderPlugin = __webpack_require__(68053);
94910 const NamedChunksPlugin = __webpack_require__(70419);
94911 const OccurrenceChunkOrderPlugin = __webpack_require__(83741);
94912 switch (chunkIds) {
94913 case "natural":
94914 new NaturalChunkOrderPlugin().apply(compiler);
94915 break;
94916 case "named":
94917 // TODO webapck 5: for backward-compat this need to have OccurrenceChunkOrderPlugin too
94918 // The NamedChunksPlugin doesn't give every chunk a name
94919 // This should be fixed, and the OccurrenceChunkOrderPlugin should be removed here.
94920 new OccurrenceChunkOrderPlugin({
94921 prioritiseInitial: false
94922 }).apply(compiler);
94923 new NamedChunksPlugin().apply(compiler);
94924 break;
94925 case "size":
94926 new OccurrenceChunkOrderPlugin({
94927 prioritiseInitial: true
94928 }).apply(compiler);
94929 break;
94930 case "total-size":
94931 new OccurrenceChunkOrderPlugin({
94932 prioritiseInitial: false
94933 }).apply(compiler);
94934 break;
94935 default:
94936 throw new Error(
94937 `webpack bug: chunkIds: ${chunkIds} is not implemented`
94938 );
94939 }
94940 }
94941 if (options.optimization.nodeEnv) {
94942 const DefinePlugin = __webpack_require__(97374);
94943 new DefinePlugin({
94944 "process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv)
94945 }).apply(compiler);
94946 }
94947 if (options.optimization.minimize) {
94948 for (const minimizer of options.optimization.minimizer) {
94949 if (typeof minimizer === "function") {
94950 minimizer.call(compiler, compiler);
94951 } else {
94952 minimizer.apply(compiler);
94953 }
94954 }
94955 }
94956
94957 if (options.performance) {
94958 const SizeLimitsPlugin = __webpack_require__(68310);
94959 new SizeLimitsPlugin(options.performance).apply(compiler);
94960 }
94961
94962 new TemplatedPathPlugin().apply(compiler);
94963
94964 new RecordIdsPlugin({
94965 portableIds: options.optimization.portableRecords
94966 }).apply(compiler);
94967
94968 new WarnCaseSensitiveModulesPlugin().apply(compiler);
94969
94970 if (options.cache) {
94971 const CachePlugin = __webpack_require__(6465);
94972 new CachePlugin(
94973 typeof options.cache === "object" ? options.cache : null
94974 ).apply(compiler);
94975 }
94976
94977 compiler.hooks.afterPlugins.call(compiler);
94978 if (!compiler.inputFileSystem) {
94979 throw new Error("No input filesystem provided");
94980 }
94981 compiler.resolverFactory.hooks.resolveOptions
94982 .for("normal")
94983 .tap("WebpackOptionsApply", resolveOptions => {
94984 return Object.assign(
94985 {
94986 fileSystem: compiler.inputFileSystem
94987 },
94988 cachedCleverMerge(options.resolve, resolveOptions)
94989 );
94990 });
94991 compiler.resolverFactory.hooks.resolveOptions
94992 .for("context")
94993 .tap("WebpackOptionsApply", resolveOptions => {
94994 return Object.assign(
94995 {
94996 fileSystem: compiler.inputFileSystem,
94997 resolveToContext: true
94998 },
94999 cachedCleverMerge(options.resolve, resolveOptions)
95000 );
95001 });
95002 compiler.resolverFactory.hooks.resolveOptions
95003 .for("loader")
95004 .tap("WebpackOptionsApply", resolveOptions => {
95005 return Object.assign(
95006 {
95007 fileSystem: compiler.inputFileSystem
95008 },
95009 cachedCleverMerge(options.resolveLoader, resolveOptions)
95010 );
95011 });
95012 compiler.hooks.afterResolvers.call(compiler);
95013 return options;
95014 }
95015}
95016
95017module.exports = WebpackOptionsApply;
95018
95019
95020/***/ }),
95021
95022/***/ 60016:
95023/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
95024
95025"use strict";
95026/*
95027 MIT License http://www.opensource.org/licenses/mit-license.php
95028 Author Tobias Koppers @sokra
95029*/
95030
95031
95032const path = __webpack_require__(85622);
95033
95034const OptionsDefaulter = __webpack_require__(3414);
95035const Template = __webpack_require__(96066);
95036
95037const isProductionLikeMode = options => {
95038 return options.mode === "production" || !options.mode;
95039};
95040
95041const isWebLikeTarget = options => {
95042 return options.target === "web" || options.target === "webworker";
95043};
95044
95045const getDevtoolNamespace = library => {
95046 // if options.output.library is a string
95047 if (Array.isArray(library)) {
95048 return library.join(".");
95049 } else if (typeof library === "object") {
95050 return getDevtoolNamespace(library.root);
95051 }
95052 return library || "";
95053};
95054
95055class WebpackOptionsDefaulter extends OptionsDefaulter {
95056 constructor() {
95057 super();
95058
95059 this.set("entry", "./src");
95060
95061 this.set("devtool", "make", options =>
95062 options.mode === "development" ? "eval" : false
95063 );
95064 this.set("cache", "make", options => options.mode === "development");
95065
95066 this.set("context", process.cwd());
95067 this.set("target", "web");
95068
95069 this.set("module", "call", value => Object.assign({}, value));
95070 this.set("module.unknownContextRequest", ".");
95071 this.set("module.unknownContextRegExp", false);
95072 this.set("module.unknownContextRecursive", true);
95073 this.set("module.unknownContextCritical", true);
95074 this.set("module.exprContextRequest", ".");
95075 this.set("module.exprContextRegExp", false);
95076 this.set("module.exprContextRecursive", true);
95077 this.set("module.exprContextCritical", true);
95078 this.set("module.wrappedContextRegExp", /.*/);
95079 this.set("module.wrappedContextRecursive", true);
95080 this.set("module.wrappedContextCritical", false);
95081 this.set("module.strictExportPresence", false);
95082 this.set("module.strictThisContextOnImports", false);
95083 this.set("module.unsafeCache", "make", options => !!options.cache);
95084 this.set("module.rules", []);
95085 this.set("module.defaultRules", "make", options => [
95086 {
95087 type: "javascript/auto",
95088 resolve: {}
95089 },
95090 {
95091 test: /\.mjs$/i,
95092 type: "javascript/esm",
95093 resolve: {
95094 mainFields:
95095 options.target === "web" ||
95096 options.target === "webworker" ||
95097 options.target === "electron-renderer"
95098 ? ["browser", "main"]
95099 : ["main"]
95100 }
95101 },
95102 {
95103 test: /\.json$/i,
95104 type: "json"
95105 },
95106 {
95107 test: /\.wasm$/i,
95108 type: "webassembly/experimental"
95109 }
95110 ]);
95111
95112 this.set("output", "call", (value, options) => {
95113 if (typeof value === "string") {
95114 return {
95115 filename: value
95116 };
95117 } else if (typeof value !== "object") {
95118 return {};
95119 } else {
95120 return Object.assign({}, value);
95121 }
95122 });
95123
95124 this.set("output.filename", "[name].js");
95125 this.set("output.chunkFilename", "make", options => {
95126 const filename = options.output.filename;
95127 if (typeof filename !== "function") {
95128 const hasName = filename.includes("[name]");
95129 const hasId = filename.includes("[id]");
95130 const hasChunkHash = filename.includes("[chunkhash]");
95131 // Anything changing depending on chunk is fine
95132 if (hasChunkHash || hasName || hasId) return filename;
95133 // Elsewise prefix "[id]." in front of the basename to make it changing
95134 return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2");
95135 }
95136 return "[id].js";
95137 });
95138 this.set("output.webassemblyModuleFilename", "[modulehash].module.wasm");
95139 this.set("output.library", "");
95140 this.set("output.hotUpdateFunction", "make", options => {
95141 return Template.toIdentifier(
95142 "webpackHotUpdate" + Template.toIdentifier(options.output.library)
95143 );
95144 });
95145 this.set("output.jsonpFunction", "make", options => {
95146 return Template.toIdentifier(
95147 "webpackJsonp" + Template.toIdentifier(options.output.library)
95148 );
95149 });
95150 this.set("output.chunkCallbackName", "make", options => {
95151 return Template.toIdentifier(
95152 "webpackChunk" + Template.toIdentifier(options.output.library)
95153 );
95154 });
95155 this.set("output.globalObject", "make", options => {
95156 switch (options.target) {
95157 case "web":
95158 case "electron-renderer":
95159 case "node-webkit":
95160 return "window";
95161 case "webworker":
95162 return "self";
95163 case "node":
95164 case "async-node":
95165 case "electron-main":
95166 return "global";
95167 default:
95168 return "self";
95169 }
95170 });
95171 this.set("output.devtoolNamespace", "make", options => {
95172 return getDevtoolNamespace(options.output.library);
95173 });
95174 this.set("output.libraryTarget", "var");
95175 this.set("output.path", path.join(process.cwd(), "dist"));
95176 this.set(
95177 "output.pathinfo",
95178 "make",
95179 options => options.mode === "development"
95180 );
95181 this.set("output.sourceMapFilename", "[file].map[query]");
95182 this.set("output.hotUpdateChunkFilename", "[id].[hash].hot-update.js");
95183 this.set("output.hotUpdateMainFilename", "[hash].hot-update.json");
95184 this.set("output.crossOriginLoading", false);
95185 this.set("output.jsonpScriptType", false);
95186 this.set("output.chunkLoadTimeout", 120000);
95187 this.set("output.hashFunction", "md4");
95188 this.set("output.hashDigest", "hex");
95189 this.set("output.hashDigestLength", 20);
95190 this.set("output.devtoolLineToLine", false);
95191 this.set("output.strictModuleExceptionHandling", false);
95192
95193 this.set("node", "call", value => {
95194 if (typeof value === "boolean") {
95195 return value;
95196 } else {
95197 return Object.assign({}, value);
95198 }
95199 });
95200 this.set("node.console", false);
95201 this.set("node.process", true);
95202 this.set("node.global", true);
95203 this.set("node.Buffer", true);
95204 this.set("node.setImmediate", true);
95205 this.set("node.__filename", "mock");
95206 this.set("node.__dirname", "mock");
95207
95208 this.set("performance", "call", (value, options) => {
95209 if (value === false) return false;
95210 if (
95211 value === undefined &&
95212 (!isProductionLikeMode(options) || !isWebLikeTarget(options))
95213 )
95214 return false;
95215 return Object.assign({}, value);
95216 });
95217 this.set("performance.maxAssetSize", 250000);
95218 this.set("performance.maxEntrypointSize", 250000);
95219 this.set("performance.hints", "make", options =>
95220 isProductionLikeMode(options) ? "warning" : false
95221 );
95222
95223 this.set("optimization", "call", value => Object.assign({}, value));
95224 // TODO webpack 5: Disable by default in a modes
95225 this.set(
95226 "optimization.removeAvailableModules",
95227 "make",
95228 options => options.mode !== "development"
95229 );
95230 this.set("optimization.removeEmptyChunks", true);
95231 this.set("optimization.mergeDuplicateChunks", true);
95232 this.set("optimization.flagIncludedChunks", "make", options =>
95233 isProductionLikeMode(options)
95234 );
95235 // TODO webpack 5 add `moduleIds: "named"` default for development
95236 // TODO webpack 5 add `moduleIds: "size"` default for production
95237 // TODO webpack 5 remove optimization.occurrenceOrder
95238 this.set("optimization.occurrenceOrder", "make", options =>
95239 isProductionLikeMode(options)
95240 );
95241 this.set("optimization.sideEffects", "make", options =>
95242 isProductionLikeMode(options)
95243 );
95244 this.set("optimization.providedExports", true);
95245 this.set("optimization.usedExports", "make", options =>
95246 isProductionLikeMode(options)
95247 );
95248 this.set("optimization.concatenateModules", "make", options =>
95249 isProductionLikeMode(options)
95250 );
95251 this.set("optimization.splitChunks", {});
95252 this.set("optimization.splitChunks.hidePathInfo", "make", options => {
95253 return isProductionLikeMode(options);
95254 });
95255 this.set("optimization.splitChunks.chunks", "async");
95256 this.set("optimization.splitChunks.minSize", "make", options => {
95257 return isProductionLikeMode(options) ? 30000 : 10000;
95258 });
95259 this.set("optimization.splitChunks.minChunks", 1);
95260 this.set("optimization.splitChunks.maxAsyncRequests", "make", options => {
95261 return isProductionLikeMode(options) ? 5 : Infinity;
95262 });
95263 this.set("optimization.splitChunks.automaticNameDelimiter", "~");
95264 this.set("optimization.splitChunks.automaticNameMaxLength", 109);
95265 this.set("optimization.splitChunks.maxInitialRequests", "make", options => {
95266 return isProductionLikeMode(options) ? 3 : Infinity;
95267 });
95268 this.set("optimization.splitChunks.name", true);
95269 this.set("optimization.splitChunks.cacheGroups", {});
95270 this.set("optimization.splitChunks.cacheGroups.default", {
95271 automaticNamePrefix: "",
95272 reuseExistingChunk: true,
95273 minChunks: 2,
95274 priority: -20
95275 });
95276 this.set("optimization.splitChunks.cacheGroups.vendors", {
95277 automaticNamePrefix: "vendors",
95278 test: /[\\/]node_modules[\\/]/,
95279 priority: -10
95280 });
95281 this.set("optimization.runtimeChunk", "call", value => {
95282 if (value === "single") {
95283 return {
95284 name: "runtime"
95285 };
95286 }
95287 if (value === true || value === "multiple") {
95288 return {
95289 name: entrypoint => `runtime~${entrypoint.name}`
95290 };
95291 }
95292 return value;
95293 });
95294 this.set("optimization.noEmitOnErrors", "make", options =>
95295 isProductionLikeMode(options)
95296 );
95297 this.set("optimization.checkWasmTypes", "make", options =>
95298 isProductionLikeMode(options)
95299 );
95300 this.set("optimization.mangleWasmImports", false);
95301 // TODO webpack 5 remove optimization.namedModules
95302 this.set(
95303 "optimization.namedModules",
95304 "make",
95305 options => options.mode === "development"
95306 );
95307 this.set("optimization.hashedModuleIds", false);
95308 // TODO webpack 5 add `chunkIds: "named"` default for development
95309 // TODO webpack 5 add `chunkIds: "size"` default for production
95310 // TODO webpack 5 remove optimization.namedChunks
95311 this.set(
95312 "optimization.namedChunks",
95313 "make",
95314 options => options.mode === "development"
95315 );
95316 this.set(
95317 "optimization.portableRecords",
95318 "make",
95319 options =>
95320 !!(
95321 options.recordsInputPath ||
95322 options.recordsOutputPath ||
95323 options.recordsPath
95324 )
95325 );
95326 this.set("optimization.minimize", "make", options =>
95327 isProductionLikeMode(options)
95328 );
95329 this.set("optimization.minimizer", "make", options => [
95330 {
95331 apply: compiler => {
95332 // Lazy load the Terser plugin
95333 const TerserPlugin = __webpack_require__(89301);
95334 const SourceMapDevToolPlugin = __webpack_require__(11851);
95335 new TerserPlugin({
95336 cache: true,
95337 parallel: true,
95338 sourceMap:
95339 (options.devtool && /source-?map/.test(options.devtool)) ||
95340 (options.plugins &&
95341 options.plugins.some(p => p instanceof SourceMapDevToolPlugin))
95342 }).apply(compiler);
95343 }
95344 }
95345 ]);
95346 this.set("optimization.nodeEnv", "make", options => {
95347 // TODO: In webpack 5, it should return `false` when mode is `none`
95348 return options.mode || "production";
95349 });
95350
95351 this.set("resolve", "call", value => Object.assign({}, value));
95352 this.set("resolve.unsafeCache", true);
95353 this.set("resolve.modules", ["node_modules"]);
95354 this.set("resolve.extensions", [".wasm", ".mjs", ".js", ".json"]);
95355 this.set("resolve.mainFiles", ["index"]);
95356 this.set("resolve.aliasFields", "make", options => {
95357 if (
95358 options.target === "web" ||
95359 options.target === "webworker" ||
95360 options.target === "electron-renderer"
95361 ) {
95362 return ["browser"];
95363 } else {
95364 return [];
95365 }
95366 });
95367 this.set("resolve.mainFields", "make", options => {
95368 if (
95369 options.target === "web" ||
95370 options.target === "webworker" ||
95371 options.target === "electron-renderer"
95372 ) {
95373 return ["browser", "module", "main"];
95374 } else {
95375 return ["module", "main"];
95376 }
95377 });
95378 this.set("resolve.cacheWithContext", "make", options => {
95379 return (
95380 Array.isArray(options.resolve.plugins) &&
95381 options.resolve.plugins.length > 0
95382 );
95383 });
95384
95385 this.set("resolveLoader", "call", value => Object.assign({}, value));
95386 this.set("resolveLoader.unsafeCache", true);
95387 this.set("resolveLoader.mainFields", ["loader", "main"]);
95388 this.set("resolveLoader.extensions", [".js", ".json"]);
95389 this.set("resolveLoader.mainFiles", ["index"]);
95390 this.set("resolveLoader.roots", "make", options => [options.context]);
95391 this.set("resolveLoader.cacheWithContext", "make", options => {
95392 return (
95393 Array.isArray(options.resolveLoader.plugins) &&
95394 options.resolveLoader.plugins.length > 0
95395 );
95396 });
95397
95398 this.set("infrastructureLogging", "call", value =>
95399 Object.assign({}, value)
95400 );
95401 this.set("infrastructureLogging.level", "info");
95402 this.set("infrastructureLogging.debug", false);
95403 }
95404}
95405
95406module.exports = WebpackOptionsDefaulter;
95407
95408
95409/***/ }),
95410
95411/***/ 285:
95412/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
95413
95414"use strict";
95415/*
95416 MIT License http://www.opensource.org/licenses/mit-license.php
95417 Author Gajus Kuizinas @gajus
95418*/
95419
95420
95421const WebpackError = __webpack_require__(97391);
95422const webpackOptionsSchema = __webpack_require__(37863);
95423
95424const getSchemaPart = (path, parents, additionalPath) => {
95425 parents = parents || 0;
95426 path = path.split("/");
95427 path = path.slice(0, path.length - parents);
95428 if (additionalPath) {
95429 additionalPath = additionalPath.split("/");
95430 path = path.concat(additionalPath);
95431 }
95432 let schemaPart = webpackOptionsSchema;
95433 for (let i = 1; i < path.length; i++) {
95434 const inner = schemaPart[path[i]];
95435 if (inner) schemaPart = inner;
95436 }
95437 return schemaPart;
95438};
95439
95440const getSchemaPartText = (schemaPart, additionalPath) => {
95441 if (additionalPath) {
95442 for (let i = 0; i < additionalPath.length; i++) {
95443 const inner = schemaPart[additionalPath[i]];
95444 if (inner) schemaPart = inner;
95445 }
95446 }
95447 while (schemaPart.$ref) {
95448 schemaPart = getSchemaPart(schemaPart.$ref);
95449 }
95450 let schemaText = WebpackOptionsValidationError.formatSchema(schemaPart);
95451 if (schemaPart.description) {
95452 schemaText += `\n-> ${schemaPart.description}`;
95453 }
95454 return schemaText;
95455};
95456
95457const getSchemaPartDescription = schemaPart => {
95458 while (schemaPart.$ref) {
95459 schemaPart = getSchemaPart(schemaPart.$ref);
95460 }
95461 if (schemaPart.description) {
95462 return `\n-> ${schemaPart.description}`;
95463 }
95464 return "";
95465};
95466
95467const SPECIFICITY = {
95468 type: 1,
95469 oneOf: 1,
95470 anyOf: 1,
95471 allOf: 1,
95472 additionalProperties: 2,
95473 enum: 1,
95474 instanceof: 1,
95475 required: 2,
95476 minimum: 2,
95477 uniqueItems: 2,
95478 minLength: 2,
95479 minItems: 2,
95480 minProperties: 2,
95481 absolutePath: 2
95482};
95483
95484const filterMax = (array, fn) => {
95485 const max = array.reduce((max, item) => Math.max(max, fn(item)), 0);
95486 return array.filter(item => fn(item) === max);
95487};
95488
95489const filterChildren = children => {
95490 children = filterMax(children, err =>
95491 err.dataPath ? err.dataPath.length : 0
95492 );
95493 children = filterMax(children, err => SPECIFICITY[err.keyword] || 2);
95494 return children;
95495};
95496
95497const indent = (str, prefix, firstLine) => {
95498 if (firstLine) {
95499 return prefix + str.replace(/\n(?!$)/g, "\n" + prefix);
95500 } else {
95501 return str.replace(/\n(?!$)/g, `\n${prefix}`);
95502 }
95503};
95504
95505class WebpackOptionsValidationError extends WebpackError {
95506 constructor(validationErrors) {
95507 super(
95508 "Invalid configuration object. " +
95509 "Webpack has been initialised using a configuration object that does not match the API schema.\n" +
95510 validationErrors
95511 .map(
95512 err =>
95513 " - " +
95514 indent(
95515 WebpackOptionsValidationError.formatValidationError(err),
95516 " ",
95517 false
95518 )
95519 )
95520 .join("\n")
95521 );
95522
95523 this.name = "WebpackOptionsValidationError";
95524 this.validationErrors = validationErrors;
95525
95526 Error.captureStackTrace(this, this.constructor);
95527 }
95528
95529 static formatSchema(schema, prevSchemas) {
95530 prevSchemas = prevSchemas || [];
95531
95532 const formatInnerSchema = (innerSchema, addSelf) => {
95533 if (!addSelf) {
95534 return WebpackOptionsValidationError.formatSchema(
95535 innerSchema,
95536 prevSchemas
95537 );
95538 }
95539 if (prevSchemas.includes(innerSchema)) {
95540 return "(recursive)";
95541 }
95542 return WebpackOptionsValidationError.formatSchema(
95543 innerSchema,
95544 prevSchemas.concat(schema)
95545 );
95546 };
95547
95548 if (schema.type === "string") {
95549 if (schema.minLength === 1) {
95550 return "non-empty string";
95551 }
95552 if (schema.minLength > 1) {
95553 return `string (min length ${schema.minLength})`;
95554 }
95555 return "string";
95556 }
95557 if (schema.type === "boolean") {
95558 return "boolean";
95559 }
95560 if (schema.type === "number") {
95561 return "number";
95562 }
95563 if (schema.type === "object") {
95564 if (schema.properties) {
95565 const required = schema.required || [];
95566 return `object { ${Object.keys(schema.properties)
95567 .map(property => {
95568 if (!required.includes(property)) return property + "?";
95569 return property;
95570 })
95571 .concat(schema.additionalProperties ? ["…"] : [])
95572 .join(", ")} }`;
95573 }
95574 if (schema.additionalProperties) {
95575 return `object { <key>: ${formatInnerSchema(
95576 schema.additionalProperties
95577 )} }`;
95578 }
95579 return "object";
95580 }
95581 if (schema.type === "array") {
95582 return `[${formatInnerSchema(schema.items)}]`;
95583 }
95584
95585 switch (schema.instanceof) {
95586 case "Function":
95587 return "function";
95588 case "RegExp":
95589 return "RegExp";
95590 }
95591
95592 if (schema.enum) {
95593 return schema.enum.map(item => JSON.stringify(item)).join(" | ");
95594 }
95595
95596 if (schema.$ref) {
95597 return formatInnerSchema(getSchemaPart(schema.$ref), true);
95598 }
95599 if (schema.allOf) {
95600 return schema.allOf.map(formatInnerSchema).join(" & ");
95601 }
95602 if (schema.oneOf) {
95603 return schema.oneOf.map(formatInnerSchema).join(" | ");
95604 }
95605 if (schema.anyOf) {
95606 return schema.anyOf.map(formatInnerSchema).join(" | ");
95607 }
95608 return JSON.stringify(schema, null, 2);
95609 }
95610
95611 static formatValidationError(err) {
95612 const dataPath = `configuration${err.dataPath}`;
95613 if (err.keyword === "additionalProperties") {
95614 const baseMessage = `${dataPath} has an unknown property '${
95615 err.params.additionalProperty
95616 }'. These properties are valid:\n${getSchemaPartText(err.parentSchema)}`;
95617 if (!err.dataPath) {
95618 switch (err.params.additionalProperty) {
95619 case "debug":
95620 return (
95621 `${baseMessage}\n` +
95622 "The 'debug' property was removed in webpack 2.0.0.\n" +
95623 "Loaders should be updated to allow passing this option via loader options in module.rules.\n" +
95624 "Until loaders are updated one can use the LoaderOptionsPlugin to switch loaders into debug mode:\n" +
95625 "plugins: [\n" +
95626 " new webpack.LoaderOptionsPlugin({\n" +
95627 " debug: true\n" +
95628 " })\n" +
95629 "]"
95630 );
95631 }
95632 return (
95633 `${baseMessage}\n` +
95634 "For typos: please correct them.\n" +
95635 "For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.\n" +
95636 " Loaders should be updated to allow passing options via loader options in module.rules.\n" +
95637 " Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:\n" +
95638 " plugins: [\n" +
95639 " new webpack.LoaderOptionsPlugin({\n" +
95640 " // test: /\\.xxx$/, // may apply this only for some modules\n" +
95641 " options: {\n" +
95642 ` ${err.params.additionalProperty}: …\n` +
95643 " }\n" +
95644 " })\n" +
95645 " ]"
95646 );
95647 }
95648 return baseMessage;
95649 } else if (err.keyword === "oneOf" || err.keyword === "anyOf") {
95650 if (err.children && err.children.length > 0) {
95651 if (err.schema.length === 1) {
95652 const lastChild = err.children[err.children.length - 1];
95653 const remainingChildren = err.children.slice(
95654 0,
95655 err.children.length - 1
95656 );
95657 return WebpackOptionsValidationError.formatValidationError(
95658 Object.assign({}, lastChild, {
95659 children: remainingChildren,
95660 parentSchema: Object.assign(
95661 {},
95662 err.parentSchema,
95663 lastChild.parentSchema
95664 )
95665 })
95666 );
95667 }
95668 const children = filterChildren(err.children);
95669 if (children.length === 1) {
95670 return WebpackOptionsValidationError.formatValidationError(
95671 children[0]
95672 );
95673 }
95674 return (
95675 `${dataPath} should be one of these:\n${getSchemaPartText(
95676 err.parentSchema
95677 )}\n` +
95678 `Details:\n${children
95679 .map(
95680 err =>
95681 " * " +
95682 indent(
95683 WebpackOptionsValidationError.formatValidationError(err),
95684 " ",
95685 false
95686 )
95687 )
95688 .join("\n")}`
95689 );
95690 }
95691 return `${dataPath} should be one of these:\n${getSchemaPartText(
95692 err.parentSchema
95693 )}`;
95694 } else if (err.keyword === "enum") {
95695 if (
95696 err.parentSchema &&
95697 err.parentSchema.enum &&
95698 err.parentSchema.enum.length === 1
95699 ) {
95700 return `${dataPath} should be ${getSchemaPartText(err.parentSchema)}`;
95701 }
95702 return `${dataPath} should be one of these:\n${getSchemaPartText(
95703 err.parentSchema
95704 )}`;
95705 } else if (err.keyword === "allOf") {
95706 return `${dataPath} should be:\n${getSchemaPartText(err.parentSchema)}`;
95707 } else if (err.keyword === "type") {
95708 switch (err.params.type) {
95709 case "object":
95710 return `${dataPath} should be an object.${getSchemaPartDescription(
95711 err.parentSchema
95712 )}`;
95713 case "string":
95714 return `${dataPath} should be a string.${getSchemaPartDescription(
95715 err.parentSchema
95716 )}`;
95717 case "boolean":
95718 return `${dataPath} should be a boolean.${getSchemaPartDescription(
95719 err.parentSchema
95720 )}`;
95721 case "number":
95722 return `${dataPath} should be a number.${getSchemaPartDescription(
95723 err.parentSchema
95724 )}`;
95725 case "array":
95726 return `${dataPath} should be an array:\n${getSchemaPartText(
95727 err.parentSchema
95728 )}`;
95729 }
95730 return `${dataPath} should be ${err.params.type}:\n${getSchemaPartText(
95731 err.parentSchema
95732 )}`;
95733 } else if (err.keyword === "instanceof") {
95734 return `${dataPath} should be an instance of ${getSchemaPartText(
95735 err.parentSchema
95736 )}`;
95737 } else if (err.keyword === "required") {
95738 const missingProperty = err.params.missingProperty.replace(/^\./, "");
95739 return `${dataPath} misses the property '${missingProperty}'.\n${getSchemaPartText(
95740 err.parentSchema,
95741 ["properties", missingProperty]
95742 )}`;
95743 } else if (err.keyword === "minimum") {
95744 return `${dataPath} ${err.message}.${getSchemaPartDescription(
95745 err.parentSchema
95746 )}`;
95747 } else if (err.keyword === "uniqueItems") {
95748 return `${dataPath} should not contain the item '${
95749 err.data[err.params.i]
95750 }' twice.${getSchemaPartDescription(err.parentSchema)}`;
95751 } else if (
95752 err.keyword === "minLength" ||
95753 err.keyword === "minItems" ||
95754 err.keyword === "minProperties"
95755 ) {
95756 if (err.params.limit === 1) {
95757 switch (err.keyword) {
95758 case "minLength":
95759 return `${dataPath} should be an non-empty string.${getSchemaPartDescription(
95760 err.parentSchema
95761 )}`;
95762 case "minItems":
95763 return `${dataPath} should be an non-empty array.${getSchemaPartDescription(
95764 err.parentSchema
95765 )}`;
95766 case "minProperties":
95767 return `${dataPath} should be an non-empty object.${getSchemaPartDescription(
95768 err.parentSchema
95769 )}`;
95770 }
95771 return `${dataPath} should be not empty.${getSchemaPartDescription(
95772 err.parentSchema
95773 )}`;
95774 } else {
95775 return `${dataPath} ${err.message}${getSchemaPartDescription(
95776 err.parentSchema
95777 )}`;
95778 }
95779 } else if (err.keyword === "not") {
95780 return `${dataPath} should not be ${getSchemaPartText(
95781 err.schema
95782 )}\n${getSchemaPartText(err.parentSchema)}`;
95783 } else if (err.keyword === "absolutePath") {
95784 const baseMessage = `${dataPath}: ${
95785 err.message
95786 }${getSchemaPartDescription(err.parentSchema)}`;
95787 if (dataPath === "configuration.output.filename") {
95788 return (
95789 `${baseMessage}\n` +
95790 "Please use output.path to specify absolute path and output.filename for the file name."
95791 );
95792 }
95793 return baseMessage;
95794 } else {
95795 return `${dataPath} ${err.message} (${JSON.stringify(
95796 err,
95797 null,
95798 2
95799 )}).\n${getSchemaPartText(err.parentSchema)}`;
95800 }
95801 }
95802}
95803
95804module.exports = WebpackOptionsValidationError;
95805
95806
95807/***/ }),
95808
95809/***/ 52337:
95810/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
95811
95812"use strict";
95813/*
95814 MIT License http://www.opensource.org/licenses/mit-license.php
95815 Author Tobias Koppers @sokra
95816*/
95817
95818
95819
95820const AsyncDependencyToInitialChunkError = __webpack_require__(67089);
95821const GraphHelpers = __webpack_require__(32973);
95822
95823/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
95824/** @typedef {import("./Chunk")} Chunk */
95825/** @typedef {import("./ChunkGroup")} ChunkGroup */
95826/** @typedef {import("./Compilation")} Compilation */
95827/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
95828/** @typedef {import("./Dependency")} Dependency */
95829/** @typedef {import("./Entrypoint")} Entrypoint */
95830/** @typedef {import("./Module")} Module */
95831
95832/**
95833 * @typedef {Object} QueueItem
95834 * @property {number} action
95835 * @property {DependenciesBlock} block
95836 * @property {Module} module
95837 * @property {Chunk} chunk
95838 * @property {ChunkGroup} chunkGroup
95839 */
95840
95841/**
95842 * @typedef {Object} ChunkGroupInfo
95843 * @property {ChunkGroup} chunkGroup the chunk group
95844 * @property {Set<Module>} minAvailableModules current minimal set of modules available at this point
95845 * @property {boolean} minAvailableModulesOwned true, if minAvailableModules is owned and can be modified
95846 * @property {Set<Module>[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules
95847 * @property {QueueItem[]} skippedItems queue items that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking)
95848 * @property {Set<Module>} resultingAvailableModules set of modules available including modules from this chunk group
95849 * @property {Set<ChunkGroup>} children set of children chunk groups, that will be revisited when availableModules shrink
95850 */
95851
95852/**
95853 * @typedef {Object} ChunkGroupDep
95854 * @property {AsyncDependenciesBlock} block referencing block
95855 * @property {ChunkGroup} chunkGroup referenced chunk group
95856 */
95857
95858/**
95859 * @template T
95860 * @param {Set<T>} a first set
95861 * @param {Set<T>} b second set
95862 * @returns {number} cmp
95863 */
95864const bySetSize = (a, b) => {
95865 return b.size - a.size;
95866};
95867
95868/**
95869 * Extracts simplified info from the modules and their dependencies
95870 * @param {Compilation} compilation the compilation
95871 * @returns {Map<DependenciesBlock, { modules: Iterable<Module>, blocks: AsyncDependenciesBlock[]}>} the mapping block to modules and inner blocks
95872 */
95873const extraceBlockInfoMap = compilation => {
95874 /** @type {Map<DependenciesBlock, { modules: Iterable<Module>, blocks: AsyncDependenciesBlock[]}>} */
95875 const blockInfoMap = new Map();
95876
95877 /**
95878 * @param {Dependency} d dependency to iterate over
95879 * @returns {void}
95880 */
95881 const iteratorDependency = d => {
95882 // We skip Dependencies without Reference
95883 const ref = compilation.getDependencyReference(currentModule, d);
95884 if (!ref) {
95885 return;
95886 }
95887 // We skip Dependencies without Module pointer
95888 const refModule = ref.module;
95889 if (!refModule) {
95890 return;
95891 }
95892 // We skip weak Dependencies
95893 if (ref.weak) {
95894 return;
95895 }
95896
95897 blockInfoModules.add(refModule);
95898 };
95899
95900 /**
95901 * @param {AsyncDependenciesBlock} b blocks to prepare
95902 * @returns {void}
95903 */
95904 const iteratorBlockPrepare = b => {
95905 blockInfoBlocks.push(b);
95906 blockQueue.push(b);
95907 };
95908
95909 /** @type {Module} */
95910 let currentModule;
95911 /** @type {DependenciesBlock} */
95912 let block;
95913 /** @type {DependenciesBlock[]} */
95914 let blockQueue;
95915 /** @type {Set<Module>} */
95916 let blockInfoModules;
95917 /** @type {AsyncDependenciesBlock[]} */
95918 let blockInfoBlocks;
95919
95920 for (const module of compilation.modules) {
95921 blockQueue = [module];
95922 currentModule = module;
95923 while (blockQueue.length > 0) {
95924 block = blockQueue.pop();
95925 blockInfoModules = new Set();
95926 blockInfoBlocks = [];
95927
95928 if (block.variables) {
95929 for (const variable of block.variables) {
95930 for (const dep of variable.dependencies) iteratorDependency(dep);
95931 }
95932 }
95933
95934 if (block.dependencies) {
95935 for (const dep of block.dependencies) iteratorDependency(dep);
95936 }
95937
95938 if (block.blocks) {
95939 for (const b of block.blocks) iteratorBlockPrepare(b);
95940 }
95941
95942 const blockInfo = {
95943 modules: blockInfoModules,
95944 blocks: blockInfoBlocks
95945 };
95946 blockInfoMap.set(block, blockInfo);
95947 }
95948 }
95949
95950 return blockInfoMap;
95951};
95952
95953/**
95954 *
95955 * @param {Compilation} compilation the compilation
95956 * @param {Entrypoint[]} inputChunkGroups input groups
95957 * @param {Map<ChunkGroup, ChunkGroupInfo>} chunkGroupInfoMap mapping from chunk group to available modules
95958 * @param {Map<ChunkGroup, ChunkGroupDep[]>} chunkDependencies dependencies for chunk groups
95959 * @param {Set<DependenciesBlock>} blocksWithNestedBlocks flag for blocks that have nested blocks
95960 * @param {Set<ChunkGroup>} allCreatedChunkGroups filled with all chunk groups that are created here
95961 */
95962const visitModules = (
95963 compilation,
95964 inputChunkGroups,
95965 chunkGroupInfoMap,
95966 chunkDependencies,
95967 blocksWithNestedBlocks,
95968 allCreatedChunkGroups
95969) => {
95970 const logger = compilation.getLogger("webpack.buildChunkGraph.visitModules");
95971 const { namedChunkGroups } = compilation;
95972
95973 logger.time("prepare");
95974 const blockInfoMap = extraceBlockInfoMap(compilation);
95975
95976 /** @type {Map<ChunkGroup, { index: number, index2: number }>} */
95977 const chunkGroupCounters = new Map();
95978 for (const chunkGroup of inputChunkGroups) {
95979 chunkGroupCounters.set(chunkGroup, {
95980 index: 0,
95981 index2: 0
95982 });
95983 }
95984
95985 let nextFreeModuleIndex = 0;
95986 let nextFreeModuleIndex2 = 0;
95987
95988 /** @type {Map<DependenciesBlock, ChunkGroup>} */
95989 const blockChunkGroups = new Map();
95990
95991 const ADD_AND_ENTER_MODULE = 0;
95992 const ENTER_MODULE = 1;
95993 const PROCESS_BLOCK = 2;
95994 const LEAVE_MODULE = 3;
95995
95996 /**
95997 * @param {QueueItem[]} queue the queue array (will be mutated)
95998 * @param {ChunkGroup} chunkGroup chunk group
95999 * @returns {QueueItem[]} the queue array again
96000 */
96001 const reduceChunkGroupToQueueItem = (queue, chunkGroup) => {
96002 for (const chunk of chunkGroup.chunks) {
96003 const module = chunk.entryModule;
96004 queue.push({
96005 action: ENTER_MODULE,
96006 block: module,
96007 module,
96008 chunk,
96009 chunkGroup
96010 });
96011 }
96012 chunkGroupInfoMap.set(chunkGroup, {
96013 chunkGroup,
96014 minAvailableModules: new Set(),
96015 minAvailableModulesOwned: true,
96016 availableModulesToBeMerged: [],
96017 skippedItems: [],
96018 resultingAvailableModules: undefined,
96019 children: undefined
96020 });
96021 return queue;
96022 };
96023
96024 // Start with the provided modules/chunks
96025 /** @type {QueueItem[]} */
96026 let queue = inputChunkGroups
96027 .reduce(reduceChunkGroupToQueueItem, [])
96028 .reverse();
96029 /** @type {Map<ChunkGroup, Set<ChunkGroup>>} */
96030 const queueConnect = new Map();
96031 /** @type {Set<ChunkGroupInfo>} */
96032 const outdatedChunkGroupInfo = new Set();
96033 /** @type {QueueItem[]} */
96034 let queueDelayed = [];
96035
96036 logger.timeEnd("prepare");
96037
96038 /** @type {Module} */
96039 let module;
96040 /** @type {Chunk} */
96041 let chunk;
96042 /** @type {ChunkGroup} */
96043 let chunkGroup;
96044 /** @type {DependenciesBlock} */
96045 let block;
96046 /** @type {Set<Module>} */
96047 let minAvailableModules;
96048 /** @type {QueueItem[]} */
96049 let skippedItems;
96050
96051 // For each async Block in graph
96052 /**
96053 * @param {AsyncDependenciesBlock} b iterating over each Async DepBlock
96054 * @returns {void}
96055 */
96056 const iteratorBlock = b => {
96057 // 1. We create a chunk for this Block
96058 // but only once (blockChunkGroups map)
96059 let c = blockChunkGroups.get(b);
96060 if (c === undefined) {
96061 c = namedChunkGroups.get(b.chunkName);
96062 if (c && c.isInitial()) {
96063 compilation.errors.push(
96064 new AsyncDependencyToInitialChunkError(b.chunkName, module, b.loc)
96065 );
96066 c = chunkGroup;
96067 } else {
96068 c = compilation.addChunkInGroup(
96069 b.groupOptions || b.chunkName,
96070 module,
96071 b.loc,
96072 b.request
96073 );
96074 chunkGroupCounters.set(c, { index: 0, index2: 0 });
96075 blockChunkGroups.set(b, c);
96076 allCreatedChunkGroups.add(c);
96077 }
96078 } else {
96079 // TODO webpack 5 remove addOptions check
96080 if (c.addOptions) c.addOptions(b.groupOptions);
96081 c.addOrigin(module, b.loc, b.request);
96082 }
96083
96084 // 2. We store the Block+Chunk mapping as dependency for the chunk
96085 let deps = chunkDependencies.get(chunkGroup);
96086 if (!deps) chunkDependencies.set(chunkGroup, (deps = []));
96087 deps.push({
96088 block: b,
96089 chunkGroup: c
96090 });
96091
96092 // 3. We create/update the chunk group info
96093 let connectList = queueConnect.get(chunkGroup);
96094 if (connectList === undefined) {
96095 connectList = new Set();
96096 queueConnect.set(chunkGroup, connectList);
96097 }
96098 connectList.add(c);
96099
96100 // 4. We enqueue the DependenciesBlock for traversal
96101 queueDelayed.push({
96102 action: PROCESS_BLOCK,
96103 block: b,
96104 module: module,
96105 chunk: c.chunks[0],
96106 chunkGroup: c
96107 });
96108 };
96109
96110 // Iterative traversal of the Module graph
96111 // Recursive would be simpler to write but could result in Stack Overflows
96112 while (queue.length) {
96113 logger.time("visiting");
96114 while (queue.length) {
96115 const queueItem = queue.pop();
96116 module = queueItem.module;
96117 block = queueItem.block;
96118 chunk = queueItem.chunk;
96119 if (chunkGroup !== queueItem.chunkGroup) {
96120 chunkGroup = queueItem.chunkGroup;
96121 const chunkGroupInfo = chunkGroupInfoMap.get(chunkGroup);
96122 minAvailableModules = chunkGroupInfo.minAvailableModules;
96123 skippedItems = chunkGroupInfo.skippedItems;
96124 }
96125
96126 switch (queueItem.action) {
96127 case ADD_AND_ENTER_MODULE: {
96128 if (minAvailableModules.has(module)) {
96129 // already in parent chunks
96130 // skip it for now, but enqueue for rechecking when minAvailableModules shrinks
96131 skippedItems.push(queueItem);
96132 break;
96133 }
96134 // We connect Module and Chunk when not already done
96135 if (chunk.addModule(module)) {
96136 module.addChunk(chunk);
96137 } else {
96138 // already connected, skip it
96139 break;
96140 }
96141 }
96142 // fallthrough
96143 case ENTER_MODULE: {
96144 if (chunkGroup !== undefined) {
96145 const index = chunkGroup.getModuleIndex(module);
96146 if (index === undefined) {
96147 chunkGroup.setModuleIndex(
96148 module,
96149 chunkGroupCounters.get(chunkGroup).index++
96150 );
96151 }
96152 }
96153
96154 if (module.index === null) {
96155 module.index = nextFreeModuleIndex++;
96156 }
96157
96158 queue.push({
96159 action: LEAVE_MODULE,
96160 block,
96161 module,
96162 chunk,
96163 chunkGroup
96164 });
96165 }
96166 // fallthrough
96167 case PROCESS_BLOCK: {
96168 // get prepared block info
96169 const blockInfo = blockInfoMap.get(block);
96170
96171 // Buffer items because order need to be reverse to get indicies correct
96172 const skipBuffer = [];
96173 const queueBuffer = [];
96174 // Traverse all referenced modules
96175 for (const refModule of blockInfo.modules) {
96176 if (chunk.containsModule(refModule)) {
96177 // skip early if already connected
96178 continue;
96179 }
96180 if (minAvailableModules.has(refModule)) {
96181 // already in parent chunks, skip it for now
96182 skipBuffer.push({
96183 action: ADD_AND_ENTER_MODULE,
96184 block: refModule,
96185 module: refModule,
96186 chunk,
96187 chunkGroup
96188 });
96189 continue;
96190 }
96191 // enqueue the add and enter to enter in the correct order
96192 // this is relevant with circular dependencies
96193 queueBuffer.push({
96194 action: ADD_AND_ENTER_MODULE,
96195 block: refModule,
96196 module: refModule,
96197 chunk,
96198 chunkGroup
96199 });
96200 }
96201 // Add buffered items in reversed order
96202 for (let i = skipBuffer.length - 1; i >= 0; i--) {
96203 skippedItems.push(skipBuffer[i]);
96204 }
96205 for (let i = queueBuffer.length - 1; i >= 0; i--) {
96206 queue.push(queueBuffer[i]);
96207 }
96208
96209 // Traverse all Blocks
96210 for (const block of blockInfo.blocks) iteratorBlock(block);
96211
96212 if (blockInfo.blocks.length > 0 && module !== block) {
96213 blocksWithNestedBlocks.add(block);
96214 }
96215 break;
96216 }
96217 case LEAVE_MODULE: {
96218 if (chunkGroup !== undefined) {
96219 const index = chunkGroup.getModuleIndex2(module);
96220 if (index === undefined) {
96221 chunkGroup.setModuleIndex2(
96222 module,
96223 chunkGroupCounters.get(chunkGroup).index2++
96224 );
96225 }
96226 }
96227
96228 if (module.index2 === null) {
96229 module.index2 = nextFreeModuleIndex2++;
96230 }
96231 break;
96232 }
96233 }
96234 }
96235 logger.timeEnd("visiting");
96236
96237 while (queueConnect.size > 0) {
96238 logger.time("calculating available modules");
96239
96240 // Figure out new parents for chunk groups
96241 // to get new available modules for these children
96242 for (const [chunkGroup, targets] of queueConnect) {
96243 const info = chunkGroupInfoMap.get(chunkGroup);
96244 let minAvailableModules = info.minAvailableModules;
96245
96246 // 1. Create a new Set of available modules at this points
96247 const resultingAvailableModules = new Set(minAvailableModules);
96248 for (const chunk of chunkGroup.chunks) {
96249 for (const m of chunk.modulesIterable) {
96250 resultingAvailableModules.add(m);
96251 }
96252 }
96253 info.resultingAvailableModules = resultingAvailableModules;
96254 if (info.children === undefined) {
96255 info.children = targets;
96256 } else {
96257 for (const target of targets) {
96258 info.children.add(target);
96259 }
96260 }
96261
96262 // 2. Update chunk group info
96263 for (const target of targets) {
96264 let chunkGroupInfo = chunkGroupInfoMap.get(target);
96265 if (chunkGroupInfo === undefined) {
96266 chunkGroupInfo = {
96267 chunkGroup: target,
96268 minAvailableModules: undefined,
96269 minAvailableModulesOwned: undefined,
96270 availableModulesToBeMerged: [],
96271 skippedItems: [],
96272 resultingAvailableModules: undefined,
96273 children: undefined
96274 };
96275 chunkGroupInfoMap.set(target, chunkGroupInfo);
96276 }
96277 chunkGroupInfo.availableModulesToBeMerged.push(
96278 resultingAvailableModules
96279 );
96280 outdatedChunkGroupInfo.add(chunkGroupInfo);
96281 }
96282 }
96283 queueConnect.clear();
96284 logger.timeEnd("calculating available modules");
96285
96286 if (outdatedChunkGroupInfo.size > 0) {
96287 logger.time("merging available modules");
96288 // Execute the merge
96289 for (const info of outdatedChunkGroupInfo) {
96290 const availableModulesToBeMerged = info.availableModulesToBeMerged;
96291 let cachedMinAvailableModules = info.minAvailableModules;
96292
96293 // 1. Get minimal available modules
96294 // It doesn't make sense to traverse a chunk again with more available modules.
96295 // This step calculates the minimal available modules and skips traversal when
96296 // the list didn't shrink.
96297 if (availableModulesToBeMerged.length > 1) {
96298 availableModulesToBeMerged.sort(bySetSize);
96299 }
96300 let changed = false;
96301 for (const availableModules of availableModulesToBeMerged) {
96302 if (cachedMinAvailableModules === undefined) {
96303 cachedMinAvailableModules = availableModules;
96304 info.minAvailableModules = cachedMinAvailableModules;
96305 info.minAvailableModulesOwned = false;
96306 changed = true;
96307 } else {
96308 if (info.minAvailableModulesOwned) {
96309 // We own it and can modify it
96310 for (const m of cachedMinAvailableModules) {
96311 if (!availableModules.has(m)) {
96312 cachedMinAvailableModules.delete(m);
96313 changed = true;
96314 }
96315 }
96316 } else {
96317 for (const m of cachedMinAvailableModules) {
96318 if (!availableModules.has(m)) {
96319 // cachedMinAvailableModules need to be modified
96320 // but we don't own it
96321 // construct a new Set as intersection of cachedMinAvailableModules and availableModules
96322 /** @type {Set<Module>} */
96323 const newSet = new Set();
96324 const iterator = cachedMinAvailableModules[
96325 Symbol.iterator
96326 ]();
96327 /** @type {IteratorResult<Module>} */
96328 let it;
96329 while (!(it = iterator.next()).done) {
96330 const module = it.value;
96331 if (module === m) break;
96332 newSet.add(module);
96333 }
96334 while (!(it = iterator.next()).done) {
96335 const module = it.value;
96336 if (availableModules.has(module)) {
96337 newSet.add(module);
96338 }
96339 }
96340 cachedMinAvailableModules = newSet;
96341 info.minAvailableModulesOwned = true;
96342 info.minAvailableModules = newSet;
96343
96344 // Update the cache from the first queue
96345 // if the chunkGroup is currently cached
96346 if (chunkGroup === info.chunkGroup) {
96347 minAvailableModules = cachedMinAvailableModules;
96348 }
96349
96350 changed = true;
96351 break;
96352 }
96353 }
96354 }
96355 }
96356 }
96357 availableModulesToBeMerged.length = 0;
96358 if (!changed) continue;
96359
96360 // 2. Reconsider skipped items
96361 for (const queueItem of info.skippedItems) {
96362 queue.push(queueItem);
96363 }
96364 info.skippedItems.length = 0;
96365
96366 // 3. Reconsider children chunk groups
96367 if (info.children !== undefined) {
96368 const chunkGroup = info.chunkGroup;
96369 for (const c of info.children) {
96370 let connectList = queueConnect.get(chunkGroup);
96371 if (connectList === undefined) {
96372 connectList = new Set();
96373 queueConnect.set(chunkGroup, connectList);
96374 }
96375 connectList.add(c);
96376 }
96377 }
96378 }
96379 outdatedChunkGroupInfo.clear();
96380 logger.timeEnd("merging available modules");
96381 }
96382 }
96383
96384 // Run queueDelayed when all items of the queue are processed
96385 // This is important to get the global indicing correct
96386 // Async blocks should be processed after all sync blocks are processed
96387 if (queue.length === 0) {
96388 const tempQueue = queue;
96389 queue = queueDelayed.reverse();
96390 queueDelayed = tempQueue;
96391 }
96392 }
96393};
96394
96395/**
96396 *
96397 * @param {Set<DependenciesBlock>} blocksWithNestedBlocks flag for blocks that have nested blocks
96398 * @param {Map<ChunkGroup, ChunkGroupDep[]>} chunkDependencies dependencies for chunk groups
96399 * @param {Map<ChunkGroup, ChunkGroupInfo>} chunkGroupInfoMap mapping from chunk group to available modules
96400 */
96401const connectChunkGroups = (
96402 blocksWithNestedBlocks,
96403 chunkDependencies,
96404 chunkGroupInfoMap
96405) => {
96406 /** @type {Set<Module>} */
96407 let resultingAvailableModules;
96408
96409 /**
96410 * Helper function to check if all modules of a chunk are available
96411 *
96412 * @param {ChunkGroup} chunkGroup the chunkGroup to scan
96413 * @param {Set<Module>} availableModules the comparitor set
96414 * @returns {boolean} return true if all modules of a chunk are available
96415 */
96416 const areModulesAvailable = (chunkGroup, availableModules) => {
96417 for (const chunk of chunkGroup.chunks) {
96418 for (const module of chunk.modulesIterable) {
96419 if (!availableModules.has(module)) return false;
96420 }
96421 }
96422 return true;
96423 };
96424
96425 // For each edge in the basic chunk graph
96426 /**
96427 * @param {ChunkGroupDep} dep the dependency used for filtering
96428 * @returns {boolean} used to filter "edges" (aka Dependencies) that were pointing
96429 * to modules that are already available. Also filters circular dependencies in the chunks graph
96430 */
96431 const filterFn = dep => {
96432 const depChunkGroup = dep.chunkGroup;
96433 // TODO is this needed?
96434 if (blocksWithNestedBlocks.has(dep.block)) return true;
96435 if (areModulesAvailable(depChunkGroup, resultingAvailableModules)) {
96436 return false; // break all modules are already available
96437 }
96438 return true;
96439 };
96440
96441 // For all deps, check if chunk groups need to be connected
96442 for (const [chunkGroup, deps] of chunkDependencies) {
96443 if (deps.length === 0) continue;
96444
96445 // 1. Get info from chunk group info map
96446 const info = chunkGroupInfoMap.get(chunkGroup);
96447 resultingAvailableModules = info.resultingAvailableModules;
96448
96449 // 2. Foreach edge
96450 for (let i = 0; i < deps.length; i++) {
96451 const dep = deps[i];
96452
96453 // Filter inline, rather than creating a new array from `.filter()`
96454 // TODO check if inlining filterFn makes sense here
96455 if (!filterFn(dep)) {
96456 continue;
96457 }
96458 const depChunkGroup = dep.chunkGroup;
96459 const depBlock = dep.block;
96460
96461 // 5. Connect block with chunk
96462 GraphHelpers.connectDependenciesBlockAndChunkGroup(
96463 depBlock,
96464 depChunkGroup
96465 );
96466
96467 // 6. Connect chunk with parent
96468 GraphHelpers.connectChunkGroupParentAndChild(chunkGroup, depChunkGroup);
96469 }
96470 }
96471};
96472
96473/**
96474 * Remove all unconnected chunk groups
96475 * @param {Compilation} compilation the compilation
96476 * @param {Iterable<ChunkGroup>} allCreatedChunkGroups all chunk groups that where created before
96477 */
96478const cleanupUnconnectedGroups = (compilation, allCreatedChunkGroups) => {
96479 for (const chunkGroup of allCreatedChunkGroups) {
96480 if (chunkGroup.getNumberOfParents() === 0) {
96481 for (const chunk of chunkGroup.chunks) {
96482 const idx = compilation.chunks.indexOf(chunk);
96483 if (idx >= 0) compilation.chunks.splice(idx, 1);
96484 chunk.remove("unconnected");
96485 }
96486 chunkGroup.remove("unconnected");
96487 }
96488 }
96489};
96490
96491/**
96492 * This method creates the Chunk graph from the Module graph
96493 * @param {Compilation} compilation the compilation
96494 * @param {Entrypoint[]} inputChunkGroups chunk groups which are processed
96495 * @returns {void}
96496 */
96497const buildChunkGraph = (compilation, inputChunkGroups) => {
96498 // SHARED STATE
96499
96500 /** @type {Map<ChunkGroup, ChunkGroupDep[]>} */
96501 const chunkDependencies = new Map();
96502
96503 /** @type {Set<ChunkGroup>} */
96504 const allCreatedChunkGroups = new Set();
96505
96506 /** @type {Map<ChunkGroup, ChunkGroupInfo>} */
96507 const chunkGroupInfoMap = new Map();
96508
96509 /** @type {Set<DependenciesBlock>} */
96510 const blocksWithNestedBlocks = new Set();
96511
96512 // PART ONE
96513
96514 visitModules(
96515 compilation,
96516 inputChunkGroups,
96517 chunkGroupInfoMap,
96518 chunkDependencies,
96519 blocksWithNestedBlocks,
96520 allCreatedChunkGroups
96521 );
96522
96523 // PART TWO
96524
96525 connectChunkGroups(
96526 blocksWithNestedBlocks,
96527 chunkDependencies,
96528 chunkGroupInfoMap
96529 );
96530
96531 // Cleaup work
96532
96533 cleanupUnconnectedGroups(compilation, allCreatedChunkGroups);
96534};
96535
96536module.exports = buildChunkGraph;
96537
96538
96539/***/ }),
96540
96541/***/ 22562:
96542/***/ (function(module) {
96543
96544"use strict";
96545/*
96546 MIT License http://www.opensource.org/licenses/mit-license.php
96547 Author Tobias Koppers @sokra
96548*/
96549
96550
96551/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
96552
96553// TODO webpack 5 remove string type from a and b
96554/**
96555 * Compare two locations
96556 * @param {string|DependencyLocation} a A location node
96557 * @param {string|DependencyLocation} b A location node
96558 * @returns {-1|0|1} sorting comparator value
96559 */
96560module.exports = (a, b) => {
96561 if (typeof a === "string") {
96562 if (typeof b === "string") {
96563 if (a < b) return -1;
96564 if (a > b) return 1;
96565 return 0;
96566 } else if (typeof b === "object") {
96567 return 1;
96568 } else {
96569 return 0;
96570 }
96571 } else if (typeof a === "object") {
96572 if (typeof b === "string") {
96573 return -1;
96574 } else if (typeof b === "object") {
96575 if ("start" in a && "start" in b) {
96576 const ap = a.start;
96577 const bp = b.start;
96578 if (ap.line < bp.line) return -1;
96579 if (ap.line > bp.line) return 1;
96580 if (ap.column < bp.column) return -1;
96581 if (ap.column > bp.column) return 1;
96582 }
96583 if ("name" in a && "name" in b) {
96584 if (a.name < b.name) return -1;
96585 if (a.name > b.name) return 1;
96586 }
96587 if ("index" in a && "index" in b) {
96588 if (a.index < b.index) return -1;
96589 if (a.index > b.index) return 1;
96590 }
96591 return 0;
96592 } else {
96593 return 0;
96594 }
96595 }
96596};
96597
96598
96599/***/ }),
96600
96601/***/ 72890:
96602/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
96603
96604const fs = __webpack_require__(35747);
96605const path = __webpack_require__(85622);
96606const mkdirp = __webpack_require__(50998);
96607const { Tracer } = __webpack_require__(92430);
96608const validateOptions = __webpack_require__(33225);
96609const schema = __webpack_require__(49049);
96610
96611/** @typedef {import("../../declarations/plugins/debug/ProfilingPlugin").ProfilingPluginOptions} ProfilingPluginOptions */
96612
96613let inspector = undefined;
96614
96615try {
96616 // eslint-disable-next-line node/no-unsupported-features/node-builtins
96617 inspector = __webpack_require__(57012);
96618} catch (e) {
96619 console.log("Unable to CPU profile in < node 8.0");
96620}
96621
96622class Profiler {
96623 constructor(inspector) {
96624 this.session = undefined;
96625 this.inspector = inspector;
96626 }
96627
96628 hasSession() {
96629 return this.session !== undefined;
96630 }
96631
96632 startProfiling() {
96633 if (this.inspector === undefined) {
96634 return Promise.resolve();
96635 }
96636
96637 try {
96638 this.session = new inspector.Session();
96639 this.session.connect();
96640 } catch (_) {
96641 this.session = undefined;
96642 return Promise.resolve();
96643 }
96644
96645 return Promise.all([
96646 this.sendCommand("Profiler.setSamplingInterval", {
96647 interval: 100
96648 }),
96649 this.sendCommand("Profiler.enable"),
96650 this.sendCommand("Profiler.start")
96651 ]);
96652 }
96653
96654 sendCommand(method, params) {
96655 if (this.hasSession()) {
96656 return new Promise((res, rej) => {
96657 return this.session.post(method, params, (err, params) => {
96658 if (err !== null) {
96659 rej(err);
96660 } else {
96661 res(params);
96662 }
96663 });
96664 });
96665 } else {
96666 return Promise.resolve();
96667 }
96668 }
96669
96670 destroy() {
96671 if (this.hasSession()) {
96672 this.session.disconnect();
96673 }
96674
96675 return Promise.resolve();
96676 }
96677
96678 stopProfiling() {
96679 return this.sendCommand("Profiler.stop");
96680 }
96681}
96682
96683/**
96684 * an object that wraps Tracer and Profiler with a counter
96685 * @typedef {Object} Trace
96686 * @property {Tracer} trace instance of Tracer
96687 * @property {number} counter Counter
96688 * @property {Profiler} profiler instance of Profiler
96689 * @property {Function} end the end function
96690 */
96691
96692/**
96693 * @param {string} outputPath The location where to write the log.
96694 * @returns {Trace} The trace object
96695 */
96696const createTrace = outputPath => {
96697 const trace = new Tracer({
96698 noStream: true
96699 });
96700 const profiler = new Profiler(inspector);
96701 if (/\/|\\/.test(outputPath)) {
96702 const dirPath = path.dirname(outputPath);
96703 mkdirp.sync(dirPath);
96704 }
96705 const fsStream = fs.createWriteStream(outputPath);
96706
96707 let counter = 0;
96708
96709 trace.pipe(fsStream);
96710 // These are critical events that need to be inserted so that tools like
96711 // chrome dev tools can load the profile.
96712 trace.instantEvent({
96713 name: "TracingStartedInPage",
96714 id: ++counter,
96715 cat: ["disabled-by-default-devtools.timeline"],
96716 args: {
96717 data: {
96718 sessionId: "-1",
96719 page: "0xfff",
96720 frames: [
96721 {
96722 frame: "0xfff",
96723 url: "webpack",
96724 name: ""
96725 }
96726 ]
96727 }
96728 }
96729 });
96730
96731 trace.instantEvent({
96732 name: "TracingStartedInBrowser",
96733 id: ++counter,
96734 cat: ["disabled-by-default-devtools.timeline"],
96735 args: {
96736 data: {
96737 sessionId: "-1"
96738 }
96739 }
96740 });
96741
96742 return {
96743 trace,
96744 counter,
96745 profiler,
96746 end: callback => {
96747 // Wait until the write stream finishes.
96748 fsStream.on("finish", () => {
96749 callback();
96750 });
96751 // Tear down the readable trace stream.
96752 trace.push(null);
96753 }
96754 };
96755};
96756
96757const pluginName = "ProfilingPlugin";
96758
96759class ProfilingPlugin {
96760 /**
96761 * @param {ProfilingPluginOptions=} opts options object
96762 */
96763 constructor(opts) {
96764 validateOptions(schema, opts || {}, "Profiling plugin");
96765 opts = opts || {};
96766 this.outputPath = opts.outputPath || "events.json";
96767 }
96768
96769 apply(compiler) {
96770 const tracer = createTrace(this.outputPath);
96771 tracer.profiler.startProfiling();
96772
96773 // Compiler Hooks
96774 Object.keys(compiler.hooks).forEach(hookName => {
96775 compiler.hooks[hookName].intercept(
96776 makeInterceptorFor("Compiler", tracer)(hookName)
96777 );
96778 });
96779
96780 Object.keys(compiler.resolverFactory.hooks).forEach(hookName => {
96781 compiler.resolverFactory.hooks[hookName].intercept(
96782 makeInterceptorFor("Resolver", tracer)(hookName)
96783 );
96784 });
96785
96786 compiler.hooks.compilation.tap(
96787 pluginName,
96788 (compilation, { normalModuleFactory, contextModuleFactory }) => {
96789 interceptAllHooksFor(compilation, tracer, "Compilation");
96790 interceptAllHooksFor(
96791 normalModuleFactory,
96792 tracer,
96793 "Normal Module Factory"
96794 );
96795 interceptAllHooksFor(
96796 contextModuleFactory,
96797 tracer,
96798 "Context Module Factory"
96799 );
96800 interceptAllParserHooks(normalModuleFactory, tracer);
96801 interceptTemplateInstancesFrom(compilation, tracer);
96802 }
96803 );
96804
96805 // We need to write out the CPU profile when we are all done.
96806 compiler.hooks.done.tapAsync(
96807 {
96808 name: pluginName,
96809 stage: Infinity
96810 },
96811 (stats, callback) => {
96812 tracer.profiler.stopProfiling().then(parsedResults => {
96813 if (parsedResults === undefined) {
96814 tracer.profiler.destroy();
96815 tracer.trace.flush();
96816 tracer.end(callback);
96817 return;
96818 }
96819
96820 const cpuStartTime = parsedResults.profile.startTime;
96821 const cpuEndTime = parsedResults.profile.endTime;
96822
96823 tracer.trace.completeEvent({
96824 name: "TaskQueueManager::ProcessTaskFromWorkQueue",
96825 id: ++tracer.counter,
96826 cat: ["toplevel"],
96827 ts: cpuStartTime,
96828 args: {
96829 src_file: "../../ipc/ipc_moji_bootstrap.cc",
96830 src_func: "Accept"
96831 }
96832 });
96833
96834 tracer.trace.completeEvent({
96835 name: "EvaluateScript",
96836 id: ++tracer.counter,
96837 cat: ["devtools.timeline"],
96838 ts: cpuStartTime,
96839 dur: cpuEndTime - cpuStartTime,
96840 args: {
96841 data: {
96842 url: "webpack",
96843 lineNumber: 1,
96844 columnNumber: 1,
96845 frame: "0xFFF"
96846 }
96847 }
96848 });
96849
96850 tracer.trace.instantEvent({
96851 name: "CpuProfile",
96852 id: ++tracer.counter,
96853 cat: ["disabled-by-default-devtools.timeline"],
96854 ts: cpuEndTime,
96855 args: {
96856 data: {
96857 cpuProfile: parsedResults.profile
96858 }
96859 }
96860 });
96861
96862 tracer.profiler.destroy();
96863 tracer.trace.flush();
96864 tracer.end(callback);
96865 });
96866 }
96867 );
96868 }
96869}
96870
96871const interceptTemplateInstancesFrom = (compilation, tracer) => {
96872 const {
96873 mainTemplate,
96874 chunkTemplate,
96875 hotUpdateChunkTemplate,
96876 moduleTemplates
96877 } = compilation;
96878
96879 const { javascript, webassembly } = moduleTemplates;
96880
96881 [
96882 {
96883 instance: mainTemplate,
96884 name: "MainTemplate"
96885 },
96886 {
96887 instance: chunkTemplate,
96888 name: "ChunkTemplate"
96889 },
96890 {
96891 instance: hotUpdateChunkTemplate,
96892 name: "HotUpdateChunkTemplate"
96893 },
96894 {
96895 instance: javascript,
96896 name: "JavaScriptModuleTemplate"
96897 },
96898 {
96899 instance: webassembly,
96900 name: "WebAssemblyModuleTemplate"
96901 }
96902 ].forEach(templateObject => {
96903 Object.keys(templateObject.instance.hooks).forEach(hookName => {
96904 templateObject.instance.hooks[hookName].intercept(
96905 makeInterceptorFor(templateObject.name, tracer)(hookName)
96906 );
96907 });
96908 });
96909};
96910
96911const interceptAllHooksFor = (instance, tracer, logLabel) => {
96912 if (Reflect.has(instance, "hooks")) {
96913 Object.keys(instance.hooks).forEach(hookName => {
96914 instance.hooks[hookName].intercept(
96915 makeInterceptorFor(logLabel, tracer)(hookName)
96916 );
96917 });
96918 }
96919};
96920
96921const interceptAllParserHooks = (moduleFactory, tracer) => {
96922 const moduleTypes = [
96923 "javascript/auto",
96924 "javascript/dynamic",
96925 "javascript/esm",
96926 "json",
96927 "webassembly/experimental"
96928 ];
96929
96930 moduleTypes.forEach(moduleType => {
96931 moduleFactory.hooks.parser
96932 .for(moduleType)
96933 .tap("ProfilingPlugin", (parser, parserOpts) => {
96934 interceptAllHooksFor(parser, tracer, "Parser");
96935 });
96936 });
96937};
96938
96939const makeInterceptorFor = (instance, tracer) => hookName => ({
96940 register: ({ name, type, context, fn }) => {
96941 const newFn = makeNewProfiledTapFn(hookName, tracer, {
96942 name,
96943 type,
96944 fn
96945 });
96946 return {
96947 name,
96948 type,
96949 context,
96950 fn: newFn
96951 };
96952 }
96953});
96954
96955// TODO improve typing
96956/** @typedef {(...args: TODO[]) => void | Promise<TODO>} PluginFunction */
96957
96958/**
96959 * @param {string} hookName Name of the hook to profile.
96960 * @param {Trace} tracer The trace object.
96961 * @param {object} options Options for the profiled fn.
96962 * @param {string} options.name Plugin name
96963 * @param {string} options.type Plugin type (sync | async | promise)
96964 * @param {PluginFunction} options.fn Plugin function
96965 * @returns {PluginFunction} Chainable hooked function.
96966 */
96967const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
96968 const defaultCategory = ["blink.user_timing"];
96969
96970 switch (type) {
96971 case "promise":
96972 return (...args) => {
96973 const id = ++tracer.counter;
96974 tracer.trace.begin({
96975 name,
96976 id,
96977 cat: defaultCategory
96978 });
96979 const promise = /** @type {Promise<*>} */ (fn(...args));
96980 return promise.then(r => {
96981 tracer.trace.end({
96982 name,
96983 id,
96984 cat: defaultCategory
96985 });
96986 return r;
96987 });
96988 };
96989 case "async":
96990 return (...args) => {
96991 const id = ++tracer.counter;
96992 tracer.trace.begin({
96993 name,
96994 id,
96995 cat: defaultCategory
96996 });
96997 const callback = args.pop();
96998 fn(...args, (...r) => {
96999 tracer.trace.end({
97000 name,
97001 id,
97002 cat: defaultCategory
97003 });
97004 callback(...r);
97005 });
97006 };
97007 case "sync":
97008 return (...args) => {
97009 const id = ++tracer.counter;
97010 // Do not instrument ourself due to the CPU
97011 // profile needing to be the last event in the trace.
97012 if (name === pluginName) {
97013 return fn(...args);
97014 }
97015
97016 tracer.trace.begin({
97017 name,
97018 id,
97019 cat: defaultCategory
97020 });
97021 let r;
97022 try {
97023 r = fn(...args);
97024 } catch (error) {
97025 tracer.trace.end({
97026 name,
97027 id,
97028 cat: defaultCategory
97029 });
97030 throw error;
97031 }
97032 tracer.trace.end({
97033 name,
97034 id,
97035 cat: defaultCategory
97036 });
97037 return r;
97038 };
97039 default:
97040 break;
97041 }
97042};
97043
97044module.exports = ProfilingPlugin;
97045module.exports.Profiler = Profiler;
97046
97047
97048/***/ }),
97049
97050/***/ 67045:
97051/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97052
97053"use strict";
97054/*
97055 MIT License http://www.opensource.org/licenses/mit-license.php
97056 Author Tobias Koppers @sokra
97057*/
97058
97059const NullDependency = __webpack_require__(5088);
97060
97061class AMDDefineDependency extends NullDependency {
97062 constructor(range, arrayRange, functionRange, objectRange, namedModule) {
97063 super();
97064 this.range = range;
97065 this.arrayRange = arrayRange;
97066 this.functionRange = functionRange;
97067 this.objectRange = objectRange;
97068 this.namedModule = namedModule;
97069 this.localModule = null;
97070 }
97071
97072 get type() {
97073 return "amd define";
97074 }
97075}
97076
97077AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
97078 get definitions() {
97079 return {
97080 f: [
97081 "var __WEBPACK_AMD_DEFINE_RESULT__;",
97082 `!(__WEBPACK_AMD_DEFINE_RESULT__ = (#).call(exports, __webpack_require__, exports, module),
97083 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
97084 ],
97085 o: ["", "!(module.exports = #)"],
97086 of: [
97087 "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;",
97088 `!(__WEBPACK_AMD_DEFINE_FACTORY__ = (#),
97089 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
97090 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
97091 __WEBPACK_AMD_DEFINE_FACTORY__),
97092 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
97093 ],
97094 af: [
97095 "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
97096 `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_RESULT__ = (#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
97097 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
97098 ],
97099 ao: ["", "!(#, module.exports = #)"],
97100 aof: [
97101 "var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;",
97102 `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
97103 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
97104 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
97105 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))`
97106 ],
97107 lf: [
97108 "var XXX, XXXmodule;",
97109 "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = #.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))"
97110 ],
97111 lo: ["var XXX;", "!(XXX = #)"],
97112 lof: [
97113 "var XXX, XXXfactory, XXXmodule;",
97114 "!(XXXfactory = (#), (XXXmodule = { id: YYY, exports: {}, loaded: false }), XXX = (typeof XXXfactory === 'function' ? (XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)) : XXXfactory), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports))"
97115 ],
97116 laf: [
97117 "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX;",
97118 "!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, XXX = ((#).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)))"
97119 ],
97120 lao: ["var XXX;", "!(#, XXX = #)"],
97121 laof: [
97122 "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_FACTORY__, XXX;",
97123 `!(__WEBPACK_AMD_DEFINE_ARRAY__ = #, __WEBPACK_AMD_DEFINE_FACTORY__ = (#),
97124 XXX = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
97125 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__))`
97126 ]
97127 };
97128 }
97129
97130 apply(dependency, source) {
97131 const branch = this.branch(dependency);
97132 const defAndText = this.definitions[branch];
97133 const definitions = defAndText[0];
97134 const text = defAndText[1];
97135 this.replace(dependency, source, definitions, text);
97136 }
97137
97138 localModuleVar(dependency) {
97139 return (
97140 dependency.localModule &&
97141 dependency.localModule.used &&
97142 dependency.localModule.variableName()
97143 );
97144 }
97145
97146 branch(dependency) {
97147 const localModuleVar = this.localModuleVar(dependency) ? "l" : "";
97148 const arrayRange = dependency.arrayRange ? "a" : "";
97149 const objectRange = dependency.objectRange ? "o" : "";
97150 const functionRange = dependency.functionRange ? "f" : "";
97151 return localModuleVar + arrayRange + objectRange + functionRange;
97152 }
97153
97154 replace(dependency, source, definition, text) {
97155 const localModuleVar = this.localModuleVar(dependency);
97156 if (localModuleVar) {
97157 text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
97158 definition = definition.replace(
97159 /XXX/g,
97160 localModuleVar.replace(/\$/g, "$$$$")
97161 );
97162 }
97163
97164 if (dependency.namedModule) {
97165 text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule));
97166 }
97167
97168 const texts = text.split("#");
97169
97170 if (definition) source.insert(0, definition);
97171
97172 let current = dependency.range[0];
97173 if (dependency.arrayRange) {
97174 source.replace(current, dependency.arrayRange[0] - 1, texts.shift());
97175 current = dependency.arrayRange[1];
97176 }
97177
97178 if (dependency.objectRange) {
97179 source.replace(current, dependency.objectRange[0] - 1, texts.shift());
97180 current = dependency.objectRange[1];
97181 } else if (dependency.functionRange) {
97182 source.replace(current, dependency.functionRange[0] - 1, texts.shift());
97183 current = dependency.functionRange[1];
97184 }
97185 source.replace(current, dependency.range[1] - 1, texts.shift());
97186 if (texts.length > 0) throw new Error("Implementation error");
97187 }
97188};
97189
97190module.exports = AMDDefineDependency;
97191
97192
97193/***/ }),
97194
97195/***/ 27057:
97196/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97197
97198"use strict";
97199/*
97200 MIT License http://www.opensource.org/licenses/mit-license.php
97201 Author Tobias Koppers @sokra
97202*/
97203
97204
97205const AMDRequireItemDependency = __webpack_require__(34345);
97206const AMDRequireContextDependency = __webpack_require__(99890);
97207const ConstDependency = __webpack_require__(71101);
97208const AMDDefineDependency = __webpack_require__(67045);
97209const AMDRequireArrayDependency = __webpack_require__(63960);
97210const LocalModuleDependency = __webpack_require__(56570);
97211const ContextDependencyHelpers = __webpack_require__(5594);
97212const LocalModulesHelpers = __webpack_require__(39658);
97213
97214const isBoundFunctionExpression = expr => {
97215 if (expr.type !== "CallExpression") return false;
97216 if (expr.callee.type !== "MemberExpression") return false;
97217 if (expr.callee.computed) return false;
97218 if (expr.callee.object.type !== "FunctionExpression") return false;
97219 if (expr.callee.property.type !== "Identifier") return false;
97220 if (expr.callee.property.name !== "bind") return false;
97221 return true;
97222};
97223
97224const isUnboundFunctionExpression = expr => {
97225 if (expr.type === "FunctionExpression") return true;
97226 if (expr.type === "ArrowFunctionExpression") return true;
97227 return false;
97228};
97229
97230const isCallable = expr => {
97231 if (isUnboundFunctionExpression(expr)) return true;
97232 if (isBoundFunctionExpression(expr)) return true;
97233 return false;
97234};
97235
97236class AMDDefineDependencyParserPlugin {
97237 constructor(options) {
97238 this.options = options;
97239 }
97240
97241 apply(parser) {
97242 parser.hooks.call
97243 .for("define")
97244 .tap(
97245 "AMDDefineDependencyParserPlugin",
97246 this.processCallDefine.bind(this, parser)
97247 );
97248 }
97249
97250 processArray(parser, expr, param, identifiers, namedModule) {
97251 if (param.isArray()) {
97252 param.items.forEach((param, idx) => {
97253 if (
97254 param.isString() &&
97255 ["require", "module", "exports"].includes(param.string)
97256 )
97257 identifiers[idx] = param.string;
97258 const result = this.processItem(parser, expr, param, namedModule);
97259 if (result === undefined) {
97260 this.processContext(parser, expr, param);
97261 }
97262 });
97263 return true;
97264 } else if (param.isConstArray()) {
97265 const deps = [];
97266 param.array.forEach((request, idx) => {
97267 let dep;
97268 let localModule;
97269 if (request === "require") {
97270 identifiers[idx] = request;
97271 dep = "__webpack_require__";
97272 } else if (["exports", "module"].includes(request)) {
97273 identifiers[idx] = request;
97274 dep = request;
97275 } else if (
97276 (localModule = LocalModulesHelpers.getLocalModule(
97277 parser.state,
97278 request
97279 ))
97280 ) {
97281 dep = new LocalModuleDependency(localModule, undefined, false);
97282 dep.loc = expr.loc;
97283 parser.state.current.addDependency(dep);
97284 } else {
97285 dep = this.newRequireItemDependency(request);
97286 dep.loc = expr.loc;
97287 dep.optional = !!parser.scope.inTry;
97288 parser.state.current.addDependency(dep);
97289 }
97290 deps.push(dep);
97291 });
97292 const dep = this.newRequireArrayDependency(deps, param.range);
97293 dep.loc = expr.loc;
97294 dep.optional = !!parser.scope.inTry;
97295 parser.state.current.addDependency(dep);
97296 return true;
97297 }
97298 }
97299 processItem(parser, expr, param, namedModule) {
97300 if (param.isConditional()) {
97301 param.options.forEach(param => {
97302 const result = this.processItem(parser, expr, param);
97303 if (result === undefined) {
97304 this.processContext(parser, expr, param);
97305 }
97306 });
97307 return true;
97308 } else if (param.isString()) {
97309 let dep, localModule;
97310 if (param.string === "require") {
97311 dep = new ConstDependency("__webpack_require__", param.range);
97312 } else if (["require", "exports", "module"].includes(param.string)) {
97313 dep = new ConstDependency(param.string, param.range);
97314 } else if (
97315 (localModule = LocalModulesHelpers.getLocalModule(
97316 parser.state,
97317 param.string,
97318 namedModule
97319 ))
97320 ) {
97321 dep = new LocalModuleDependency(localModule, param.range, false);
97322 } else {
97323 dep = this.newRequireItemDependency(param.string, param.range);
97324 }
97325 dep.loc = expr.loc;
97326 dep.optional = !!parser.scope.inTry;
97327 parser.state.current.addDependency(dep);
97328 return true;
97329 }
97330 }
97331 processContext(parser, expr, param) {
97332 const dep = ContextDependencyHelpers.create(
97333 AMDRequireContextDependency,
97334 param.range,
97335 param,
97336 expr,
97337 this.options,
97338 {},
97339 parser
97340 );
97341 if (!dep) return;
97342 dep.loc = expr.loc;
97343 dep.optional = !!parser.scope.inTry;
97344 parser.state.current.addDependency(dep);
97345 return true;
97346 }
97347
97348 processCallDefine(parser, expr) {
97349 let array, fn, obj, namedModule;
97350 switch (expr.arguments.length) {
97351 case 1:
97352 if (isCallable(expr.arguments[0])) {
97353 // define(f() {…})
97354 fn = expr.arguments[0];
97355 } else if (expr.arguments[0].type === "ObjectExpression") {
97356 // define({…})
97357 obj = expr.arguments[0];
97358 } else {
97359 // define(expr)
97360 // unclear if function or object
97361 obj = fn = expr.arguments[0];
97362 }
97363 break;
97364 case 2:
97365 if (expr.arguments[0].type === "Literal") {
97366 namedModule = expr.arguments[0].value;
97367 // define("…", …)
97368 if (isCallable(expr.arguments[1])) {
97369 // define("…", f() {…})
97370 fn = expr.arguments[1];
97371 } else if (expr.arguments[1].type === "ObjectExpression") {
97372 // define("…", {…})
97373 obj = expr.arguments[1];
97374 } else {
97375 // define("…", expr)
97376 // unclear if function or object
97377 obj = fn = expr.arguments[1];
97378 }
97379 } else {
97380 array = expr.arguments[0];
97381 if (isCallable(expr.arguments[1])) {
97382 // define([…], f() {})
97383 fn = expr.arguments[1];
97384 } else if (expr.arguments[1].type === "ObjectExpression") {
97385 // define([…], {…})
97386 obj = expr.arguments[1];
97387 } else {
97388 // define([…], expr)
97389 // unclear if function or object
97390 obj = fn = expr.arguments[1];
97391 }
97392 }
97393 break;
97394 case 3:
97395 // define("…", […], f() {…})
97396 namedModule = expr.arguments[0].value;
97397 array = expr.arguments[1];
97398 if (isCallable(expr.arguments[2])) {
97399 // define("…", […], f() {})
97400 fn = expr.arguments[2];
97401 } else if (expr.arguments[2].type === "ObjectExpression") {
97402 // define("…", […], {…})
97403 obj = expr.arguments[2];
97404 } else {
97405 // define("…", […], expr)
97406 // unclear if function or object
97407 obj = fn = expr.arguments[2];
97408 }
97409 break;
97410 default:
97411 return;
97412 }
97413 let fnParams = null;
97414 let fnParamsOffset = 0;
97415 if (fn) {
97416 if (isUnboundFunctionExpression(fn)) {
97417 fnParams = fn.params;
97418 } else if (isBoundFunctionExpression(fn)) {
97419 fnParams = fn.callee.object.params;
97420 fnParamsOffset = fn.arguments.length - 1;
97421 if (fnParamsOffset < 0) {
97422 fnParamsOffset = 0;
97423 }
97424 }
97425 }
97426 let fnRenames = parser.scope.renames.createChild();
97427 if (array) {
97428 const identifiers = {};
97429 const param = parser.evaluateExpression(array);
97430 const result = this.processArray(
97431 parser,
97432 expr,
97433 param,
97434 identifiers,
97435 namedModule
97436 );
97437 if (!result) return;
97438 if (fnParams) {
97439 fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
97440 if (identifiers[idx]) {
97441 fnRenames.set(param.name, identifiers[idx]);
97442 return false;
97443 }
97444 return true;
97445 });
97446 }
97447 } else {
97448 const identifiers = ["require", "exports", "module"];
97449 if (fnParams) {
97450 fnParams = fnParams.slice(fnParamsOffset).filter((param, idx) => {
97451 if (identifiers[idx]) {
97452 fnRenames.set(param.name, identifiers[idx]);
97453 return false;
97454 }
97455 return true;
97456 });
97457 }
97458 }
97459 let inTry;
97460 if (fn && isUnboundFunctionExpression(fn)) {
97461 inTry = parser.scope.inTry;
97462 parser.inScope(fnParams, () => {
97463 parser.scope.renames = fnRenames;
97464 parser.scope.inTry = inTry;
97465 if (fn.body.type === "BlockStatement") {
97466 parser.walkStatement(fn.body);
97467 } else {
97468 parser.walkExpression(fn.body);
97469 }
97470 });
97471 } else if (fn && isBoundFunctionExpression(fn)) {
97472 inTry = parser.scope.inTry;
97473 parser.inScope(
97474 fn.callee.object.params.filter(
97475 i => !["require", "module", "exports"].includes(i.name)
97476 ),
97477 () => {
97478 parser.scope.renames = fnRenames;
97479 parser.scope.inTry = inTry;
97480 if (fn.callee.object.body.type === "BlockStatement") {
97481 parser.walkStatement(fn.callee.object.body);
97482 } else {
97483 parser.walkExpression(fn.callee.object.body);
97484 }
97485 }
97486 );
97487 if (fn.arguments) {
97488 parser.walkExpressions(fn.arguments);
97489 }
97490 } else if (fn || obj) {
97491 parser.walkExpression(fn || obj);
97492 }
97493
97494 const dep = this.newDefineDependency(
97495 expr.range,
97496 array ? array.range : null,
97497 fn ? fn.range : null,
97498 obj ? obj.range : null,
97499 namedModule ? namedModule : null
97500 );
97501 dep.loc = expr.loc;
97502 if (namedModule) {
97503 dep.localModule = LocalModulesHelpers.addLocalModule(
97504 parser.state,
97505 namedModule
97506 );
97507 }
97508 parser.state.current.addDependency(dep);
97509 return true;
97510 }
97511
97512 newDefineDependency(
97513 range,
97514 arrayRange,
97515 functionRange,
97516 objectRange,
97517 namedModule
97518 ) {
97519 return new AMDDefineDependency(
97520 range,
97521 arrayRange,
97522 functionRange,
97523 objectRange,
97524 namedModule
97525 );
97526 }
97527 newRequireArrayDependency(depsArray, range) {
97528 return new AMDRequireArrayDependency(depsArray, range);
97529 }
97530 newRequireItemDependency(request, range) {
97531 return new AMDRequireItemDependency(request, range);
97532 }
97533}
97534module.exports = AMDDefineDependencyParserPlugin;
97535
97536
97537/***/ }),
97538
97539/***/ 85812:
97540/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97541
97542"use strict";
97543/*
97544 MIT License http://www.opensource.org/licenses/mit-license.php
97545 Author Tobias Koppers @sokra
97546*/
97547
97548
97549const path = __webpack_require__(85622);
97550const AMDRequireDependency = __webpack_require__(73985);
97551const AMDRequireItemDependency = __webpack_require__(34345);
97552const AMDRequireArrayDependency = __webpack_require__(63960);
97553const AMDRequireContextDependency = __webpack_require__(99890);
97554const AMDDefineDependency = __webpack_require__(67045);
97555const UnsupportedDependency = __webpack_require__(15826);
97556const LocalModuleDependency = __webpack_require__(56570);
97557
97558const NullFactory = __webpack_require__(40438);
97559
97560const AMDRequireDependenciesBlockParserPlugin = __webpack_require__(9994);
97561const AMDDefineDependencyParserPlugin = __webpack_require__(27057);
97562
97563const AliasPlugin = __webpack_require__(15005);
97564
97565const ParserHelpers = __webpack_require__(23999);
97566
97567class AMDPlugin {
97568 constructor(options, amdOptions) {
97569 this.amdOptions = amdOptions;
97570 this.options = options;
97571 }
97572
97573 apply(compiler) {
97574 const options = this.options;
97575 const amdOptions = this.amdOptions;
97576 compiler.hooks.compilation.tap(
97577 "AMDPlugin",
97578 (compilation, { contextModuleFactory, normalModuleFactory }) => {
97579 compilation.dependencyFactories.set(
97580 AMDRequireDependency,
97581 new NullFactory()
97582 );
97583 compilation.dependencyTemplates.set(
97584 AMDRequireDependency,
97585 new AMDRequireDependency.Template()
97586 );
97587
97588 compilation.dependencyFactories.set(
97589 AMDRequireItemDependency,
97590 normalModuleFactory
97591 );
97592 compilation.dependencyTemplates.set(
97593 AMDRequireItemDependency,
97594 new AMDRequireItemDependency.Template()
97595 );
97596
97597 compilation.dependencyFactories.set(
97598 AMDRequireArrayDependency,
97599 new NullFactory()
97600 );
97601 compilation.dependencyTemplates.set(
97602 AMDRequireArrayDependency,
97603 new AMDRequireArrayDependency.Template()
97604 );
97605
97606 compilation.dependencyFactories.set(
97607 AMDRequireContextDependency,
97608 contextModuleFactory
97609 );
97610 compilation.dependencyTemplates.set(
97611 AMDRequireContextDependency,
97612 new AMDRequireContextDependency.Template()
97613 );
97614
97615 compilation.dependencyFactories.set(
97616 AMDDefineDependency,
97617 new NullFactory()
97618 );
97619 compilation.dependencyTemplates.set(
97620 AMDDefineDependency,
97621 new AMDDefineDependency.Template()
97622 );
97623
97624 compilation.dependencyFactories.set(
97625 UnsupportedDependency,
97626 new NullFactory()
97627 );
97628 compilation.dependencyTemplates.set(
97629 UnsupportedDependency,
97630 new UnsupportedDependency.Template()
97631 );
97632
97633 compilation.dependencyFactories.set(
97634 LocalModuleDependency,
97635 new NullFactory()
97636 );
97637 compilation.dependencyTemplates.set(
97638 LocalModuleDependency,
97639 new LocalModuleDependency.Template()
97640 );
97641
97642 const handler = (parser, parserOptions) => {
97643 if (parserOptions.amd !== undefined && !parserOptions.amd) return;
97644
97645 const setExpressionToModule = (outerExpr, module) => {
97646 parser.hooks.expression.for(outerExpr).tap("AMDPlugin", expr => {
97647 const dep = new AMDRequireItemDependency(module, expr.range);
97648 dep.userRequest = outerExpr;
97649 dep.loc = expr.loc;
97650 parser.state.current.addDependency(dep);
97651 return true;
97652 });
97653 };
97654
97655 new AMDRequireDependenciesBlockParserPlugin(options).apply(parser);
97656 new AMDDefineDependencyParserPlugin(options).apply(parser);
97657
97658 setExpressionToModule("require.amd", "!!webpack amd options");
97659 setExpressionToModule("define.amd", "!!webpack amd options");
97660 setExpressionToModule("define", "!!webpack amd define");
97661
97662 parser.hooks.expression
97663 .for("__webpack_amd_options__")
97664 .tap("AMDPlugin", () =>
97665 parser.state.current.addVariable(
97666 "__webpack_amd_options__",
97667 JSON.stringify(amdOptions)
97668 )
97669 );
97670 parser.hooks.evaluateTypeof
97671 .for("define.amd")
97672 .tap(
97673 "AMDPlugin",
97674 ParserHelpers.evaluateToString(typeof amdOptions)
97675 );
97676 parser.hooks.evaluateTypeof
97677 .for("require.amd")
97678 .tap(
97679 "AMDPlugin",
97680 ParserHelpers.evaluateToString(typeof amdOptions)
97681 );
97682 parser.hooks.evaluateIdentifier
97683 .for("define.amd")
97684 .tap(
97685 "AMDPlugin",
97686 ParserHelpers.evaluateToIdentifier("define.amd", true)
97687 );
97688 parser.hooks.evaluateIdentifier
97689 .for("require.amd")
97690 .tap(
97691 "AMDPlugin",
97692 ParserHelpers.evaluateToIdentifier("require.amd", true)
97693 );
97694 parser.hooks.typeof
97695 .for("define")
97696 .tap(
97697 "AMDPlugin",
97698 ParserHelpers.toConstantDependency(
97699 parser,
97700 JSON.stringify("function")
97701 )
97702 );
97703 parser.hooks.evaluateTypeof
97704 .for("define")
97705 .tap("AMDPlugin", ParserHelpers.evaluateToString("function"));
97706 parser.hooks.canRename
97707 .for("define")
97708 .tap("AMDPlugin", ParserHelpers.approve);
97709 parser.hooks.rename.for("define").tap("AMDPlugin", expr => {
97710 const dep = new AMDRequireItemDependency(
97711 "!!webpack amd define",
97712 expr.range
97713 );
97714 dep.userRequest = "define";
97715 dep.loc = expr.loc;
97716 parser.state.current.addDependency(dep);
97717 return false;
97718 });
97719 parser.hooks.typeof
97720 .for("require")
97721 .tap(
97722 "AMDPlugin",
97723 ParserHelpers.toConstantDependency(
97724 parser,
97725 JSON.stringify("function")
97726 )
97727 );
97728 parser.hooks.evaluateTypeof
97729 .for("require")
97730 .tap("AMDPlugin", ParserHelpers.evaluateToString("function"));
97731 };
97732
97733 normalModuleFactory.hooks.parser
97734 .for("javascript/auto")
97735 .tap("AMDPlugin", handler);
97736 normalModuleFactory.hooks.parser
97737 .for("javascript/dynamic")
97738 .tap("AMDPlugin", handler);
97739 }
97740 );
97741 compiler.hooks.afterResolvers.tap("AMDPlugin", () => {
97742 compiler.resolverFactory.hooks.resolver
97743 .for("normal")
97744 .tap("AMDPlugin", resolver => {
97745 new AliasPlugin(
97746 "described-resolve",
97747 {
97748 name: "amdefine",
97749 alias: __webpack_require__.ab + "amd-define.js"
97750 },
97751 "resolve"
97752 ).apply(resolver);
97753 new AliasPlugin(
97754 "described-resolve",
97755 {
97756 name: "webpack amd options",
97757 alias: __webpack_require__.ab + "amd-options.js"
97758 },
97759 "resolve"
97760 ).apply(resolver);
97761 new AliasPlugin(
97762 "described-resolve",
97763 {
97764 name: "webpack amd define",
97765 alias: __webpack_require__.ab + "amd-define.js"
97766 },
97767 "resolve"
97768 ).apply(resolver);
97769 });
97770 });
97771 }
97772}
97773module.exports = AMDPlugin;
97774
97775
97776/***/ }),
97777
97778/***/ 63960:
97779/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97780
97781"use strict";
97782/*
97783 MIT License http://www.opensource.org/licenses/mit-license.php
97784 Author Tobias Koppers @sokra
97785*/
97786
97787const Dependency = __webpack_require__(57282);
97788
97789class AMDRequireArrayDependency extends Dependency {
97790 constructor(depsArray, range) {
97791 super();
97792 this.depsArray = depsArray;
97793 this.range = range;
97794 }
97795
97796 get type() {
97797 return "amd require array";
97798 }
97799}
97800
97801AMDRequireArrayDependency.Template = class AMDRequireArrayDependencyTemplate {
97802 apply(dep, source, runtime) {
97803 const content = this.getContent(dep, runtime);
97804 source.replace(dep.range[0], dep.range[1] - 1, content);
97805 }
97806
97807 getContent(dep, runtime) {
97808 const requires = dep.depsArray.map(dependency => {
97809 return this.contentForDependency(dependency, runtime);
97810 });
97811 return `[${requires.join(", ")}]`;
97812 }
97813
97814 contentForDependency(dep, runtime) {
97815 if (typeof dep === "string") {
97816 return dep;
97817 }
97818
97819 if (dep.localModule) {
97820 return dep.localModule.variableName();
97821 } else {
97822 return runtime.moduleExports({
97823 module: dep.module,
97824 request: dep.request
97825 });
97826 }
97827 }
97828};
97829
97830module.exports = AMDRequireArrayDependency;
97831
97832
97833/***/ }),
97834
97835/***/ 99890:
97836/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97837
97838"use strict";
97839/*
97840 MIT License http://www.opensource.org/licenses/mit-license.php
97841 Author Tobias Koppers @sokra
97842*/
97843
97844
97845const ContextDependency = __webpack_require__(11583);
97846class AMDRequireContextDependency extends ContextDependency {
97847 constructor(options, range, valueRange) {
97848 super(options);
97849 this.range = range;
97850 this.valueRange = valueRange;
97851 }
97852
97853 get type() {
97854 return "amd require context";
97855 }
97856}
97857AMDRequireContextDependency.Template = __webpack_require__(54380);
97858module.exports = AMDRequireContextDependency;
97859
97860
97861/***/ }),
97862
97863/***/ 32894:
97864/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97865
97866"use strict";
97867/*
97868 MIT License http://www.opensource.org/licenses/mit-license.php
97869 Author Tobias Koppers @sokra
97870*/
97871
97872const AsyncDependenciesBlock = __webpack_require__(22814);
97873const AMDRequireDependency = __webpack_require__(73985);
97874
97875module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBlock {
97876 constructor(
97877 expr,
97878 arrayRange,
97879 functionRange,
97880 errorCallbackRange,
97881 module,
97882 loc,
97883 request
97884 ) {
97885 super(null, module, loc, request);
97886 this.expr = expr;
97887 this.outerRange = expr.range;
97888 this.arrayRange = arrayRange;
97889 this.functionBindThis = false;
97890 this.functionRange = functionRange;
97891 this.errorCallbackBindThis = false;
97892 this.errorCallbackRange = errorCallbackRange;
97893 this.bindThis = true;
97894 if (arrayRange && functionRange && errorCallbackRange) {
97895 this.range = [arrayRange[0], errorCallbackRange[1]];
97896 } else if (arrayRange && functionRange) {
97897 this.range = [arrayRange[0], functionRange[1]];
97898 } else if (arrayRange) {
97899 this.range = arrayRange;
97900 } else if (functionRange) {
97901 this.range = functionRange;
97902 } else {
97903 this.range = expr.range;
97904 }
97905 const dep = this.newRequireDependency();
97906 dep.loc = loc;
97907 this.addDependency(dep);
97908 }
97909
97910 newRequireDependency() {
97911 return new AMDRequireDependency(this);
97912 }
97913};
97914
97915
97916/***/ }),
97917
97918/***/ 9994:
97919/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
97920
97921"use strict";
97922/*
97923 MIT License http://www.opensource.org/licenses/mit-license.php
97924 Author Tobias Koppers @sokra
97925*/
97926
97927
97928const AMDRequireItemDependency = __webpack_require__(34345);
97929const AMDRequireArrayDependency = __webpack_require__(63960);
97930const AMDRequireContextDependency = __webpack_require__(99890);
97931const AMDRequireDependenciesBlock = __webpack_require__(32894);
97932const UnsupportedDependency = __webpack_require__(15826);
97933const LocalModuleDependency = __webpack_require__(56570);
97934const ContextDependencyHelpers = __webpack_require__(5594);
97935const LocalModulesHelpers = __webpack_require__(39658);
97936const ConstDependency = __webpack_require__(71101);
97937const getFunctionExpression = __webpack_require__(64197);
97938const UnsupportedFeatureWarning = __webpack_require__(99953);
97939
97940class AMDRequireDependenciesBlockParserPlugin {
97941 constructor(options) {
97942 this.options = options;
97943 }
97944
97945 processFunctionArgument(parser, expression) {
97946 let bindThis = true;
97947 const fnData = getFunctionExpression(expression);
97948 if (fnData) {
97949 parser.inScope(
97950 fnData.fn.params.filter(i => {
97951 return !["require", "module", "exports"].includes(i.name);
97952 }),
97953 () => {
97954 if (fnData.fn.body.type === "BlockStatement") {
97955 parser.walkStatement(fnData.fn.body);
97956 } else {
97957 parser.walkExpression(fnData.fn.body);
97958 }
97959 }
97960 );
97961 parser.walkExpressions(fnData.expressions);
97962 if (fnData.needThis === false) {
97963 bindThis = false;
97964 }
97965 } else {
97966 parser.walkExpression(expression);
97967 }
97968 return bindThis;
97969 }
97970
97971 apply(parser) {
97972 parser.hooks.call
97973 .for("require")
97974 .tap(
97975 "AMDRequireDependenciesBlockParserPlugin",
97976 this.processCallRequire.bind(this, parser)
97977 );
97978 }
97979
97980 processArray(parser, expr, param) {
97981 if (param.isArray()) {
97982 for (const p of param.items) {
97983 const result = this.processItem(parser, expr, p);
97984 if (result === undefined) {
97985 this.processContext(parser, expr, p);
97986 }
97987 }
97988 return true;
97989 } else if (param.isConstArray()) {
97990 const deps = [];
97991 for (const request of param.array) {
97992 let dep, localModule;
97993 if (request === "require") {
97994 dep = "__webpack_require__";
97995 } else if (["exports", "module"].includes(request)) {
97996 dep = request;
97997 } else if (
97998 (localModule = LocalModulesHelpers.getLocalModule(
97999 parser.state,
98000 request
98001 ))
98002 ) {
98003 dep = new LocalModuleDependency(localModule, undefined, false);
98004 dep.loc = expr.loc;
98005 parser.state.current.addDependency(dep);
98006 } else {
98007 dep = this.newRequireItemDependency(request);
98008 dep.loc = expr.loc;
98009 dep.optional = !!parser.scope.inTry;
98010 parser.state.current.addDependency(dep);
98011 }
98012 deps.push(dep);
98013 }
98014 const dep = this.newRequireArrayDependency(deps, param.range);
98015 dep.loc = expr.loc;
98016 dep.optional = !!parser.scope.inTry;
98017 parser.state.current.addDependency(dep);
98018 return true;
98019 }
98020 }
98021 processItem(parser, expr, param) {
98022 if (param.isConditional()) {
98023 for (const p of param.options) {
98024 const result = this.processItem(parser, expr, p);
98025 if (result === undefined) {
98026 this.processContext(parser, expr, p);
98027 }
98028 }
98029 return true;
98030 } else if (param.isString()) {
98031 let dep, localModule;
98032 if (param.string === "require") {
98033 dep = new ConstDependency("__webpack_require__", param.string);
98034 } else if (param.string === "module") {
98035 dep = new ConstDependency(
98036 parser.state.module.buildInfo.moduleArgument,
98037 param.range
98038 );
98039 } else if (param.string === "exports") {
98040 dep = new ConstDependency(
98041 parser.state.module.buildInfo.exportsArgument,
98042 param.range
98043 );
98044 } else if (
98045 (localModule = LocalModulesHelpers.getLocalModule(
98046 parser.state,
98047 param.string
98048 ))
98049 ) {
98050 dep = new LocalModuleDependency(localModule, param.range, false);
98051 } else {
98052 dep = this.newRequireItemDependency(param.string, param.range);
98053 }
98054 dep.loc = expr.loc;
98055 dep.optional = !!parser.scope.inTry;
98056 parser.state.current.addDependency(dep);
98057 return true;
98058 }
98059 }
98060 processContext(parser, expr, param) {
98061 const dep = ContextDependencyHelpers.create(
98062 AMDRequireContextDependency,
98063 param.range,
98064 param,
98065 expr,
98066 this.options,
98067 {},
98068 parser
98069 );
98070 if (!dep) return;
98071 dep.loc = expr.loc;
98072 dep.optional = !!parser.scope.inTry;
98073 parser.state.current.addDependency(dep);
98074 return true;
98075 }
98076
98077 processArrayForRequestString(param) {
98078 if (param.isArray()) {
98079 const result = param.items.map(item =>
98080 this.processItemForRequestString(item)
98081 );
98082 if (result.every(Boolean)) return result.join(" ");
98083 } else if (param.isConstArray()) {
98084 return param.array.join(" ");
98085 }
98086 }
98087
98088 processItemForRequestString(param) {
98089 if (param.isConditional()) {
98090 const result = param.options.map(item =>
98091 this.processItemForRequestString(item)
98092 );
98093 if (result.every(Boolean)) return result.join("|");
98094 } else if (param.isString()) {
98095 return param.string;
98096 }
98097 }
98098
98099 processCallRequire(parser, expr) {
98100 let param;
98101 let dep;
98102 let result;
98103
98104 const old = parser.state.current;
98105
98106 if (expr.arguments.length >= 1) {
98107 param = parser.evaluateExpression(expr.arguments[0]);
98108 dep = this.newRequireDependenciesBlock(
98109 expr,
98110 param.range,
98111 expr.arguments.length > 1 ? expr.arguments[1].range : null,
98112 expr.arguments.length > 2 ? expr.arguments[2].range : null,
98113 parser.state.module,
98114 expr.loc,
98115 this.processArrayForRequestString(param)
98116 );
98117 parser.state.current = dep;
98118 }
98119
98120 if (expr.arguments.length === 1) {
98121 parser.inScope([], () => {
98122 result = this.processArray(parser, expr, param);
98123 });
98124 parser.state.current = old;
98125 if (!result) return;
98126 parser.state.current.addBlock(dep);
98127 return true;
98128 }
98129
98130 if (expr.arguments.length === 2 || expr.arguments.length === 3) {
98131 try {
98132 parser.inScope([], () => {
98133 result = this.processArray(parser, expr, param);
98134 });
98135 if (!result) {
98136 dep = new UnsupportedDependency("unsupported", expr.range);
98137 old.addDependency(dep);
98138 if (parser.state.module) {
98139 parser.state.module.errors.push(
98140 new UnsupportedFeatureWarning(
98141 parser.state.module,
98142 "Cannot statically analyse 'require(…, …)' in line " +
98143 expr.loc.start.line,
98144 expr.loc
98145 )
98146 );
98147 }
98148 dep = null;
98149 return true;
98150 }
98151 dep.functionBindThis = this.processFunctionArgument(
98152 parser,
98153 expr.arguments[1]
98154 );
98155 if (expr.arguments.length === 3) {
98156 dep.errorCallbackBindThis = this.processFunctionArgument(
98157 parser,
98158 expr.arguments[2]
98159 );
98160 }
98161 } finally {
98162 parser.state.current = old;
98163 if (dep) parser.state.current.addBlock(dep);
98164 }
98165 return true;
98166 }
98167 }
98168
98169 newRequireDependenciesBlock(
98170 expr,
98171 arrayRange,
98172 functionRange,
98173 errorCallbackRange,
98174 module,
98175 loc,
98176 request
98177 ) {
98178 return new AMDRequireDependenciesBlock(
98179 expr,
98180 arrayRange,
98181 functionRange,
98182 errorCallbackRange,
98183 module,
98184 loc,
98185 request
98186 );
98187 }
98188 newRequireItemDependency(request, range) {
98189 return new AMDRequireItemDependency(request, range);
98190 }
98191 newRequireArrayDependency(depsArray, range) {
98192 return new AMDRequireArrayDependency(depsArray, range);
98193 }
98194}
98195module.exports = AMDRequireDependenciesBlockParserPlugin;
98196
98197
98198/***/ }),
98199
98200/***/ 73985:
98201/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98202
98203"use strict";
98204/*
98205 MIT License http://www.opensource.org/licenses/mit-license.php
98206 Author Tobias Koppers @sokra
98207*/
98208
98209const NullDependency = __webpack_require__(5088);
98210
98211class AMDRequireDependency extends NullDependency {
98212 constructor(block) {
98213 super();
98214 this.block = block;
98215 }
98216}
98217
98218AMDRequireDependency.Template = class AMDRequireDependencyTemplate {
98219 apply(dep, source, runtime) {
98220 const depBlock = dep.block;
98221 const promise = runtime.blockPromise({
98222 block: depBlock,
98223 message: "AMD require"
98224 });
98225
98226 // has array range but no function range
98227 if (depBlock.arrayRange && !depBlock.functionRange) {
98228 const startBlock = `${promise}.then(function() {`;
98229 const endBlock = `;}).catch(${runtime.onError()})`;
98230 source.replace(
98231 depBlock.outerRange[0],
98232 depBlock.arrayRange[0] - 1,
98233 startBlock
98234 );
98235 source.replace(
98236 depBlock.arrayRange[1],
98237 depBlock.outerRange[1] - 1,
98238 endBlock
98239 );
98240 return;
98241 }
98242
98243 // has function range but no array range
98244 if (depBlock.functionRange && !depBlock.arrayRange) {
98245 const startBlock = `${promise}.then((`;
98246 const endBlock = `).bind(exports, __webpack_require__, exports, module)).catch(${runtime.onError()})`;
98247 source.replace(
98248 depBlock.outerRange[0],
98249 depBlock.functionRange[0] - 1,
98250 startBlock
98251 );
98252 source.replace(
98253 depBlock.functionRange[1],
98254 depBlock.outerRange[1] - 1,
98255 endBlock
98256 );
98257 return;
98258 }
98259
98260 // has array range, function range, and errorCallbackRange
98261 if (
98262 depBlock.arrayRange &&
98263 depBlock.functionRange &&
98264 depBlock.errorCallbackRange
98265 ) {
98266 const startBlock = `${promise}.then(function() { `;
98267 const errorRangeBlock = `}${
98268 depBlock.functionBindThis ? ".bind(this)" : ""
98269 }).catch(`;
98270 const endBlock = `${
98271 depBlock.errorCallbackBindThis ? ".bind(this)" : ""
98272 })`;
98273
98274 source.replace(
98275 depBlock.outerRange[0],
98276 depBlock.arrayRange[0] - 1,
98277 startBlock
98278 );
98279 source.insert(
98280 depBlock.arrayRange[0] + 0.9,
98281 "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
98282 );
98283 source.replace(
98284 depBlock.arrayRange[1],
98285 depBlock.functionRange[0] - 1,
98286 "; ("
98287 );
98288 source.insert(
98289 depBlock.functionRange[1],
98290 ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);"
98291 );
98292 source.replace(
98293 depBlock.functionRange[1],
98294 depBlock.errorCallbackRange[0] - 1,
98295 errorRangeBlock
98296 );
98297 source.replace(
98298 depBlock.errorCallbackRange[1],
98299 depBlock.outerRange[1] - 1,
98300 endBlock
98301 );
98302 return;
98303 }
98304
98305 // has array range, function range, but no errorCallbackRange
98306 if (depBlock.arrayRange && depBlock.functionRange) {
98307 const startBlock = `${promise}.then(function() { `;
98308 const endBlock = `}${
98309 depBlock.functionBindThis ? ".bind(this)" : ""
98310 }).catch(${runtime.onError()})`;
98311 source.replace(
98312 depBlock.outerRange[0],
98313 depBlock.arrayRange[0] - 1,
98314 startBlock
98315 );
98316 source.insert(
98317 depBlock.arrayRange[0] + 0.9,
98318 "var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
98319 );
98320 source.replace(
98321 depBlock.arrayRange[1],
98322 depBlock.functionRange[0] - 1,
98323 "; ("
98324 );
98325 source.insert(
98326 depBlock.functionRange[1],
98327 ").apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);"
98328 );
98329 source.replace(
98330 depBlock.functionRange[1],
98331 depBlock.outerRange[1] - 1,
98332 endBlock
98333 );
98334 }
98335 }
98336};
98337
98338module.exports = AMDRequireDependency;
98339
98340
98341/***/ }),
98342
98343/***/ 34345:
98344/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98345
98346"use strict";
98347/*
98348 MIT License http://www.opensource.org/licenses/mit-license.php
98349 Author Tobias Koppers @sokra
98350*/
98351
98352const ModuleDependency = __webpack_require__(90865);
98353const ModuleDependencyTemplateAsRequireId = __webpack_require__(60441);
98354
98355class AMDRequireItemDependency extends ModuleDependency {
98356 constructor(request, range) {
98357 super(request);
98358 this.range = range;
98359 }
98360
98361 get type() {
98362 return "amd require";
98363 }
98364}
98365
98366AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId;
98367
98368module.exports = AMDRequireItemDependency;
98369
98370
98371/***/ }),
98372
98373/***/ 85358:
98374/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98375
98376"use strict";
98377/*
98378 MIT License http://www.opensource.org/licenses/mit-license.php
98379 Author Tobias Koppers @sokra
98380*/
98381
98382const ConstDependency = __webpack_require__(71101);
98383const CommonJsRequireDependency = __webpack_require__(37504);
98384const CommonJsRequireContextDependency = __webpack_require__(26791);
98385const RequireResolveDependency = __webpack_require__(43519);
98386const RequireResolveContextDependency = __webpack_require__(83309);
98387const RequireResolveHeaderDependency = __webpack_require__(69647);
98388const RequireHeaderDependency = __webpack_require__(22928);
98389
98390const NullFactory = __webpack_require__(40438);
98391
98392const RequireResolveDependencyParserPlugin = __webpack_require__(68349);
98393const CommonJsRequireDependencyParserPlugin = __webpack_require__(37278);
98394
98395const ParserHelpers = __webpack_require__(23999);
98396
98397class CommonJsPlugin {
98398 constructor(options) {
98399 this.options = options;
98400 }
98401
98402 apply(compiler) {
98403 const options = this.options;
98404 compiler.hooks.compilation.tap(
98405 "CommonJsPlugin",
98406 (compilation, { contextModuleFactory, normalModuleFactory }) => {
98407 compilation.dependencyFactories.set(
98408 CommonJsRequireDependency,
98409 normalModuleFactory
98410 );
98411 compilation.dependencyTemplates.set(
98412 CommonJsRequireDependency,
98413 new CommonJsRequireDependency.Template()
98414 );
98415
98416 compilation.dependencyFactories.set(
98417 CommonJsRequireContextDependency,
98418 contextModuleFactory
98419 );
98420 compilation.dependencyTemplates.set(
98421 CommonJsRequireContextDependency,
98422 new CommonJsRequireContextDependency.Template()
98423 );
98424
98425 compilation.dependencyFactories.set(
98426 RequireResolveDependency,
98427 normalModuleFactory
98428 );
98429 compilation.dependencyTemplates.set(
98430 RequireResolveDependency,
98431 new RequireResolveDependency.Template()
98432 );
98433
98434 compilation.dependencyFactories.set(
98435 RequireResolveContextDependency,
98436 contextModuleFactory
98437 );
98438 compilation.dependencyTemplates.set(
98439 RequireResolveContextDependency,
98440 new RequireResolveContextDependency.Template()
98441 );
98442
98443 compilation.dependencyFactories.set(
98444 RequireResolveHeaderDependency,
98445 new NullFactory()
98446 );
98447 compilation.dependencyTemplates.set(
98448 RequireResolveHeaderDependency,
98449 new RequireResolveHeaderDependency.Template()
98450 );
98451
98452 compilation.dependencyFactories.set(
98453 RequireHeaderDependency,
98454 new NullFactory()
98455 );
98456 compilation.dependencyTemplates.set(
98457 RequireHeaderDependency,
98458 new RequireHeaderDependency.Template()
98459 );
98460
98461 const handler = (parser, parserOptions) => {
98462 if (parserOptions.commonjs !== undefined && !parserOptions.commonjs)
98463 return;
98464
98465 const requireExpressions = [
98466 "require",
98467 "require.resolve",
98468 "require.resolveWeak"
98469 ];
98470 for (let expression of requireExpressions) {
98471 parser.hooks.typeof
98472 .for(expression)
98473 .tap(
98474 "CommonJsPlugin",
98475 ParserHelpers.toConstantDependency(
98476 parser,
98477 JSON.stringify("function")
98478 )
98479 );
98480 parser.hooks.evaluateTypeof
98481 .for(expression)
98482 .tap(
98483 "CommonJsPlugin",
98484 ParserHelpers.evaluateToString("function")
98485 );
98486 parser.hooks.evaluateIdentifier
98487 .for(expression)
98488 .tap(
98489 "CommonJsPlugin",
98490 ParserHelpers.evaluateToIdentifier(expression, true)
98491 );
98492 }
98493
98494 parser.hooks.evaluateTypeof
98495 .for("module")
98496 .tap("CommonJsPlugin", ParserHelpers.evaluateToString("object"));
98497 parser.hooks.assign.for("require").tap("CommonJsPlugin", expr => {
98498 // to not leak to global "require", we need to define a local require here.
98499 const dep = new ConstDependency("var require;", 0);
98500 dep.loc = expr.loc;
98501 parser.state.current.addDependency(dep);
98502 parser.scope.definitions.add("require");
98503 return true;
98504 });
98505 parser.hooks.canRename
98506 .for("require")
98507 .tap("CommonJsPlugin", () => true);
98508 parser.hooks.rename.for("require").tap("CommonJsPlugin", expr => {
98509 // define the require variable. It's still undefined, but not "not defined".
98510 const dep = new ConstDependency("var require;", 0);
98511 dep.loc = expr.loc;
98512 parser.state.current.addDependency(dep);
98513 return false;
98514 });
98515 parser.hooks.typeof.for("module").tap("CommonJsPlugin", () => true);
98516 parser.hooks.evaluateTypeof
98517 .for("exports")
98518 .tap("CommonJsPlugin", ParserHelpers.evaluateToString("object"));
98519
98520 new CommonJsRequireDependencyParserPlugin(options).apply(parser);
98521 new RequireResolveDependencyParserPlugin(options).apply(parser);
98522 };
98523
98524 normalModuleFactory.hooks.parser
98525 .for("javascript/auto")
98526 .tap("CommonJsPlugin", handler);
98527 normalModuleFactory.hooks.parser
98528 .for("javascript/dynamic")
98529 .tap("CommonJsPlugin", handler);
98530 }
98531 );
98532 }
98533}
98534module.exports = CommonJsPlugin;
98535
98536
98537/***/ }),
98538
98539/***/ 26791:
98540/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98541
98542"use strict";
98543/*
98544 MIT License http://www.opensource.org/licenses/mit-license.php
98545 Author Tobias Koppers @sokra
98546*/
98547
98548const ContextDependency = __webpack_require__(11583);
98549const ContextDependencyTemplateAsRequireCall = __webpack_require__(54380);
98550
98551class CommonJsRequireContextDependency extends ContextDependency {
98552 constructor(options, range, valueRange) {
98553 super(options);
98554 this.range = range;
98555 this.valueRange = valueRange;
98556 }
98557
98558 get type() {
98559 return "cjs require context";
98560 }
98561}
98562
98563CommonJsRequireContextDependency.Template = ContextDependencyTemplateAsRequireCall;
98564
98565module.exports = CommonJsRequireContextDependency;
98566
98567
98568/***/ }),
98569
98570/***/ 37504:
98571/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98572
98573"use strict";
98574/*
98575 MIT License http://www.opensource.org/licenses/mit-license.php
98576 Author Tobias Koppers @sokra
98577*/
98578
98579const ModuleDependency = __webpack_require__(90865);
98580const ModuleDependencyTemplateAsId = __webpack_require__(63708);
98581
98582class CommonJsRequireDependency extends ModuleDependency {
98583 constructor(request, range) {
98584 super(request);
98585 this.range = range;
98586 }
98587
98588 get type() {
98589 return "cjs require";
98590 }
98591}
98592
98593CommonJsRequireDependency.Template = ModuleDependencyTemplateAsId;
98594
98595module.exports = CommonJsRequireDependency;
98596
98597
98598/***/ }),
98599
98600/***/ 37278:
98601/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98602
98603"use strict";
98604/*
98605 MIT License http://www.opensource.org/licenses/mit-license.php
98606 Author Tobias Koppers @sokra
98607*/
98608
98609
98610const CommonJsRequireDependency = __webpack_require__(37504);
98611const CommonJsRequireContextDependency = __webpack_require__(26791);
98612const RequireHeaderDependency = __webpack_require__(22928);
98613const LocalModuleDependency = __webpack_require__(56570);
98614const ContextDependencyHelpers = __webpack_require__(5594);
98615const LocalModulesHelpers = __webpack_require__(39658);
98616const ParserHelpers = __webpack_require__(23999);
98617
98618class CommonJsRequireDependencyParserPlugin {
98619 constructor(options) {
98620 this.options = options;
98621 }
98622
98623 apply(parser) {
98624 const options = this.options;
98625
98626 const processItem = (expr, param) => {
98627 if (param.isString()) {
98628 const dep = new CommonJsRequireDependency(param.string, param.range);
98629 dep.loc = expr.loc;
98630 dep.optional = !!parser.scope.inTry;
98631 parser.state.current.addDependency(dep);
98632 return true;
98633 }
98634 };
98635 const processContext = (expr, param) => {
98636 const dep = ContextDependencyHelpers.create(
98637 CommonJsRequireContextDependency,
98638 expr.range,
98639 param,
98640 expr,
98641 options,
98642 {},
98643 parser
98644 );
98645 if (!dep) return;
98646 dep.loc = expr.loc;
98647 dep.optional = !!parser.scope.inTry;
98648 parser.state.current.addDependency(dep);
98649 return true;
98650 };
98651
98652 parser.hooks.expression
98653 .for("require.cache")
98654 .tap(
98655 "CommonJsRequireDependencyParserPlugin",
98656 ParserHelpers.toConstantDependencyWithWebpackRequire(
98657 parser,
98658 "__webpack_require__.c"
98659 )
98660 );
98661 parser.hooks.expression
98662 .for("require")
98663 .tap("CommonJsRequireDependencyParserPlugin", expr => {
98664 const dep = new CommonJsRequireContextDependency(
98665 {
98666 request: options.unknownContextRequest,
98667 recursive: options.unknownContextRecursive,
98668 regExp: options.unknownContextRegExp,
98669 mode: "sync"
98670 },
98671 expr.range
98672 );
98673 dep.critical =
98674 options.unknownContextCritical &&
98675 "require function is used in a way in which dependencies cannot be statically extracted";
98676 dep.loc = expr.loc;
98677 dep.optional = !!parser.scope.inTry;
98678 parser.state.current.addDependency(dep);
98679 return true;
98680 });
98681
98682 const createHandler = callNew => expr => {
98683 if (expr.arguments.length !== 1) return;
98684 let localModule;
98685 const param = parser.evaluateExpression(expr.arguments[0]);
98686 if (param.isConditional()) {
98687 let isExpression = false;
98688 const prevLength = parser.state.current.dependencies.length;
98689 const dep = new RequireHeaderDependency(expr.callee.range);
98690 dep.loc = expr.loc;
98691 parser.state.current.addDependency(dep);
98692 for (const p of param.options) {
98693 const result = processItem(expr, p);
98694 if (result === undefined) {
98695 isExpression = true;
98696 }
98697 }
98698 if (isExpression) {
98699 parser.state.current.dependencies.length = prevLength;
98700 } else {
98701 return true;
98702 }
98703 }
98704 if (
98705 param.isString() &&
98706 (localModule = LocalModulesHelpers.getLocalModule(
98707 parser.state,
98708 param.string
98709 ))
98710 ) {
98711 const dep = new LocalModuleDependency(localModule, expr.range, callNew);
98712 dep.loc = expr.loc;
98713 parser.state.current.addDependency(dep);
98714 return true;
98715 } else {
98716 const result = processItem(expr, param);
98717 if (result === undefined) {
98718 processContext(expr, param);
98719 } else {
98720 const dep = new RequireHeaderDependency(expr.callee.range);
98721 dep.loc = expr.loc;
98722 parser.state.current.addDependency(dep);
98723 }
98724 return true;
98725 }
98726 };
98727 parser.hooks.call
98728 .for("require")
98729 .tap("CommonJsRequireDependencyParserPlugin", createHandler(false));
98730 parser.hooks.new
98731 .for("require")
98732 .tap("CommonJsRequireDependencyParserPlugin", createHandler(true));
98733 parser.hooks.call
98734 .for("module.require")
98735 .tap("CommonJsRequireDependencyParserPlugin", createHandler(false));
98736 parser.hooks.new
98737 .for("module.require")
98738 .tap("CommonJsRequireDependencyParserPlugin", createHandler(true));
98739 }
98740}
98741module.exports = CommonJsRequireDependencyParserPlugin;
98742
98743
98744/***/ }),
98745
98746/***/ 71101:
98747/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98748
98749"use strict";
98750/*
98751 MIT License http://www.opensource.org/licenses/mit-license.php
98752 Author Tobias Koppers @sokra
98753*/
98754
98755const NullDependency = __webpack_require__(5088);
98756
98757class ConstDependency extends NullDependency {
98758 constructor(expression, range, requireWebpackRequire) {
98759 super();
98760 this.expression = expression;
98761 this.range = range;
98762 this.requireWebpackRequire = requireWebpackRequire;
98763 }
98764
98765 updateHash(hash) {
98766 hash.update(this.range + "");
98767 hash.update(this.expression + "");
98768 }
98769}
98770
98771ConstDependency.Template = class ConstDependencyTemplate {
98772 apply(dep, source) {
98773 if (typeof dep.range === "number") {
98774 source.insert(dep.range, dep.expression);
98775 return;
98776 }
98777
98778 source.replace(dep.range[0], dep.range[1] - 1, dep.expression);
98779 }
98780};
98781
98782module.exports = ConstDependency;
98783
98784
98785/***/ }),
98786
98787/***/ 11583:
98788/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98789
98790"use strict";
98791/*
98792 MIT License http://www.opensource.org/licenses/mit-license.php
98793 Author Tobias Koppers @sokra
98794*/
98795
98796const Dependency = __webpack_require__(57282);
98797const CriticalDependencyWarning = __webpack_require__(54983);
98798
98799const regExpToString = r => (r ? r + "" : "");
98800
98801class ContextDependency extends Dependency {
98802 // options: { request, recursive, regExp, include, exclude, mode, chunkName, groupOptions }
98803 constructor(options) {
98804 super();
98805 this.options = options;
98806 this.userRequest = this.options.request;
98807 /** @type {false | string} */
98808 this.critical = false;
98809 this.hadGlobalOrStickyRegExp = false;
98810 if (this.options.regExp.global || this.options.regExp.sticky) {
98811 this.options.regExp = null;
98812 this.hadGlobalOrStickyRegExp = true;
98813 }
98814 }
98815
98816 getResourceIdentifier() {
98817 return (
98818 `context${this.options.request} ${this.options.recursive} ` +
98819 `${regExpToString(this.options.regExp)} ${regExpToString(
98820 this.options.include
98821 )} ${regExpToString(this.options.exclude)} ` +
98822 `${this.options.mode} ${this.options.chunkName} ` +
98823 `${JSON.stringify(this.options.groupOptions)}`
98824 );
98825 }
98826
98827 getWarnings() {
98828 let warnings = super.getWarnings() || [];
98829 if (this.critical) {
98830 warnings.push(new CriticalDependencyWarning(this.critical));
98831 }
98832 if (this.hadGlobalOrStickyRegExp) {
98833 warnings.push(
98834 new CriticalDependencyWarning(
98835 "Contexts can't use RegExps with the 'g' or 'y' flags."
98836 )
98837 );
98838 }
98839 return warnings;
98840 }
98841}
98842
98843// TODO remove in webpack 5
98844Object.defineProperty(ContextDependency.prototype, "async", {
98845 configurable: false,
98846 get() {
98847 throw new Error(
98848 "ContextDependency.async was removed. Use ContextDependency.options.mode instead."
98849 );
98850 },
98851 set() {
98852 throw new Error(
98853 "ContextDependency.async was removed. Pass options.mode to constructor instead"
98854 );
98855 }
98856});
98857
98858module.exports = ContextDependency;
98859
98860
98861/***/ }),
98862
98863/***/ 5594:
98864/***/ (function(__unused_webpack_module, exports) {
98865
98866"use strict";
98867/*
98868 MIT License http://www.opensource.org/licenses/mit-license.php
98869 Author Tobias Koppers @sokra
98870*/
98871
98872
98873const ContextDependencyHelpers = exports;
98874
98875/**
98876 * Escapes regular expression metacharacters
98877 * @param {string} str String to quote
98878 * @returns {string} Escaped string
98879 */
98880const quotemeta = str => {
98881 return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
98882};
98883
98884const splitContextFromPrefix = prefix => {
98885 const idx = prefix.lastIndexOf("/");
98886 let context = ".";
98887 if (idx >= 0) {
98888 context = prefix.substr(0, idx);
98889 prefix = `.${prefix.substr(idx)}`;
98890 }
98891 return {
98892 context,
98893 prefix
98894 };
98895};
98896
98897const splitQueryFromPostfix = postfix => {
98898 const idx = postfix.indexOf("?");
98899 let query = "";
98900 if (idx >= 0) {
98901 query = postfix.substr(idx);
98902 postfix = postfix.substr(0, idx);
98903 }
98904 return {
98905 postfix,
98906 query
98907 };
98908};
98909
98910ContextDependencyHelpers.create = (
98911 Dep,
98912 range,
98913 param,
98914 expr,
98915 options,
98916 contextOptions,
98917 // when parser is not passed in, expressions won't be walked
98918 parser = null
98919) => {
98920 if (param.isTemplateString()) {
98921 let prefixRaw = param.quasis[0].string;
98922 let postfixRaw =
98923 param.quasis.length > 1
98924 ? param.quasis[param.quasis.length - 1].string
98925 : "";
98926
98927 const valueRange = param.range;
98928 const { context, prefix } = splitContextFromPrefix(prefixRaw);
98929 const { postfix, query } = splitQueryFromPostfix(postfixRaw);
98930
98931 // When there are more than two quasis, the generated RegExp can be more precise
98932 // We join the quasis with the expression regexp
98933 const innerQuasis = param.quasis.slice(1, param.quasis.length - 1);
98934 const innerRegExp =
98935 options.wrappedContextRegExp.source +
98936 innerQuasis
98937 .map(q => quotemeta(q.string) + options.wrappedContextRegExp.source)
98938 .join("");
98939
98940 // Example: `./context/pre${e}inner${e}inner2${e}post?query`
98941 // context: "./context"
98942 // prefix: "./pre"
98943 // innerQuasis: [BEE("inner"), BEE("inner2")]
98944 // (BEE = BasicEvaluatedExpression)
98945 // postfix: "post"
98946 // query: "?query"
98947 // regExp: /^\.\/pre.*inner.*inner2.*post$/
98948 const regExp = new RegExp(
98949 `^${quotemeta(prefix)}${innerRegExp}${quotemeta(postfix)}$`
98950 );
98951 const dep = new Dep(
98952 Object.assign(
98953 {
98954 request: context + query,
98955 recursive: options.wrappedContextRecursive,
98956 regExp,
98957 mode: "sync"
98958 },
98959 contextOptions
98960 ),
98961 range,
98962 valueRange
98963 );
98964 dep.loc = expr.loc;
98965 const replaces = [];
98966
98967 param.parts.forEach((part, i) => {
98968 if (i % 2 === 0) {
98969 // Quasis or merged quasi
98970 let range = part.range;
98971 let value = part.string;
98972 if (param.templateStringKind === "cooked") {
98973 value = JSON.stringify(value);
98974 value = value.slice(1, value.length - 1);
98975 }
98976 if (i === 0) {
98977 // prefix
98978 value = prefix;
98979 range = [param.range[0], part.range[1]];
98980 value =
98981 (param.templateStringKind === "cooked" ? "`" : "String.raw`") +
98982 value;
98983 } else if (i === param.parts.length - 1) {
98984 // postfix
98985 value = postfix;
98986 range = [part.range[0], param.range[1]];
98987 value = value + "`";
98988 } else if (
98989 part.expression &&
98990 part.expression.type === "TemplateElement" &&
98991 part.expression.value.raw === value
98992 ) {
98993 // Shortcut when it's a single quasi and doesn't need to be replaced
98994 return;
98995 }
98996 replaces.push({
98997 range,
98998 value
98999 });
99000 } else {
99001 // Expression
99002 if (parser) {
99003 parser.walkExpression(part.expression);
99004 }
99005 }
99006 });
99007
99008 dep.replaces = replaces;
99009 dep.critical =
99010 options.wrappedContextCritical &&
99011 "a part of the request of a dependency is an expression";
99012 return dep;
99013 } else if (
99014 param.isWrapped() &&
99015 ((param.prefix && param.prefix.isString()) ||
99016 (param.postfix && param.postfix.isString()))
99017 ) {
99018 let prefixRaw =
99019 param.prefix && param.prefix.isString() ? param.prefix.string : "";
99020 let postfixRaw =
99021 param.postfix && param.postfix.isString() ? param.postfix.string : "";
99022 const prefixRange =
99023 param.prefix && param.prefix.isString() ? param.prefix.range : null;
99024 const postfixRange =
99025 param.postfix && param.postfix.isString() ? param.postfix.range : null;
99026 const valueRange = param.range;
99027 const { context, prefix } = splitContextFromPrefix(prefixRaw);
99028 const { postfix, query } = splitQueryFromPostfix(postfixRaw);
99029 const regExp = new RegExp(
99030 `^${quotemeta(prefix)}${options.wrappedContextRegExp.source}${quotemeta(
99031 postfix
99032 )}$`
99033 );
99034 const dep = new Dep(
99035 Object.assign(
99036 {
99037 request: context + query,
99038 recursive: options.wrappedContextRecursive,
99039 regExp,
99040 mode: "sync"
99041 },
99042 contextOptions
99043 ),
99044 range,
99045 valueRange
99046 );
99047 dep.loc = expr.loc;
99048 const replaces = [];
99049 if (prefixRange) {
99050 replaces.push({
99051 range: prefixRange,
99052 value: JSON.stringify(prefix)
99053 });
99054 }
99055 if (postfixRange) {
99056 replaces.push({
99057 range: postfixRange,
99058 value: JSON.stringify(postfix)
99059 });
99060 }
99061 dep.replaces = replaces;
99062 dep.critical =
99063 options.wrappedContextCritical &&
99064 "a part of the request of a dependency is an expression";
99065
99066 if (parser && param.wrappedInnerExpressions) {
99067 for (const part of param.wrappedInnerExpressions) {
99068 if (part.expression) parser.walkExpression(part.expression);
99069 }
99070 }
99071
99072 return dep;
99073 } else {
99074 const dep = new Dep(
99075 Object.assign(
99076 {
99077 request: options.exprContextRequest,
99078 recursive: options.exprContextRecursive,
99079 regExp: options.exprContextRegExp,
99080 mode: "sync"
99081 },
99082 contextOptions
99083 ),
99084 range,
99085 param.range
99086 );
99087 dep.loc = expr.loc;
99088 dep.critical =
99089 options.exprContextCritical &&
99090 "the request of a dependency is an expression";
99091
99092 if (parser) {
99093 parser.walkExpression(param.expression);
99094 }
99095
99096 return dep;
99097 }
99098};
99099
99100
99101/***/ }),
99102
99103/***/ 6174:
99104/***/ (function(module) {
99105
99106"use strict";
99107/*
99108 MIT License http://www.opensource.org/licenses/mit-license.php
99109 Author Tobias Koppers @sokra
99110*/
99111
99112
99113class ContextDependencyTemplateAsId {
99114 apply(dep, source, runtime) {
99115 const moduleExports = runtime.moduleExports({
99116 module: dep.module,
99117 request: dep.request
99118 });
99119
99120 if (dep.module) {
99121 if (dep.valueRange) {
99122 if (Array.isArray(dep.replaces)) {
99123 for (let i = 0; i < dep.replaces.length; i++) {
99124 const rep = dep.replaces[i];
99125 source.replace(rep.range[0], rep.range[1] - 1, rep.value);
99126 }
99127 }
99128 source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
99129 // TODO webpack 5 remove `prepend` it's no longer used
99130 source.replace(
99131 dep.range[0],
99132 dep.valueRange[0] - 1,
99133 `${moduleExports}.resolve(${
99134 typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : ""
99135 }`
99136 );
99137 } else {
99138 source.replace(
99139 dep.range[0],
99140 dep.range[1] - 1,
99141 `${moduleExports}.resolve`
99142 );
99143 }
99144 } else {
99145 source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
99146 }
99147 }
99148}
99149module.exports = ContextDependencyTemplateAsId;
99150
99151
99152/***/ }),
99153
99154/***/ 54380:
99155/***/ (function(module) {
99156
99157"use strict";
99158/*
99159 MIT License http://www.opensource.org/licenses/mit-license.php
99160 Author Tobias Koppers @sokra
99161*/
99162
99163
99164class ContextDependencyTemplateAsRequireCall {
99165 apply(dep, source, runtime) {
99166 const moduleExports = runtime.moduleExports({
99167 module: dep.module,
99168 request: dep.request
99169 });
99170
99171 if (dep.module) {
99172 if (dep.valueRange) {
99173 if (Array.isArray(dep.replaces)) {
99174 for (let i = 0; i < dep.replaces.length; i++) {
99175 const rep = dep.replaces[i];
99176 source.replace(rep.range[0], rep.range[1] - 1, rep.value);
99177 }
99178 }
99179 source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
99180 // TODO webpack 5 remove `prepend` it's no longer used
99181 source.replace(
99182 dep.range[0],
99183 dep.valueRange[0] - 1,
99184 `${moduleExports}(${
99185 typeof dep.prepend === "string" ? JSON.stringify(dep.prepend) : ""
99186 }`
99187 );
99188 } else {
99189 source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
99190 }
99191 } else {
99192 source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
99193 }
99194 }
99195}
99196module.exports = ContextDependencyTemplateAsRequireCall;
99197
99198
99199/***/ }),
99200
99201/***/ 89079:
99202/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99203
99204"use strict";
99205/*
99206 MIT License http://www.opensource.org/licenses/mit-license.php
99207 Author Tobias Koppers @sokra
99208*/
99209
99210const ModuleDependency = __webpack_require__(90865);
99211
99212class ContextElementDependency extends ModuleDependency {
99213 constructor(request, userRequest) {
99214 super(request);
99215 if (userRequest) {
99216 this.userRequest = userRequest;
99217 }
99218 }
99219
99220 get type() {
99221 return "context element";
99222 }
99223}
99224
99225module.exports = ContextElementDependency;
99226
99227
99228/***/ }),
99229
99230/***/ 54983:
99231/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99232
99233"use strict";
99234/*
99235 MIT License http://www.opensource.org/licenses/mit-license.php
99236 Author Tobias Koppers @sokra
99237*/
99238
99239
99240const WebpackError = __webpack_require__(97391);
99241
99242class CriticalDependencyWarning extends WebpackError {
99243 constructor(message) {
99244 super();
99245
99246 this.name = "CriticalDependencyWarning";
99247 this.message = "Critical dependency: " + message;
99248
99249 Error.captureStackTrace(this, this.constructor);
99250 }
99251}
99252
99253module.exports = CriticalDependencyWarning;
99254
99255
99256/***/ }),
99257
99258/***/ 53104:
99259/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99260
99261"use strict";
99262/*
99263 MIT License http://www.opensource.org/licenses/mit-license.php
99264 Author Tobias Koppers @sokra
99265*/
99266
99267
99268const DependencyReference = __webpack_require__(71722);
99269const NullDependency = __webpack_require__(5088);
99270
99271class DelegatedExportsDependency extends NullDependency {
99272 constructor(originModule, exports) {
99273 super();
99274 this.originModule = originModule;
99275 this.exports = exports;
99276 }
99277
99278 get type() {
99279 return "delegated exports";
99280 }
99281
99282 getReference() {
99283 return new DependencyReference(this.originModule, true, false);
99284 }
99285
99286 getExports() {
99287 return {
99288 exports: this.exports,
99289 dependencies: undefined
99290 };
99291 }
99292}
99293
99294module.exports = DelegatedExportsDependency;
99295
99296
99297/***/ }),
99298
99299/***/ 25930:
99300/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99301
99302"use strict";
99303/*
99304 MIT License http://www.opensource.org/licenses/mit-license.php
99305 Author Tobias Koppers @sokra
99306*/
99307
99308const ModuleDependency = __webpack_require__(90865);
99309
99310class DelegatedSourceDependency extends ModuleDependency {
99311 constructor(request) {
99312 super(request);
99313 }
99314
99315 get type() {
99316 return "delegated source";
99317 }
99318}
99319
99320module.exports = DelegatedSourceDependency;
99321
99322
99323/***/ }),
99324
99325/***/ 71722:
99326/***/ (function(module) {
99327
99328"use strict";
99329/*
99330 MIT License http://www.opensource.org/licenses/mit-license.php
99331 Author Florent Cailhol @ooflorent
99332*/
99333
99334
99335/** @typedef {import("../Module")} Module */
99336
99337class DependencyReference {
99338 // TODO webpack 5: module must be dynamic, you must pass a function returning a module
99339 // This is needed to remove the hack in ConcatenatedModule
99340 // The problem is that the `module` in Dependency could be replaced i. e. because of Scope Hoisting
99341 /**
99342 *
99343 * @param {Module} module the referenced module
99344 * @param {string[] | boolean} importedNames imported named from the module
99345 * @param {boolean=} weak if this is a weak reference
99346 * @param {number} order the order information or NaN if don't care
99347 */
99348 constructor(module, importedNames, weak = false, order = NaN) {
99349 // TODO webpack 5: make it a getter
99350 this.module = module;
99351 // true: full object
99352 // false: only sideeffects/no export
99353 // array of strings: the exports with this names
99354 this.importedNames = importedNames;
99355 this.weak = !!weak;
99356 this.order = order;
99357 }
99358
99359 /**
99360 * @param {DependencyReference[]} array an array (will be modified)
99361 * @returns {DependencyReference[]} the array again
99362 */
99363 static sort(array) {
99364 /** @type {WeakMap<DependencyReference, number>} */
99365 const originalOrder = new WeakMap();
99366 let i = 0;
99367 for (const ref of array) {
99368 originalOrder.set(ref, i++);
99369 }
99370 return array.sort((a, b) => {
99371 const aOrder = a.order;
99372 const bOrder = b.order;
99373 if (isNaN(aOrder)) {
99374 if (!isNaN(bOrder)) {
99375 return 1;
99376 }
99377 } else {
99378 if (isNaN(bOrder)) {
99379 return -1;
99380 }
99381 if (aOrder !== bOrder) {
99382 return aOrder - bOrder;
99383 }
99384 }
99385 const aOrg = originalOrder.get(a);
99386 const bOrg = originalOrder.get(b);
99387 return aOrg - bOrg;
99388 });
99389 }
99390}
99391
99392module.exports = DependencyReference;
99393
99394
99395/***/ }),
99396
99397/***/ 66279:
99398/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99399
99400"use strict";
99401/*
99402 MIT License http://www.opensource.org/licenses/mit-license.php
99403 Author Tobias Koppers @sokra
99404*/
99405
99406const Dependency = __webpack_require__(57282);
99407
99408class DllEntryDependency extends Dependency {
99409 constructor(dependencies, name) {
99410 super();
99411 this.dependencies = dependencies;
99412 this.name = name;
99413 }
99414
99415 get type() {
99416 return "dll entry";
99417 }
99418}
99419
99420module.exports = DllEntryDependency;
99421
99422
99423/***/ }),
99424
99425/***/ 75159:
99426/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99427
99428"use strict";
99429/*
99430 MIT License http://www.opensource.org/licenses/mit-license.php
99431 Author Tobias Koppers @sokra
99432*/
99433
99434
99435const NullDependency = __webpack_require__(5088);
99436const HarmonyImportDependency = __webpack_require__(81599);
99437
99438class HarmonyAcceptDependency extends NullDependency {
99439 constructor(range, dependencies, hasCallback) {
99440 super();
99441 this.range = range;
99442 this.dependencies = dependencies;
99443 this.hasCallback = hasCallback;
99444 }
99445
99446 get type() {
99447 return "accepted harmony modules";
99448 }
99449}
99450
99451HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate {
99452 apply(dep, source, runtime) {
99453 const content = dep.dependencies
99454 .filter(dependency =>
99455 HarmonyImportDependency.Template.isImportEmitted(dependency, source)
99456 )
99457 .map(dependency => dependency.getImportStatement(true, runtime))
99458 .join("");
99459
99460 if (dep.hasCallback) {
99461 source.insert(
99462 dep.range[0],
99463 `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(`
99464 );
99465 source.insert(
99466 dep.range[1],
99467 ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }.bind(this)"
99468 );
99469 return;
99470 }
99471
99472 source.insert(dep.range[1] - 0.5, `, function() { ${content} }`);
99473 }
99474};
99475
99476module.exports = HarmonyAcceptDependency;
99477
99478
99479/***/ }),
99480
99481/***/ 66136:
99482/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99483
99484"use strict";
99485/*
99486 MIT License http://www.opensource.org/licenses/mit-license.php
99487 Author Tobias Koppers @sokra
99488*/
99489
99490const HarmonyImportDependency = __webpack_require__(81599);
99491
99492class HarmonyAcceptImportDependency extends HarmonyImportDependency {
99493 constructor(request, originModule, parserScope) {
99494 super(request, originModule, NaN, parserScope);
99495 this.weak = true;
99496 }
99497
99498 get type() {
99499 return "harmony accept";
99500 }
99501}
99502
99503HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate extends HarmonyImportDependency.Template {
99504 apply(dep, source, runtime) {}
99505};
99506
99507module.exports = HarmonyAcceptImportDependency;
99508
99509
99510/***/ }),
99511
99512/***/ 1533:
99513/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99514
99515"use strict";
99516/*
99517 MIT License http://www.opensource.org/licenses/mit-license.php
99518 Author Tobias Koppers @sokra
99519*/
99520
99521const NullDependency = __webpack_require__(5088);
99522
99523class HarmonyCompatibilityDependency extends NullDependency {
99524 constructor(originModule) {
99525 super();
99526 this.originModule = originModule;
99527 }
99528
99529 get type() {
99530 return "harmony export header";
99531 }
99532}
99533
99534HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate {
99535 apply(dep, source, runtime) {
99536 const usedExports = dep.originModule.usedExports;
99537 if (usedExports !== false && !Array.isArray(usedExports)) {
99538 const content = runtime.defineEsModuleFlagStatement({
99539 exportsArgument: dep.originModule.exportsArgument
99540 });
99541 source.insert(-10, content);
99542 }
99543 }
99544};
99545
99546module.exports = HarmonyCompatibilityDependency;
99547
99548
99549/***/ }),
99550
99551/***/ 59310:
99552/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99553
99554"use strict";
99555/*
99556 MIT License http://www.opensource.org/licenses/mit-license.php
99557 Author Tobias Koppers @sokra
99558*/
99559
99560
99561const HarmonyCompatibilityDependency = __webpack_require__(1533);
99562const HarmonyInitDependency = __webpack_require__(27204);
99563
99564module.exports = class HarmonyDetectionParserPlugin {
99565 apply(parser) {
99566 parser.hooks.program.tap("HarmonyDetectionParserPlugin", ast => {
99567 const isStrictHarmony = parser.state.module.type === "javascript/esm";
99568 const isHarmony =
99569 isStrictHarmony ||
99570 ast.body.some(
99571 statement =>
99572 statement.type === "ImportDeclaration" ||
99573 statement.type === "ExportDefaultDeclaration" ||
99574 statement.type === "ExportNamedDeclaration" ||
99575 statement.type === "ExportAllDeclaration"
99576 );
99577 if (isHarmony) {
99578 const module = parser.state.module;
99579 const compatDep = new HarmonyCompatibilityDependency(module);
99580 compatDep.loc = {
99581 start: {
99582 line: -1,
99583 column: 0
99584 },
99585 end: {
99586 line: -1,
99587 column: 0
99588 },
99589 index: -3
99590 };
99591 module.addDependency(compatDep);
99592 const initDep = new HarmonyInitDependency(module);
99593 initDep.loc = {
99594 start: {
99595 line: -1,
99596 column: 0
99597 },
99598 end: {
99599 line: -1,
99600 column: 0
99601 },
99602 index: -2
99603 };
99604 module.addDependency(initDep);
99605 parser.state.harmonyParserScope = parser.state.harmonyParserScope || {};
99606 parser.scope.isStrict = true;
99607 module.buildMeta.exportsType = "namespace";
99608 module.buildInfo.strict = true;
99609 module.buildInfo.exportsArgument = "__webpack_exports__";
99610 if (isStrictHarmony) {
99611 module.buildMeta.strictHarmonyModule = true;
99612 module.buildInfo.moduleArgument = "__webpack_module__";
99613 }
99614 }
99615 });
99616
99617 const skipInHarmony = () => {
99618 const module = parser.state.module;
99619 if (module && module.buildMeta && module.buildMeta.exportsType) {
99620 return true;
99621 }
99622 };
99623
99624 const nullInHarmony = () => {
99625 const module = parser.state.module;
99626 if (module && module.buildMeta && module.buildMeta.exportsType) {
99627 return null;
99628 }
99629 };
99630
99631 const nonHarmonyIdentifiers = ["define", "exports"];
99632 for (const identifer of nonHarmonyIdentifiers) {
99633 parser.hooks.evaluateTypeof
99634 .for(identifer)
99635 .tap("HarmonyDetectionParserPlugin", nullInHarmony);
99636 parser.hooks.typeof
99637 .for(identifer)
99638 .tap("HarmonyDetectionParserPlugin", skipInHarmony);
99639 parser.hooks.evaluate
99640 .for(identifer)
99641 .tap("HarmonyDetectionParserPlugin", nullInHarmony);
99642 parser.hooks.expression
99643 .for(identifer)
99644 .tap("HarmonyDetectionParserPlugin", skipInHarmony);
99645 parser.hooks.call
99646 .for(identifer)
99647 .tap("HarmonyDetectionParserPlugin", skipInHarmony);
99648 }
99649 }
99650};
99651
99652
99653/***/ }),
99654
99655/***/ 49180:
99656/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99657
99658"use strict";
99659/*
99660 MIT License http://www.opensource.org/licenses/mit-license.php
99661 Author Tobias Koppers @sokra
99662*/
99663
99664
99665const HarmonyExportExpressionDependency = __webpack_require__(84245);
99666const HarmonyImportSideEffectDependency = __webpack_require__(79171);
99667const HarmonyExportHeaderDependency = __webpack_require__(21320);
99668const HarmonyExportSpecifierDependency = __webpack_require__(34834);
99669const HarmonyExportImportedSpecifierDependency = __webpack_require__(22864);
99670const ConstDependency = __webpack_require__(71101);
99671
99672module.exports = class HarmonyExportDependencyParserPlugin {
99673 constructor(moduleOptions) {
99674 this.strictExportPresence = moduleOptions.strictExportPresence;
99675 }
99676
99677 apply(parser) {
99678 parser.hooks.export.tap(
99679 "HarmonyExportDependencyParserPlugin",
99680 statement => {
99681 const dep = new HarmonyExportHeaderDependency(
99682 statement.declaration && statement.declaration.range,
99683 statement.range
99684 );
99685 dep.loc = Object.create(statement.loc);
99686 dep.loc.index = -1;
99687 parser.state.current.addDependency(dep);
99688 return true;
99689 }
99690 );
99691 parser.hooks.exportImport.tap(
99692 "HarmonyExportDependencyParserPlugin",
99693 (statement, source) => {
99694 parser.state.lastHarmonyImportOrder =
99695 (parser.state.lastHarmonyImportOrder || 0) + 1;
99696 const clearDep = new ConstDependency("", statement.range);
99697 clearDep.loc = Object.create(statement.loc);
99698 clearDep.loc.index = -1;
99699 parser.state.current.addDependency(clearDep);
99700 const sideEffectDep = new HarmonyImportSideEffectDependency(
99701 source,
99702 parser.state.module,
99703 parser.state.lastHarmonyImportOrder,
99704 parser.state.harmonyParserScope
99705 );
99706 sideEffectDep.loc = Object.create(statement.loc);
99707 sideEffectDep.loc.index = -1;
99708 parser.state.current.addDependency(sideEffectDep);
99709 return true;
99710 }
99711 );
99712 parser.hooks.exportExpression.tap(
99713 "HarmonyExportDependencyParserPlugin",
99714 (statement, expr) => {
99715 const comments = parser.getComments([
99716 statement.range[0],
99717 expr.range[0]
99718 ]);
99719 const dep = new HarmonyExportExpressionDependency(
99720 parser.state.module,
99721 expr.range,
99722 statement.range,
99723 comments
99724 .map(c => {
99725 switch (c.type) {
99726 case "Block":
99727 return `/*${c.value}*/`;
99728 case "Line":
99729 return `//${c.value}\n`;
99730 }
99731 return "";
99732 })
99733 .join("")
99734 );
99735 dep.loc = Object.create(statement.loc);
99736 dep.loc.index = -1;
99737 parser.state.current.addDependency(dep);
99738 return true;
99739 }
99740 );
99741 parser.hooks.exportDeclaration.tap(
99742 "HarmonyExportDependencyParserPlugin",
99743 statement => {}
99744 );
99745 parser.hooks.exportSpecifier.tap(
99746 "HarmonyExportDependencyParserPlugin",
99747 (statement, id, name, idx) => {
99748 const rename = parser.scope.renames.get(id);
99749 let dep;
99750 const harmonyNamedExports = (parser.state.harmonyNamedExports =
99751 parser.state.harmonyNamedExports || new Set());
99752 harmonyNamedExports.add(name);
99753 if (rename === "imported var") {
99754 const settings = parser.state.harmonySpecifier.get(id);
99755 dep = new HarmonyExportImportedSpecifierDependency(
99756 settings.source,
99757 parser.state.module,
99758 settings.sourceOrder,
99759 parser.state.harmonyParserScope,
99760 settings.id,
99761 name,
99762 harmonyNamedExports,
99763 null,
99764 this.strictExportPresence
99765 );
99766 } else {
99767 dep = new HarmonyExportSpecifierDependency(
99768 parser.state.module,
99769 id,
99770 name
99771 );
99772 }
99773 dep.loc = Object.create(statement.loc);
99774 dep.loc.index = idx;
99775 parser.state.current.addDependency(dep);
99776 return true;
99777 }
99778 );
99779 parser.hooks.exportImportSpecifier.tap(
99780 "HarmonyExportDependencyParserPlugin",
99781 (statement, source, id, name, idx) => {
99782 const harmonyNamedExports = (parser.state.harmonyNamedExports =
99783 parser.state.harmonyNamedExports || new Set());
99784 let harmonyStarExports = null;
99785 if (name) {
99786 harmonyNamedExports.add(name);
99787 } else {
99788 harmonyStarExports = parser.state.harmonyStarExports =
99789 parser.state.harmonyStarExports || [];
99790 }
99791 const dep = new HarmonyExportImportedSpecifierDependency(
99792 source,
99793 parser.state.module,
99794 parser.state.lastHarmonyImportOrder,
99795 parser.state.harmonyParserScope,
99796 id,
99797 name,
99798 harmonyNamedExports,
99799 harmonyStarExports && harmonyStarExports.slice(),
99800 this.strictExportPresence
99801 );
99802 if (harmonyStarExports) {
99803 harmonyStarExports.push(dep);
99804 }
99805 dep.loc = Object.create(statement.loc);
99806 dep.loc.index = idx;
99807 parser.state.current.addDependency(dep);
99808 return true;
99809 }
99810 );
99811 }
99812};
99813
99814
99815/***/ }),
99816
99817/***/ 84245:
99818/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99819
99820"use strict";
99821/*
99822 MIT License http://www.opensource.org/licenses/mit-license.php
99823 Author Tobias Koppers @sokra
99824*/
99825
99826const NullDependency = __webpack_require__(5088);
99827
99828class HarmonyExportExpressionDependency extends NullDependency {
99829 constructor(originModule, range, rangeStatement, prefix) {
99830 super();
99831 this.originModule = originModule;
99832 this.range = range;
99833 this.rangeStatement = rangeStatement;
99834 this.prefix = prefix;
99835 }
99836
99837 get type() {
99838 return "harmony export expression";
99839 }
99840
99841 getExports() {
99842 return {
99843 exports: ["default"],
99844 dependencies: undefined
99845 };
99846 }
99847}
99848
99849HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTemplate {
99850 apply(dep, source) {
99851 const used = dep.originModule.isUsed("default");
99852 const content = this.getContent(dep.originModule, used);
99853
99854 if (dep.range) {
99855 source.replace(
99856 dep.rangeStatement[0],
99857 dep.range[0] - 1,
99858 content + "(" + dep.prefix
99859 );
99860 source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
99861 return;
99862 }
99863
99864 source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
99865 }
99866
99867 getContent(module, used) {
99868 const exportsName = module.exportsArgument;
99869 if (used) {
99870 return `/* harmony default export */ ${exportsName}[${JSON.stringify(
99871 used
99872 )}] = `;
99873 }
99874 return "/* unused harmony default export */ var _unused_webpack_default_export = ";
99875 }
99876};
99877
99878module.exports = HarmonyExportExpressionDependency;
99879
99880
99881/***/ }),
99882
99883/***/ 21320:
99884/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99885
99886"use strict";
99887/*
99888 MIT License http://www.opensource.org/licenses/mit-license.php
99889 Author Tobias Koppers @sokra
99890*/
99891
99892const NullDependency = __webpack_require__(5088);
99893
99894class HarmonyExportHeaderDependency extends NullDependency {
99895 constructor(range, rangeStatement) {
99896 super();
99897 this.range = range;
99898 this.rangeStatement = rangeStatement;
99899 }
99900
99901 get type() {
99902 return "harmony export header";
99903 }
99904}
99905
99906HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate {
99907 apply(dep, source) {
99908 const content = "";
99909 const replaceUntil = dep.range
99910 ? dep.range[0] - 1
99911 : dep.rangeStatement[1] - 1;
99912 source.replace(dep.rangeStatement[0], replaceUntil, content);
99913 }
99914};
99915
99916module.exports = HarmonyExportHeaderDependency;
99917
99918
99919/***/ }),
99920
99921/***/ 22864:
99922/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
99923
99924"use strict";
99925/*
99926 MIT License http://www.opensource.org/licenses/mit-license.php
99927 Author Tobias Koppers @sokra
99928*/
99929
99930
99931const DependencyReference = __webpack_require__(71722);
99932const HarmonyImportDependency = __webpack_require__(81599);
99933const Template = __webpack_require__(96066);
99934const HarmonyLinkingError = __webpack_require__(30327);
99935
99936/** @typedef {import("../Module")} Module */
99937
99938/** @typedef {"missing"|"unused"|"empty-star"|"reexport-non-harmony-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-non-harmony-default-strict"|"reexport-fake-namespace-object"|"rexport-non-harmony-undefined"|"safe-reexport"|"checked-reexport"|"dynamic-reexport"} ExportModeType */
99939
99940/** @type {Map<string, string>} */
99941const EMPTY_MAP = new Map();
99942
99943class ExportMode {
99944 /**
99945 * @param {ExportModeType} type type of the mode
99946 */
99947 constructor(type) {
99948 /** @type {ExportModeType} */
99949 this.type = type;
99950 /** @type {string|null} */
99951 this.name = null;
99952 /** @type {Map<string, string>} */
99953 this.map = EMPTY_MAP;
99954 /** @type {Set<string>|null} */
99955 this.ignored = null;
99956 /** @type {Module|null} */
99957 this.module = null;
99958 /** @type {string|null} */
99959 this.userRequest = null;
99960 }
99961}
99962
99963const EMPTY_STAR_MODE = new ExportMode("empty-star");
99964
99965class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
99966 constructor(
99967 request,
99968 originModule,
99969 sourceOrder,
99970 parserScope,
99971 id,
99972 name,
99973 activeExports,
99974 otherStarExports,
99975 strictExportPresence
99976 ) {
99977 super(request, originModule, sourceOrder, parserScope);
99978 this.id = id;
99979 this.redirectedId = undefined;
99980 this.name = name;
99981 this.activeExports = activeExports;
99982 this.otherStarExports = otherStarExports;
99983 this.strictExportPresence = strictExportPresence;
99984 }
99985
99986 get type() {
99987 return "harmony export imported specifier";
99988 }
99989
99990 get _id() {
99991 return this.redirectedId || this.id;
99992 }
99993
99994 getMode(ignoreUnused) {
99995 const name = this.name;
99996 const id = this._id;
99997 const used = this.originModule.isUsed(name);
99998 const importedModule = this._module;
99999
100000 if (!importedModule) {
100001 const mode = new ExportMode("missing");
100002 mode.userRequest = this.userRequest;
100003 return mode;
100004 }
100005
100006 if (
100007 !ignoreUnused &&
100008 (name ? !used : this.originModule.usedExports === false)
100009 ) {
100010 const mode = new ExportMode("unused");
100011 mode.name = name || "*";
100012 return mode;
100013 }
100014
100015 const strictHarmonyModule = this.originModule.buildMeta.strictHarmonyModule;
100016 if (name && id === "default" && importedModule.buildMeta) {
100017 if (!importedModule.buildMeta.exportsType) {
100018 const mode = new ExportMode(
100019 strictHarmonyModule
100020 ? "reexport-non-harmony-default-strict"
100021 : "reexport-non-harmony-default"
100022 );
100023 mode.name = name;
100024 mode.module = importedModule;
100025 return mode;
100026 } else if (importedModule.buildMeta.exportsType === "named") {
100027 const mode = new ExportMode("reexport-named-default");
100028 mode.name = name;
100029 mode.module = importedModule;
100030 return mode;
100031 }
100032 }
100033
100034 const isNotAHarmonyModule =
100035 importedModule.buildMeta && !importedModule.buildMeta.exportsType;
100036 if (name) {
100037 let mode;
100038 if (id) {
100039 // export { name as name }
100040 if (isNotAHarmonyModule && strictHarmonyModule) {
100041 mode = new ExportMode("rexport-non-harmony-undefined");
100042 mode.name = name;
100043 } else {
100044 mode = new ExportMode("safe-reexport");
100045 mode.map = new Map([[name, id]]);
100046 }
100047 } else {
100048 // export { * as name }
100049 if (isNotAHarmonyModule && strictHarmonyModule) {
100050 mode = new ExportMode("reexport-fake-namespace-object");
100051 mode.name = name;
100052 } else {
100053 mode = new ExportMode("reexport-namespace-object");
100054 mode.name = name;
100055 }
100056 }
100057 mode.module = importedModule;
100058 return mode;
100059 }
100060
100061 const hasUsedExports = Array.isArray(this.originModule.usedExports);
100062 const hasProvidedExports = Array.isArray(
100063 importedModule.buildMeta.providedExports
100064 );
100065 const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
100066
100067 // export *
100068 if (hasUsedExports) {
100069 // reexport * with known used exports
100070 if (hasProvidedExports) {
100071 const map = new Map(
100072 this.originModule.usedExports
100073 .filter(id => {
100074 if (id === "default") return false;
100075 if (this.activeExports.has(id)) return false;
100076 if (activeFromOtherStarExports.has(id)) return false;
100077 if (!importedModule.buildMeta.providedExports.includes(id))
100078 return false;
100079 return true;
100080 })
100081 .map(item => [item, item])
100082 );
100083
100084 if (map.size === 0) {
100085 return EMPTY_STAR_MODE;
100086 }
100087
100088 const mode = new ExportMode("safe-reexport");
100089 mode.module = importedModule;
100090 mode.map = map;
100091 return mode;
100092 }
100093
100094 const map = new Map(
100095 this.originModule.usedExports
100096 .filter(id => {
100097 if (id === "default") return false;
100098 if (this.activeExports.has(id)) return false;
100099 if (activeFromOtherStarExports.has(id)) return false;
100100
100101 return true;
100102 })
100103 .map(item => [item, item])
100104 );
100105
100106 if (map.size === 0) {
100107 return EMPTY_STAR_MODE;
100108 }
100109
100110 const mode = new ExportMode("checked-reexport");
100111 mode.module = importedModule;
100112 mode.map = map;
100113 return mode;
100114 }
100115
100116 if (hasProvidedExports) {
100117 const map = new Map(
100118 importedModule.buildMeta.providedExports
100119 .filter(id => {
100120 if (id === "default") return false;
100121 if (this.activeExports.has(id)) return false;
100122 if (activeFromOtherStarExports.has(id)) return false;
100123
100124 return true;
100125 })
100126 .map(item => [item, item])
100127 );
100128
100129 if (map.size === 0) {
100130 return EMPTY_STAR_MODE;
100131 }
100132
100133 const mode = new ExportMode("safe-reexport");
100134 mode.module = importedModule;
100135 mode.map = map;
100136 return mode;
100137 }
100138
100139 const mode = new ExportMode("dynamic-reexport");
100140 mode.module = importedModule;
100141 mode.ignored = new Set([
100142 "default",
100143 ...this.activeExports,
100144 ...activeFromOtherStarExports
100145 ]);
100146 return mode;
100147 }
100148
100149 getReference() {
100150 const mode = this.getMode(false);
100151
100152 switch (mode.type) {
100153 case "missing":
100154 case "unused":
100155 case "empty-star":
100156 return null;
100157
100158 case "reexport-non-harmony-default":
100159 case "reexport-named-default":
100160 return new DependencyReference(
100161 mode.module,
100162 ["default"],
100163 false,
100164 this.sourceOrder
100165 );
100166
100167 case "reexport-namespace-object":
100168 case "reexport-non-harmony-default-strict":
100169 case "reexport-fake-namespace-object":
100170 case "rexport-non-harmony-undefined":
100171 return new DependencyReference(
100172 mode.module,
100173 true,
100174 false,
100175 this.sourceOrder
100176 );
100177
100178 case "safe-reexport":
100179 case "checked-reexport":
100180 return new DependencyReference(
100181 mode.module,
100182 Array.from(mode.map.values()),
100183 false,
100184 this.sourceOrder
100185 );
100186
100187 case "dynamic-reexport":
100188 return new DependencyReference(
100189 mode.module,
100190 true,
100191 false,
100192 this.sourceOrder
100193 );
100194
100195 default:
100196 throw new Error(`Unknown mode ${mode.type}`);
100197 }
100198 }
100199
100200 _discoverActiveExportsFromOtherStartExports() {
100201 if (!this.otherStarExports) return new Set();
100202 const result = new Set();
100203 // try to learn impossible exports from other star exports with provided exports
100204 for (const otherStarExport of this.otherStarExports) {
100205 const otherImportedModule = otherStarExport._module;
100206 if (
100207 otherImportedModule &&
100208 Array.isArray(otherImportedModule.buildMeta.providedExports)
100209 ) {
100210 for (const exportName of otherImportedModule.buildMeta
100211 .providedExports) {
100212 result.add(exportName);
100213 }
100214 }
100215 }
100216 return result;
100217 }
100218
100219 getExports() {
100220 if (this.name) {
100221 return {
100222 exports: [this.name],
100223 dependencies: undefined
100224 };
100225 }
100226
100227 const importedModule = this._module;
100228
100229 if (!importedModule) {
100230 // no imported module available
100231 return {
100232 exports: null,
100233 dependencies: undefined
100234 };
100235 }
100236
100237 if (Array.isArray(importedModule.buildMeta.providedExports)) {
100238 const activeFromOtherStarExports = this._discoverActiveExportsFromOtherStartExports();
100239 return {
100240 exports: importedModule.buildMeta.providedExports.filter(
100241 id =>
100242 id !== "default" &&
100243 !activeFromOtherStarExports.has(id) &&
100244 !this.activeExports.has(id)
100245 ),
100246 dependencies: [importedModule]
100247 };
100248 }
100249
100250 if (importedModule.buildMeta.providedExports) {
100251 return {
100252 exports: true,
100253 dependencies: undefined
100254 };
100255 }
100256
100257 return {
100258 exports: null,
100259 dependencies: [importedModule]
100260 };
100261 }
100262
100263 getWarnings() {
100264 if (
100265 this.strictExportPresence ||
100266 this.originModule.buildMeta.strictHarmonyModule
100267 ) {
100268 return [];
100269 }
100270 return this._getErrors();
100271 }
100272
100273 getErrors() {
100274 if (
100275 this.strictExportPresence ||
100276 this.originModule.buildMeta.strictHarmonyModule
100277 ) {
100278 return this._getErrors();
100279 }
100280 return [];
100281 }
100282
100283 _getErrors() {
100284 const importedModule = this._module;
100285 if (!importedModule) {
100286 return;
100287 }
100288
100289 if (!importedModule.buildMeta || !importedModule.buildMeta.exportsType) {
100290 // It's not an harmony module
100291 if (
100292 this.originModule.buildMeta.strictHarmonyModule &&
100293 this._id &&
100294 this._id !== "default"
100295 ) {
100296 // In strict harmony modules we only support the default export
100297 return [
100298 new HarmonyLinkingError(
100299 `Can't reexport the named export '${this._id}' from non EcmaScript module (only default export is available)`
100300 )
100301 ];
100302 }
100303 return;
100304 }
100305
100306 if (!this._id) {
100307 return;
100308 }
100309
100310 if (importedModule.isProvided(this._id) !== false) {
100311 // It's provided or we are not sure
100312 return;
100313 }
100314
100315 // We are sure that it's not provided
100316 const idIsNotNameMessage =
100317 this._id !== this.name ? ` (reexported as '${this.name}')` : "";
100318 const errorMessage = `"export '${this._id}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
100319 return [new HarmonyLinkingError(errorMessage)];
100320 }
100321
100322 updateHash(hash) {
100323 super.updateHash(hash);
100324 const hashValue = this.getHashValue(this._module);
100325 hash.update(hashValue);
100326 }
100327
100328 getHashValue(importedModule) {
100329 if (!importedModule) {
100330 return "";
100331 }
100332
100333 const stringifiedUsedExport = JSON.stringify(importedModule.usedExports);
100334 const stringifiedProvidedExport = JSON.stringify(
100335 importedModule.buildMeta.providedExports
100336 );
100337 return (
100338 importedModule.used + stringifiedUsedExport + stringifiedProvidedExport
100339 );
100340 }
100341
100342 disconnect() {
100343 super.disconnect();
100344 this.redirectedId = undefined;
100345 }
100346}
100347
100348module.exports = HarmonyExportImportedSpecifierDependency;
100349
100350HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends HarmonyImportDependency.Template {
100351 harmonyInit(dep, source, runtime, dependencyTemplates) {
100352 super.harmonyInit(dep, source, runtime, dependencyTemplates);
100353 const content = this.getContent(dep);
100354 source.insert(-1, content);
100355 }
100356
100357 getHarmonyInitOrder(dep) {
100358 if (dep.name) {
100359 const used = dep.originModule.isUsed(dep.name);
100360 if (!used) return NaN;
100361 } else {
100362 const importedModule = dep._module;
100363
100364 const activeFromOtherStarExports = dep._discoverActiveExportsFromOtherStartExports();
100365
100366 if (Array.isArray(dep.originModule.usedExports)) {
100367 // we know which exports are used
100368
100369 const unused = dep.originModule.usedExports.every(id => {
100370 if (id === "default") return true;
100371 if (dep.activeExports.has(id)) return true;
100372 if (importedModule.isProvided(id) === false) return true;
100373 if (activeFromOtherStarExports.has(id)) return true;
100374 return false;
100375 });
100376 if (unused) return NaN;
100377 } else if (
100378 dep.originModule.usedExports &&
100379 importedModule &&
100380 Array.isArray(importedModule.buildMeta.providedExports)
100381 ) {
100382 // not sure which exports are used, but we know which are provided
100383
100384 const unused = importedModule.buildMeta.providedExports.every(id => {
100385 if (id === "default") return true;
100386 if (dep.activeExports.has(id)) return true;
100387 if (activeFromOtherStarExports.has(id)) return true;
100388 return false;
100389 });
100390 if (unused) return NaN;
100391 }
100392 }
100393 return super.getHarmonyInitOrder(dep);
100394 }
100395
100396 getContent(dep) {
100397 const mode = dep.getMode(false);
100398 const module = dep.originModule;
100399 const importedModule = dep._module;
100400 const importVar = dep.getImportVar();
100401
100402 switch (mode.type) {
100403 case "missing":
100404 return `throw new Error(${JSON.stringify(
100405 `Cannot find module '${mode.userRequest}'`
100406 )});\n`;
100407
100408 case "unused":
100409 return `${Template.toNormalComment(
100410 `unused harmony reexport ${mode.name}`
100411 )}\n`;
100412
100413 case "reexport-non-harmony-default":
100414 return (
100415 "/* harmony reexport (default from non-harmony) */ " +
100416 this.getReexportStatement(
100417 module,
100418 module.isUsed(mode.name),
100419 importVar,
100420 null
100421 )
100422 );
100423
100424 case "reexport-named-default":
100425 return (
100426 "/* harmony reexport (default from named exports) */ " +
100427 this.getReexportStatement(
100428 module,
100429 module.isUsed(mode.name),
100430 importVar,
100431 ""
100432 )
100433 );
100434
100435 case "reexport-fake-namespace-object":
100436 return (
100437 "/* harmony reexport (fake namespace object from non-harmony) */ " +
100438 this.getReexportFakeNamespaceObjectStatement(
100439 module,
100440 module.isUsed(mode.name),
100441 importVar
100442 )
100443 );
100444
100445 case "rexport-non-harmony-undefined":
100446 return (
100447 "/* harmony reexport (non default export from non-harmony) */ " +
100448 this.getReexportStatement(
100449 module,
100450 module.isUsed(mode.name),
100451 "undefined",
100452 ""
100453 )
100454 );
100455
100456 case "reexport-non-harmony-default-strict":
100457 return (
100458 "/* harmony reexport (default from non-harmony) */ " +
100459 this.getReexportStatement(
100460 module,
100461 module.isUsed(mode.name),
100462 importVar,
100463 ""
100464 )
100465 );
100466
100467 case "reexport-namespace-object":
100468 return (
100469 "/* harmony reexport (module object) */ " +
100470 this.getReexportStatement(
100471 module,
100472 module.isUsed(mode.name),
100473 importVar,
100474 ""
100475 )
100476 );
100477
100478 case "empty-star":
100479 return "/* empty/unused harmony star reexport */";
100480
100481 case "safe-reexport":
100482 return Array.from(mode.map.entries())
100483 .map(item => {
100484 return (
100485 "/* harmony reexport (safe) */ " +
100486 this.getReexportStatement(
100487 module,
100488 module.isUsed(item[0]),
100489 importVar,
100490 importedModule.isUsed(item[1])
100491 ) +
100492 "\n"
100493 );
100494 })
100495 .join("");
100496
100497 case "checked-reexport":
100498 return Array.from(mode.map.entries())
100499 .map(item => {
100500 return (
100501 "/* harmony reexport (checked) */ " +
100502 this.getConditionalReexportStatement(
100503 module,
100504 item[0],
100505 importVar,
100506 item[1]
100507 ) +
100508 "\n"
100509 );
100510 })
100511 .join("");
100512
100513 case "dynamic-reexport": {
100514 const ignoredExports = mode.ignored;
100515 let content =
100516 "/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in " +
100517 importVar +
100518 ") ";
100519
100520 // Filter out exports which are defined by other exports
100521 // and filter out default export because it cannot be reexported with *
100522 if (ignoredExports.size > 0) {
100523 content +=
100524 "if(" +
100525 JSON.stringify(Array.from(ignoredExports)) +
100526 ".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
100527 } else {
100528 content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
100529 }
100530 const exportsName = dep.originModule.exportsArgument;
100531 return (
100532 content +
100533 `(function(key) { __webpack_require__.d(${exportsName}, key, function() { return ${importVar}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`
100534 );
100535 }
100536
100537 default:
100538 throw new Error(`Unknown mode ${mode.type}`);
100539 }
100540 }
100541
100542 getReexportStatement(module, key, name, valueKey) {
100543 const exportsName = module.exportsArgument;
100544 const returnValue = this.getReturnValue(name, valueKey);
100545 return `__webpack_require__.d(${exportsName}, ${JSON.stringify(
100546 key
100547 )}, function() { return ${returnValue}; });\n`;
100548 }
100549
100550 getReexportFakeNamespaceObjectStatement(module, key, name) {
100551 const exportsName = module.exportsArgument;
100552 return `__webpack_require__.d(${exportsName}, ${JSON.stringify(
100553 key
100554 )}, function() { return __webpack_require__.t(${name}); });\n`;
100555 }
100556
100557 getConditionalReexportStatement(module, key, name, valueKey) {
100558 if (valueKey === false) {
100559 return "/* unused export */\n";
100560 }
100561 const exportsName = module.exportsArgument;
100562 const returnValue = this.getReturnValue(name, valueKey);
100563 return `if(__webpack_require__.o(${name}, ${JSON.stringify(
100564 valueKey
100565 )})) __webpack_require__.d(${exportsName}, ${JSON.stringify(
100566 key
100567 )}, function() { return ${returnValue}; });\n`;
100568 }
100569
100570 getReturnValue(name, valueKey) {
100571 if (valueKey === null) {
100572 return `${name}_default.a`;
100573 }
100574 if (valueKey === "") {
100575 return name;
100576 }
100577 if (valueKey === false) {
100578 return "/* unused export */ undefined";
100579 }
100580
100581 return `${name}[${JSON.stringify(valueKey)}]`;
100582 }
100583};
100584
100585
100586/***/ }),
100587
100588/***/ 34834:
100589/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
100590
100591"use strict";
100592/*
100593 MIT License http://www.opensource.org/licenses/mit-license.php
100594 Author Tobias Koppers @sokra
100595*/
100596
100597const NullDependency = __webpack_require__(5088);
100598
100599class HarmonyExportSpecifierDependency extends NullDependency {
100600 constructor(originModule, id, name) {
100601 super();
100602 this.originModule = originModule;
100603 this.id = id;
100604 this.name = name;
100605 }
100606
100607 get type() {
100608 return "harmony export specifier";
100609 }
100610
100611 getExports() {
100612 return {
100613 exports: [this.name],
100614 dependencies: undefined
100615 };
100616 }
100617}
100618
100619HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependencyTemplate {
100620 apply(dep, source) {}
100621
100622 getHarmonyInitOrder(dep) {
100623 return 0;
100624 }
100625
100626 harmonyInit(dep, source, runtime) {
100627 const content = this.getContent(dep);
100628 source.insert(-1, content);
100629 }
100630
100631 getContent(dep) {
100632 const used = dep.originModule.isUsed(dep.name);
100633 if (!used) {
100634 return `/* unused harmony export ${dep.name || "namespace"} */\n`;
100635 }
100636
100637 const exportsName = dep.originModule.exportsArgument;
100638
100639 return `/* harmony export (binding) */ __webpack_require__.d(${exportsName}, ${JSON.stringify(
100640 used
100641 )}, function() { return ${dep.id}; });\n`;
100642 }
100643};
100644
100645module.exports = HarmonyExportSpecifierDependency;
100646
100647
100648/***/ }),
100649
100650/***/ 81599:
100651/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
100652
100653"use strict";
100654/*
100655 MIT License http://www.opensource.org/licenses/mit-license.php
100656 Author Tobias Koppers @sokra
100657*/
100658
100659
100660const DependencyReference = __webpack_require__(71722);
100661const ModuleDependency = __webpack_require__(90865);
100662const Template = __webpack_require__(96066);
100663
100664class HarmonyImportDependency extends ModuleDependency {
100665 constructor(request, originModule, sourceOrder, parserScope) {
100666 super(request);
100667 this.redirectedModule = undefined;
100668 this.originModule = originModule;
100669 this.sourceOrder = sourceOrder;
100670 this.parserScope = parserScope;
100671 }
100672
100673 get _module() {
100674 return this.redirectedModule || this.module;
100675 }
100676
100677 getReference() {
100678 if (!this._module) return null;
100679 return new DependencyReference(
100680 this._module,
100681 false,
100682 this.weak,
100683 this.sourceOrder
100684 );
100685 }
100686
100687 getImportVar() {
100688 let importVarMap = this.parserScope.importVarMap;
100689 if (!importVarMap) this.parserScope.importVarMap = importVarMap = new Map();
100690 let importVar = importVarMap.get(this._module);
100691 if (importVar) return importVar;
100692 importVar = `${Template.toIdentifier(
100693 `${this.userRequest}`
100694 )}__WEBPACK_IMPORTED_MODULE_${importVarMap.size}__`;
100695 importVarMap.set(this._module, importVar);
100696 return importVar;
100697 }
100698
100699 getImportStatement(update, runtime) {
100700 return runtime.importStatement({
100701 update,
100702 module: this._module,
100703 importVar: this.getImportVar(),
100704 request: this.request,
100705 originModule: this.originModule
100706 });
100707 }
100708
100709 updateHash(hash) {
100710 super.updateHash(hash);
100711 const importedModule = this._module;
100712 hash.update(
100713 (importedModule &&
100714 (!importedModule.buildMeta || importedModule.buildMeta.exportsType)) +
100715 ""
100716 );
100717 hash.update((importedModule && importedModule.id) + "");
100718 }
100719
100720 disconnect() {
100721 super.disconnect();
100722 this.redirectedModule = undefined;
100723 }
100724}
100725
100726module.exports = HarmonyImportDependency;
100727
100728const importEmittedMap = new WeakMap();
100729
100730HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate {
100731 apply(dep, source, runtime) {
100732 // no-op
100733 }
100734
100735 getHarmonyInitOrder(dep) {
100736 return dep.sourceOrder;
100737 }
100738
100739 static isImportEmitted(dep, source) {
100740 let sourceInfo = importEmittedMap.get(source);
100741 if (!sourceInfo) return false;
100742 const key = dep._module || dep.request;
100743 return key && sourceInfo.emittedImports.get(key);
100744 }
100745
100746 harmonyInit(dep, source, runtime, dependencyTemplates) {
100747 let sourceInfo = importEmittedMap.get(source);
100748 if (!sourceInfo) {
100749 importEmittedMap.set(
100750 source,
100751 (sourceInfo = {
100752 emittedImports: new Map()
100753 })
100754 );
100755 }
100756 const key = dep._module || dep.request;
100757 if (key && sourceInfo.emittedImports.get(key)) return;
100758 sourceInfo.emittedImports.set(key, true);
100759 const content = dep.getImportStatement(false, runtime);
100760 source.insert(-1, content);
100761 }
100762};
100763
100764
100765/***/ }),
100766
100767/***/ 99433:
100768/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
100769
100770"use strict";
100771/*
100772 MIT License http://www.opensource.org/licenses/mit-license.php
100773 Author Tobias Koppers @sokra
100774*/
100775
100776
100777const { SyncBailHook } = __webpack_require__(56758);
100778const HarmonyImportSideEffectDependency = __webpack_require__(79171);
100779const HarmonyImportSpecifierDependency = __webpack_require__(95966);
100780const HarmonyAcceptImportDependency = __webpack_require__(66136);
100781const HarmonyAcceptDependency = __webpack_require__(75159);
100782const ConstDependency = __webpack_require__(71101);
100783
100784module.exports = class HarmonyImportDependencyParserPlugin {
100785 constructor(moduleOptions) {
100786 this.strictExportPresence = moduleOptions.strictExportPresence;
100787 this.strictThisContextOnImports = moduleOptions.strictThisContextOnImports;
100788 }
100789
100790 apply(parser) {
100791 parser.hooks.import.tap(
100792 "HarmonyImportDependencyParserPlugin",
100793 (statement, source) => {
100794 parser.state.lastHarmonyImportOrder =
100795 (parser.state.lastHarmonyImportOrder || 0) + 1;
100796 const clearDep = new ConstDependency("", statement.range);
100797 clearDep.loc = statement.loc;
100798 parser.state.module.addDependency(clearDep);
100799 const sideEffectDep = new HarmonyImportSideEffectDependency(
100800 source,
100801 parser.state.module,
100802 parser.state.lastHarmonyImportOrder,
100803 parser.state.harmonyParserScope
100804 );
100805 sideEffectDep.loc = statement.loc;
100806 parser.state.module.addDependency(sideEffectDep);
100807 return true;
100808 }
100809 );
100810 parser.hooks.importSpecifier.tap(
100811 "HarmonyImportDependencyParserPlugin",
100812 (statement, source, id, name) => {
100813 parser.scope.definitions.delete(name);
100814 parser.scope.renames.set(name, "imported var");
100815 if (!parser.state.harmonySpecifier) {
100816 parser.state.harmonySpecifier = new Map();
100817 }
100818 parser.state.harmonySpecifier.set(name, {
100819 source,
100820 id,
100821 sourceOrder: parser.state.lastHarmonyImportOrder
100822 });
100823 return true;
100824 }
100825 );
100826 parser.hooks.expression
100827 .for("imported var")
100828 .tap("HarmonyImportDependencyParserPlugin", expr => {
100829 const name = expr.name;
100830 const settings = parser.state.harmonySpecifier.get(name);
100831 const dep = new HarmonyImportSpecifierDependency(
100832 settings.source,
100833 parser.state.module,
100834 settings.sourceOrder,
100835 parser.state.harmonyParserScope,
100836 settings.id,
100837 name,
100838 expr.range,
100839 this.strictExportPresence
100840 );
100841 dep.shorthand = parser.scope.inShorthand;
100842 dep.directImport = true;
100843 dep.loc = expr.loc;
100844 parser.state.module.addDependency(dep);
100845 return true;
100846 });
100847 parser.hooks.expressionAnyMember
100848 .for("imported var")
100849 .tap("HarmonyImportDependencyParserPlugin", expr => {
100850 const name = expr.object.name;
100851 const settings = parser.state.harmonySpecifier.get(name);
100852 if (settings.id !== null) return false;
100853 const dep = new HarmonyImportSpecifierDependency(
100854 settings.source,
100855 parser.state.module,
100856 settings.sourceOrder,
100857 parser.state.harmonyParserScope,
100858 expr.property.name || expr.property.value,
100859 name,
100860 expr.range,
100861 this.strictExportPresence
100862 );
100863 dep.shorthand = parser.scope.inShorthand;
100864 dep.directImport = false;
100865 dep.loc = expr.loc;
100866 parser.state.module.addDependency(dep);
100867 return true;
100868 });
100869 if (this.strictThisContextOnImports) {
100870 // only in case when we strictly follow the spec we need a special case here
100871 parser.hooks.callAnyMember
100872 .for("imported var")
100873 .tap("HarmonyImportDependencyParserPlugin", expr => {
100874 if (expr.callee.type !== "MemberExpression") return;
100875 if (expr.callee.object.type !== "Identifier") return;
100876 const name = expr.callee.object.name;
100877 const settings = parser.state.harmonySpecifier.get(name);
100878 if (settings.id !== null) return false;
100879 const dep = new HarmonyImportSpecifierDependency(
100880 settings.source,
100881 parser.state.module,
100882 settings.sourceOrder,
100883 parser.state.harmonyParserScope,
100884 expr.callee.property.name || expr.callee.property.value,
100885 name,
100886 expr.callee.range,
100887 this.strictExportPresence
100888 );
100889 dep.shorthand = parser.scope.inShorthand;
100890 dep.directImport = false;
100891 dep.namespaceObjectAsContext = true;
100892 dep.loc = expr.callee.loc;
100893 parser.state.module.addDependency(dep);
100894 if (expr.arguments) parser.walkExpressions(expr.arguments);
100895 return true;
100896 });
100897 }
100898 parser.hooks.call
100899 .for("imported var")
100900 .tap("HarmonyImportDependencyParserPlugin", expr => {
100901 const args = expr.arguments;
100902 const fullExpr = expr;
100903 expr = expr.callee;
100904 if (expr.type !== "Identifier") return;
100905 const name = expr.name;
100906 const settings = parser.state.harmonySpecifier.get(name);
100907 const dep = new HarmonyImportSpecifierDependency(
100908 settings.source,
100909 parser.state.module,
100910 settings.sourceOrder,
100911 parser.state.harmonyParserScope,
100912 settings.id,
100913 name,
100914 expr.range,
100915 this.strictExportPresence
100916 );
100917 dep.directImport = true;
100918 dep.callArgs = args;
100919 dep.call = fullExpr;
100920 dep.loc = expr.loc;
100921 parser.state.module.addDependency(dep);
100922 if (args) parser.walkExpressions(args);
100923 return true;
100924 });
100925 // TODO webpack 5: refactor this, no custom hooks
100926 if (!parser.hooks.hotAcceptCallback) {
100927 parser.hooks.hotAcceptCallback = new SyncBailHook([
100928 "expression",
100929 "requests"
100930 ]);
100931 }
100932 if (!parser.hooks.hotAcceptWithoutCallback) {
100933 parser.hooks.hotAcceptWithoutCallback = new SyncBailHook([
100934 "expression",
100935 "requests"
100936 ]);
100937 }
100938 parser.hooks.hotAcceptCallback.tap(
100939 "HarmonyImportDependencyParserPlugin",
100940 (expr, requests) => {
100941 const harmonyParserScope = parser.state.harmonyParserScope;
100942 if (!harmonyParserScope) {
100943 // This is not a harmony module, skip it
100944 return;
100945 }
100946 const dependencies = requests.map(request => {
100947 const dep = new HarmonyAcceptImportDependency(
100948 request,
100949 parser.state.module,
100950 harmonyParserScope
100951 );
100952 dep.loc = expr.loc;
100953 parser.state.module.addDependency(dep);
100954 return dep;
100955 });
100956 if (dependencies.length > 0) {
100957 const dep = new HarmonyAcceptDependency(
100958 expr.range,
100959 dependencies,
100960 true
100961 );
100962 dep.loc = expr.loc;
100963 parser.state.module.addDependency(dep);
100964 }
100965 }
100966 );
100967 parser.hooks.hotAcceptWithoutCallback.tap(
100968 "HarmonyImportDependencyParserPlugin",
100969 (expr, requests) => {
100970 const dependencies = requests.map(request => {
100971 const dep = new HarmonyAcceptImportDependency(
100972 request,
100973 parser.state.module,
100974 parser.state.harmonyParserScope
100975 );
100976 dep.loc = expr.loc;
100977 parser.state.module.addDependency(dep);
100978 return dep;
100979 });
100980 if (dependencies.length > 0) {
100981 const dep = new HarmonyAcceptDependency(
100982 expr.range,
100983 dependencies,
100984 false
100985 );
100986 dep.loc = expr.loc;
100987 parser.state.module.addDependency(dep);
100988 }
100989 }
100990 );
100991 }
100992};
100993
100994
100995/***/ }),
100996
100997/***/ 79171:
100998/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
100999
101000"use strict";
101001/*
101002 MIT License http://www.opensource.org/licenses/mit-license.php
101003 Author Tobias Koppers @sokra
101004*/
101005
101006const HarmonyImportDependency = __webpack_require__(81599);
101007
101008class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
101009 constructor(request, originModule, sourceOrder, parserScope) {
101010 super(request, originModule, sourceOrder, parserScope);
101011 }
101012
101013 getReference() {
101014 if (this._module && this._module.factoryMeta.sideEffectFree) return null;
101015
101016 return super.getReference();
101017 }
101018
101019 get type() {
101020 return "harmony side effect evaluation";
101021 }
101022}
101023
101024HarmonyImportSideEffectDependency.Template = class HarmonyImportSideEffectDependencyTemplate extends HarmonyImportDependency.Template {
101025 getHarmonyInitOrder(dep) {
101026 if (dep._module && dep._module.factoryMeta.sideEffectFree) return NaN;
101027 return super.getHarmonyInitOrder(dep);
101028 }
101029};
101030
101031module.exports = HarmonyImportSideEffectDependency;
101032
101033
101034/***/ }),
101035
101036/***/ 95966:
101037/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101038
101039"use strict";
101040/*
101041 MIT License http://www.opensource.org/licenses/mit-license.php
101042 Author Tobias Koppers @sokra
101043*/
101044
101045
101046const DependencyReference = __webpack_require__(71722);
101047const HarmonyImportDependency = __webpack_require__(81599);
101048const HarmonyLinkingError = __webpack_require__(30327);
101049
101050class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
101051 constructor(
101052 request,
101053 originModule,
101054 sourceOrder,
101055 parserScope,
101056 id,
101057 name,
101058 range,
101059 strictExportPresence
101060 ) {
101061 super(request, originModule, sourceOrder, parserScope);
101062 this.id = id === null ? null : `${id}`;
101063 this.redirectedId = undefined;
101064 this.name = name;
101065 this.range = range;
101066 this.strictExportPresence = strictExportPresence;
101067 this.namespaceObjectAsContext = false;
101068 this.callArgs = undefined;
101069 this.call = undefined;
101070 this.directImport = undefined;
101071 this.shorthand = undefined;
101072 }
101073
101074 get type() {
101075 return "harmony import specifier";
101076 }
101077
101078 get _id() {
101079 return this.redirectedId || this.id;
101080 }
101081
101082 getReference() {
101083 if (!this._module) return null;
101084 return new DependencyReference(
101085 this._module,
101086 this._id && !this.namespaceObjectAsContext ? [this._id] : true,
101087 false,
101088 this.sourceOrder
101089 );
101090 }
101091
101092 getWarnings() {
101093 if (
101094 this.strictExportPresence ||
101095 this.originModule.buildMeta.strictHarmonyModule
101096 ) {
101097 return [];
101098 }
101099 return this._getErrors();
101100 }
101101
101102 getErrors() {
101103 if (
101104 this.strictExportPresence ||
101105 this.originModule.buildMeta.strictHarmonyModule
101106 ) {
101107 return this._getErrors();
101108 }
101109 return [];
101110 }
101111
101112 _getErrors() {
101113 const importedModule = this._module;
101114 if (!importedModule) {
101115 return;
101116 }
101117
101118 if (!importedModule.buildMeta || !importedModule.buildMeta.exportsType) {
101119 // It's not an harmony module
101120 if (
101121 this.originModule.buildMeta.strictHarmonyModule &&
101122 this._id &&
101123 this._id !== "default"
101124 ) {
101125 // In strict harmony modules we only support the default export
101126 return [
101127 new HarmonyLinkingError(
101128 `Can't import the named export '${this._id}' from non EcmaScript module (only default export is available)`
101129 )
101130 ];
101131 }
101132 return;
101133 }
101134
101135 if (!this._id) {
101136 return;
101137 }
101138
101139 if (importedModule.isProvided(this._id) !== false) {
101140 // It's provided or we are not sure
101141 return;
101142 }
101143
101144 // We are sure that it's not provided
101145 const idIsNotNameMessage =
101146 this._id !== this.name ? ` (imported as '${this.name}')` : "";
101147 const errorMessage = `"export '${this._id}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
101148 return [new HarmonyLinkingError(errorMessage)];
101149 }
101150
101151 // implement this method to allow the occurrence order plugin to count correctly
101152 getNumberOfIdOccurrences() {
101153 return 0;
101154 }
101155
101156 updateHash(hash) {
101157 super.updateHash(hash);
101158 const importedModule = this._module;
101159 hash.update((importedModule && this._id) + "");
101160 hash.update(
101161 (importedModule && this._id && importedModule.isUsed(this._id)) + ""
101162 );
101163 hash.update(
101164 (importedModule &&
101165 (!importedModule.buildMeta || importedModule.buildMeta.exportsType)) +
101166 ""
101167 );
101168 hash.update(
101169 (importedModule &&
101170 importedModule.used + JSON.stringify(importedModule.usedExports)) + ""
101171 );
101172 }
101173
101174 disconnect() {
101175 super.disconnect();
101176 this.redirectedId = undefined;
101177 }
101178}
101179
101180HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends HarmonyImportDependency.Template {
101181 apply(dep, source, runtime) {
101182 super.apply(dep, source, runtime);
101183 const content = this.getContent(dep, runtime);
101184 source.replace(dep.range[0], dep.range[1] - 1, content);
101185 }
101186
101187 getContent(dep, runtime) {
101188 const exportExpr = runtime.exportFromImport({
101189 module: dep._module,
101190 request: dep.request,
101191 exportName: dep._id,
101192 originModule: dep.originModule,
101193 asiSafe: dep.shorthand,
101194 isCall: dep.call,
101195 callContext: !dep.directImport,
101196 importVar: dep.getImportVar()
101197 });
101198 return dep.shorthand ? `${dep.name}: ${exportExpr}` : exportExpr;
101199 }
101200};
101201
101202module.exports = HarmonyImportSpecifierDependency;
101203
101204
101205/***/ }),
101206
101207/***/ 27204:
101208/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101209
101210"use strict";
101211/*
101212 MIT License http://www.opensource.org/licenses/mit-license.php
101213 Author Tobias Koppers @sokra
101214*/
101215
101216
101217const NullDependency = __webpack_require__(5088);
101218
101219class HarmonyInitDependency extends NullDependency {
101220 constructor(originModule) {
101221 super();
101222 this.originModule = originModule;
101223 }
101224
101225 get type() {
101226 return "harmony init";
101227 }
101228}
101229
101230module.exports = HarmonyInitDependency;
101231
101232HarmonyInitDependency.Template = class HarmonyInitDependencyTemplate {
101233 apply(dep, source, runtime, dependencyTemplates) {
101234 const module = dep.originModule;
101235 const list = [];
101236 for (const dependency of module.dependencies) {
101237 const template = dependencyTemplates.get(dependency.constructor);
101238 if (
101239 template &&
101240 typeof template.harmonyInit === "function" &&
101241 typeof template.getHarmonyInitOrder === "function"
101242 ) {
101243 const order = template.getHarmonyInitOrder(dependency);
101244 if (!isNaN(order)) {
101245 list.push({
101246 order,
101247 listOrder: list.length,
101248 dependency,
101249 template
101250 });
101251 }
101252 }
101253 }
101254
101255 list.sort((a, b) => {
101256 const x = a.order - b.order;
101257 if (x) return x;
101258 return a.listOrder - b.listOrder;
101259 });
101260
101261 for (const item of list) {
101262 item.template.harmonyInit(
101263 item.dependency,
101264 source,
101265 runtime,
101266 dependencyTemplates
101267 );
101268 }
101269 }
101270};
101271
101272
101273/***/ }),
101274
101275/***/ 66792:
101276/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101277
101278"use strict";
101279/*
101280 MIT License http://www.opensource.org/licenses/mit-license.php
101281 Author Tobias Koppers @sokra
101282*/
101283
101284const HarmonyCompatibilityDependency = __webpack_require__(1533);
101285const HarmonyInitDependency = __webpack_require__(27204);
101286const HarmonyImportSpecifierDependency = __webpack_require__(95966);
101287const HarmonyImportSideEffectDependency = __webpack_require__(79171);
101288const HarmonyExportHeaderDependency = __webpack_require__(21320);
101289const HarmonyExportExpressionDependency = __webpack_require__(84245);
101290const HarmonyExportSpecifierDependency = __webpack_require__(34834);
101291const HarmonyExportImportedSpecifierDependency = __webpack_require__(22864);
101292const HarmonyAcceptDependency = __webpack_require__(75159);
101293const HarmonyAcceptImportDependency = __webpack_require__(66136);
101294
101295const NullFactory = __webpack_require__(40438);
101296
101297const HarmonyDetectionParserPlugin = __webpack_require__(59310);
101298const HarmonyImportDependencyParserPlugin = __webpack_require__(99433);
101299const HarmonyExportDependencyParserPlugin = __webpack_require__(49180);
101300const HarmonyTopLevelThisParserPlugin = __webpack_require__(58215);
101301
101302class HarmonyModulesPlugin {
101303 constructor(options) {
101304 this.options = options;
101305 }
101306
101307 apply(compiler) {
101308 compiler.hooks.compilation.tap(
101309 "HarmonyModulesPlugin",
101310 (compilation, { normalModuleFactory }) => {
101311 compilation.dependencyFactories.set(
101312 HarmonyCompatibilityDependency,
101313 new NullFactory()
101314 );
101315 compilation.dependencyTemplates.set(
101316 HarmonyCompatibilityDependency,
101317 new HarmonyCompatibilityDependency.Template()
101318 );
101319
101320 compilation.dependencyFactories.set(
101321 HarmonyInitDependency,
101322 new NullFactory()
101323 );
101324 compilation.dependencyTemplates.set(
101325 HarmonyInitDependency,
101326 new HarmonyInitDependency.Template()
101327 );
101328
101329 compilation.dependencyFactories.set(
101330 HarmonyImportSideEffectDependency,
101331 normalModuleFactory
101332 );
101333 compilation.dependencyTemplates.set(
101334 HarmonyImportSideEffectDependency,
101335 new HarmonyImportSideEffectDependency.Template()
101336 );
101337
101338 compilation.dependencyFactories.set(
101339 HarmonyImportSpecifierDependency,
101340 normalModuleFactory
101341 );
101342 compilation.dependencyTemplates.set(
101343 HarmonyImportSpecifierDependency,
101344 new HarmonyImportSpecifierDependency.Template()
101345 );
101346
101347 compilation.dependencyFactories.set(
101348 HarmonyExportHeaderDependency,
101349 new NullFactory()
101350 );
101351 compilation.dependencyTemplates.set(
101352 HarmonyExportHeaderDependency,
101353 new HarmonyExportHeaderDependency.Template()
101354 );
101355
101356 compilation.dependencyFactories.set(
101357 HarmonyExportExpressionDependency,
101358 new NullFactory()
101359 );
101360 compilation.dependencyTemplates.set(
101361 HarmonyExportExpressionDependency,
101362 new HarmonyExportExpressionDependency.Template()
101363 );
101364
101365 compilation.dependencyFactories.set(
101366 HarmonyExportSpecifierDependency,
101367 new NullFactory()
101368 );
101369 compilation.dependencyTemplates.set(
101370 HarmonyExportSpecifierDependency,
101371 new HarmonyExportSpecifierDependency.Template()
101372 );
101373
101374 compilation.dependencyFactories.set(
101375 HarmonyExportImportedSpecifierDependency,
101376 normalModuleFactory
101377 );
101378 compilation.dependencyTemplates.set(
101379 HarmonyExportImportedSpecifierDependency,
101380 new HarmonyExportImportedSpecifierDependency.Template()
101381 );
101382
101383 compilation.dependencyFactories.set(
101384 HarmonyAcceptDependency,
101385 new NullFactory()
101386 );
101387 compilation.dependencyTemplates.set(
101388 HarmonyAcceptDependency,
101389 new HarmonyAcceptDependency.Template()
101390 );
101391
101392 compilation.dependencyFactories.set(
101393 HarmonyAcceptImportDependency,
101394 normalModuleFactory
101395 );
101396 compilation.dependencyTemplates.set(
101397 HarmonyAcceptImportDependency,
101398 new HarmonyAcceptImportDependency.Template()
101399 );
101400
101401 const handler = (parser, parserOptions) => {
101402 if (parserOptions.harmony !== undefined && !parserOptions.harmony)
101403 return;
101404
101405 new HarmonyDetectionParserPlugin().apply(parser);
101406 new HarmonyImportDependencyParserPlugin(this.options).apply(parser);
101407 new HarmonyExportDependencyParserPlugin(this.options).apply(parser);
101408 new HarmonyTopLevelThisParserPlugin().apply(parser);
101409 };
101410
101411 normalModuleFactory.hooks.parser
101412 .for("javascript/auto")
101413 .tap("HarmonyModulesPlugin", handler);
101414 normalModuleFactory.hooks.parser
101415 .for("javascript/esm")
101416 .tap("HarmonyModulesPlugin", handler);
101417 }
101418 );
101419 }
101420}
101421module.exports = HarmonyModulesPlugin;
101422
101423
101424/***/ }),
101425
101426/***/ 58215:
101427/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101428
101429"use strict";
101430/*
101431 MIT License http://www.opensource.org/licenses/mit-license.php
101432 Author Florent Cailhol @ooflorent
101433*/
101434
101435
101436const ConstDependency = __webpack_require__(71101);
101437
101438class HarmonyTopLevelThisParserPlugin {
101439 apply(parser) {
101440 parser.hooks.expression
101441 .for("this")
101442 .tap("HarmonyTopLevelThisParserPlugin", node => {
101443 if (!parser.scope.topLevelScope) return;
101444 const module = parser.state.module;
101445 const isHarmony = !!(module.buildMeta && module.buildMeta.exportsType);
101446 if (isHarmony) {
101447 const dep = new ConstDependency("undefined", node.range, false);
101448 dep.loc = node.loc;
101449 parser.state.current.addDependency(dep);
101450 }
101451 });
101452 }
101453}
101454
101455module.exports = HarmonyTopLevelThisParserPlugin;
101456
101457
101458/***/ }),
101459
101460/***/ 20417:
101461/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101462
101463"use strict";
101464/*
101465 MIT License http://www.opensource.org/licenses/mit-license.php
101466 Author Tobias Koppers @sokra
101467*/
101468
101469const ContextDependency = __webpack_require__(11583);
101470const ContextDependencyTemplateAsRequireCall = __webpack_require__(54380);
101471
101472class ImportContextDependency extends ContextDependency {
101473 constructor(options, range, valueRange) {
101474 super(options);
101475 this.range = range;
101476 this.valueRange = valueRange;
101477 }
101478
101479 get type() {
101480 return `import() context ${this.options.mode}`;
101481 }
101482}
101483
101484ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;
101485
101486module.exports = ImportContextDependency;
101487
101488
101489/***/ }),
101490
101491/***/ 38875:
101492/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101493
101494"use strict";
101495/*
101496 MIT License http://www.opensource.org/licenses/mit-license.php
101497 Author Tobias Koppers @sokra
101498*/
101499
101500const AsyncDependenciesBlock = __webpack_require__(22814);
101501const ImportDependency = __webpack_require__(50883);
101502
101503module.exports = class ImportDependenciesBlock extends AsyncDependenciesBlock {
101504 // TODO webpack 5 reorganize arguments
101505 constructor(request, range, groupOptions, module, loc, originModule) {
101506 super(groupOptions, module, loc, request);
101507 this.range = range;
101508 const dep = new ImportDependency(request, originModule, this);
101509 dep.loc = loc;
101510 this.addDependency(dep);
101511 }
101512};
101513
101514
101515/***/ }),
101516
101517/***/ 50883:
101518/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101519
101520"use strict";
101521/*
101522 MIT License http://www.opensource.org/licenses/mit-license.php
101523 Author Tobias Koppers @sokra
101524*/
101525
101526const ModuleDependency = __webpack_require__(90865);
101527
101528class ImportDependency extends ModuleDependency {
101529 constructor(request, originModule, block) {
101530 super(request);
101531 this.originModule = originModule;
101532 this.block = block;
101533 }
101534
101535 get type() {
101536 return "import()";
101537 }
101538}
101539
101540ImportDependency.Template = class ImportDependencyTemplate {
101541 apply(dep, source, runtime) {
101542 const content = runtime.moduleNamespacePromise({
101543 block: dep.block,
101544 module: dep.module,
101545 request: dep.request,
101546 strict: dep.originModule.buildMeta.strictHarmonyModule,
101547 message: "import()"
101548 });
101549
101550 source.replace(dep.block.range[0], dep.block.range[1] - 1, content);
101551 }
101552};
101553
101554module.exports = ImportDependency;
101555
101556
101557/***/ }),
101558
101559/***/ 25552:
101560/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101561
101562"use strict";
101563/*
101564 MIT License http://www.opensource.org/licenses/mit-license.php
101565 Author Tobias Koppers @sokra
101566*/
101567
101568const ModuleDependency = __webpack_require__(90865);
101569
101570class ImportEagerDependency extends ModuleDependency {
101571 constructor(request, originModule, range) {
101572 super(request);
101573 this.originModule = originModule;
101574 this.range = range;
101575 }
101576
101577 get type() {
101578 return "import() eager";
101579 }
101580}
101581
101582ImportEagerDependency.Template = class ImportEagerDependencyTemplate {
101583 apply(dep, source, runtime) {
101584 const content = runtime.moduleNamespacePromise({
101585 module: dep.module,
101586 request: dep.request,
101587 strict: dep.originModule.buildMeta.strictHarmonyModule,
101588 message: "import() eager"
101589 });
101590 source.replace(dep.range[0], dep.range[1] - 1, content);
101591 }
101592};
101593
101594module.exports = ImportEagerDependency;
101595
101596
101597/***/ }),
101598
101599/***/ 93382:
101600/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101601
101602"use strict";
101603/*
101604 MIT License http://www.opensource.org/licenses/mit-license.php
101605 Author Tobias Koppers @sokra
101606*/
101607
101608
101609const ImportContextDependency = __webpack_require__(20417);
101610const ImportWeakDependency = __webpack_require__(86817);
101611const ImportDependenciesBlock = __webpack_require__(38875);
101612const ImportEagerDependency = __webpack_require__(25552);
101613const ContextDependencyHelpers = __webpack_require__(5594);
101614const UnsupportedFeatureWarning = __webpack_require__(99953);
101615const CommentCompilationWarning = __webpack_require__(51760);
101616
101617class ImportParserPlugin {
101618 constructor(options) {
101619 this.options = options;
101620 }
101621
101622 apply(parser) {
101623 parser.hooks.importCall.tap("ImportParserPlugin", expr => {
101624 if (expr.arguments.length !== 1) {
101625 throw new Error(
101626 "Incorrect number of arguments provided to 'import(module: string) -> Promise'."
101627 );
101628 }
101629
101630 const param = parser.evaluateExpression(expr.arguments[0]);
101631
101632 let chunkName = null;
101633 let mode = "lazy";
101634 let include = null;
101635 let exclude = null;
101636 const groupOptions = {};
101637
101638 const {
101639 options: importOptions,
101640 errors: commentErrors
101641 } = parser.parseCommentOptions(expr.range);
101642
101643 if (commentErrors) {
101644 for (const e of commentErrors) {
101645 const { comment } = e;
101646 parser.state.module.warnings.push(
101647 new CommentCompilationWarning(
101648 `Compilation error while processing magic comment(-s): /*${comment.value}*/: ${e.message}`,
101649 parser.state.module,
101650 comment.loc
101651 )
101652 );
101653 }
101654 }
101655
101656 if (importOptions) {
101657 if (importOptions.webpackIgnore !== undefined) {
101658 if (typeof importOptions.webpackIgnore !== "boolean") {
101659 parser.state.module.warnings.push(
101660 new UnsupportedFeatureWarning(
101661 parser.state.module,
101662 `\`webpackIgnore\` expected a boolean, but received: ${importOptions.webpackIgnore}.`,
101663 expr.loc
101664 )
101665 );
101666 } else {
101667 // Do not instrument `import()` if `webpackIgnore` is `true`
101668 if (importOptions.webpackIgnore) {
101669 return false;
101670 }
101671 }
101672 }
101673 if (importOptions.webpackChunkName !== undefined) {
101674 if (typeof importOptions.webpackChunkName !== "string") {
101675 parser.state.module.warnings.push(
101676 new UnsupportedFeatureWarning(
101677 parser.state.module,
101678 `\`webpackChunkName\` expected a string, but received: ${importOptions.webpackChunkName}.`,
101679 expr.loc
101680 )
101681 );
101682 } else {
101683 chunkName = importOptions.webpackChunkName;
101684 }
101685 }
101686 if (importOptions.webpackMode !== undefined) {
101687 if (typeof importOptions.webpackMode !== "string") {
101688 parser.state.module.warnings.push(
101689 new UnsupportedFeatureWarning(
101690 parser.state.module,
101691 `\`webpackMode\` expected a string, but received: ${importOptions.webpackMode}.`,
101692 expr.loc
101693 )
101694 );
101695 } else {
101696 mode = importOptions.webpackMode;
101697 }
101698 }
101699 if (importOptions.webpackPrefetch !== undefined) {
101700 if (importOptions.webpackPrefetch === true) {
101701 groupOptions.prefetchOrder = 0;
101702 } else if (typeof importOptions.webpackPrefetch === "number") {
101703 groupOptions.prefetchOrder = importOptions.webpackPrefetch;
101704 } else {
101705 parser.state.module.warnings.push(
101706 new UnsupportedFeatureWarning(
101707 parser.state.module,
101708 `\`webpackPrefetch\` expected true or a number, but received: ${importOptions.webpackPrefetch}.`,
101709 expr.loc
101710 )
101711 );
101712 }
101713 }
101714 if (importOptions.webpackPreload !== undefined) {
101715 if (importOptions.webpackPreload === true) {
101716 groupOptions.preloadOrder = 0;
101717 } else if (typeof importOptions.webpackPreload === "number") {
101718 groupOptions.preloadOrder = importOptions.webpackPreload;
101719 } else {
101720 parser.state.module.warnings.push(
101721 new UnsupportedFeatureWarning(
101722 parser.state.module,
101723 `\`webpackPreload\` expected true or a number, but received: ${importOptions.webpackPreload}.`,
101724 expr.loc
101725 )
101726 );
101727 }
101728 }
101729 if (importOptions.webpackInclude !== undefined) {
101730 if (
101731 !importOptions.webpackInclude ||
101732 importOptions.webpackInclude.constructor.name !== "RegExp"
101733 ) {
101734 parser.state.module.warnings.push(
101735 new UnsupportedFeatureWarning(
101736 parser.state.module,
101737 `\`webpackInclude\` expected a regular expression, but received: ${importOptions.webpackInclude}.`,
101738 expr.loc
101739 )
101740 );
101741 } else {
101742 include = new RegExp(importOptions.webpackInclude);
101743 }
101744 }
101745 if (importOptions.webpackExclude !== undefined) {
101746 if (
101747 !importOptions.webpackExclude ||
101748 importOptions.webpackExclude.constructor.name !== "RegExp"
101749 ) {
101750 parser.state.module.warnings.push(
101751 new UnsupportedFeatureWarning(
101752 parser.state.module,
101753 `\`webpackExclude\` expected a regular expression, but received: ${importOptions.webpackExclude}.`,
101754 expr.loc
101755 )
101756 );
101757 } else {
101758 exclude = new RegExp(importOptions.webpackExclude);
101759 }
101760 }
101761 }
101762
101763 if (param.isString()) {
101764 if (mode !== "lazy" && mode !== "eager" && mode !== "weak") {
101765 parser.state.module.warnings.push(
101766 new UnsupportedFeatureWarning(
101767 parser.state.module,
101768 `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`,
101769 expr.loc
101770 )
101771 );
101772 }
101773
101774 if (mode === "eager") {
101775 const dep = new ImportEagerDependency(
101776 param.string,
101777 parser.state.module,
101778 expr.range
101779 );
101780 parser.state.current.addDependency(dep);
101781 } else if (mode === "weak") {
101782 const dep = new ImportWeakDependency(
101783 param.string,
101784 parser.state.module,
101785 expr.range
101786 );
101787 parser.state.current.addDependency(dep);
101788 } else {
101789 const depBlock = new ImportDependenciesBlock(
101790 param.string,
101791 expr.range,
101792 Object.assign(groupOptions, {
101793 name: chunkName
101794 }),
101795 parser.state.module,
101796 expr.loc,
101797 parser.state.module
101798 );
101799 parser.state.current.addBlock(depBlock);
101800 }
101801 return true;
101802 } else {
101803 if (
101804 mode !== "lazy" &&
101805 mode !== "lazy-once" &&
101806 mode !== "eager" &&
101807 mode !== "weak"
101808 ) {
101809 parser.state.module.warnings.push(
101810 new UnsupportedFeatureWarning(
101811 parser.state.module,
101812 `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
101813 expr.loc
101814 )
101815 );
101816 mode = "lazy";
101817 }
101818
101819 if (mode === "weak") {
101820 mode = "async-weak";
101821 }
101822 const dep = ContextDependencyHelpers.create(
101823 ImportContextDependency,
101824 expr.range,
101825 param,
101826 expr,
101827 this.options,
101828 {
101829 chunkName,
101830 groupOptions,
101831 include,
101832 exclude,
101833 mode,
101834 namespaceObject: parser.state.module.buildMeta.strictHarmonyModule
101835 ? "strict"
101836 : true
101837 },
101838 parser
101839 );
101840 if (!dep) return;
101841 dep.loc = expr.loc;
101842 dep.optional = !!parser.scope.inTry;
101843 parser.state.current.addDependency(dep);
101844 return true;
101845 }
101846 });
101847 }
101848}
101849
101850module.exports = ImportParserPlugin;
101851
101852
101853/***/ }),
101854
101855/***/ 58839:
101856/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101857
101858"use strict";
101859/*
101860 MIT License http://www.opensource.org/licenses/mit-license.php
101861 Author Tobias Koppers @sokra
101862*/
101863
101864
101865const ImportDependency = __webpack_require__(50883);
101866const ImportEagerDependency = __webpack_require__(25552);
101867const ImportWeakDependency = __webpack_require__(86817);
101868const ImportContextDependency = __webpack_require__(20417);
101869const ImportParserPlugin = __webpack_require__(93382);
101870
101871class ImportPlugin {
101872 constructor(options) {
101873 this.options = options;
101874 }
101875
101876 apply(compiler) {
101877 const options = this.options;
101878 compiler.hooks.compilation.tap(
101879 "ImportPlugin",
101880 (compilation, { contextModuleFactory, normalModuleFactory }) => {
101881 compilation.dependencyFactories.set(
101882 ImportDependency,
101883 normalModuleFactory
101884 );
101885 compilation.dependencyTemplates.set(
101886 ImportDependency,
101887 new ImportDependency.Template()
101888 );
101889
101890 compilation.dependencyFactories.set(
101891 ImportEagerDependency,
101892 normalModuleFactory
101893 );
101894 compilation.dependencyTemplates.set(
101895 ImportEagerDependency,
101896 new ImportEagerDependency.Template()
101897 );
101898
101899 compilation.dependencyFactories.set(
101900 ImportWeakDependency,
101901 normalModuleFactory
101902 );
101903 compilation.dependencyTemplates.set(
101904 ImportWeakDependency,
101905 new ImportWeakDependency.Template()
101906 );
101907
101908 compilation.dependencyFactories.set(
101909 ImportContextDependency,
101910 contextModuleFactory
101911 );
101912 compilation.dependencyTemplates.set(
101913 ImportContextDependency,
101914 new ImportContextDependency.Template()
101915 );
101916
101917 const handler = (parser, parserOptions) => {
101918 if (parserOptions.import !== undefined && !parserOptions.import)
101919 return;
101920
101921 new ImportParserPlugin(options).apply(parser);
101922 };
101923
101924 normalModuleFactory.hooks.parser
101925 .for("javascript/auto")
101926 .tap("ImportPlugin", handler);
101927 normalModuleFactory.hooks.parser
101928 .for("javascript/dynamic")
101929 .tap("ImportPlugin", handler);
101930 normalModuleFactory.hooks.parser
101931 .for("javascript/esm")
101932 .tap("ImportPlugin", handler);
101933 }
101934 );
101935 }
101936}
101937module.exports = ImportPlugin;
101938
101939
101940/***/ }),
101941
101942/***/ 86817:
101943/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101944
101945"use strict";
101946/*
101947 MIT License http://www.opensource.org/licenses/mit-license.php
101948 Author Tobias Koppers @sokra
101949*/
101950
101951const ModuleDependency = __webpack_require__(90865);
101952
101953class ImportWeakDependency extends ModuleDependency {
101954 constructor(request, originModule, range) {
101955 super(request);
101956 this.originModule = originModule;
101957 this.range = range;
101958 this.weak = true;
101959 }
101960
101961 get type() {
101962 return "import() weak";
101963 }
101964}
101965
101966ImportWeakDependency.Template = class ImportDependencyTemplate {
101967 apply(dep, source, runtime) {
101968 const content = runtime.moduleNamespacePromise({
101969 module: dep.module,
101970 request: dep.request,
101971 strict: dep.originModule.buildMeta.strictHarmonyModule,
101972 message: "import() weak",
101973 weak: true
101974 });
101975 source.replace(dep.range[0], dep.range[1] - 1, content);
101976 }
101977};
101978
101979module.exports = ImportWeakDependency;
101980
101981
101982/***/ }),
101983
101984/***/ 54396:
101985/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
101986
101987"use strict";
101988/*
101989 MIT License http://www.opensource.org/licenses/mit-license.php
101990 Author Tobias Koppers @sokra
101991*/
101992
101993const NullDependency = __webpack_require__(5088);
101994
101995class JsonExportsDependency extends NullDependency {
101996 constructor(exports) {
101997 super();
101998 this.exports = exports;
101999 }
102000
102001 get type() {
102002 return "json exports";
102003 }
102004
102005 getExports() {
102006 return {
102007 exports: this.exports,
102008 dependencies: undefined
102009 };
102010 }
102011}
102012
102013module.exports = JsonExportsDependency;
102014
102015
102016/***/ }),
102017
102018/***/ 1129:
102019/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102020
102021"use strict";
102022/*
102023 MIT License http://www.opensource.org/licenses/mit-license.php
102024 Author Tobias Koppers @sokra
102025*/
102026
102027const ModuleDependency = __webpack_require__(90865);
102028
102029class LoaderDependency extends ModuleDependency {
102030 /**
102031 * @param {string} request request string
102032 */
102033 constructor(request) {
102034 super(request);
102035 }
102036
102037 get type() {
102038 return "loader";
102039 }
102040}
102041
102042module.exports = LoaderDependency;
102043
102044
102045/***/ }),
102046
102047/***/ 31559:
102048/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102049
102050"use strict";
102051/*
102052 MIT License http://www.opensource.org/licenses/mit-license.php
102053 Author Tobias Koppers @sokra
102054*/
102055
102056
102057const LoaderDependency = __webpack_require__(1129);
102058const NormalModule = __webpack_require__(25963);
102059
102060/** @typedef {import("../Module")} Module */
102061
102062/**
102063 * @callback LoadModuleCallback
102064 * @param {Error=} err error object
102065 * @param {string=} source source code
102066 * @param {object=} map source map
102067 * @param {Module=} module loaded module if successful
102068 */
102069
102070class LoaderPlugin {
102071 apply(compiler) {
102072 compiler.hooks.compilation.tap(
102073 "LoaderPlugin",
102074 (compilation, { normalModuleFactory }) => {
102075 compilation.dependencyFactories.set(
102076 LoaderDependency,
102077 normalModuleFactory
102078 );
102079 }
102080 );
102081
102082 compiler.hooks.compilation.tap("LoaderPlugin", compilation => {
102083 compilation.hooks.normalModuleLoader.tap(
102084 "LoaderPlugin",
102085 (loaderContext, module) => {
102086 /**
102087 * @param {string} request the request string to load the module from
102088 * @param {LoadModuleCallback} callback callback returning the loaded module or error
102089 * @returns {void}
102090 */
102091 loaderContext.loadModule = (request, callback) => {
102092 const dep = new LoaderDependency(request);
102093 dep.loc = {
102094 name: request
102095 };
102096 const factory = compilation.dependencyFactories.get(
102097 dep.constructor
102098 );
102099 if (factory === undefined) {
102100 return callback(
102101 new Error(
102102 `No module factory available for dependency type: ${dep.constructor.name}`
102103 )
102104 );
102105 }
102106 compilation.semaphore.release();
102107 compilation.addModuleDependencies(
102108 module,
102109 [
102110 {
102111 factory,
102112 dependencies: [dep]
102113 }
102114 ],
102115 true,
102116 "lm",
102117 true,
102118 err => {
102119 compilation.semaphore.acquire(() => {
102120 if (err) {
102121 return callback(err);
102122 }
102123 if (!dep.module) {
102124 return callback(new Error("Cannot load the module"));
102125 }
102126 // TODO consider removing this in webpack 5
102127 if (dep.module instanceof NormalModule && dep.module.error) {
102128 return callback(dep.module.error);
102129 }
102130 if (!dep.module._source) {
102131 throw new Error(
102132 "The module created for a LoaderDependency must have a property _source"
102133 );
102134 }
102135 let source, map;
102136 const moduleSource = dep.module._source;
102137 if (moduleSource.sourceAndMap) {
102138 const sourceAndMap = moduleSource.sourceAndMap();
102139 map = sourceAndMap.map;
102140 source = sourceAndMap.source;
102141 } else {
102142 map = moduleSource.map();
102143 source = moduleSource.source();
102144 }
102145 if (dep.module.buildInfo.fileDependencies) {
102146 for (const d of dep.module.buildInfo.fileDependencies) {
102147 loaderContext.addDependency(d);
102148 }
102149 }
102150 if (dep.module.buildInfo.contextDependencies) {
102151 for (const d of dep.module.buildInfo.contextDependencies) {
102152 loaderContext.addContextDependency(d);
102153 }
102154 }
102155 return callback(null, source, map, dep.module);
102156 });
102157 }
102158 );
102159 };
102160 }
102161 );
102162 });
102163 }
102164}
102165module.exports = LoaderPlugin;
102166
102167
102168/***/ }),
102169
102170/***/ 17356:
102171/***/ (function(module) {
102172
102173"use strict";
102174/*
102175 MIT License http://www.opensource.org/licenses/mit-license.php
102176 Author Tobias Koppers @sokra
102177*/
102178
102179
102180class LocalModule {
102181 constructor(module, name, idx) {
102182 this.module = module;
102183 this.name = name;
102184 this.idx = idx;
102185 this.used = false;
102186 }
102187
102188 flagUsed() {
102189 this.used = true;
102190 }
102191
102192 variableName() {
102193 return "__WEBPACK_LOCAL_MODULE_" + this.idx + "__";
102194 }
102195}
102196module.exports = LocalModule;
102197
102198
102199/***/ }),
102200
102201/***/ 56570:
102202/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102203
102204"use strict";
102205/*
102206 MIT License http://www.opensource.org/licenses/mit-license.php
102207 Author Tobias Koppers @sokra
102208*/
102209
102210const NullDependency = __webpack_require__(5088);
102211
102212class LocalModuleDependency extends NullDependency {
102213 constructor(localModule, range, callNew) {
102214 super();
102215 localModule.flagUsed();
102216 this.localModule = localModule;
102217 this.range = range;
102218 this.callNew = callNew;
102219 }
102220}
102221
102222LocalModuleDependency.Template = class LocalModuleDependencyTemplate {
102223 apply(dep, source) {
102224 if (!dep.range) return;
102225 const moduleInstance = dep.callNew
102226 ? `new (function () { return ${dep.localModule.variableName()}; })()`
102227 : dep.localModule.variableName();
102228 source.replace(dep.range[0], dep.range[1] - 1, moduleInstance);
102229 }
102230};
102231
102232module.exports = LocalModuleDependency;
102233
102234
102235/***/ }),
102236
102237/***/ 39658:
102238/***/ (function(module, exports, __webpack_require__) {
102239
102240"use strict";
102241/*
102242 MIT License http://www.opensource.org/licenses/mit-license.php
102243 Author Tobias Koppers @sokra
102244*/
102245
102246
102247const LocalModule = __webpack_require__(17356);
102248const LocalModulesHelpers = exports;
102249
102250const lookup = (parent, mod) => {
102251 if (mod.charAt(0) !== ".") return mod;
102252
102253 var path = parent.split("/");
102254 var segs = mod.split("/");
102255 path.pop();
102256
102257 for (let i = 0; i < segs.length; i++) {
102258 const seg = segs[i];
102259 if (seg === "..") {
102260 path.pop();
102261 } else if (seg !== ".") {
102262 path.push(seg);
102263 }
102264 }
102265
102266 return path.join("/");
102267};
102268
102269LocalModulesHelpers.addLocalModule = (state, name) => {
102270 if (!state.localModules) {
102271 state.localModules = [];
102272 }
102273 const m = new LocalModule(state.module, name, state.localModules.length);
102274 state.localModules.push(m);
102275 return m;
102276};
102277
102278LocalModulesHelpers.getLocalModule = (state, name, namedModule) => {
102279 if (!state.localModules) return null;
102280 if (namedModule) {
102281 // resolve dependency name relative to the defining named module
102282 name = lookup(namedModule, name);
102283 }
102284 for (let i = 0; i < state.localModules.length; i++) {
102285 if (state.localModules[i].name === name) {
102286 return state.localModules[i];
102287 }
102288 }
102289 return null;
102290};
102291
102292module.exports = LocalModulesHelpers;
102293
102294
102295/***/ }),
102296
102297/***/ 90865:
102298/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102299
102300"use strict";
102301/*
102302 MIT License http://www.opensource.org/licenses/mit-license.php
102303 Author Tobias Koppers @sokra
102304*/
102305
102306const Dependency = __webpack_require__(57282);
102307
102308class ModuleDependency extends Dependency {
102309 /**
102310 * @param {string} request request path which needs resolving
102311 */
102312 constructor(request) {
102313 super();
102314 this.request = request;
102315 this.userRequest = request;
102316 }
102317
102318 getResourceIdentifier() {
102319 return `module${this.request}`;
102320 }
102321}
102322
102323module.exports = ModuleDependency;
102324
102325
102326/***/ }),
102327
102328/***/ 63708:
102329/***/ (function(module) {
102330
102331"use strict";
102332/*
102333 MIT License http://www.opensource.org/licenses/mit-license.php
102334 Author Tobias Koppers @sokra
102335*/
102336
102337
102338class ModuleDependencyTemplateAsId {
102339 apply(dep, source, runtime) {
102340 if (!dep.range) return;
102341 const content = runtime.moduleId({
102342 module: dep.module,
102343 request: dep.request
102344 });
102345 source.replace(dep.range[0], dep.range[1] - 1, content);
102346 }
102347}
102348module.exports = ModuleDependencyTemplateAsId;
102349
102350
102351/***/ }),
102352
102353/***/ 60441:
102354/***/ (function(module) {
102355
102356"use strict";
102357/*
102358 MIT License http://www.opensource.org/licenses/mit-license.php
102359 Author Tobias Koppers @sokra
102360*/
102361
102362
102363class ModuleDependencyTemplateAsRequireId {
102364 apply(dep, source, runtime) {
102365 if (!dep.range) return;
102366 const content = runtime.moduleExports({
102367 module: dep.module,
102368 request: dep.request
102369 });
102370 source.replace(dep.range[0], dep.range[1] - 1, content);
102371 }
102372}
102373module.exports = ModuleDependencyTemplateAsRequireId;
102374
102375
102376/***/ }),
102377
102378/***/ 29018:
102379/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102380
102381"use strict";
102382/*
102383 MIT License http://www.opensource.org/licenses/mit-license.php
102384 Author Tobias Koppers @sokra
102385*/
102386
102387const ModuleDependency = __webpack_require__(90865);
102388const ModuleDependencyTemplateAsId = __webpack_require__(63708);
102389
102390class ModuleHotAcceptDependency extends ModuleDependency {
102391 constructor(request, range) {
102392 super(request);
102393 this.range = range;
102394 this.weak = true;
102395 }
102396
102397 get type() {
102398 return "module.hot.accept";
102399 }
102400}
102401
102402ModuleHotAcceptDependency.Template = ModuleDependencyTemplateAsId;
102403
102404module.exports = ModuleHotAcceptDependency;
102405
102406
102407/***/ }),
102408
102409/***/ 60482:
102410/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102411
102412"use strict";
102413/*
102414 MIT License http://www.opensource.org/licenses/mit-license.php
102415 Author Tobias Koppers @sokra
102416*/
102417
102418const ModuleDependency = __webpack_require__(90865);
102419const ModuleDependencyTemplateAsId = __webpack_require__(63708);
102420
102421class ModuleHotDeclineDependency extends ModuleDependency {
102422 constructor(request, range) {
102423 super(request);
102424 this.range = range;
102425 this.weak = true;
102426 }
102427
102428 get type() {
102429 return "module.hot.decline";
102430 }
102431}
102432
102433ModuleHotDeclineDependency.Template = ModuleDependencyTemplateAsId;
102434
102435module.exports = ModuleHotDeclineDependency;
102436
102437
102438/***/ }),
102439
102440/***/ 7791:
102441/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102442
102443"use strict";
102444/*
102445 MIT License http://www.opensource.org/licenses/mit-license.php
102446 Author Tobias Koppers @sokra
102447*/
102448
102449/** @typedef {import("./SingleEntryDependency")} SingleEntryDependency */
102450const Dependency = __webpack_require__(57282);
102451
102452class MultiEntryDependency extends Dependency {
102453 /**
102454 * @param {SingleEntryDependency[]} dependencies an array of SingleEntryDependencies
102455 * @param {string} name entry name
102456 */
102457 constructor(dependencies, name) {
102458 super();
102459 this.dependencies = dependencies;
102460 this.name = name;
102461 }
102462
102463 get type() {
102464 return "multi entry";
102465 }
102466}
102467
102468module.exports = MultiEntryDependency;
102469
102470
102471/***/ }),
102472
102473/***/ 5088:
102474/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102475
102476"use strict";
102477/*
102478 MIT License http://www.opensource.org/licenses/mit-license.php
102479 Author Tobias Koppers @sokra
102480*/
102481
102482const Dependency = __webpack_require__(57282);
102483
102484class NullDependency extends Dependency {
102485 get type() {
102486 return "null";
102487 }
102488
102489 updateHash() {}
102490}
102491
102492NullDependency.Template = class NullDependencyTemplate {
102493 apply() {}
102494};
102495
102496module.exports = NullDependency;
102497
102498
102499/***/ }),
102500
102501/***/ 14237:
102502/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102503
102504"use strict";
102505/*
102506 MIT License http://www.opensource.org/licenses/mit-license.php
102507 Author Tobias Koppers @sokra
102508*/
102509
102510const ModuleDependency = __webpack_require__(90865);
102511
102512class PrefetchDependency extends ModuleDependency {
102513 constructor(request) {
102514 super(request);
102515 }
102516
102517 get type() {
102518 return "prefetch";
102519 }
102520}
102521
102522module.exports = PrefetchDependency;
102523
102524
102525/***/ }),
102526
102527/***/ 79142:
102528/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102529
102530"use strict";
102531/*
102532 MIT License http://www.opensource.org/licenses/mit-license.php
102533 Author Tobias Koppers @sokra
102534*/
102535
102536const ContextDependency = __webpack_require__(11583);
102537const ModuleDependencyTemplateAsRequireId = __webpack_require__(60441);
102538
102539class RequireContextDependency extends ContextDependency {
102540 constructor(options, range) {
102541 super(options);
102542 this.range = range;
102543 }
102544
102545 get type() {
102546 return "require.context";
102547 }
102548}
102549
102550RequireContextDependency.Template = ModuleDependencyTemplateAsRequireId;
102551
102552module.exports = RequireContextDependency;
102553
102554
102555/***/ }),
102556
102557/***/ 10566:
102558/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102559
102560"use strict";
102561/*
102562 MIT License http://www.opensource.org/licenses/mit-license.php
102563 Author Tobias Koppers @sokra
102564*/
102565
102566
102567const RequireContextDependency = __webpack_require__(79142);
102568
102569module.exports = class RequireContextDependencyParserPlugin {
102570 apply(parser) {
102571 parser.hooks.call
102572 .for("require.context")
102573 .tap("RequireContextDependencyParserPlugin", expr => {
102574 let regExp = /^\.\/.*$/;
102575 let recursive = true;
102576 let mode = "sync";
102577 switch (expr.arguments.length) {
102578 case 4: {
102579 const modeExpr = parser.evaluateExpression(expr.arguments[3]);
102580 if (!modeExpr.isString()) return;
102581 mode = modeExpr.string;
102582 }
102583 // falls through
102584 case 3: {
102585 const regExpExpr = parser.evaluateExpression(expr.arguments[2]);
102586 if (!regExpExpr.isRegExp()) return;
102587 regExp = regExpExpr.regExp;
102588 }
102589 // falls through
102590 case 2: {
102591 const recursiveExpr = parser.evaluateExpression(expr.arguments[1]);
102592 if (!recursiveExpr.isBoolean()) return;
102593 recursive = recursiveExpr.bool;
102594 }
102595 // falls through
102596 case 1: {
102597 const requestExpr = parser.evaluateExpression(expr.arguments[0]);
102598 if (!requestExpr.isString()) return;
102599 const dep = new RequireContextDependency(
102600 {
102601 request: requestExpr.string,
102602 recursive,
102603 regExp,
102604 mode
102605 },
102606 expr.range
102607 );
102608 dep.loc = expr.loc;
102609 dep.optional = parser.scope.inTry;
102610 parser.state.current.addDependency(dep);
102611 return true;
102612 }
102613 }
102614 });
102615 }
102616};
102617
102618
102619/***/ }),
102620
102621/***/ 89042:
102622/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102623
102624"use strict";
102625/*
102626 MIT License http://www.opensource.org/licenses/mit-license.php
102627 Author Tobias Koppers @sokra
102628*/
102629
102630
102631const RequireContextDependency = __webpack_require__(79142);
102632const ContextElementDependency = __webpack_require__(89079);
102633
102634const RequireContextDependencyParserPlugin = __webpack_require__(10566);
102635
102636class RequireContextPlugin {
102637 constructor(modulesDirectories, extensions, mainFiles) {
102638 if (!Array.isArray(modulesDirectories)) {
102639 throw new Error("modulesDirectories must be an array");
102640 }
102641 if (!Array.isArray(extensions)) {
102642 throw new Error("extensions must be an array");
102643 }
102644 this.modulesDirectories = modulesDirectories;
102645 this.extensions = extensions;
102646 this.mainFiles = mainFiles;
102647 }
102648
102649 apply(compiler) {
102650 compiler.hooks.compilation.tap(
102651 "RequireContextPlugin",
102652 (compilation, { contextModuleFactory, normalModuleFactory }) => {
102653 compilation.dependencyFactories.set(
102654 RequireContextDependency,
102655 contextModuleFactory
102656 );
102657 compilation.dependencyTemplates.set(
102658 RequireContextDependency,
102659 new RequireContextDependency.Template()
102660 );
102661
102662 compilation.dependencyFactories.set(
102663 ContextElementDependency,
102664 normalModuleFactory
102665 );
102666
102667 const handler = (parser, parserOptions) => {
102668 if (
102669 parserOptions.requireContext !== undefined &&
102670 !parserOptions.requireContext
102671 )
102672 return;
102673
102674 new RequireContextDependencyParserPlugin().apply(parser);
102675 };
102676
102677 normalModuleFactory.hooks.parser
102678 .for("javascript/auto")
102679 .tap("RequireContextPlugin", handler);
102680 normalModuleFactory.hooks.parser
102681 .for("javascript/dynamic")
102682 .tap("RequireContextPlugin", handler);
102683
102684 contextModuleFactory.hooks.alternatives.tap(
102685 "RequireContextPlugin",
102686 items => {
102687 if (items.length === 0) return items;
102688 return items
102689 .map(obj => {
102690 return this.extensions
102691 .filter(ext => {
102692 const l = obj.request.length;
102693 return (
102694 l > ext.length &&
102695 obj.request.substr(l - ext.length, l) === ext
102696 );
102697 })
102698 .map(ext => {
102699 const l = obj.request.length;
102700 return {
102701 context: obj.context,
102702 request: obj.request.substr(0, l - ext.length)
102703 };
102704 })
102705 .concat(obj);
102706 })
102707 .reduce((a, b) => a.concat(b), []);
102708 }
102709 );
102710
102711 contextModuleFactory.hooks.alternatives.tap(
102712 "RequireContextPlugin",
102713 items => {
102714 if (items.length === 0) return items;
102715 return items
102716 .map(obj => {
102717 return this.mainFiles
102718 .filter(mainFile => {
102719 const l = obj.request.length;
102720 return (
102721 l > mainFile.length + 1 &&
102722 obj.request.substr(l - mainFile.length - 1, l) ===
102723 "/" + mainFile
102724 );
102725 })
102726 .map(mainFile => {
102727 const l = obj.request.length;
102728 return [
102729 {
102730 context: obj.context,
102731 request: obj.request.substr(0, l - mainFile.length)
102732 },
102733 {
102734 context: obj.context,
102735 request: obj.request.substr(0, l - mainFile.length - 1)
102736 }
102737 ];
102738 })
102739 .reduce((a, b) => a.concat(b), [])
102740 .concat(obj);
102741 })
102742 .reduce((a, b) => a.concat(b), []);
102743 }
102744 );
102745
102746 contextModuleFactory.hooks.alternatives.tap(
102747 "RequireContextPlugin",
102748 items => {
102749 if (items.length === 0) return items;
102750 return items.map(obj => {
102751 for (let i = 0; i < this.modulesDirectories.length; i++) {
102752 const dir = this.modulesDirectories[i];
102753 const idx = obj.request.indexOf("./" + dir + "/");
102754 if (idx === 0) {
102755 obj.request = obj.request.slice(dir.length + 3);
102756 break;
102757 }
102758 }
102759 return obj;
102760 });
102761 }
102762 );
102763 }
102764 );
102765 }
102766}
102767module.exports = RequireContextPlugin;
102768
102769
102770/***/ }),
102771
102772/***/ 49105:
102773/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102774
102775"use strict";
102776/*
102777 MIT License http://www.opensource.org/licenses/mit-license.php
102778 Author Tobias Koppers @sokra
102779*/
102780
102781const AsyncDependenciesBlock = __webpack_require__(22814);
102782const RequireEnsureDependency = __webpack_require__(75830);
102783
102784module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
102785 constructor(
102786 expr,
102787 successExpression,
102788 errorExpression,
102789 chunkName,
102790 chunkNameRange,
102791 module,
102792 loc
102793 ) {
102794 super(chunkName, module, loc, null);
102795 this.expr = expr;
102796 const successBodyRange =
102797 successExpression &&
102798 successExpression.body &&
102799 successExpression.body.range;
102800 if (successBodyRange) {
102801 this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
102802 }
102803 this.chunkNameRange = chunkNameRange;
102804 const dep = new RequireEnsureDependency(this);
102805 dep.loc = loc;
102806 this.addDependency(dep);
102807 }
102808};
102809
102810
102811/***/ }),
102812
102813/***/ 24620:
102814/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102815
102816"use strict";
102817/*
102818 MIT License http://www.opensource.org/licenses/mit-license.php
102819 Author Tobias Koppers @sokra
102820*/
102821
102822
102823const RequireEnsureDependenciesBlock = __webpack_require__(49105);
102824const RequireEnsureItemDependency = __webpack_require__(5511);
102825const getFunctionExpression = __webpack_require__(64197);
102826
102827module.exports = class RequireEnsureDependenciesBlockParserPlugin {
102828 apply(parser) {
102829 parser.hooks.call
102830 .for("require.ensure")
102831 .tap("RequireEnsureDependenciesBlockParserPlugin", expr => {
102832 let chunkName = null;
102833 let chunkNameRange = null;
102834 let errorExpressionArg = null;
102835 let errorExpression = null;
102836 switch (expr.arguments.length) {
102837 case 4: {
102838 const chunkNameExpr = parser.evaluateExpression(expr.arguments[3]);
102839 if (!chunkNameExpr.isString()) return;
102840 chunkNameRange = chunkNameExpr.range;
102841 chunkName = chunkNameExpr.string;
102842 }
102843 // falls through
102844 case 3: {
102845 errorExpressionArg = expr.arguments[2];
102846 errorExpression = getFunctionExpression(errorExpressionArg);
102847
102848 if (!errorExpression && !chunkName) {
102849 const chunkNameExpr = parser.evaluateExpression(
102850 expr.arguments[2]
102851 );
102852 if (!chunkNameExpr.isString()) return;
102853 chunkNameRange = chunkNameExpr.range;
102854 chunkName = chunkNameExpr.string;
102855 }
102856 }
102857 // falls through
102858 case 2: {
102859 const dependenciesExpr = parser.evaluateExpression(
102860 expr.arguments[0]
102861 );
102862 const dependenciesItems = dependenciesExpr.isArray()
102863 ? dependenciesExpr.items
102864 : [dependenciesExpr];
102865 const successExpressionArg = expr.arguments[1];
102866 const successExpression = getFunctionExpression(
102867 successExpressionArg
102868 );
102869
102870 if (successExpression) {
102871 parser.walkExpressions(successExpression.expressions);
102872 }
102873 if (errorExpression) {
102874 parser.walkExpressions(errorExpression.expressions);
102875 }
102876
102877 const dep = new RequireEnsureDependenciesBlock(
102878 expr,
102879 successExpression ? successExpression.fn : successExpressionArg,
102880 errorExpression ? errorExpression.fn : errorExpressionArg,
102881 chunkName,
102882 chunkNameRange,
102883 parser.state.module,
102884 expr.loc
102885 );
102886 const old = parser.state.current;
102887 parser.state.current = dep;
102888 try {
102889 let failed = false;
102890 parser.inScope([], () => {
102891 for (const ee of dependenciesItems) {
102892 if (ee.isString()) {
102893 const edep = new RequireEnsureItemDependency(ee.string);
102894 edep.loc = dep.loc;
102895 dep.addDependency(edep);
102896 } else {
102897 failed = true;
102898 }
102899 }
102900 });
102901 if (failed) {
102902 return;
102903 }
102904 if (successExpression) {
102905 if (successExpression.fn.body.type === "BlockStatement") {
102906 parser.walkStatement(successExpression.fn.body);
102907 } else {
102908 parser.walkExpression(successExpression.fn.body);
102909 }
102910 }
102911 old.addBlock(dep);
102912 } finally {
102913 parser.state.current = old;
102914 }
102915 if (!successExpression) {
102916 parser.walkExpression(successExpressionArg);
102917 }
102918 if (errorExpression) {
102919 if (errorExpression.fn.body.type === "BlockStatement") {
102920 parser.walkStatement(errorExpression.fn.body);
102921 } else {
102922 parser.walkExpression(errorExpression.fn.body);
102923 }
102924 } else if (errorExpressionArg) {
102925 parser.walkExpression(errorExpressionArg);
102926 }
102927 return true;
102928 }
102929 }
102930 });
102931 }
102932};
102933
102934
102935/***/ }),
102936
102937/***/ 75830:
102938/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
102939
102940"use strict";
102941/*
102942 MIT License http://www.opensource.org/licenses/mit-license.php
102943 Author Tobias Koppers @sokra
102944*/
102945
102946const NullDependency = __webpack_require__(5088);
102947
102948class RequireEnsureDependency extends NullDependency {
102949 constructor(block) {
102950 super();
102951 this.block = block;
102952 }
102953
102954 get type() {
102955 return "require.ensure";
102956 }
102957}
102958
102959RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate {
102960 apply(dep, source, runtime) {
102961 const depBlock = dep.block;
102962 const promise = runtime.blockPromise({
102963 block: depBlock,
102964 message: "require.ensure"
102965 });
102966 const errorCallbackExists =
102967 depBlock.expr.arguments.length === 4 ||
102968 (!depBlock.chunkName && depBlock.expr.arguments.length === 3);
102969 const startBlock = `${promise}.then((`;
102970 const middleBlock = ").bind(null, __webpack_require__)).catch(";
102971 const endBlock = `).bind(null, __webpack_require__)).catch(${runtime.onError()})`;
102972 source.replace(
102973 depBlock.expr.range[0],
102974 depBlock.expr.arguments[1].range[0] - 1,
102975 startBlock
102976 );
102977 if (errorCallbackExists) {
102978 source.replace(
102979 depBlock.expr.arguments[1].range[1],
102980 depBlock.expr.arguments[2].range[0] - 1,
102981 middleBlock
102982 );
102983 source.replace(
102984 depBlock.expr.arguments[2].range[1],
102985 depBlock.expr.range[1] - 1,
102986 ")"
102987 );
102988 } else {
102989 source.replace(
102990 depBlock.expr.arguments[1].range[1],
102991 depBlock.expr.range[1] - 1,
102992 endBlock
102993 );
102994 }
102995 }
102996};
102997
102998module.exports = RequireEnsureDependency;
102999
103000
103001/***/ }),
103002
103003/***/ 5511:
103004/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103005
103006"use strict";
103007/*
103008 MIT License http://www.opensource.org/licenses/mit-license.php
103009 Author Tobias Koppers @sokra
103010*/
103011
103012const ModuleDependency = __webpack_require__(90865);
103013const NullDependency = __webpack_require__(5088);
103014
103015class RequireEnsureItemDependency extends ModuleDependency {
103016 constructor(request) {
103017 super(request);
103018 }
103019
103020 get type() {
103021 return "require.ensure item";
103022 }
103023}
103024
103025RequireEnsureItemDependency.Template = NullDependency.Template;
103026
103027module.exports = RequireEnsureItemDependency;
103028
103029
103030/***/ }),
103031
103032/***/ 98655:
103033/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103034
103035"use strict";
103036/*
103037 MIT License http://www.opensource.org/licenses/mit-license.php
103038 Author Tobias Koppers @sokra
103039*/
103040
103041
103042const RequireEnsureItemDependency = __webpack_require__(5511);
103043const RequireEnsureDependency = __webpack_require__(75830);
103044
103045const NullFactory = __webpack_require__(40438);
103046
103047const RequireEnsureDependenciesBlockParserPlugin = __webpack_require__(24620);
103048
103049const ParserHelpers = __webpack_require__(23999);
103050
103051class RequireEnsurePlugin {
103052 apply(compiler) {
103053 compiler.hooks.compilation.tap(
103054 "RequireEnsurePlugin",
103055 (compilation, { normalModuleFactory }) => {
103056 compilation.dependencyFactories.set(
103057 RequireEnsureItemDependency,
103058 normalModuleFactory
103059 );
103060 compilation.dependencyTemplates.set(
103061 RequireEnsureItemDependency,
103062 new RequireEnsureItemDependency.Template()
103063 );
103064
103065 compilation.dependencyFactories.set(
103066 RequireEnsureDependency,
103067 new NullFactory()
103068 );
103069 compilation.dependencyTemplates.set(
103070 RequireEnsureDependency,
103071 new RequireEnsureDependency.Template()
103072 );
103073
103074 const handler = (parser, parserOptions) => {
103075 if (
103076 parserOptions.requireEnsure !== undefined &&
103077 !parserOptions.requireEnsure
103078 )
103079 return;
103080
103081 new RequireEnsureDependenciesBlockParserPlugin().apply(parser);
103082 parser.hooks.evaluateTypeof
103083 .for("require.ensure")
103084 .tap(
103085 "RequireEnsurePlugin",
103086 ParserHelpers.evaluateToString("function")
103087 );
103088 parser.hooks.typeof
103089 .for("require.ensure")
103090 .tap(
103091 "RequireEnsurePlugin",
103092 ParserHelpers.toConstantDependency(
103093 parser,
103094 JSON.stringify("function")
103095 )
103096 );
103097 };
103098
103099 normalModuleFactory.hooks.parser
103100 .for("javascript/auto")
103101 .tap("RequireEnsurePlugin", handler);
103102 normalModuleFactory.hooks.parser
103103 .for("javascript/dynamic")
103104 .tap("RequireEnsurePlugin", handler);
103105 }
103106 );
103107 }
103108}
103109module.exports = RequireEnsurePlugin;
103110
103111
103112/***/ }),
103113
103114/***/ 22928:
103115/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103116
103117"use strict";
103118/*
103119 MIT License http://www.opensource.org/licenses/mit-license.php
103120 Author Tobias Koppers @sokra
103121*/
103122
103123const NullDependency = __webpack_require__(5088);
103124
103125class RequireHeaderDependency extends NullDependency {
103126 constructor(range) {
103127 super();
103128 if (!Array.isArray(range)) throw new Error("range must be valid");
103129 this.range = range;
103130 }
103131}
103132
103133RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
103134 apply(dep, source) {
103135 source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__");
103136 }
103137
103138 applyAsTemplateArgument(name, dep, source) {
103139 source.replace(dep.range[0], dep.range[1] - 1, "require");
103140 }
103141};
103142
103143module.exports = RequireHeaderDependency;
103144
103145
103146/***/ }),
103147
103148/***/ 58045:
103149/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103150
103151"use strict";
103152/*
103153 MIT License http://www.opensource.org/licenses/mit-license.php
103154 Author Tobias Koppers @sokra
103155*/
103156
103157
103158const DependencyReference = __webpack_require__(71722);
103159const ModuleDependency = __webpack_require__(90865);
103160const Template = __webpack_require__(96066);
103161
103162class RequireIncludeDependency extends ModuleDependency {
103163 constructor(request, range) {
103164 super(request);
103165 this.range = range;
103166 }
103167
103168 getReference() {
103169 if (!this.module) return null;
103170 // This doesn't use any export
103171 return new DependencyReference(this.module, [], false);
103172 }
103173
103174 get type() {
103175 return "require.include";
103176 }
103177}
103178
103179RequireIncludeDependency.Template = class RequireIncludeDependencyTemplate {
103180 apply(dep, source, runtime) {
103181 const comment = runtime.outputOptions.pathinfo
103182 ? Template.toComment(
103183 `require.include ${runtime.requestShortener.shorten(dep.request)}`
103184 )
103185 : "";
103186 source.replace(dep.range[0], dep.range[1] - 1, `undefined${comment}`);
103187 }
103188};
103189
103190module.exports = RequireIncludeDependency;
103191
103192
103193/***/ }),
103194
103195/***/ 36330:
103196/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103197
103198"use strict";
103199/*
103200 MIT License http://www.opensource.org/licenses/mit-license.php
103201 Author Tobias Koppers @sokra
103202*/
103203
103204
103205const RequireIncludeDependency = __webpack_require__(58045);
103206
103207module.exports = class RequireIncludeDependencyParserPlugin {
103208 apply(parser) {
103209 parser.hooks.call
103210 .for("require.include")
103211 .tap("RequireIncludeDependencyParserPlugin", expr => {
103212 if (expr.arguments.length !== 1) return;
103213 const param = parser.evaluateExpression(expr.arguments[0]);
103214 if (!param.isString()) return;
103215 const dep = new RequireIncludeDependency(param.string, expr.range);
103216 dep.loc = expr.loc;
103217 parser.state.current.addDependency(dep);
103218 return true;
103219 });
103220 }
103221};
103222
103223
103224/***/ }),
103225
103226/***/ 16522:
103227/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103228
103229"use strict";
103230/*
103231 MIT License http://www.opensource.org/licenses/mit-license.php
103232 Author Tobias Koppers @sokra
103233*/
103234
103235
103236const RequireIncludeDependency = __webpack_require__(58045);
103237const RequireIncludeDependencyParserPlugin = __webpack_require__(36330);
103238
103239const ParserHelpers = __webpack_require__(23999);
103240
103241class RequireIncludePlugin {
103242 apply(compiler) {
103243 compiler.hooks.compilation.tap(
103244 "RequireIncludePlugin",
103245 (compilation, { normalModuleFactory }) => {
103246 compilation.dependencyFactories.set(
103247 RequireIncludeDependency,
103248 normalModuleFactory
103249 );
103250 compilation.dependencyTemplates.set(
103251 RequireIncludeDependency,
103252 new RequireIncludeDependency.Template()
103253 );
103254
103255 const handler = (parser, parserOptions) => {
103256 if (
103257 parserOptions.requireInclude !== undefined &&
103258 !parserOptions.requireInclude
103259 )
103260 return;
103261
103262 new RequireIncludeDependencyParserPlugin().apply(parser);
103263 parser.hooks.evaluateTypeof
103264 .for("require.include")
103265 .tap(
103266 "RequireIncludePlugin",
103267 ParserHelpers.evaluateToString("function")
103268 );
103269 parser.hooks.typeof
103270 .for("require.include")
103271 .tap(
103272 "RequireIncludePlugin",
103273 ParserHelpers.toConstantDependency(
103274 parser,
103275 JSON.stringify("function")
103276 )
103277 );
103278 };
103279
103280 normalModuleFactory.hooks.parser
103281 .for("javascript/auto")
103282 .tap("RequireIncludePlugin", handler);
103283 normalModuleFactory.hooks.parser
103284 .for("javascript/dynamic")
103285 .tap("RequireIncludePlugin", handler);
103286 }
103287 );
103288 }
103289}
103290module.exports = RequireIncludePlugin;
103291
103292
103293/***/ }),
103294
103295/***/ 83309:
103296/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103297
103298"use strict";
103299/*
103300 MIT License http://www.opensource.org/licenses/mit-license.php
103301 Author Tobias Koppers @sokra
103302*/
103303
103304const ContextDependency = __webpack_require__(11583);
103305const ContextDependencyTemplateAsId = __webpack_require__(6174);
103306
103307class RequireResolveContextDependency extends ContextDependency {
103308 constructor(options, range, valueRange) {
103309 super(options);
103310 this.range = range;
103311 this.valueRange = valueRange;
103312 }
103313
103314 get type() {
103315 return "amd require context";
103316 }
103317}
103318
103319RequireResolveContextDependency.Template = ContextDependencyTemplateAsId;
103320
103321module.exports = RequireResolveContextDependency;
103322
103323
103324/***/ }),
103325
103326/***/ 43519:
103327/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103328
103329"use strict";
103330/*
103331 MIT License http://www.opensource.org/licenses/mit-license.php
103332 Author Tobias Koppers @sokra
103333*/
103334
103335const ModuleDependency = __webpack_require__(90865);
103336const ModuleDependencyAsId = __webpack_require__(63708);
103337
103338class RequireResolveDependency extends ModuleDependency {
103339 constructor(request, range) {
103340 super(request);
103341 this.range = range;
103342 }
103343
103344 get type() {
103345 return "require.resolve";
103346 }
103347}
103348
103349RequireResolveDependency.Template = ModuleDependencyAsId;
103350
103351module.exports = RequireResolveDependency;
103352
103353
103354/***/ }),
103355
103356/***/ 68349:
103357/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103358
103359"use strict";
103360/*
103361 MIT License http://www.opensource.org/licenses/mit-license.php
103362 Author Tobias Koppers @sokra
103363*/
103364
103365
103366const RequireResolveDependency = __webpack_require__(43519);
103367const RequireResolveContextDependency = __webpack_require__(83309);
103368const RequireResolveHeaderDependency = __webpack_require__(69647);
103369const ContextDependencyHelpers = __webpack_require__(5594);
103370
103371class RequireResolveDependencyParserPlugin {
103372 constructor(options) {
103373 this.options = options;
103374 }
103375
103376 apply(parser) {
103377 const options = this.options;
103378
103379 const process = (expr, weak) => {
103380 if (expr.arguments.length !== 1) return;
103381 const param = parser.evaluateExpression(expr.arguments[0]);
103382 if (param.isConditional()) {
103383 for (const option of param.options) {
103384 const result = processItem(expr, option, weak);
103385 if (result === undefined) {
103386 processContext(expr, option, weak);
103387 }
103388 }
103389 const dep = new RequireResolveHeaderDependency(expr.callee.range);
103390 dep.loc = expr.loc;
103391 parser.state.current.addDependency(dep);
103392 return true;
103393 } else {
103394 const result = processItem(expr, param, weak);
103395 if (result === undefined) {
103396 processContext(expr, param, weak);
103397 }
103398 const dep = new RequireResolveHeaderDependency(expr.callee.range);
103399 dep.loc = expr.loc;
103400 parser.state.current.addDependency(dep);
103401 return true;
103402 }
103403 };
103404 const processItem = (expr, param, weak) => {
103405 if (param.isString()) {
103406 const dep = new RequireResolveDependency(param.string, param.range);
103407 dep.loc = expr.loc;
103408 dep.optional = !!parser.scope.inTry;
103409 dep.weak = weak;
103410 parser.state.current.addDependency(dep);
103411 return true;
103412 }
103413 };
103414 const processContext = (expr, param, weak) => {
103415 const dep = ContextDependencyHelpers.create(
103416 RequireResolveContextDependency,
103417 param.range,
103418 param,
103419 expr,
103420 options,
103421 {
103422 mode: weak ? "weak" : "sync"
103423 },
103424 parser
103425 );
103426 if (!dep) return;
103427 dep.loc = expr.loc;
103428 dep.optional = !!parser.scope.inTry;
103429 parser.state.current.addDependency(dep);
103430 return true;
103431 };
103432
103433 parser.hooks.call
103434 .for("require.resolve")
103435 .tap("RequireResolveDependencyParserPlugin", expr => {
103436 return process(expr, false);
103437 });
103438 parser.hooks.call
103439 .for("require.resolveWeak")
103440 .tap("RequireResolveDependencyParserPlugin", expr => {
103441 return process(expr, true);
103442 });
103443 }
103444}
103445module.exports = RequireResolveDependencyParserPlugin;
103446
103447
103448/***/ }),
103449
103450/***/ 69647:
103451/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103452
103453"use strict";
103454/*
103455 MIT License http://www.opensource.org/licenses/mit-license.php
103456 Author Tobias Koppers @sokra
103457*/
103458
103459const NullDependency = __webpack_require__(5088);
103460
103461class RequireResolveHeaderDependency extends NullDependency {
103462 constructor(range) {
103463 super();
103464 if (!Array.isArray(range)) throw new Error("range must be valid");
103465 this.range = range;
103466 }
103467}
103468
103469RequireResolveHeaderDependency.Template = class RequireResolveHeaderDependencyTemplate {
103470 apply(dep, source) {
103471 source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
103472 }
103473
103474 applyAsTemplateArgument(name, dep, source) {
103475 source.replace(dep.range[0], dep.range[1] - 1, "/*require.resolve*/");
103476 }
103477};
103478
103479module.exports = RequireResolveHeaderDependency;
103480
103481
103482/***/ }),
103483
103484/***/ 84828:
103485/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103486
103487"use strict";
103488/*
103489 MIT License http://www.opensource.org/licenses/mit-license.php
103490 Author Tobias Koppers @sokra
103491*/
103492
103493const ModuleDependency = __webpack_require__(90865);
103494
103495class SingleEntryDependency extends ModuleDependency {
103496 /**
103497 * @param {string} request request path for entry
103498 */
103499 constructor(request) {
103500 super(request);
103501 }
103502
103503 get type() {
103504 return "single entry";
103505 }
103506}
103507
103508module.exports = SingleEntryDependency;
103509
103510
103511/***/ }),
103512
103513/***/ 68166:
103514/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103515
103516"use strict";
103517/*
103518 MIT License http://www.opensource.org/licenses/mit-license.php
103519 Author Tobias Koppers @sokra
103520*/
103521
103522
103523const ParserHelpers = __webpack_require__(23999);
103524const WebpackError = __webpack_require__(97391);
103525
103526class SystemPlugin {
103527 constructor(options) {
103528 this.options = options;
103529 }
103530
103531 apply(compiler) {
103532 compiler.hooks.compilation.tap(
103533 "SystemPlugin",
103534 (compilation, { normalModuleFactory }) => {
103535 const handler = (parser, parserOptions) => {
103536 if (parserOptions.system !== undefined && !parserOptions.system)
103537 return;
103538
103539 const shouldWarn = parserOptions.system === undefined;
103540
103541 const setNotSupported = name => {
103542 parser.hooks.evaluateTypeof
103543 .for(name)
103544 .tap("SystemPlugin", ParserHelpers.evaluateToString("undefined"));
103545 parser.hooks.expression
103546 .for(name)
103547 .tap(
103548 "SystemPlugin",
103549 ParserHelpers.expressionIsUnsupported(
103550 parser,
103551 name + " is not supported by webpack."
103552 )
103553 );
103554 };
103555
103556 parser.hooks.typeof
103557 .for("System.import")
103558 .tap(
103559 "SystemPlugin",
103560 ParserHelpers.toConstantDependency(
103561 parser,
103562 JSON.stringify("function")
103563 )
103564 );
103565 parser.hooks.evaluateTypeof
103566 .for("System.import")
103567 .tap("SystemPlugin", ParserHelpers.evaluateToString("function"));
103568 parser.hooks.typeof
103569 .for("System")
103570 .tap(
103571 "SystemPlugin",
103572 ParserHelpers.toConstantDependency(
103573 parser,
103574 JSON.stringify("object")
103575 )
103576 );
103577 parser.hooks.evaluateTypeof
103578 .for("System")
103579 .tap("SystemPlugin", ParserHelpers.evaluateToString("object"));
103580
103581 setNotSupported("System.set");
103582 setNotSupported("System.get");
103583 setNotSupported("System.register");
103584
103585 parser.hooks.expression.for("System").tap("SystemPlugin", () => {
103586 const systemPolyfillRequire = ParserHelpers.requireFileAsExpression(
103587 parser.state.module.context,
103588 __webpack_require__.ab + "system.js"
103589 );
103590 return ParserHelpers.addParsedVariableToModule(
103591 parser,
103592 "System",
103593 systemPolyfillRequire
103594 );
103595 });
103596
103597 parser.hooks.call.for("System.import").tap("SystemPlugin", expr => {
103598 if (shouldWarn) {
103599 parser.state.module.warnings.push(
103600 new SystemImportDeprecationWarning(
103601 parser.state.module,
103602 expr.loc
103603 )
103604 );
103605 }
103606
103607 return parser.hooks.importCall.call(expr);
103608 });
103609 };
103610
103611 normalModuleFactory.hooks.parser
103612 .for("javascript/auto")
103613 .tap("SystemPlugin", handler);
103614 normalModuleFactory.hooks.parser
103615 .for("javascript/dynamic")
103616 .tap("SystemPlugin", handler);
103617 }
103618 );
103619 }
103620}
103621
103622class SystemImportDeprecationWarning extends WebpackError {
103623 constructor(module, loc) {
103624 super(
103625 "System.import() is deprecated and will be removed soon. Use import() instead.\n" +
103626 "For more info visit https://webpack.js.org/guides/code-splitting/"
103627 );
103628
103629 this.name = "SystemImportDeprecationWarning";
103630
103631 this.module = module;
103632 this.loc = loc;
103633
103634 Error.captureStackTrace(this, this.constructor);
103635 }
103636}
103637
103638module.exports = SystemPlugin;
103639
103640
103641/***/ }),
103642
103643/***/ 15826:
103644/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103645
103646"use strict";
103647/*
103648 MIT License http://www.opensource.org/licenses/mit-license.php
103649 Author Tobias Koppers @sokra
103650*/
103651
103652const NullDependency = __webpack_require__(5088);
103653const webpackMissingModule = __webpack_require__(75386).module;
103654
103655class UnsupportedDependency extends NullDependency {
103656 constructor(request, range) {
103657 super();
103658 this.request = request;
103659 this.range = range;
103660 }
103661}
103662
103663UnsupportedDependency.Template = class UnsupportedDependencyTemplate {
103664 apply(dep, source, runtime) {
103665 source.replace(
103666 dep.range[0],
103667 dep.range[1],
103668 webpackMissingModule(dep.request)
103669 );
103670 }
103671};
103672
103673module.exports = UnsupportedDependency;
103674
103675
103676/***/ }),
103677
103678/***/ 18925:
103679/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103680
103681"use strict";
103682/*
103683 MIT License http://www.opensource.org/licenses/mit-license.php
103684 Author Tobias Koppers @sokra
103685*/
103686
103687
103688const DependencyReference = __webpack_require__(71722);
103689const ModuleDependency = __webpack_require__(90865);
103690
103691class WebAssemblyExportImportedDependency extends ModuleDependency {
103692 constructor(exportName, request, name, valueType) {
103693 super(request);
103694 /** @type {string} */
103695 this.exportName = exportName;
103696 /** @type {string} */
103697 this.name = name;
103698 /** @type {string} */
103699 this.valueType = valueType;
103700 }
103701
103702 getReference() {
103703 if (!this.module) return null;
103704 return new DependencyReference(this.module, [this.name], false);
103705 }
103706
103707 get type() {
103708 return "wasm export import";
103709 }
103710}
103711
103712module.exports = WebAssemblyExportImportedDependency;
103713
103714
103715/***/ }),
103716
103717/***/ 52959:
103718/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
103719
103720"use strict";
103721/*
103722 MIT License http://www.opensource.org/licenses/mit-license.php
103723 Author Tobias Koppers @sokra
103724*/
103725
103726
103727const DependencyReference = __webpack_require__(71722);
103728const ModuleDependency = __webpack_require__(90865);
103729const UnsupportedWebAssemblyFeatureError = __webpack_require__(43101);
103730
103731/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */
103732
103733class WebAssemblyImportDependency extends ModuleDependency {
103734 /**
103735 * @param {string} request the request
103736 * @param {string} name the imported name
103737 * @param {ModuleImportDescription} description the WASM ast node
103738 * @param {false | string} onlyDirectImport if only direct imports are allowed
103739 */
103740 constructor(request, name, description, onlyDirectImport) {
103741 super(request);
103742 /** @type {string} */
103743 this.name = name;
103744 /** @type {ModuleImportDescription} */
103745 this.description = description;
103746 /** @type {false | string} */
103747 this.onlyDirectImport = onlyDirectImport;
103748 }
103749
103750 getReference() {
103751 if (!this.module) return null;
103752 return new DependencyReference(this.module, [this.name], false);
103753 }
103754
103755 getErrors() {
103756 if (
103757 this.onlyDirectImport &&
103758 this.module &&
103759 !this.module.type.startsWith("webassembly")
103760 ) {
103761 return [
103762 new UnsupportedWebAssemblyFeatureError(
103763 `Import "${this.name}" from "${this.request}" with ${this.onlyDirectImport} can only be used for direct wasm to wasm dependencies`
103764 )
103765 ];
103766 }
103767 }
103768
103769 get type() {
103770 return "wasm import";
103771 }
103772}
103773
103774module.exports = WebAssemblyImportDependency;
103775
103776
103777/***/ }),
103778
103779/***/ 75386:
103780/***/ (function(__unused_webpack_module, exports) {
103781
103782"use strict";
103783/*
103784 MIT License http://www.opensource.org/licenses/mit-license.php
103785 Author Tobias Koppers @sokra
103786*/
103787
103788const toErrorCode = err =>
103789 `var e = new Error(${JSON.stringify(err)}); e.code = 'MODULE_NOT_FOUND';`;
103790
103791exports.module = request =>
103792 `!(function webpackMissingModule() { ${exports.moduleCode(request)} }())`;
103793
103794exports.promise = request => {
103795 const errorCode = toErrorCode(`Cannot find module '${request}'`);
103796 return `Promise.reject(function webpackMissingModule() { ${errorCode} return e; }())`;
103797};
103798
103799exports.moduleCode = request => {
103800 const errorCode = toErrorCode(`Cannot find module '${request}'`);
103801 return `${errorCode} throw e;`;
103802};
103803
103804
103805/***/ }),
103806
103807/***/ 64197:
103808/***/ (function(module) {
103809
103810/*
103811 MIT License http://www.opensource.org/licenses/mit-license.php
103812 Author Tobias Koppers @sokra
103813*/
103814module.exports = expr => {
103815 // <FunctionExpression>
103816 if (
103817 expr.type === "FunctionExpression" ||
103818 expr.type === "ArrowFunctionExpression"
103819 ) {
103820 return {
103821 fn: expr,
103822 expressions: [],
103823 needThis: false
103824 };
103825 }
103826
103827 // <FunctionExpression>.bind(<Expression>)
103828 if (
103829 expr.type === "CallExpression" &&
103830 expr.callee.type === "MemberExpression" &&
103831 expr.callee.object.type === "FunctionExpression" &&
103832 expr.callee.property.type === "Identifier" &&
103833 expr.callee.property.name === "bind" &&
103834 expr.arguments.length === 1
103835 ) {
103836 return {
103837 fn: expr.callee.object,
103838 expressions: [expr.arguments[0]],
103839 needThis: undefined
103840 };
103841 }
103842 // (function(_this) {return <FunctionExpression>})(this) (Coffeescript)
103843 if (
103844 expr.type === "CallExpression" &&
103845 expr.callee.type === "FunctionExpression" &&
103846 expr.callee.body.type === "BlockStatement" &&
103847 expr.arguments.length === 1 &&
103848 expr.arguments[0].type === "ThisExpression" &&
103849 expr.callee.body.body &&
103850 expr.callee.body.body.length === 1 &&
103851 expr.callee.body.body[0].type === "ReturnStatement" &&
103852 expr.callee.body.body[0].argument &&
103853 expr.callee.body.body[0].argument.type === "FunctionExpression"
103854 ) {
103855 return {
103856 fn: expr.callee.body.body[0].argument,
103857 expressions: [],
103858 needThis: true
103859 };
103860 }
103861};
103862
103863
103864/***/ }),
103865
103866/***/ 49:
103867/***/ (function(module) {
103868
103869"use strict";
103870/*
103871 MIT License http://www.opensource.org/licenses/mit-license.php
103872 Author Tobias Koppers @sokra
103873*/
103874
103875
103876
103877/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
103878/** @typedef {import("./Dependency").SourcePosition} SourcePosition */
103879
103880// TODO webpack 5: pos must be SourcePosition
103881/**
103882 * @param {SourcePosition|DependencyLocation|string} pos position
103883 * @returns {string} formatted position
103884 */
103885const formatPosition = pos => {
103886 if (pos === null) return "";
103887 // TODO webpack 5: Simplify this
103888 if (typeof pos === "string") return pos;
103889 if (typeof pos === "number") return `${pos}`;
103890 if (typeof pos === "object") {
103891 if ("line" in pos && "column" in pos) {
103892 return `${pos.line}:${pos.column}`;
103893 } else if ("line" in pos) {
103894 return `${pos.line}:?`;
103895 } else if ("index" in pos) {
103896 // TODO webpack 5 remove this case
103897 return `+${pos.index}`;
103898 } else {
103899 return "";
103900 }
103901 }
103902 return "";
103903};
103904
103905// TODO webpack 5: loc must be DependencyLocation
103906/**
103907 * @param {DependencyLocation|SourcePosition|string} loc location
103908 * @returns {string} formatted location
103909 */
103910const formatLocation = loc => {
103911 if (loc === null) return "";
103912 // TODO webpack 5: Simplify this
103913 if (typeof loc === "string") return loc;
103914 if (typeof loc === "number") return `${loc}`;
103915 if (typeof loc === "object") {
103916 if ("start" in loc && loc.start && "end" in loc && loc.end) {
103917 if (
103918 typeof loc.start === "object" &&
103919 typeof loc.start.line === "number" &&
103920 typeof loc.end === "object" &&
103921 typeof loc.end.line === "number" &&
103922 typeof loc.end.column === "number" &&
103923 loc.start.line === loc.end.line
103924 ) {
103925 return `${formatPosition(loc.start)}-${loc.end.column}`;
103926 } else {
103927 return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
103928 }
103929 }
103930 if ("start" in loc && loc.start) {
103931 return formatPosition(loc.start);
103932 }
103933 if ("name" in loc && "index" in loc) {
103934 return `${loc.name}[${loc.index}]`;
103935 }
103936 if ("name" in loc) {
103937 return loc.name;
103938 }
103939 return formatPosition(loc);
103940 }
103941 return "";
103942};
103943
103944module.exports = formatLocation;
103945
103946
103947/***/ }),
103948
103949/***/ 47194:
103950/***/ (function(__unused_webpack_module, exports) {
103951
103952"use strict";
103953/*
103954 MIT License http://www.opensource.org/licenses/mit-license.php
103955 Author Tobias Koppers @sokra
103956 */
103957
103958
103959
103960const LogType = Object.freeze({
103961 error: /** @type {"error"} */ ("error"), // message, c style arguments
103962 warn: /** @type {"warn"} */ ("warn"), // message, c style arguments
103963 info: /** @type {"info"} */ ("info"), // message, c style arguments
103964 log: /** @type {"log"} */ ("log"), // message, c style arguments
103965 debug: /** @type {"debug"} */ ("debug"), // message, c style arguments
103966
103967 trace: /** @type {"trace"} */ ("trace"), // no arguments
103968
103969 group: /** @type {"group"} */ ("group"), // [label]
103970 groupCollapsed: /** @type {"groupCollapsed"} */ ("groupCollapsed"), // [label]
103971 groupEnd: /** @type {"groupEnd"} */ ("groupEnd"), // [label]
103972
103973 profile: /** @type {"profile"} */ ("profile"), // [profileName]
103974 profileEnd: /** @type {"profileEnd"} */ ("profileEnd"), // [profileName]
103975
103976 time: /** @type {"time"} */ ("time"), // name, time as [seconds, nanoseconds]
103977
103978 clear: /** @type {"clear"} */ ("clear"), // no arguments
103979 status: /** @type {"status"} */ ("status") // message, arguments
103980});
103981
103982exports.LogType = LogType;
103983
103984/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */
103985
103986const LOG_SYMBOL = Symbol("webpack logger raw log method");
103987const TIMERS_SYMBOL = Symbol("webpack logger times");
103988
103989class WebpackLogger {
103990 /**
103991 * @param {function(LogTypeEnum, any[]=): void} log log function
103992 */
103993 constructor(log) {
103994 this[LOG_SYMBOL] = log;
103995 }
103996
103997 error(...args) {
103998 this[LOG_SYMBOL](LogType.error, args);
103999 }
104000
104001 warn(...args) {
104002 this[LOG_SYMBOL](LogType.warn, args);
104003 }
104004
104005 info(...args) {
104006 this[LOG_SYMBOL](LogType.info, args);
104007 }
104008
104009 log(...args) {
104010 this[LOG_SYMBOL](LogType.log, args);
104011 }
104012
104013 debug(...args) {
104014 this[LOG_SYMBOL](LogType.debug, args);
104015 }
104016
104017 assert(assertion, ...args) {
104018 if (!assertion) {
104019 this[LOG_SYMBOL](LogType.error, args);
104020 }
104021 }
104022
104023 trace() {
104024 this[LOG_SYMBOL](LogType.trace, ["Trace"]);
104025 }
104026
104027 clear() {
104028 this[LOG_SYMBOL](LogType.clear);
104029 }
104030
104031 status(...args) {
104032 this[LOG_SYMBOL](LogType.status, args);
104033 }
104034
104035 group(...args) {
104036 this[LOG_SYMBOL](LogType.group, args);
104037 }
104038
104039 groupCollapsed(...args) {
104040 this[LOG_SYMBOL](LogType.groupCollapsed, args);
104041 }
104042
104043 groupEnd(...args) {
104044 this[LOG_SYMBOL](LogType.groupEnd, args);
104045 }
104046
104047 profile(label) {
104048 this[LOG_SYMBOL](LogType.profile, [label]);
104049 }
104050
104051 profileEnd(label) {
104052 this[LOG_SYMBOL](LogType.profileEnd, [label]);
104053 }
104054
104055 time(label) {
104056 this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map();
104057 this[TIMERS_SYMBOL].set(label, process.hrtime());
104058 }
104059
104060 timeLog(label) {
104061 const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
104062 if (!prev) {
104063 throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`);
104064 }
104065 const time = process.hrtime(prev);
104066 this[LOG_SYMBOL](LogType.time, [label, ...time]);
104067 }
104068
104069 timeEnd(label) {
104070 const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
104071 if (!prev) {
104072 throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
104073 }
104074 const time = process.hrtime(prev);
104075 this[TIMERS_SYMBOL].delete(label);
104076 this[LOG_SYMBOL](LogType.time, [label, ...time]);
104077 }
104078}
104079
104080exports.Logger = WebpackLogger;
104081
104082
104083/***/ }),
104084
104085/***/ 88838:
104086/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104087
104088"use strict";
104089/*
104090 MIT License http://www.opensource.org/licenses/mit-license.php
104091 Author Tobias Koppers @sokra
104092*/
104093
104094
104095
104096const { LogType } = __webpack_require__(47194);
104097
104098/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */
104099/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */
104100/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */
104101
104102/** @typedef {function(string): boolean} FilterFunction */
104103
104104/**
104105 * @typedef {Object} LoggerOptions
104106 * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel
104107 * @property {FilterTypes|boolean} debug filter for debug logging
104108 * @property {Console & { status?: Function, logTime?: Function }} console the console to log to
104109 */
104110
104111/**
104112 * @param {FilterItemTypes} item an input item
104113 * @returns {FilterFunction} filter funtion
104114 */
104115const filterToFunction = item => {
104116 if (typeof item === "string") {
104117 const regExp = new RegExp(
104118 `[\\\\/]${item.replace(
104119 // eslint-disable-next-line no-useless-escape
104120 /[-[\]{}()*+?.\\^$|]/g,
104121 "\\$&"
104122 )}([\\\\/]|$|!|\\?)`
104123 );
104124 return ident => regExp.test(ident);
104125 }
104126 if (item && typeof item === "object" && typeof item.test === "function") {
104127 return ident => item.test(ident);
104128 }
104129 if (typeof item === "function") {
104130 return item;
104131 }
104132 if (typeof item === "boolean") {
104133 return () => item;
104134 }
104135};
104136
104137/**
104138 * @enum {number}
104139 */
104140const LogLevel = {
104141 none: 6,
104142 false: 6,
104143 error: 5,
104144 warn: 4,
104145 info: 3,
104146 log: 2,
104147 true: 2,
104148 verbose: 1
104149};
104150
104151/**
104152 * @param {LoggerOptions} options options object
104153 * @returns {function(string, LogTypeEnum, any[]): void} logging function
104154 */
104155module.exports = ({ level = "info", debug = false, console }) => {
104156 const debugFilters =
104157 typeof debug === "boolean"
104158 ? [() => debug]
104159 : /** @type {FilterItemTypes[]} */ ([])
104160 .concat(debug)
104161 .map(filterToFunction);
104162 /** @type {number} */
104163 const loglevel = LogLevel[`${level}`] || 0;
104164
104165 /**
104166 * @param {string} name name of the logger
104167 * @param {LogTypeEnum} type type of the log entry
104168 * @param {any[]} args arguments of the log entry
104169 * @returns {void}
104170 */
104171 const logger = (name, type, args) => {
104172 const labeledArgs = () => {
104173 if (Array.isArray(args)) {
104174 if (args.length > 0 && typeof args[0] === "string") {
104175 return [`[${name}] ${args[0]}`, ...args.slice(1)];
104176 } else {
104177 return [`[${name}]`, ...args];
104178 }
104179 } else {
104180 return [];
104181 }
104182 };
104183 const debug = debugFilters.some(f => f(name));
104184 switch (type) {
104185 case LogType.debug:
104186 if (!debug) return;
104187 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104188 if (typeof console.debug === "function") {
104189 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104190 console.debug(...labeledArgs());
104191 } else {
104192 console.log(...labeledArgs());
104193 }
104194 break;
104195 case LogType.log:
104196 if (!debug && loglevel > LogLevel.log) return;
104197 console.log(...labeledArgs());
104198 break;
104199 case LogType.info:
104200 if (!debug && loglevel > LogLevel.info) return;
104201 console.info(...labeledArgs());
104202 break;
104203 case LogType.warn:
104204 if (!debug && loglevel > LogLevel.warn) return;
104205 console.warn(...labeledArgs());
104206 break;
104207 case LogType.error:
104208 if (!debug && loglevel > LogLevel.error) return;
104209 console.error(...labeledArgs());
104210 break;
104211 case LogType.trace:
104212 if (!debug) return;
104213 console.trace();
104214 break;
104215 case LogType.groupCollapsed:
104216 if (!debug && loglevel > LogLevel.log) return;
104217 if (!debug && loglevel > LogLevel.verbose) {
104218 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104219 if (typeof console.groupCollapsed === "function") {
104220 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104221 console.groupCollapsed(...labeledArgs());
104222 } else {
104223 console.log(...labeledArgs());
104224 }
104225 break;
104226 }
104227 // falls through
104228 case LogType.group:
104229 if (!debug && loglevel > LogLevel.log) return;
104230 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104231 if (typeof console.group === "function") {
104232 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104233 console.group(...labeledArgs());
104234 } else {
104235 console.log(...labeledArgs());
104236 }
104237 break;
104238 case LogType.groupEnd:
104239 if (!debug && loglevel > LogLevel.log) return;
104240 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104241 if (typeof console.groupEnd === "function") {
104242 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104243 console.groupEnd();
104244 }
104245 break;
104246 case LogType.time: {
104247 if (!debug && loglevel > LogLevel.log) return;
104248 const ms = args[1] * 1000 + args[2] / 1000000;
104249 const msg = `[${name}] ${args[0]}: ${ms}ms`;
104250 if (typeof console.logTime === "function") {
104251 console.logTime(msg);
104252 } else {
104253 console.log(msg);
104254 }
104255 break;
104256 }
104257 case LogType.profile:
104258 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104259 if (typeof console.profile === "function") {
104260 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104261 console.profile(...labeledArgs());
104262 }
104263 break;
104264 case LogType.profileEnd:
104265 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104266 if (typeof console.profileEnd === "function") {
104267 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104268 console.profileEnd(...labeledArgs());
104269 }
104270 break;
104271 case LogType.clear:
104272 if (!debug && loglevel > LogLevel.log) return;
104273 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104274 if (typeof console.clear === "function") {
104275 // eslint-disable-next-line node/no-unsupported-features/node-builtins
104276 console.clear();
104277 }
104278 break;
104279 case LogType.status:
104280 if (!debug && loglevel > LogLevel.info) return;
104281 if (typeof console.status === "function") {
104282 if (args.length === 0) {
104283 console.status();
104284 } else {
104285 console.status(...labeledArgs());
104286 }
104287 } else {
104288 if (args.length !== 0) {
104289 console.info(...labeledArgs());
104290 }
104291 }
104292 break;
104293 default:
104294 throw new Error(`Unexpected LogType ${type}`);
104295 }
104296 };
104297 return logger;
104298};
104299
104300
104301/***/ }),
104302
104303/***/ 62299:
104304/***/ (function(module) {
104305
104306"use strict";
104307/*
104308 MIT License http://www.opensource.org/licenses/mit-license.php
104309 Author Tobias Koppers @sokra
104310 */
104311
104312
104313
104314/**
104315 * @param {any[]} args items to be truncated
104316 * @param {number} maxLength maximum length of args including spaces between
104317 * @returns {string[]} truncated args
104318 */
104319const truncateArgs = (args, maxLength) => {
104320 const lengths = args.map(a => `${a}`.length);
104321 const availableLength = maxLength - lengths.length + 1;
104322
104323 if (availableLength > 0 && args.length === 1) {
104324 if (availableLength >= args[0].length) {
104325 return args;
104326 } else if (availableLength > 3) {
104327 return ["..." + args[0].slice(-availableLength + 3)];
104328 } else {
104329 return [args[0].slice(-availableLength)];
104330 }
104331 }
104332
104333 // Check if there is space for at least 4 chars per arg
104334 if (availableLength < lengths.reduce((s, i) => s + Math.min(i, 6), 0)) {
104335 // remove args
104336 if (args.length > 1)
104337 return truncateArgs(args.slice(0, args.length - 1), maxLength);
104338 return [];
104339 }
104340
104341 let currentLength = lengths.reduce((a, b) => a + b, 0);
104342
104343 // Check if all fits into maxLength
104344 if (currentLength <= availableLength) return args;
104345
104346 // Try to remove chars from the longest items until it fits
104347 while (currentLength > availableLength) {
104348 const maxLength = Math.max(...lengths);
104349 const shorterItems = lengths.filter(l => l !== maxLength);
104350 const nextToMaxLength =
104351 shorterItems.length > 0 ? Math.max(...shorterItems) : 0;
104352 const maxReduce = maxLength - nextToMaxLength;
104353 let maxItems = lengths.length - shorterItems.length;
104354 let overrun = currentLength - availableLength;
104355 for (let i = 0; i < lengths.length; i++) {
104356 if (lengths[i] === maxLength) {
104357 const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce);
104358 lengths[i] -= reduce;
104359 currentLength -= reduce;
104360 overrun -= reduce;
104361 maxItems--;
104362 }
104363 }
104364 }
104365
104366 // Return args reduced to length in lengths
104367 return args.map((a, i) => {
104368 const str = `${a}`;
104369 const length = lengths[i];
104370 if (str.length === length) {
104371 return str;
104372 } else if (length > 5) {
104373 return "..." + str.slice(-length + 3);
104374 } else if (length > 0) {
104375 return str.slice(-length);
104376 } else {
104377 return "";
104378 }
104379 });
104380};
104381
104382module.exports = truncateArgs;
104383
104384
104385/***/ }),
104386
104387/***/ 45249:
104388/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104389
104390"use strict";
104391/*
104392 MIT License http://www.opensource.org/licenses/mit-license.php
104393 Author Tobias Koppers @sokra
104394*/
104395
104396
104397
104398const { ConcatSource } = __webpack_require__(53665);
104399
104400class NodeChunkTemplatePlugin {
104401 apply(chunkTemplate) {
104402 chunkTemplate.hooks.render.tap(
104403 "NodeChunkTemplatePlugin",
104404 (modules, chunk) => {
104405 const source = new ConcatSource();
104406 source.add(
104407 `exports.ids = ${JSON.stringify(chunk.ids)};\nexports.modules = `
104408 );
104409 source.add(modules);
104410 source.add(";");
104411 return source;
104412 }
104413 );
104414 chunkTemplate.hooks.hash.tap("NodeChunkTemplatePlugin", hash => {
104415 hash.update("node");
104416 hash.update("3");
104417 });
104418 }
104419}
104420
104421module.exports = NodeChunkTemplatePlugin;
104422
104423
104424/***/ }),
104425
104426/***/ 52520:
104427/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104428
104429"use strict";
104430/*
104431 MIT License http://www.opensource.org/licenses/mit-license.php
104432 Author Tobias Koppers @sokra
104433*/
104434
104435
104436const NodeWatchFileSystem = __webpack_require__(71610);
104437const NodeOutputFileSystem = __webpack_require__(31836);
104438const NodeJsInputFileSystem = __webpack_require__(13445);
104439const CachedInputFileSystem = __webpack_require__(75544);
104440const createConsoleLogger = __webpack_require__(88838);
104441const nodeConsole = __webpack_require__(7886);
104442
104443class NodeEnvironmentPlugin {
104444 constructor(options) {
104445 this.options = options || {};
104446 }
104447
104448 apply(compiler) {
104449 compiler.infrastructureLogger = createConsoleLogger(
104450 Object.assign(
104451 {
104452 level: "info",
104453 debug: false,
104454 console: nodeConsole
104455 },
104456 this.options.infrastructureLogging
104457 )
104458 );
104459 compiler.inputFileSystem = new CachedInputFileSystem(
104460 new NodeJsInputFileSystem(),
104461 60000
104462 );
104463 const inputFileSystem = compiler.inputFileSystem;
104464 compiler.outputFileSystem = new NodeOutputFileSystem();
104465 compiler.watchFileSystem = new NodeWatchFileSystem(
104466 compiler.inputFileSystem
104467 );
104468 compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
104469 if (compiler.inputFileSystem === inputFileSystem) inputFileSystem.purge();
104470 });
104471 }
104472}
104473module.exports = NodeEnvironmentPlugin;
104474
104475
104476/***/ }),
104477
104478/***/ 95909:
104479/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104480
104481"use strict";
104482/*
104483 MIT License http://www.opensource.org/licenses/mit-license.php
104484 Author Tobias Koppers @sokra
104485*/
104486
104487
104488const { ConcatSource } = __webpack_require__(53665);
104489
104490class NodeHotUpdateChunkTemplatePlugin {
104491 apply(hotUpdateChunkTemplate) {
104492 hotUpdateChunkTemplate.hooks.render.tap(
104493 "NodeHotUpdateChunkTemplatePlugin",
104494 (modulesSource, modules, removedModules, hash, id) => {
104495 const source = new ConcatSource();
104496 source.add(
104497 "exports.id = " + JSON.stringify(id) + ";\nexports.modules = "
104498 );
104499 source.add(modulesSource);
104500 source.add(";");
104501 return source;
104502 }
104503 );
104504 hotUpdateChunkTemplate.hooks.hash.tap(
104505 "NodeHotUpdateChunkTemplatePlugin",
104506 hash => {
104507 hash.update("NodeHotUpdateChunkTemplatePlugin");
104508 hash.update("3");
104509 hash.update(
104510 hotUpdateChunkTemplate.outputOptions.hotUpdateFunction + ""
104511 );
104512 hash.update(hotUpdateChunkTemplate.outputOptions.library + "");
104513 }
104514 );
104515 }
104516}
104517module.exports = NodeHotUpdateChunkTemplatePlugin;
104518
104519
104520/***/ }),
104521
104522/***/ 33514:
104523/***/ (function(module) {
104524
104525/*
104526 MIT License http://www.opensource.org/licenses/mit-license.php
104527 Author Tobias Koppers @sokra
104528*/
104529// eslint-disable-next-line no-unused-vars
104530var $hotChunkFilename$ = undefined;
104531var hotAddUpdateChunk = undefined;
104532var installedChunks = undefined;
104533var $hotMainFilename$ = undefined;
104534
104535module.exports = function() {
104536 // eslint-disable-next-line no-unused-vars
104537 function hotDownloadUpdateChunk(chunkId) {
104538 var chunk = require("./" + $hotChunkFilename$);
104539 hotAddUpdateChunk(chunk.id, chunk.modules);
104540 }
104541
104542 // eslint-disable-next-line no-unused-vars
104543 function hotDownloadManifest() {
104544 try {
104545 var update = require("./" + $hotMainFilename$);
104546 } catch (e) {
104547 return Promise.resolve();
104548 }
104549 return Promise.resolve(update);
104550 }
104551
104552 //eslint-disable-next-line no-unused-vars
104553 function hotDisposeChunk(chunkId) {
104554 delete installedChunks[chunkId];
104555 }
104556};
104557
104558
104559/***/ }),
104560
104561/***/ 51433:
104562/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104563
104564/*
104565 MIT License http://www.opensource.org/licenses/mit-license.php
104566 Author Tobias Koppers @sokra
104567*/
104568// eslint-disable-next-line no-unused-vars
104569var $hotChunkFilename$ = undefined;
104570var $require$ = undefined;
104571var hotAddUpdateChunk = undefined;
104572var $hotMainFilename$ = undefined;
104573var installedChunks = undefined;
104574
104575module.exports = function() {
104576 // eslint-disable-next-line no-unused-vars
104577 function hotDownloadUpdateChunk(chunkId) {
104578 var filename = __webpack_require__(85622).join(__dirname, $hotChunkFilename$);
104579 __webpack_require__(35747).readFile(filename, "utf-8", function(err, content) {
104580 if (err) {
104581 if ($require$.onError) return $require$.oe(err);
104582 throw err;
104583 }
104584 var chunk = {};
104585 __webpack_require__(92184).runInThisContext(
104586 "(function(exports) {" + content + "\n})",
104587 { filename: filename }
104588 )(chunk);
104589 hotAddUpdateChunk(chunk.id, chunk.modules);
104590 });
104591 }
104592
104593 // eslint-disable-next-line no-unused-vars
104594 function hotDownloadManifest() {
104595 var filename = __webpack_require__(85622).join(__dirname, $hotMainFilename$);
104596 return new Promise(function(resolve, reject) {
104597 __webpack_require__(35747).readFile(filename, "utf-8", function(err, content) {
104598 if (err) return resolve();
104599 try {
104600 var update = JSON.parse(content);
104601 } catch (e) {
104602 return reject(e);
104603 }
104604 resolve(update);
104605 });
104606 });
104607 }
104608
104609 // eslint-disable-next-line no-unused-vars
104610 function hotDisposeChunk(chunkId) {
104611 delete installedChunks[chunkId];
104612 }
104613};
104614
104615
104616/***/ }),
104617
104618/***/ 78597:
104619/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104620
104621"use strict";
104622/*
104623 MIT License http://www.opensource.org/licenses/mit-license.php
104624 Author Tobias Koppers @sokra
104625*/
104626
104627
104628const Template = __webpack_require__(96066);
104629
104630module.exports = class NodeMainTemplatePlugin {
104631 constructor(asyncChunkLoading) {
104632 this.asyncChunkLoading = asyncChunkLoading;
104633 }
104634
104635 apply(mainTemplate) {
104636 const needChunkOnDemandLoadingCode = chunk => {
104637 for (const chunkGroup of chunk.groupsIterable) {
104638 if (chunkGroup.getNumberOfChildren() > 0) return true;
104639 }
104640 return false;
104641 };
104642 const asyncChunkLoading = this.asyncChunkLoading;
104643 mainTemplate.hooks.localVars.tap(
104644 "NodeMainTemplatePlugin",
104645 (source, chunk) => {
104646 if (needChunkOnDemandLoadingCode(chunk)) {
104647 return Template.asString([
104648 source,
104649 "",
104650 "// object to store loaded chunks",
104651 '// "0" means "already loaded"',
104652 "var installedChunks = {",
104653 Template.indent(
104654 chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
104655 ),
104656 "};"
104657 ]);
104658 }
104659 return source;
104660 }
104661 );
104662 mainTemplate.hooks.requireExtensions.tap(
104663 "NodeMainTemplatePlugin",
104664 (source, chunk) => {
104665 if (needChunkOnDemandLoadingCode(chunk)) {
104666 return Template.asString([
104667 source,
104668 "",
104669 "// uncaught error handler for webpack runtime",
104670 `${mainTemplate.requireFn}.oe = function(err) {`,
104671 Template.indent([
104672 "process.nextTick(function() {",
104673 Template.indent(
104674 "throw err; // catch this error by using import().catch()"
104675 ),
104676 "});"
104677 ]),
104678 "};"
104679 ]);
104680 }
104681 return source;
104682 }
104683 );
104684 mainTemplate.hooks.requireEnsure.tap(
104685 "NodeMainTemplatePlugin",
104686 (source, chunk, hash) => {
104687 const chunkFilename = mainTemplate.outputOptions.chunkFilename;
104688 const chunkMaps = chunk.getChunkMaps();
104689 const insertMoreModules = [
104690 "var moreModules = chunk.modules, chunkIds = chunk.ids;",
104691 "for(var moduleId in moreModules) {",
104692 Template.indent(
104693 mainTemplate.renderAddModule(
104694 hash,
104695 chunk,
104696 "moduleId",
104697 "moreModules[moduleId]"
104698 )
104699 ),
104700 "}"
104701 ];
104702 if (asyncChunkLoading) {
104703 return Template.asString([
104704 source,
104705 "",
104706 "// ReadFile + VM.run chunk loading for javascript",
104707 "",
104708 "var installedChunkData = installedChunks[chunkId];",
104709 'if(installedChunkData !== 0) { // 0 means "already installed".',
104710 Template.indent([
104711 '// array of [resolve, reject, promise] means "currently loading"',
104712 "if(installedChunkData) {",
104713 Template.indent(["promises.push(installedChunkData[2]);"]),
104714 "} else {",
104715 Template.indent([
104716 "// load the chunk and return promise to it",
104717 "var promise = new Promise(function(resolve, reject) {",
104718 Template.indent([
104719 "installedChunkData = installedChunks[chunkId] = [resolve, reject];",
104720 "var filename = require('path').join(__dirname, " +
104721 mainTemplate.getAssetPath(
104722 JSON.stringify(`/${chunkFilename}`),
104723 {
104724 hash: `" + ${mainTemplate.renderCurrentHashCode(
104725 hash
104726 )} + "`,
104727 hashWithLength: length =>
104728 `" + ${mainTemplate.renderCurrentHashCode(
104729 hash,
104730 length
104731 )} + "`,
104732 chunk: {
104733 id: '" + chunkId + "',
104734 hash: `" + ${JSON.stringify(
104735 chunkMaps.hash
104736 )}[chunkId] + "`,
104737 hashWithLength: length => {
104738 const shortChunkHashMap = {};
104739 for (const chunkId of Object.keys(chunkMaps.hash)) {
104740 if (typeof chunkMaps.hash[chunkId] === "string") {
104741 shortChunkHashMap[chunkId] = chunkMaps.hash[
104742 chunkId
104743 ].substr(0, length);
104744 }
104745 }
104746 return `" + ${JSON.stringify(
104747 shortChunkHashMap
104748 )}[chunkId] + "`;
104749 },
104750 contentHash: {
104751 javascript: `" + ${JSON.stringify(
104752 chunkMaps.contentHash.javascript
104753 )}[chunkId] + "`
104754 },
104755 contentHashWithLength: {
104756 javascript: length => {
104757 const shortContentHashMap = {};
104758 const contentHash =
104759 chunkMaps.contentHash.javascript;
104760 for (const chunkId of Object.keys(contentHash)) {
104761 if (typeof contentHash[chunkId] === "string") {
104762 shortContentHashMap[chunkId] = contentHash[
104763 chunkId
104764 ].substr(0, length);
104765 }
104766 }
104767 return `" + ${JSON.stringify(
104768 shortContentHashMap
104769 )}[chunkId] + "`;
104770 }
104771 },
104772 name: `" + (${JSON.stringify(
104773 chunkMaps.name
104774 )}[chunkId]||chunkId) + "`
104775 },
104776 contentHashType: "javascript"
104777 }
104778 ) +
104779 ");",
104780 "require('fs').readFile(filename, 'utf-8', function(err, content) {",
104781 Template.indent(
104782 [
104783 "if(err) return reject(err);",
104784 "var chunk = {};",
104785 "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" +
104786 "(chunk, require, require('path').dirname(filename), filename);"
104787 ]
104788 .concat(insertMoreModules)
104789 .concat([
104790 "var callbacks = [];",
104791 "for(var i = 0; i < chunkIds.length; i++) {",
104792 Template.indent([
104793 "if(installedChunks[chunkIds[i]])",
104794 Template.indent([
104795 "callbacks = callbacks.concat(installedChunks[chunkIds[i]][0]);"
104796 ]),
104797 "installedChunks[chunkIds[i]] = 0;"
104798 ]),
104799 "}",
104800 "for(i = 0; i < callbacks.length; i++)",
104801 Template.indent("callbacks[i]();")
104802 ])
104803 ),
104804 "});"
104805 ]),
104806 "});",
104807 "promises.push(installedChunkData[2] = promise);"
104808 ]),
104809 "}"
104810 ]),
104811 "}"
104812 ]);
104813 } else {
104814 const request = mainTemplate.getAssetPath(
104815 JSON.stringify(`./${chunkFilename}`),
104816 {
104817 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
104818 hashWithLength: length =>
104819 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
104820 chunk: {
104821 id: '" + chunkId + "',
104822 hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
104823 hashWithLength: length => {
104824 const shortChunkHashMap = {};
104825 for (const chunkId of Object.keys(chunkMaps.hash)) {
104826 if (typeof chunkMaps.hash[chunkId] === "string") {
104827 shortChunkHashMap[chunkId] = chunkMaps.hash[
104828 chunkId
104829 ].substr(0, length);
104830 }
104831 }
104832 return `" + ${JSON.stringify(
104833 shortChunkHashMap
104834 )}[chunkId] + "`;
104835 },
104836 contentHash: {
104837 javascript: `" + ${JSON.stringify(
104838 chunkMaps.contentHash.javascript
104839 )}[chunkId] + "`
104840 },
104841 contentHashWithLength: {
104842 javascript: length => {
104843 const shortContentHashMap = {};
104844 const contentHash = chunkMaps.contentHash.javascript;
104845 for (const chunkId of Object.keys(contentHash)) {
104846 if (typeof contentHash[chunkId] === "string") {
104847 shortContentHashMap[chunkId] = contentHash[
104848 chunkId
104849 ].substr(0, length);
104850 }
104851 }
104852 return `" + ${JSON.stringify(
104853 shortContentHashMap
104854 )}[chunkId] + "`;
104855 }
104856 },
104857 name: `" + (${JSON.stringify(
104858 chunkMaps.name
104859 )}[chunkId]||chunkId) + "`
104860 },
104861 contentHashType: "javascript"
104862 }
104863 );
104864 return Template.asString([
104865 source,
104866 "",
104867 "// require() chunk loading for javascript",
104868 "",
104869 '// "0" is the signal for "already loaded"',
104870 "if(installedChunks[chunkId] !== 0) {",
104871 Template.indent(
104872 [`var chunk = require(${request});`]
104873 .concat(insertMoreModules)
104874 .concat([
104875 "for(var i = 0; i < chunkIds.length; i++)",
104876 Template.indent("installedChunks[chunkIds[i]] = 0;")
104877 ])
104878 ),
104879 "}"
104880 ]);
104881 }
104882 }
104883 );
104884 mainTemplate.hooks.hotBootstrap.tap(
104885 "NodeMainTemplatePlugin",
104886 (source, chunk, hash) => {
104887 const hotUpdateChunkFilename =
104888 mainTemplate.outputOptions.hotUpdateChunkFilename;
104889 const hotUpdateMainFilename =
104890 mainTemplate.outputOptions.hotUpdateMainFilename;
104891 const chunkMaps = chunk.getChunkMaps();
104892 const currentHotUpdateChunkFilename = mainTemplate.getAssetPath(
104893 JSON.stringify(hotUpdateChunkFilename),
104894 {
104895 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
104896 hashWithLength: length =>
104897 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
104898 chunk: {
104899 id: '" + chunkId + "',
104900 hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
104901 hashWithLength: length => {
104902 const shortChunkHashMap = {};
104903 for (const chunkId of Object.keys(chunkMaps.hash)) {
104904 if (typeof chunkMaps.hash[chunkId] === "string") {
104905 shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(
104906 0,
104907 length
104908 );
104909 }
104910 }
104911 return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
104912 },
104913 name: `" + (${JSON.stringify(
104914 chunkMaps.name
104915 )}[chunkId]||chunkId) + "`
104916 }
104917 }
104918 );
104919 const currentHotUpdateMainFilename = mainTemplate.getAssetPath(
104920 JSON.stringify(hotUpdateMainFilename),
104921 {
104922 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
104923 hashWithLength: length =>
104924 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`
104925 }
104926 );
104927 return Template.getFunctionContent(
104928 asyncChunkLoading
104929 ? __webpack_require__(51433)
104930 : __webpack_require__(33514)
104931 )
104932 .replace(/\$require\$/g, mainTemplate.requireFn)
104933 .replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
104934 .replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename);
104935 }
104936 );
104937 mainTemplate.hooks.hash.tap("NodeMainTemplatePlugin", hash => {
104938 hash.update("node");
104939 hash.update("4");
104940 });
104941 }
104942};
104943
104944
104945/***/ }),
104946
104947/***/ 31836:
104948/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104949
104950"use strict";
104951/*
104952 MIT License http://www.opensource.org/licenses/mit-license.php
104953 Author Tobias Koppers @sokra
104954*/
104955
104956
104957const fs = __webpack_require__(35747);
104958const path = __webpack_require__(85622);
104959const mkdirp = __webpack_require__(50998);
104960
104961class NodeOutputFileSystem {
104962 constructor() {
104963 this.mkdirp = mkdirp;
104964 this.mkdir = fs.mkdir.bind(fs);
104965 this.rmdir = fs.rmdir.bind(fs);
104966 this.unlink = fs.unlink.bind(fs);
104967 this.writeFile = fs.writeFile.bind(fs);
104968 this.join = path.join.bind(path);
104969 }
104970}
104971
104972module.exports = NodeOutputFileSystem;
104973
104974
104975/***/ }),
104976
104977/***/ 9128:
104978/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
104979
104980"use strict";
104981/*
104982 MIT License http://www.opensource.org/licenses/mit-license.php
104983 Author Tobias Koppers @sokra
104984*/
104985
104986const AliasPlugin = __webpack_require__(15005);
104987const ParserHelpers = __webpack_require__(23999);
104988const nodeLibsBrowser = __webpack_require__(27852);
104989
104990module.exports = class NodeSourcePlugin {
104991 constructor(options) {
104992 this.options = options;
104993 }
104994 apply(compiler) {
104995 const options = this.options;
104996 if (options === false) {
104997 // allow single kill switch to turn off this plugin
104998 return;
104999 }
105000
105001 const getPathToModule = (module, type) => {
105002 if (type === true || (type === undefined && nodeLibsBrowser[module])) {
105003 if (!nodeLibsBrowser[module]) {
105004 throw new Error(
105005 `No browser version for node.js core module ${module} available`
105006 );
105007 }
105008 return nodeLibsBrowser[module];
105009 } else if (type === "mock") {
105010 return require.resolve(`node-libs-browser/mock/${module}`);
105011 } else if (type === "empty") {
105012 return __webpack_require__.ab + "empty.js";
105013 } else {
105014 return module;
105015 }
105016 };
105017
105018 const addExpression = (parser, name, module, type, suffix) => {
105019 suffix = suffix || "";
105020 parser.hooks.expression.for(name).tap("NodeSourcePlugin", () => {
105021 if (
105022 parser.state.module &&
105023 parser.state.module.resource === getPathToModule(module, type)
105024 )
105025 return;
105026 const mockModule = ParserHelpers.requireFileAsExpression(
105027 parser.state.module.context,
105028 getPathToModule(module, type)
105029 );
105030 return ParserHelpers.addParsedVariableToModule(
105031 parser,
105032 name,
105033 mockModule + suffix
105034 );
105035 });
105036 };
105037
105038 compiler.hooks.compilation.tap(
105039 "NodeSourcePlugin",
105040 (compilation, { normalModuleFactory }) => {
105041 const handler = (parser, parserOptions) => {
105042 if (parserOptions.node === false) return;
105043
105044 let localOptions = options;
105045 if (parserOptions.node) {
105046 localOptions = Object.assign({}, localOptions, parserOptions.node);
105047 }
105048 if (localOptions.global) {
105049 parser.hooks.expression
105050 .for("global")
105051 .tap("NodeSourcePlugin", () => {
105052 const retrieveGlobalModule = ParserHelpers.requireFileAsExpression(
105053 parser.state.module.context,
105054 __webpack_require__.ab + "global.js"
105055 );
105056 return ParserHelpers.addParsedVariableToModule(
105057 parser,
105058 "global",
105059 retrieveGlobalModule
105060 );
105061 });
105062 }
105063 if (localOptions.process) {
105064 const processType = localOptions.process;
105065 addExpression(parser, "process", "process", processType);
105066 }
105067 if (localOptions.console) {
105068 const consoleType = localOptions.console;
105069 addExpression(parser, "console", "console", consoleType);
105070 }
105071 const bufferType = localOptions.Buffer;
105072 if (bufferType) {
105073 addExpression(parser, "Buffer", "buffer", bufferType, ".Buffer");
105074 }
105075 if (localOptions.setImmediate) {
105076 const setImmediateType = localOptions.setImmediate;
105077 addExpression(
105078 parser,
105079 "setImmediate",
105080 "timers",
105081 setImmediateType,
105082 ".setImmediate"
105083 );
105084 addExpression(
105085 parser,
105086 "clearImmediate",
105087 "timers",
105088 setImmediateType,
105089 ".clearImmediate"
105090 );
105091 }
105092 };
105093 normalModuleFactory.hooks.parser
105094 .for("javascript/auto")
105095 .tap("NodeSourcePlugin", handler);
105096 normalModuleFactory.hooks.parser
105097 .for("javascript/dynamic")
105098 .tap("NodeSourcePlugin", handler);
105099 }
105100 );
105101 compiler.hooks.afterResolvers.tap("NodeSourcePlugin", compiler => {
105102 for (const lib of Object.keys(nodeLibsBrowser)) {
105103 if (options[lib] !== false) {
105104 compiler.resolverFactory.hooks.resolver
105105 .for("normal")
105106 .tap("NodeSourcePlugin", resolver => {
105107 new AliasPlugin(
105108 "described-resolve",
105109 {
105110 name: lib,
105111 onlyModule: true,
105112 alias: getPathToModule(lib, options[lib])
105113 },
105114 "resolve"
105115 ).apply(resolver);
105116 });
105117 }
105118 }
105119 });
105120 }
105121};
105122
105123
105124/***/ }),
105125
105126/***/ 59743:
105127/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105128
105129"use strict";
105130/*
105131 MIT License http://www.opensource.org/licenses/mit-license.php
105132 Author Tobias Koppers @sokra
105133*/
105134
105135
105136const ExternalsPlugin = __webpack_require__(75705);
105137
105138const builtins =
105139 // eslint-disable-next-line node/no-unsupported-features/node-builtins,node/no-deprecated-api
105140 __webpack_require__(32282).builtinModules || Object.keys(process.binding("natives"));
105141
105142class NodeTargetPlugin {
105143 apply(compiler) {
105144 new ExternalsPlugin("commonjs", builtins).apply(compiler);
105145 }
105146}
105147
105148module.exports = NodeTargetPlugin;
105149
105150
105151/***/ }),
105152
105153/***/ 90010:
105154/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105155
105156"use strict";
105157/*
105158 MIT License http://www.opensource.org/licenses/mit-license.php
105159 Author Tobias Koppers @sokra
105160*/
105161
105162
105163
105164const NodeMainTemplatePlugin = __webpack_require__(78597);
105165const NodeChunkTemplatePlugin = __webpack_require__(45249);
105166const NodeHotUpdateChunkTemplatePlugin = __webpack_require__(95909);
105167
105168class NodeTemplatePlugin {
105169 constructor(options) {
105170 options = options || {};
105171 this.asyncChunkLoading = options.asyncChunkLoading;
105172 }
105173
105174 apply(compiler) {
105175 compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", compilation => {
105176 new NodeMainTemplatePlugin(this.asyncChunkLoading).apply(
105177 compilation.mainTemplate
105178 );
105179 new NodeChunkTemplatePlugin().apply(compilation.chunkTemplate);
105180 new NodeHotUpdateChunkTemplatePlugin().apply(
105181 compilation.hotUpdateChunkTemplate
105182 );
105183 });
105184 }
105185}
105186
105187module.exports = NodeTemplatePlugin;
105188
105189
105190/***/ }),
105191
105192/***/ 71610:
105193/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105194
105195"use strict";
105196/*
105197 MIT License http://www.opensource.org/licenses/mit-license.php
105198 Author Tobias Koppers @sokra
105199*/
105200
105201
105202const Watchpack = __webpack_require__(77056);
105203const objectToMap = __webpack_require__(1111);
105204
105205class NodeWatchFileSystem {
105206 constructor(inputFileSystem) {
105207 this.inputFileSystem = inputFileSystem;
105208 this.watcherOptions = {
105209 aggregateTimeout: 0
105210 };
105211 this.watcher = new Watchpack(this.watcherOptions);
105212 }
105213
105214 watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
105215 if (!Array.isArray(files)) {
105216 throw new Error("Invalid arguments: 'files'");
105217 }
105218 if (!Array.isArray(dirs)) {
105219 throw new Error("Invalid arguments: 'dirs'");
105220 }
105221 if (!Array.isArray(missing)) {
105222 throw new Error("Invalid arguments: 'missing'");
105223 }
105224 if (typeof callback !== "function") {
105225 throw new Error("Invalid arguments: 'callback'");
105226 }
105227 if (typeof startTime !== "number" && startTime) {
105228 throw new Error("Invalid arguments: 'startTime'");
105229 }
105230 if (typeof options !== "object") {
105231 throw new Error("Invalid arguments: 'options'");
105232 }
105233 if (typeof callbackUndelayed !== "function" && callbackUndelayed) {
105234 throw new Error("Invalid arguments: 'callbackUndelayed'");
105235 }
105236 const oldWatcher = this.watcher;
105237 this.watcher = new Watchpack(options);
105238
105239 if (callbackUndelayed) {
105240 this.watcher.once("change", callbackUndelayed);
105241 }
105242 const cachedFiles = files;
105243 const cachedDirs = dirs;
105244 this.watcher.once("aggregated", (changes, removals) => {
105245 changes = changes.concat(removals);
105246 if (this.inputFileSystem && this.inputFileSystem.purge) {
105247 this.inputFileSystem.purge(changes);
105248 }
105249 const times = objectToMap(this.watcher.getTimes());
105250 files = new Set(files);
105251 dirs = new Set(dirs);
105252 missing = new Set(missing);
105253 removals = new Set(removals.filter(file => files.has(file)));
105254 callback(
105255 null,
105256 changes.filter(file => files.has(file)).sort(),
105257 changes.filter(file => dirs.has(file)).sort(),
105258 changes.filter(file => missing.has(file)).sort(),
105259 times,
105260 times,
105261 removals
105262 );
105263 });
105264
105265 this.watcher.watch(
105266 cachedFiles.concat(missing),
105267 cachedDirs.concat(missing),
105268 startTime
105269 );
105270
105271 if (oldWatcher) {
105272 oldWatcher.close();
105273 }
105274 return {
105275 close: () => {
105276 if (this.watcher) {
105277 this.watcher.close();
105278 this.watcher = null;
105279 }
105280 },
105281 pause: () => {
105282 if (this.watcher) {
105283 this.watcher.pause();
105284 }
105285 },
105286 getFileTimestamps: () => {
105287 if (this.watcher) {
105288 return objectToMap(this.watcher.getTimes());
105289 } else {
105290 return new Map();
105291 }
105292 },
105293 getContextTimestamps: () => {
105294 if (this.watcher) {
105295 return objectToMap(this.watcher.getTimes());
105296 } else {
105297 return new Map();
105298 }
105299 }
105300 };
105301 }
105302}
105303
105304module.exports = NodeWatchFileSystem;
105305
105306
105307/***/ }),
105308
105309/***/ 73839:
105310/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105311
105312"use strict";
105313/*
105314 MIT License http://www.opensource.org/licenses/mit-license.php
105315 Author Tobias Koppers @sokra
105316*/
105317
105318
105319const Template = __webpack_require__(96066);
105320const WasmMainTemplatePlugin = __webpack_require__(65331);
105321
105322class ReadFileCompileWasmTemplatePlugin {
105323 constructor(options) {
105324 this.options = options || {};
105325 }
105326
105327 apply(compiler) {
105328 compiler.hooks.thisCompilation.tap(
105329 "ReadFileCompileWasmTemplatePlugin",
105330 compilation => {
105331 const generateLoadBinaryCode = path =>
105332 Template.asString([
105333 "new Promise(function (resolve, reject) {",
105334 Template.indent([
105335 "var { readFile } = require('fs');",
105336 "var { join } = require('path');",
105337 "",
105338 "try {",
105339 Template.indent([
105340 `readFile(join(__dirname, ${path}), function(err, buffer){`,
105341 Template.indent([
105342 "if (err) return reject(err);",
105343 "",
105344 "// Fake fetch response",
105345 "resolve({",
105346 Template.indent([
105347 "arrayBuffer() { return Promise.resolve(buffer); }"
105348 ]),
105349 "});"
105350 ]),
105351 "});"
105352 ]),
105353 "} catch (err) { reject(err); }"
105354 ]),
105355 "})"
105356 ]);
105357
105358 const plugin = new WasmMainTemplatePlugin(
105359 Object.assign(
105360 {
105361 generateLoadBinaryCode,
105362 supportsStreaming: false
105363 },
105364 this.options
105365 )
105366 );
105367 plugin.apply(compilation.mainTemplate);
105368 }
105369 );
105370 }
105371}
105372
105373module.exports = ReadFileCompileWasmTemplatePlugin;
105374
105375
105376/***/ }),
105377
105378/***/ 7886:
105379/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105380
105381"use strict";
105382/*
105383 MIT License http://www.opensource.org/licenses/mit-license.php
105384 Author Tobias Koppers @sokra
105385*/
105386
105387
105388
105389const truncateArgs = __webpack_require__(62299);
105390const util = __webpack_require__(31669);
105391
105392const tty = process.stderr.isTTY && process.env.TERM !== "dumb";
105393
105394let currentStatusMessage = undefined;
105395let hasStatusMessage = false;
105396let currentIndent = "";
105397let currentCollapsed = 0;
105398
105399const indent = (str, prefix, colorPrefix, colorSuffix) => {
105400 if (str === "") return str;
105401 prefix = currentIndent + prefix;
105402 if (tty) {
105403 return (
105404 prefix +
105405 colorPrefix +
105406 str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) +
105407 colorSuffix
105408 );
105409 } else {
105410 return prefix + str.replace(/\n/g, "\n" + prefix);
105411 }
105412};
105413
105414const clearStatusMessage = () => {
105415 if (hasStatusMessage) {
105416 process.stderr.write("\x1b[2K\r");
105417 hasStatusMessage = false;
105418 }
105419};
105420
105421const writeStatusMessage = () => {
105422 if (!currentStatusMessage) return;
105423 const l = process.stderr.columns;
105424 const args = l
105425 ? truncateArgs(currentStatusMessage, l - 1)
105426 : currentStatusMessage;
105427 const str = args.join(" ");
105428 const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
105429 process.stderr.write(`\x1b[2K\r${coloredStr}`);
105430 hasStatusMessage = true;
105431};
105432
105433const writeColored = (prefix, colorPrefix, colorSuffix) => {
105434 return (...args) => {
105435 if (currentCollapsed > 0) return;
105436 clearStatusMessage();
105437 // @ts-ignore
105438 const str = indent(util.format(...args), prefix, colorPrefix, colorSuffix);
105439 process.stderr.write(str + "\n");
105440 writeStatusMessage();
105441 };
105442};
105443
105444const writeGroupMessage = writeColored(
105445 "<-> ",
105446 "\u001b[1m\u001b[36m",
105447 "\u001b[39m\u001b[22m"
105448);
105449
105450const writeGroupCollapsedMessage = writeColored(
105451 "<+> ",
105452 "\u001b[1m\u001b[36m",
105453 "\u001b[39m\u001b[22m"
105454);
105455
105456module.exports = {
105457 log: writeColored(" ", "\u001b[1m", "\u001b[22m"),
105458 debug: writeColored(" ", "", ""),
105459 trace: writeColored(" ", "", ""),
105460 info: writeColored("<i> ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"),
105461 warn: writeColored("<w> ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"),
105462 error: writeColored("<e> ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"),
105463 logTime: writeColored("<t> ", "\u001b[1m\u001b[35m", "\u001b[39m\u001b[22m"),
105464 group: (...args) => {
105465 writeGroupMessage(...args);
105466 if (currentCollapsed > 0) {
105467 currentCollapsed++;
105468 } else {
105469 currentIndent += " ";
105470 }
105471 },
105472 groupCollapsed: (...args) => {
105473 writeGroupCollapsedMessage(...args);
105474 currentCollapsed++;
105475 },
105476 groupEnd: () => {
105477 if (currentCollapsed > 0) currentCollapsed--;
105478 else if (currentIndent.length >= 2)
105479 currentIndent = currentIndent.slice(0, currentIndent.length - 2);
105480 },
105481 // eslint-disable-next-line node/no-unsupported-features/node-builtins
105482 profile: console.profile && (name => console.profile(name)),
105483 // eslint-disable-next-line node/no-unsupported-features/node-builtins
105484 profileEnd: console.profileEnd && (name => console.profileEnd(name)),
105485 clear:
105486 tty &&
105487 // eslint-disable-next-line node/no-unsupported-features/node-builtins
105488 console.clear &&
105489 (() => {
105490 clearStatusMessage();
105491 // eslint-disable-next-line node/no-unsupported-features/node-builtins
105492 console.clear();
105493 writeStatusMessage();
105494 }),
105495 status: tty
105496 ? (name, ...args) => {
105497 args = args.filter(Boolean);
105498 if (name === undefined && args.length === 0) {
105499 clearStatusMessage();
105500 currentStatusMessage = undefined;
105501 } else if (
105502 typeof name === "string" &&
105503 name.startsWith("[webpack.Progress] ")
105504 ) {
105505 currentStatusMessage = [name.slice(19), ...args];
105506 writeStatusMessage();
105507 } else if (name === "[webpack.Progress]") {
105508 currentStatusMessage = [...args];
105509 writeStatusMessage();
105510 } else {
105511 currentStatusMessage = [name, ...args];
105512 writeStatusMessage();
105513 }
105514 }
105515 : writeColored("<s> ", "", "")
105516};
105517
105518
105519/***/ }),
105520
105521/***/ 88197:
105522/***/ (function(module) {
105523
105524"use strict";
105525/*
105526 MIT License http://www.opensource.org/licenses/mit-license.php
105527 Author Tobias Koppers @sokra
105528*/
105529
105530
105531class AggressiveMergingPlugin {
105532 constructor(options) {
105533 if (
105534 (options !== undefined && typeof options !== "object") ||
105535 Array.isArray(options)
105536 ) {
105537 throw new Error(
105538 "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/"
105539 );
105540 }
105541 this.options = options || {};
105542 }
105543
105544 apply(compiler) {
105545 const options = this.options;
105546 const minSizeReduce = options.minSizeReduce || 1.5;
105547
105548 compiler.hooks.thisCompilation.tap(
105549 "AggressiveMergingPlugin",
105550 compilation => {
105551 compilation.hooks.optimizeChunksAdvanced.tap(
105552 "AggressiveMergingPlugin",
105553 chunks => {
105554 let combinations = [];
105555 chunks.forEach((a, idx) => {
105556 if (a.canBeInitial()) return;
105557 for (let i = 0; i < idx; i++) {
105558 const b = chunks[i];
105559 if (b.canBeInitial()) continue;
105560 combinations.push({
105561 a,
105562 b,
105563 improvement: undefined
105564 });
105565 }
105566 });
105567
105568 for (const pair of combinations) {
105569 const a = pair.b.size({
105570 chunkOverhead: 0
105571 });
105572 const b = pair.a.size({
105573 chunkOverhead: 0
105574 });
105575 const ab = pair.b.integratedSize(pair.a, {
105576 chunkOverhead: 0
105577 });
105578 let newSize;
105579 if (ab === false) {
105580 pair.improvement = false;
105581 return;
105582 } else {
105583 newSize = ab;
105584 }
105585
105586 pair.improvement = (a + b) / newSize;
105587 }
105588 combinations = combinations.filter(pair => {
105589 return pair.improvement !== false;
105590 });
105591 combinations.sort((a, b) => {
105592 return b.improvement - a.improvement;
105593 });
105594
105595 const pair = combinations[0];
105596
105597 if (!pair) return;
105598 if (pair.improvement < minSizeReduce) return;
105599
105600 if (pair.b.integrate(pair.a, "aggressive-merge")) {
105601 chunks.splice(chunks.indexOf(pair.a), 1);
105602 return true;
105603 }
105604 }
105605 );
105606 }
105607 );
105608 }
105609}
105610
105611module.exports = AggressiveMergingPlugin;
105612
105613
105614/***/ }),
105615
105616/***/ 26688:
105617/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105618
105619"use strict";
105620/*
105621 MIT License http://www.opensource.org/licenses/mit-license.php
105622 Author Tobias Koppers @sokra
105623*/
105624
105625
105626const identifierUtils = __webpack_require__(94658);
105627const { intersect } = __webpack_require__(54262);
105628const validateOptions = __webpack_require__(33225);
105629const schema = __webpack_require__(71884);
105630
105631/** @typedef {import("../../declarations/plugins/optimize/AggressiveSplittingPlugin").AggressiveSplittingPluginOptions} AggressiveSplittingPluginOptions */
105632
105633const moveModuleBetween = (oldChunk, newChunk) => {
105634 return module => {
105635 oldChunk.moveModule(module, newChunk);
105636 };
105637};
105638
105639const isNotAEntryModule = entryModule => {
105640 return module => {
105641 return entryModule !== module;
105642 };
105643};
105644
105645class AggressiveSplittingPlugin {
105646 /**
105647 * @param {AggressiveSplittingPluginOptions=} options options object
105648 */
105649 constructor(options) {
105650 if (!options) options = {};
105651
105652 validateOptions(schema, options, "Aggressive Splitting Plugin");
105653
105654 this.options = options;
105655 if (typeof this.options.minSize !== "number") {
105656 this.options.minSize = 30 * 1024;
105657 }
105658 if (typeof this.options.maxSize !== "number") {
105659 this.options.maxSize = 50 * 1024;
105660 }
105661 if (typeof this.options.chunkOverhead !== "number") {
105662 this.options.chunkOverhead = 0;
105663 }
105664 if (typeof this.options.entryChunkMultiplicator !== "number") {
105665 this.options.entryChunkMultiplicator = 1;
105666 }
105667 }
105668 apply(compiler) {
105669 compiler.hooks.thisCompilation.tap(
105670 "AggressiveSplittingPlugin",
105671 compilation => {
105672 let needAdditionalSeal = false;
105673 let newSplits;
105674 let fromAggressiveSplittingSet;
105675 let chunkSplitDataMap;
105676 compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => {
105677 newSplits = [];
105678 fromAggressiveSplittingSet = new Set();
105679 chunkSplitDataMap = new Map();
105680 });
105681 compilation.hooks.optimizeChunksAdvanced.tap(
105682 "AggressiveSplittingPlugin",
105683 chunks => {
105684 // Precompute stuff
105685 const nameToModuleMap = new Map();
105686 const moduleToNameMap = new Map();
105687 for (const m of compilation.modules) {
105688 const name = identifierUtils.makePathsRelative(
105689 compiler.context,
105690 m.identifier(),
105691 compilation.cache
105692 );
105693 nameToModuleMap.set(name, m);
105694 moduleToNameMap.set(m, name);
105695 }
105696
105697 // Check used chunk ids
105698 const usedIds = new Set();
105699 for (const chunk of chunks) {
105700 usedIds.add(chunk.id);
105701 }
105702
105703 const recordedSplits =
105704 (compilation.records && compilation.records.aggressiveSplits) ||
105705 [];
105706 const usedSplits = newSplits
105707 ? recordedSplits.concat(newSplits)
105708 : recordedSplits;
105709
105710 const minSize = this.options.minSize;
105711 const maxSize = this.options.maxSize;
105712
105713 const applySplit = splitData => {
105714 // Cannot split if id is already taken
105715 if (splitData.id !== undefined && usedIds.has(splitData.id)) {
105716 return false;
105717 }
105718
105719 // Get module objects from names
105720 const selectedModules = splitData.modules.map(name =>
105721 nameToModuleMap.get(name)
105722 );
105723
105724 // Does the modules exist at all?
105725 if (!selectedModules.every(Boolean)) return false;
105726
105727 // Check if size matches (faster than waiting for hash)
105728 const size = selectedModules.reduce(
105729 (sum, m) => sum + m.size(),
105730 0
105731 );
105732 if (size !== splitData.size) return false;
105733
105734 // get chunks with all modules
105735 const selectedChunks = intersect(
105736 selectedModules.map(m => new Set(m.chunksIterable))
105737 );
105738
105739 // No relevant chunks found
105740 if (selectedChunks.size === 0) return false;
105741
105742 // The found chunk is already the split or similar
105743 if (
105744 selectedChunks.size === 1 &&
105745 Array.from(selectedChunks)[0].getNumberOfModules() ===
105746 selectedModules.length
105747 ) {
105748 const chunk = Array.from(selectedChunks)[0];
105749 if (fromAggressiveSplittingSet.has(chunk)) return false;
105750 fromAggressiveSplittingSet.add(chunk);
105751 chunkSplitDataMap.set(chunk, splitData);
105752 return true;
105753 }
105754
105755 // split the chunk into two parts
105756 const newChunk = compilation.addChunk();
105757 newChunk.chunkReason = "aggressive splitted";
105758 for (const chunk of selectedChunks) {
105759 selectedModules.forEach(moveModuleBetween(chunk, newChunk));
105760 chunk.split(newChunk);
105761 chunk.name = null;
105762 }
105763 fromAggressiveSplittingSet.add(newChunk);
105764 chunkSplitDataMap.set(newChunk, splitData);
105765
105766 if (splitData.id !== null && splitData.id !== undefined) {
105767 newChunk.id = splitData.id;
105768 }
105769 return true;
105770 };
105771
105772 // try to restore to recorded splitting
105773 let changed = false;
105774 for (let j = 0; j < usedSplits.length; j++) {
105775 const splitData = usedSplits[j];
105776 if (applySplit(splitData)) changed = true;
105777 }
105778
105779 // for any chunk which isn't splitted yet, split it and create a new entry
105780 // start with the biggest chunk
105781 const sortedChunks = chunks.slice().sort((a, b) => {
105782 const diff1 = b.modulesSize() - a.modulesSize();
105783 if (diff1) return diff1;
105784 const diff2 = a.getNumberOfModules() - b.getNumberOfModules();
105785 if (diff2) return diff2;
105786 const modulesA = Array.from(a.modulesIterable);
105787 const modulesB = Array.from(b.modulesIterable);
105788 modulesA.sort();
105789 modulesB.sort();
105790 const aI = modulesA[Symbol.iterator]();
105791 const bI = modulesB[Symbol.iterator]();
105792 // eslint-disable-next-line no-constant-condition
105793 while (true) {
105794 const aItem = aI.next();
105795 const bItem = bI.next();
105796 if (aItem.done) return 0;
105797 const aModuleIdentifier = aItem.value.identifier();
105798 const bModuleIdentifier = bItem.value.identifier();
105799 if (aModuleIdentifier > bModuleIdentifier) return -1;
105800 if (aModuleIdentifier < bModuleIdentifier) return 1;
105801 }
105802 });
105803 for (const chunk of sortedChunks) {
105804 if (fromAggressiveSplittingSet.has(chunk)) continue;
105805 const size = chunk.modulesSize();
105806 if (size > maxSize && chunk.getNumberOfModules() > 1) {
105807 const modules = chunk
105808 .getModules()
105809 .filter(isNotAEntryModule(chunk.entryModule))
105810 .sort((a, b) => {
105811 a = a.identifier();
105812 b = b.identifier();
105813 if (a > b) return 1;
105814 if (a < b) return -1;
105815 return 0;
105816 });
105817 const selectedModules = [];
105818 let selectedModulesSize = 0;
105819 for (let k = 0; k < modules.length; k++) {
105820 const module = modules[k];
105821 const newSize = selectedModulesSize + module.size();
105822 if (newSize > maxSize && selectedModulesSize >= minSize) {
105823 break;
105824 }
105825 selectedModulesSize = newSize;
105826 selectedModules.push(module);
105827 }
105828 if (selectedModules.length === 0) continue;
105829 const splitData = {
105830 modules: selectedModules
105831 .map(m => moduleToNameMap.get(m))
105832 .sort(),
105833 size: selectedModulesSize
105834 };
105835
105836 if (applySplit(splitData)) {
105837 newSplits = (newSplits || []).concat(splitData);
105838 changed = true;
105839 }
105840 }
105841 }
105842 if (changed) return true;
105843 }
105844 );
105845 compilation.hooks.recordHash.tap(
105846 "AggressiveSplittingPlugin",
105847 records => {
105848 // 4. save made splittings to records
105849 const allSplits = new Set();
105850 const invalidSplits = new Set();
105851
105852 // Check if some splittings are invalid
105853 // We remove invalid splittings and try again
105854 for (const chunk of compilation.chunks) {
105855 const splitData = chunkSplitDataMap.get(chunk);
105856 if (splitData !== undefined) {
105857 if (splitData.hash && chunk.hash !== splitData.hash) {
105858 // Split was successful, but hash doesn't equal
105859 // We can throw away the split since it's useless now
105860 invalidSplits.add(splitData);
105861 }
105862 }
105863 }
105864
105865 if (invalidSplits.size > 0) {
105866 records.aggressiveSplits = records.aggressiveSplits.filter(
105867 splitData => !invalidSplits.has(splitData)
105868 );
105869 needAdditionalSeal = true;
105870 } else {
105871 // set hash and id values on all (new) splittings
105872 for (const chunk of compilation.chunks) {
105873 const splitData = chunkSplitDataMap.get(chunk);
105874 if (splitData !== undefined) {
105875 splitData.hash = chunk.hash;
105876 splitData.id = chunk.id;
105877 allSplits.add(splitData);
105878 // set flag for stats
105879 chunk.recorded = true;
105880 }
105881 }
105882
105883 // Also add all unused historial splits (after the used ones)
105884 // They can still be used in some future compilation
105885 const recordedSplits =
105886 compilation.records && compilation.records.aggressiveSplits;
105887 if (recordedSplits) {
105888 for (const splitData of recordedSplits) {
105889 if (!invalidSplits.has(splitData)) allSplits.add(splitData);
105890 }
105891 }
105892
105893 // record all splits
105894 records.aggressiveSplits = Array.from(allSplits);
105895
105896 needAdditionalSeal = false;
105897 }
105898 }
105899 );
105900 compilation.hooks.needAdditionalSeal.tap(
105901 "AggressiveSplittingPlugin",
105902 () => {
105903 if (needAdditionalSeal) {
105904 needAdditionalSeal = false;
105905 return true;
105906 }
105907 }
105908 );
105909 }
105910 );
105911 }
105912}
105913module.exports = AggressiveSplittingPlugin;
105914
105915
105916/***/ }),
105917
105918/***/ 30346:
105919/***/ (function(module) {
105920
105921"use strict";
105922/*
105923 MIT License http://www.opensource.org/licenses/mit-license.php
105924 Author Tobias Koppers @sokra
105925*/
105926
105927
105928const sortByIndex = (a, b) => {
105929 return a.index - b.index;
105930};
105931
105932const sortByIndex2 = (a, b) => {
105933 return a.index2 - b.index2;
105934};
105935
105936class ChunkModuleIdRangePlugin {
105937 constructor(options) {
105938 this.options = options;
105939 }
105940
105941 apply(compiler) {
105942 const options = this.options;
105943 compiler.hooks.compilation.tap("ChunkModuleIdRangePlugin", compilation => {
105944 compilation.hooks.moduleIds.tap("ChunkModuleIdRangePlugin", modules => {
105945 const chunk = compilation.chunks.find(
105946 chunk => chunk.name === options.name
105947 );
105948 if (!chunk) {
105949 throw new Error(
105950 `ChunkModuleIdRangePlugin: Chunk with name '${options.name}"' was not found`
105951 );
105952 }
105953
105954 let chunkModules;
105955 if (options.order) {
105956 chunkModules = Array.from(chunk.modulesIterable);
105957 switch (options.order) {
105958 case "index":
105959 chunkModules.sort(sortByIndex);
105960 break;
105961 case "index2":
105962 chunkModules.sort(sortByIndex2);
105963 break;
105964 default:
105965 throw new Error(
105966 "ChunkModuleIdRangePlugin: unexpected value of order"
105967 );
105968 }
105969 } else {
105970 chunkModules = modules.filter(m => {
105971 return m.chunksIterable.has(chunk);
105972 });
105973 }
105974
105975 let currentId = options.start || 0;
105976 for (let i = 0; i < chunkModules.length; i++) {
105977 const m = chunkModules[i];
105978 if (m.id === null) {
105979 m.id = currentId++;
105980 }
105981 if (options.end && currentId > options.end) break;
105982 }
105983 });
105984 });
105985 }
105986}
105987module.exports = ChunkModuleIdRangePlugin;
105988
105989
105990/***/ }),
105991
105992/***/ 16953:
105993/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
105994
105995"use strict";
105996/*
105997 MIT License http://www.opensource.org/licenses/mit-license.php
105998 Author Tobias Koppers @sokra
105999*/
106000
106001
106002const Module = __webpack_require__(75993);
106003const Template = __webpack_require__(96066);
106004const Parser = __webpack_require__(70558);
106005const eslintScope = __webpack_require__(41632);
106006const { ConcatSource, ReplaceSource } = __webpack_require__(53665);
106007const DependencyReference = __webpack_require__(71722);
106008const HarmonyImportDependency = __webpack_require__(81599);
106009const HarmonyImportSideEffectDependency = __webpack_require__(79171);
106010const HarmonyImportSpecifierDependency = __webpack_require__(95966);
106011const HarmonyExportSpecifierDependency = __webpack_require__(34834);
106012const HarmonyExportExpressionDependency = __webpack_require__(84245);
106013const HarmonyExportImportedSpecifierDependency = __webpack_require__(22864);
106014const HarmonyCompatibilityDependency = __webpack_require__(1533);
106015const createHash = __webpack_require__(15660);
106016
106017/** @typedef {import("../Dependency")} Dependency */
106018/** @typedef {import("../Compilation")} Compilation */
106019/** @typedef {import("../util/createHash").Hash} Hash */
106020/** @typedef {import("../RequestShortener")} RequestShortener */
106021
106022const joinIterableWithComma = iterable => {
106023 // This is more performant than Array.from().join(", ")
106024 // as it doesn't create an array
106025 let str = "";
106026 let first = true;
106027 for (const item of iterable) {
106028 if (first) {
106029 first = false;
106030 } else {
106031 str += ", ";
106032 }
106033 str += item;
106034 }
106035 return str;
106036};
106037
106038/**
106039 * @typedef {Object} ConcatenationEntry
106040 * @property {"concatenated" | "external"} type
106041 * @property {Module} module
106042 */
106043
106044const ensureNsObjSource = (
106045 info,
106046 moduleToInfoMap,
106047 requestShortener,
106048 strictHarmonyModule
106049) => {
106050 if (!info.hasNamespaceObject) {
106051 info.hasNamespaceObject = true;
106052 const name = info.exportMap.get(true);
106053 const nsObj = [`var ${name} = {};`, `__webpack_require__.r(${name});`];
106054 for (const exportName of info.module.buildMeta.providedExports) {
106055 const finalName = getFinalName(
106056 info,
106057 exportName,
106058 moduleToInfoMap,
106059 requestShortener,
106060 false,
106061 strictHarmonyModule
106062 );
106063 nsObj.push(
106064 `__webpack_require__.d(${name}, ${JSON.stringify(
106065 exportName
106066 )}, function() { return ${finalName}; });`
106067 );
106068 }
106069 info.namespaceObjectSource = nsObj.join("\n") + "\n";
106070 }
106071};
106072
106073const getExternalImport = (
106074 importedModule,
106075 info,
106076 exportName,
106077 asCall,
106078 strictHarmonyModule
106079) => {
106080 const used = importedModule.isUsed(exportName);
106081 if (!used) return "/* unused reexport */undefined";
106082 const comment =
106083 used !== exportName ? ` ${Template.toNormalComment(exportName)}` : "";
106084 switch (importedModule.buildMeta.exportsType) {
106085 case "named":
106086 if (exportName === "default") {
106087 return info.name;
106088 } else if (exportName === true) {
106089 info.interopNamespaceObjectUsed = true;
106090 return info.interopNamespaceObjectName;
106091 } else {
106092 break;
106093 }
106094 case "namespace":
106095 if (exportName === true) {
106096 return info.name;
106097 } else {
106098 break;
106099 }
106100 default:
106101 if (strictHarmonyModule) {
106102 if (exportName === "default") {
106103 return info.name;
106104 } else if (exportName === true) {
106105 info.interopNamespaceObjectUsed = true;
106106 return info.interopNamespaceObjectName;
106107 } else {
106108 return "/* non-default import from non-esm module */undefined";
106109 }
106110 } else {
106111 if (exportName === "default") {
106112 info.interopDefaultAccessUsed = true;
106113 return asCall
106114 ? `${info.interopDefaultAccessName}()`
106115 : `${info.interopDefaultAccessName}.a`;
106116 } else if (exportName === true) {
106117 return info.name;
106118 } else {
106119 break;
106120 }
106121 }
106122 }
106123 const reference = `${info.name}[${JSON.stringify(used)}${comment}]`;
106124 if (asCall) return `Object(${reference})`;
106125 return reference;
106126};
106127
106128const getFinalName = (
106129 info,
106130 exportName,
106131 moduleToInfoMap,
106132 requestShortener,
106133 asCall,
106134 strictHarmonyModule,
106135 alreadyVisited = new Set()
106136) => {
106137 switch (info.type) {
106138 case "concatenated": {
106139 const directExport = info.exportMap.get(exportName);
106140 if (directExport) {
106141 if (exportName === true) {
106142 ensureNsObjSource(
106143 info,
106144 moduleToInfoMap,
106145 requestShortener,
106146 strictHarmonyModule
106147 );
106148 } else if (!info.module.isUsed(exportName)) {
106149 return "/* unused export */ undefined";
106150 }
106151 if (info.globalExports.has(directExport)) {
106152 return directExport;
106153 }
106154 const name = info.internalNames.get(directExport);
106155 if (!name) {
106156 throw new Error(
106157 `The export "${directExport}" in "${info.module.readableIdentifier(
106158 requestShortener
106159 )}" has no internal name`
106160 );
106161 }
106162 return name;
106163 }
106164 const reexport = info.reexportMap.get(exportName);
106165 if (reexport) {
106166 if (alreadyVisited.has(reexport)) {
106167 throw new Error(
106168 `Circular reexports ${Array.from(
106169 alreadyVisited,
106170 e =>
106171 `"${e.module.readableIdentifier(requestShortener)}".${
106172 e.exportName
106173 }`
106174 ).join(
106175 " --> "
106176 )} -(circular)-> "${reexport.module.readableIdentifier(
106177 requestShortener
106178 )}".${reexport.exportName}`
106179 );
106180 }
106181 alreadyVisited.add(reexport);
106182 const refInfo = moduleToInfoMap.get(reexport.module);
106183 if (refInfo) {
106184 // module is in the concatenation
106185 return getFinalName(
106186 refInfo,
106187 reexport.exportName,
106188 moduleToInfoMap,
106189 requestShortener,
106190 asCall,
106191 strictHarmonyModule,
106192 alreadyVisited
106193 );
106194 }
106195 }
106196 const problem =
106197 `Cannot get final name for export "${exportName}" in "${info.module.readableIdentifier(
106198 requestShortener
106199 )}"` +
106200 ` (known exports: ${Array.from(info.exportMap.keys())
106201 .filter(name => name !== true)
106202 .join(" ")}, ` +
106203 `known reexports: ${Array.from(info.reexportMap.keys()).join(" ")})`;
106204 return `${Template.toNormalComment(problem)} undefined`;
106205 }
106206 case "external": {
106207 const importedModule = info.module;
106208 return getExternalImport(
106209 importedModule,
106210 info,
106211 exportName,
106212 asCall,
106213 strictHarmonyModule
106214 );
106215 }
106216 }
106217};
106218
106219const addScopeSymbols1 = (s, nameSet, scopeSet) => {
106220 let scope = s;
106221 while (scope) {
106222 if (scopeSet.has(scope)) break;
106223 scopeSet.add(scope);
106224 for (const variable of scope.variables) {
106225 nameSet.add(variable.name);
106226 }
106227 scope = scope.upper;
106228 }
106229};
106230
106231const addScopeSymbols2 = (s, nameSet, scopeSet1, scopeSet2) => {
106232 let scope = s;
106233 while (scope) {
106234 if (scopeSet1.has(scope)) break;
106235 if (scopeSet2.has(scope)) break;
106236 scopeSet1.add(scope);
106237 for (const variable of scope.variables) {
106238 nameSet.add(variable.name);
106239 }
106240 scope = scope.upper;
106241 }
106242};
106243
106244const getAllReferences = variable => {
106245 let set = variable.references;
106246 // Look for inner scope variables too (like in class Foo { t() { Foo } })
106247 const identifiers = new Set(variable.identifiers);
106248 for (const scope of variable.scope.childScopes) {
106249 for (const innerVar of scope.variables) {
106250 if (innerVar.identifiers.some(id => identifiers.has(id))) {
106251 set = set.concat(innerVar.references);
106252 break;
106253 }
106254 }
106255 }
106256 return set;
106257};
106258
106259const getPathInAst = (ast, node) => {
106260 if (ast === node) {
106261 return [];
106262 }
106263
106264 const nr = node.range;
106265
106266 const enterNode = n => {
106267 if (!n) return undefined;
106268 const r = n.range;
106269 if (r) {
106270 if (r[0] <= nr[0] && r[1] >= nr[1]) {
106271 const path = getPathInAst(n, node);
106272 if (path) {
106273 path.push(n);
106274 return path;
106275 }
106276 }
106277 }
106278 return undefined;
106279 };
106280
106281 var i;
106282 if (Array.isArray(ast)) {
106283 for (i = 0; i < ast.length; i++) {
106284 const enterResult = enterNode(ast[i]);
106285 if (enterResult !== undefined) return enterResult;
106286 }
106287 } else if (ast && typeof ast === "object") {
106288 const keys = Object.keys(ast);
106289 for (i = 0; i < keys.length; i++) {
106290 const value = ast[keys[i]];
106291 if (Array.isArray(value)) {
106292 const pathResult = getPathInAst(value, node);
106293 if (pathResult !== undefined) return pathResult;
106294 } else if (value && typeof value === "object") {
106295 const enterResult = enterNode(value);
106296 if (enterResult !== undefined) return enterResult;
106297 }
106298 }
106299 }
106300};
106301
106302const getHarmonyExportImportedSpecifierDependencyExports = dep => {
106303 const importModule = dep._module;
106304 if (!importModule) return [];
106305 if (dep._id) {
106306 // export { named } from "module"
106307 return [
106308 {
106309 name: dep.name,
106310 id: dep._id,
106311 module: importModule
106312 }
106313 ];
106314 }
106315 if (dep.name) {
106316 // export * as abc from "module"
106317 return [
106318 {
106319 name: dep.name,
106320 id: true,
106321 module: importModule
106322 }
106323 ];
106324 }
106325 // export * from "module"
106326 return importModule.buildMeta.providedExports
106327 .filter(exp => exp !== "default" && !dep.activeExports.has(exp))
106328 .map(exp => {
106329 return {
106330 name: exp,
106331 id: exp,
106332 module: importModule
106333 };
106334 });
106335};
106336
106337class ConcatenatedModule extends Module {
106338 constructor(rootModule, modules, concatenationList) {
106339 super("javascript/esm", null);
106340 super.setChunks(rootModule._chunks);
106341
106342 // Info from Factory
106343 this.rootModule = rootModule;
106344 this.factoryMeta = rootModule.factoryMeta;
106345
106346 // Info from Compilation
106347 this.index = rootModule.index;
106348 this.index2 = rootModule.index2;
106349 this.depth = rootModule.depth;
106350
106351 // Info from Optimization
106352 this.used = rootModule.used;
106353 this.usedExports = rootModule.usedExports;
106354
106355 // Info from Build
106356 this.buildInfo = {
106357 strict: true,
106358 cacheable: modules.every(m => m.buildInfo.cacheable),
106359 moduleArgument: rootModule.buildInfo.moduleArgument,
106360 exportsArgument: rootModule.buildInfo.exportsArgument,
106361 fileDependencies: new Set(),
106362 contextDependencies: new Set(),
106363 assets: undefined
106364 };
106365 this.built = modules.some(m => m.built);
106366 this.buildMeta = rootModule.buildMeta;
106367
106368 // Caching
106369 this._numberOfConcatenatedModules = modules.length;
106370
106371 // Graph
106372 const modulesSet = new Set(modules);
106373 this.reasons = rootModule.reasons.filter(
106374 reason =>
106375 !(reason.dependency instanceof HarmonyImportDependency) ||
106376 !modulesSet.has(reason.module)
106377 );
106378
106379 this.dependencies = [];
106380 this.blocks = [];
106381
106382 this.warnings = [];
106383 this.errors = [];
106384 this._orderedConcatenationList =
106385 concatenationList ||
106386 ConcatenatedModule.createConcatenationList(rootModule, modulesSet, null);
106387 for (const info of this._orderedConcatenationList) {
106388 if (info.type === "concatenated") {
106389 const m = info.module;
106390
106391 // populate dependencies
106392 for (const d of m.dependencies.filter(
106393 dep =>
106394 !(dep instanceof HarmonyImportDependency) ||
106395 !modulesSet.has(dep._module)
106396 )) {
106397 this.dependencies.push(d);
106398 }
106399 // populate blocks
106400 for (const d of m.blocks) {
106401 this.blocks.push(d);
106402 }
106403 // populate file dependencies
106404 if (m.buildInfo.fileDependencies) {
106405 for (const file of m.buildInfo.fileDependencies) {
106406 this.buildInfo.fileDependencies.add(file);
106407 }
106408 }
106409 // populate context dependencies
106410 if (m.buildInfo.contextDependencies) {
106411 for (const context of m.buildInfo.contextDependencies) {
106412 this.buildInfo.contextDependencies.add(context);
106413 }
106414 }
106415 // populate warnings
106416 for (const warning of m.warnings) {
106417 this.warnings.push(warning);
106418 }
106419 // populate errors
106420 for (const error of m.errors) {
106421 this.errors.push(error);
106422 }
106423
106424 if (m.buildInfo.assets) {
106425 if (this.buildInfo.assets === undefined) {
106426 this.buildInfo.assets = Object.create(null);
106427 }
106428 Object.assign(this.buildInfo.assets, m.buildInfo.assets);
106429 }
106430 if (m.buildInfo.assetsInfo) {
106431 if (this.buildInfo.assetsInfo === undefined) {
106432 this.buildInfo.assetsInfo = new Map();
106433 }
106434 for (const [key, value] of m.buildInfo.assetsInfo) {
106435 this.buildInfo.assetsInfo.set(key, value);
106436 }
106437 }
106438 }
106439 }
106440 this._identifier = this._createIdentifier();
106441 }
106442
106443 get modules() {
106444 return this._orderedConcatenationList
106445 .filter(info => info.type === "concatenated")
106446 .map(info => info.module);
106447 }
106448
106449 identifier() {
106450 return this._identifier;
106451 }
106452
106453 readableIdentifier(requestShortener) {
106454 return (
106455 this.rootModule.readableIdentifier(requestShortener) +
106456 ` + ${this._numberOfConcatenatedModules - 1} modules`
106457 );
106458 }
106459
106460 libIdent(options) {
106461 return this.rootModule.libIdent(options);
106462 }
106463
106464 nameForCondition() {
106465 return this.rootModule.nameForCondition();
106466 }
106467
106468 build(options, compilation, resolver, fs, callback) {
106469 throw new Error("Cannot build this module. It should be already built.");
106470 }
106471
106472 size() {
106473 // Guess size from embedded modules
106474 return this._orderedConcatenationList.reduce((sum, info) => {
106475 switch (info.type) {
106476 case "concatenated":
106477 return sum + info.module.size();
106478 case "external":
106479 return sum + 5;
106480 }
106481 return sum;
106482 }, 0);
106483 }
106484
106485 /**
106486 * @param {Module} rootModule the root of the concatenation
106487 * @param {Set<Module>} modulesSet a set of modules which should be concatenated
106488 * @param {Compilation} compilation the compilation context
106489 * @returns {ConcatenationEntry[]} concatenation list
106490 */
106491 static createConcatenationList(rootModule, modulesSet, compilation) {
106492 const list = [];
106493 const set = new Set();
106494
106495 /**
106496 * @param {Module} module a module
106497 * @returns {(function(): Module)[]} imported modules in order
106498 */
106499 const getConcatenatedImports = module => {
106500 /** @type {WeakMap<DependencyReference, Dependency>} */
106501 const map = new WeakMap();
106502 const references = module.dependencies
106503 .filter(dep => dep instanceof HarmonyImportDependency)
106504 .map(dep => {
106505 const ref = compilation.getDependencyReference(module, dep);
106506 if (ref) map.set(ref, dep);
106507 return ref;
106508 })
106509 .filter(ref => ref);
106510 DependencyReference.sort(references);
106511 // TODO webpack 5: remove this hack, see also DependencyReference
106512 return references.map(ref => {
106513 const dep = map.get(ref);
106514 return () => compilation.getDependencyReference(module, dep).module;
106515 });
106516 };
106517
106518 const enterModule = getModule => {
106519 const module = getModule();
106520 if (!module) return;
106521 if (set.has(module)) return;
106522 set.add(module);
106523 if (modulesSet.has(module)) {
106524 const imports = getConcatenatedImports(module);
106525 imports.forEach(enterModule);
106526 list.push({
106527 type: "concatenated",
106528 module
106529 });
106530 } else {
106531 list.push({
106532 type: "external",
106533 get module() {
106534 // We need to use a getter here, because the module in the dependency
106535 // could be replaced by some other process (i. e. also replaced with a
106536 // concatenated module)
106537 return getModule();
106538 }
106539 });
106540 }
106541 };
106542
106543 enterModule(() => rootModule);
106544
106545 return list;
106546 }
106547
106548 _createIdentifier() {
106549 let orderedConcatenationListIdentifiers = "";
106550 for (let i = 0; i < this._orderedConcatenationList.length; i++) {
106551 if (this._orderedConcatenationList[i].type === "concatenated") {
106552 orderedConcatenationListIdentifiers += this._orderedConcatenationList[
106553 i
106554 ].module.identifier();
106555 orderedConcatenationListIdentifiers += " ";
106556 }
106557 }
106558 const hash = createHash("md4");
106559 hash.update(orderedConcatenationListIdentifiers);
106560 return this.rootModule.identifier() + " " + hash.digest("hex");
106561 }
106562
106563 source(dependencyTemplates, runtimeTemplate) {
106564 const requestShortener = runtimeTemplate.requestShortener;
106565 // Metainfo for each module
106566 const modulesWithInfo = this._orderedConcatenationList.map((info, idx) => {
106567 switch (info.type) {
106568 case "concatenated": {
106569 const exportMap = new Map();
106570 const reexportMap = new Map();
106571 for (const dep of info.module.dependencies) {
106572 if (dep instanceof HarmonyExportSpecifierDependency) {
106573 if (!exportMap.has(dep.name)) {
106574 exportMap.set(dep.name, dep.id);
106575 }
106576 } else if (dep instanceof HarmonyExportExpressionDependency) {
106577 if (!exportMap.has("default")) {
106578 exportMap.set("default", "__WEBPACK_MODULE_DEFAULT_EXPORT__");
106579 }
106580 } else if (
106581 dep instanceof HarmonyExportImportedSpecifierDependency
106582 ) {
106583 const exportName = dep.name;
106584 const importName = dep._id;
106585 const importedModule = dep._module;
106586 if (exportName && importName) {
106587 if (!reexportMap.has(exportName)) {
106588 reexportMap.set(exportName, {
106589 module: importedModule,
106590 exportName: importName,
106591 dependency: dep
106592 });
106593 }
106594 } else if (exportName) {
106595 if (!reexportMap.has(exportName)) {
106596 reexportMap.set(exportName, {
106597 module: importedModule,
106598 exportName: true,
106599 dependency: dep
106600 });
106601 }
106602 } else if (importedModule) {
106603 for (const name of importedModule.buildMeta.providedExports) {
106604 if (dep.activeExports.has(name) || name === "default") {
106605 continue;
106606 }
106607 if (!reexportMap.has(name)) {
106608 reexportMap.set(name, {
106609 module: importedModule,
106610 exportName: name,
106611 dependency: dep
106612 });
106613 }
106614 }
106615 }
106616 }
106617 }
106618 return {
106619 type: "concatenated",
106620 module: info.module,
106621 index: idx,
106622 ast: undefined,
106623 internalSource: undefined,
106624 source: undefined,
106625 globalScope: undefined,
106626 moduleScope: undefined,
106627 internalNames: new Map(),
106628 globalExports: new Set(),
106629 exportMap: exportMap,
106630 reexportMap: reexportMap,
106631 hasNamespaceObject: false,
106632 namespaceObjectSource: null
106633 };
106634 }
106635 case "external":
106636 return {
106637 type: "external",
106638 module: info.module,
106639 index: idx,
106640 name: undefined,
106641 interopNamespaceObjectUsed: false,
106642 interopNamespaceObjectName: undefined,
106643 interopDefaultAccessUsed: false,
106644 interopDefaultAccessName: undefined
106645 };
106646 default:
106647 throw new Error(`Unsupported concatenation entry type ${info.type}`);
106648 }
106649 });
106650
106651 // Create mapping from module to info
106652 const moduleToInfoMap = new Map();
106653 for (const m of modulesWithInfo) {
106654 moduleToInfoMap.set(m.module, m);
106655 }
106656
106657 // Configure template decorators for dependencies
106658 const innerDependencyTemplates = new Map(dependencyTemplates);
106659
106660 innerDependencyTemplates.set(
106661 HarmonyImportSpecifierDependency,
106662 new HarmonyImportSpecifierDependencyConcatenatedTemplate(
106663 dependencyTemplates.get(HarmonyImportSpecifierDependency),
106664 moduleToInfoMap
106665 )
106666 );
106667 innerDependencyTemplates.set(
106668 HarmonyImportSideEffectDependency,
106669 new HarmonyImportSideEffectDependencyConcatenatedTemplate(
106670 dependencyTemplates.get(HarmonyImportSideEffectDependency),
106671 moduleToInfoMap
106672 )
106673 );
106674 innerDependencyTemplates.set(
106675 HarmonyExportSpecifierDependency,
106676 new NullTemplate()
106677 );
106678 innerDependencyTemplates.set(
106679 HarmonyExportExpressionDependency,
106680 new HarmonyExportExpressionDependencyConcatenatedTemplate(
106681 dependencyTemplates.get(HarmonyExportExpressionDependency),
106682 this.rootModule
106683 )
106684 );
106685 innerDependencyTemplates.set(
106686 HarmonyExportImportedSpecifierDependency,
106687 new NullTemplate()
106688 );
106689 innerDependencyTemplates.set(
106690 HarmonyCompatibilityDependency,
106691 new NullTemplate()
106692 );
106693
106694 // Must use full identifier in our cache here to ensure that the source
106695 // is updated should our dependencies list change.
106696 // TODO webpack 5 refactor
106697 innerDependencyTemplates.set(
106698 "hash",
106699 innerDependencyTemplates.get("hash") + this.identifier()
106700 );
106701
106702 // Generate source code and analyse scopes
106703 // Prepare a ReplaceSource for the final source
106704 for (const info of modulesWithInfo) {
106705 if (info.type === "concatenated") {
106706 const m = info.module;
106707 const source = m.source(innerDependencyTemplates, runtimeTemplate);
106708 const code = source.source();
106709 let ast;
106710 try {
106711 ast = Parser.parse(code, {
106712 sourceType: "module"
106713 });
106714 } catch (err) {
106715 if (
106716 err.loc &&
106717 typeof err.loc === "object" &&
106718 typeof err.loc.line === "number"
106719 ) {
106720 const lineNumber = err.loc.line;
106721 const lines = code.split("\n");
106722 err.message +=
106723 "\n| " +
106724 lines
106725 .slice(Math.max(0, lineNumber - 3), lineNumber + 2)
106726 .join("\n| ");
106727 }
106728 throw err;
106729 }
106730 const scopeManager = eslintScope.analyze(ast, {
106731 ecmaVersion: 6,
106732 sourceType: "module",
106733 optimistic: true,
106734 ignoreEval: true,
106735 impliedStrict: true
106736 });
106737 const globalScope = scopeManager.acquire(ast);
106738 const moduleScope = globalScope.childScopes[0];
106739 const resultSource = new ReplaceSource(source);
106740 info.ast = ast;
106741 info.internalSource = source;
106742 info.source = resultSource;
106743 info.globalScope = globalScope;
106744 info.moduleScope = moduleScope;
106745 }
106746 }
106747
106748 // List of all used names to avoid conflicts
106749 const allUsedNames = new Set([
106750 "__WEBPACK_MODULE_DEFAULT_EXPORT__", // avoid using this internal name
106751
106752 "abstract",
106753 "arguments",
106754 "async",
106755 "await",
106756 "boolean",
106757 "break",
106758 "byte",
106759 "case",
106760 "catch",
106761 "char",
106762 "class",
106763 "const",
106764 "continue",
106765 "debugger",
106766 "default",
106767 "delete",
106768 "do",
106769 "double",
106770 "else",
106771 "enum",
106772 "eval",
106773 "export",
106774 "extends",
106775 "false",
106776 "final",
106777 "finally",
106778 "float",
106779 "for",
106780 "function",
106781 "goto",
106782 "if",
106783 "implements",
106784 "import",
106785 "in",
106786 "instanceof",
106787 "int",
106788 "interface",
106789 "let",
106790 "long",
106791 "native",
106792 "new",
106793 "null",
106794 "package",
106795 "private",
106796 "protected",
106797 "public",
106798 "return",
106799 "short",
106800 "static",
106801 "super",
106802 "switch",
106803 "synchronized",
106804 "this",
106805 "throw",
106806 "throws",
106807 "transient",
106808 "true",
106809 "try",
106810 "typeof",
106811 "var",
106812 "void",
106813 "volatile",
106814 "while",
106815 "with",
106816 "yield",
106817
106818 "module",
106819 "__dirname",
106820 "__filename",
106821 "exports",
106822
106823 "Array",
106824 "Date",
106825 "eval",
106826 "function",
106827 "hasOwnProperty",
106828 "Infinity",
106829 "isFinite",
106830 "isNaN",
106831 "isPrototypeOf",
106832 "length",
106833 "Math",
106834 "NaN",
106835 "name",
106836 "Number",
106837 "Object",
106838 "prototype",
106839 "String",
106840 "toString",
106841 "undefined",
106842 "valueOf",
106843
106844 "alert",
106845 "all",
106846 "anchor",
106847 "anchors",
106848 "area",
106849 "assign",
106850 "blur",
106851 "button",
106852 "checkbox",
106853 "clearInterval",
106854 "clearTimeout",
106855 "clientInformation",
106856 "close",
106857 "closed",
106858 "confirm",
106859 "constructor",
106860 "crypto",
106861 "decodeURI",
106862 "decodeURIComponent",
106863 "defaultStatus",
106864 "document",
106865 "element",
106866 "elements",
106867 "embed",
106868 "embeds",
106869 "encodeURI",
106870 "encodeURIComponent",
106871 "escape",
106872 "event",
106873 "fileUpload",
106874 "focus",
106875 "form",
106876 "forms",
106877 "frame",
106878 "innerHeight",
106879 "innerWidth",
106880 "layer",
106881 "layers",
106882 "link",
106883 "location",
106884 "mimeTypes",
106885 "navigate",
106886 "navigator",
106887 "frames",
106888 "frameRate",
106889 "hidden",
106890 "history",
106891 "image",
106892 "images",
106893 "offscreenBuffering",
106894 "open",
106895 "opener",
106896 "option",
106897 "outerHeight",
106898 "outerWidth",
106899 "packages",
106900 "pageXOffset",
106901 "pageYOffset",
106902 "parent",
106903 "parseFloat",
106904 "parseInt",
106905 "password",
106906 "pkcs11",
106907 "plugin",
106908 "prompt",
106909 "propertyIsEnum",
106910 "radio",
106911 "reset",
106912 "screenX",
106913 "screenY",
106914 "scroll",
106915 "secure",
106916 "select",
106917 "self",
106918 "setInterval",
106919 "setTimeout",
106920 "status",
106921 "submit",
106922 "taint",
106923 "text",
106924 "textarea",
106925 "top",
106926 "unescape",
106927 "untaint",
106928 "window",
106929
106930 "onblur",
106931 "onclick",
106932 "onerror",
106933 "onfocus",
106934 "onkeydown",
106935 "onkeypress",
106936 "onkeyup",
106937 "onmouseover",
106938 "onload",
106939 "onmouseup",
106940 "onmousedown",
106941 "onsubmit"
106942 ]);
106943
106944 // Set of already checked scopes
106945 const alreadyCheckedScopes = new Set();
106946
106947 // get all global names
106948 for (const info of modulesWithInfo) {
106949 const superClassExpressions = [];
106950
106951 // ignore symbols from moduleScope
106952 if (info.moduleScope) {
106953 alreadyCheckedScopes.add(info.moduleScope);
106954
106955 // The super class expression in class scopes behaves weird
106956 // We store ranges of all super class expressions to make
106957 // renaming to work correctly
106958 for (const childScope of info.moduleScope.childScopes) {
106959 if (childScope.type !== "class") continue;
106960 if (!childScope.block.superClass) continue;
106961 superClassExpressions.push({
106962 range: childScope.block.superClass.range,
106963 variables: childScope.variables
106964 });
106965 }
106966 }
106967
106968 // add global symbols
106969 if (info.globalScope) {
106970 for (const reference of info.globalScope.through) {
106971 const name = reference.identifier.name;
106972 if (
106973 /^__WEBPACK_MODULE_REFERENCE__\d+_([\da-f]+|ns)(_call)?(_strict)?__$/.test(
106974 name
106975 )
106976 ) {
106977 for (const expr of superClassExpressions) {
106978 if (
106979 expr.range[0] <= reference.identifier.range[0] &&
106980 expr.range[1] >= reference.identifier.range[1]
106981 ) {
106982 for (const variable of expr.variables) {
106983 allUsedNames.add(variable.name);
106984 }
106985 }
106986 }
106987 addScopeSymbols1(
106988 reference.from,
106989 allUsedNames,
106990 alreadyCheckedScopes
106991 );
106992 } else {
106993 allUsedNames.add(name);
106994 }
106995 }
106996 }
106997
106998 // add exported globals
106999 if (info.type === "concatenated") {
107000 const variables = new Set();
107001 for (const variable of info.moduleScope.variables) {
107002 variables.add(variable.name);
107003 }
107004 for (const [, variable] of info.exportMap) {
107005 if (!variables.has(variable)) {
107006 info.globalExports.add(variable);
107007 }
107008 }
107009 }
107010 }
107011
107012 // generate names for symbols
107013 for (const info of modulesWithInfo) {
107014 switch (info.type) {
107015 case "concatenated": {
107016 const namespaceObjectName = this.findNewName(
107017 "namespaceObject",
107018 allUsedNames,
107019 null,
107020 info.module.readableIdentifier(requestShortener)
107021 );
107022 allUsedNames.add(namespaceObjectName);
107023 info.internalNames.set(namespaceObjectName, namespaceObjectName);
107024 info.exportMap.set(true, namespaceObjectName);
107025 for (const variable of info.moduleScope.variables) {
107026 const name = variable.name;
107027 if (allUsedNames.has(name)) {
107028 const references = getAllReferences(variable);
107029 const symbolsInReferences = new Set();
107030 const alreadyCheckedInnerScopes = new Set();
107031 for (const ref of references) {
107032 addScopeSymbols2(
107033 ref.from,
107034 symbolsInReferences,
107035 alreadyCheckedInnerScopes,
107036 alreadyCheckedScopes
107037 );
107038 }
107039 const newName = this.findNewName(
107040 name,
107041 allUsedNames,
107042 symbolsInReferences,
107043 info.module.readableIdentifier(requestShortener)
107044 );
107045 allUsedNames.add(newName);
107046 info.internalNames.set(name, newName);
107047 const source = info.source;
107048 const allIdentifiers = new Set(
107049 references.map(r => r.identifier).concat(variable.identifiers)
107050 );
107051 for (const identifier of allIdentifiers) {
107052 const r = identifier.range;
107053 const path = getPathInAst(info.ast, identifier);
107054 if (
107055 path &&
107056 path.length > 1 &&
107057 path[1].type === "Property" &&
107058 path[1].shorthand
107059 ) {
107060 source.insert(r[1], `: ${newName}`);
107061 } else {
107062 source.replace(r[0], r[1] - 1, newName);
107063 }
107064 }
107065 } else {
107066 allUsedNames.add(name);
107067 info.internalNames.set(name, name);
107068 }
107069 }
107070 break;
107071 }
107072 case "external": {
107073 const externalName = this.findNewName(
107074 "",
107075 allUsedNames,
107076 null,
107077 info.module.readableIdentifier(requestShortener)
107078 );
107079 allUsedNames.add(externalName);
107080 info.name = externalName;
107081 if (
107082 info.module.buildMeta.exportsType === "named" ||
107083 !info.module.buildMeta.exportsType
107084 ) {
107085 const externalNameInterop = this.findNewName(
107086 "namespaceObject",
107087 allUsedNames,
107088 null,
107089 info.module.readableIdentifier(requestShortener)
107090 );
107091 allUsedNames.add(externalNameInterop);
107092 info.interopNamespaceObjectName = externalNameInterop;
107093 }
107094 if (!info.module.buildMeta.exportsType) {
107095 const externalNameInterop = this.findNewName(
107096 "default",
107097 allUsedNames,
107098 null,
107099 info.module.readableIdentifier(requestShortener)
107100 );
107101 allUsedNames.add(externalNameInterop);
107102 info.interopDefaultAccessName = externalNameInterop;
107103 }
107104 break;
107105 }
107106 }
107107 }
107108
107109 // Find and replace referenced to modules
107110 for (const info of modulesWithInfo) {
107111 if (info.type === "concatenated") {
107112 for (const reference of info.globalScope.through) {
107113 const name = reference.identifier.name;
107114 const match = /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_strict)?__$/.exec(
107115 name
107116 );
107117 if (match) {
107118 const referencedModule = modulesWithInfo[+match[1]];
107119 let exportName;
107120 if (match[2] === "ns") {
107121 exportName = true;
107122 } else {
107123 const exportData = match[2];
107124 exportName = Buffer.from(exportData, "hex").toString("utf-8");
107125 }
107126 const asCall = !!match[3];
107127 const strictHarmonyModule = !!match[4];
107128 const finalName = getFinalName(
107129 referencedModule,
107130 exportName,
107131 moduleToInfoMap,
107132 requestShortener,
107133 asCall,
107134 strictHarmonyModule
107135 );
107136 const r = reference.identifier.range;
107137 const source = info.source;
107138 source.replace(r[0], r[1] - 1, finalName);
107139 }
107140 }
107141 }
107142 }
107143
107144 // Map with all root exposed used exports
107145 /** @type {Map<string, function(RequestShortener): string>} */
107146 const exportsMap = new Map();
107147
107148 // Set with all root exposed unused exports
107149 /** @type {Set<string>} */
107150 const unusedExports = new Set();
107151
107152 for (const dep of this.rootModule.dependencies) {
107153 if (dep instanceof HarmonyExportSpecifierDependency) {
107154 const used = this.rootModule.isUsed(dep.name);
107155 if (used) {
107156 const info = moduleToInfoMap.get(this.rootModule);
107157 if (!exportsMap.has(used)) {
107158 exportsMap.set(
107159 used,
107160 () => `/* binding */ ${info.internalNames.get(dep.id)}`
107161 );
107162 }
107163 } else {
107164 unusedExports.add(dep.name || "namespace");
107165 }
107166 } else if (dep instanceof HarmonyExportImportedSpecifierDependency) {
107167 const exportDefs = getHarmonyExportImportedSpecifierDependencyExports(
107168 dep
107169 );
107170 for (const def of exportDefs) {
107171 const info = moduleToInfoMap.get(def.module);
107172 const used = dep.originModule.isUsed(def.name);
107173 if (used) {
107174 if (!exportsMap.has(used)) {
107175 exportsMap.set(used, requestShortener => {
107176 const finalName = getFinalName(
107177 info,
107178 def.id,
107179 moduleToInfoMap,
107180 requestShortener,
107181 false,
107182 this.rootModule.buildMeta.strictHarmonyModule
107183 );
107184 return `/* reexport */ ${finalName}`;
107185 });
107186 }
107187 } else {
107188 unusedExports.add(def.name);
107189 }
107190 }
107191 }
107192 }
107193
107194 const result = new ConcatSource();
107195
107196 // add harmony compatibility flag (must be first because of possible circular dependencies)
107197 const usedExports = this.rootModule.usedExports;
107198 if (usedExports === true || usedExports === null) {
107199 result.add(`// ESM COMPAT FLAG\n`);
107200 result.add(
107201 runtimeTemplate.defineEsModuleFlagStatement({
107202 exportsArgument: this.exportsArgument
107203 })
107204 );
107205 }
107206
107207 // define exports
107208 if (exportsMap.size > 0) {
107209 result.add(`\n// EXPORTS\n`);
107210 for (const [key, value] of exportsMap) {
107211 result.add(
107212 `__webpack_require__.d(${this.exportsArgument}, ${JSON.stringify(
107213 key
107214 )}, function() { return ${value(requestShortener)}; });\n`
107215 );
107216 }
107217 }
107218
107219 // list unused exports
107220 if (unusedExports.size > 0) {
107221 result.add(
107222 `\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n`
107223 );
107224 }
107225
107226 // define required namespace objects (must be before evaluation modules)
107227 for (const info of modulesWithInfo) {
107228 if (info.namespaceObjectSource) {
107229 result.add(
107230 `\n// NAMESPACE OBJECT: ${info.module.readableIdentifier(
107231 requestShortener
107232 )}\n`
107233 );
107234 result.add(info.namespaceObjectSource);
107235 }
107236 }
107237
107238 // evaluate modules in order
107239 for (const info of modulesWithInfo) {
107240 switch (info.type) {
107241 case "concatenated":
107242 result.add(
107243 `\n// CONCATENATED MODULE: ${info.module.readableIdentifier(
107244 requestShortener
107245 )}\n`
107246 );
107247 result.add(info.source);
107248 break;
107249 case "external":
107250 result.add(
107251 `\n// EXTERNAL MODULE: ${info.module.readableIdentifier(
107252 requestShortener
107253 )}\n`
107254 );
107255 result.add(
107256 `var ${info.name} = __webpack_require__(${JSON.stringify(
107257 info.module.id
107258 )});\n`
107259 );
107260 if (info.interopNamespaceObjectUsed) {
107261 if (info.module.buildMeta.exportsType === "named") {
107262 result.add(
107263 `var ${info.interopNamespaceObjectName} = /*#__PURE__*/__webpack_require__.t(${info.name}, 2);\n`
107264 );
107265 } else if (!info.module.buildMeta.exportsType) {
107266 result.add(
107267 `var ${info.interopNamespaceObjectName} = /*#__PURE__*/__webpack_require__.t(${info.name});\n`
107268 );
107269 }
107270 }
107271 if (info.interopDefaultAccessUsed) {
107272 result.add(
107273 `var ${info.interopDefaultAccessName} = /*#__PURE__*/__webpack_require__.n(${info.name});\n`
107274 );
107275 }
107276 break;
107277 default:
107278 throw new Error(`Unsupported concatenation entry type ${info.type}`);
107279 }
107280 }
107281
107282 return result;
107283 }
107284
107285 findNewName(oldName, usedNamed1, usedNamed2, extraInfo) {
107286 let name = oldName;
107287
107288 if (name === "__WEBPACK_MODULE_DEFAULT_EXPORT__") name = "";
107289
107290 // Remove uncool stuff
107291 extraInfo = extraInfo.replace(
107292 /\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g,
107293 ""
107294 );
107295
107296 const splittedInfo = extraInfo.split("/");
107297 while (splittedInfo.length) {
107298 name = splittedInfo.pop() + (name ? "_" + name : "");
107299 const nameIdent = Template.toIdentifier(name);
107300 if (
107301 !usedNamed1.has(nameIdent) &&
107302 (!usedNamed2 || !usedNamed2.has(nameIdent))
107303 )
107304 return nameIdent;
107305 }
107306
107307 let i = 0;
107308 let nameWithNumber = Template.toIdentifier(`${name}_${i}`);
107309 while (
107310 usedNamed1.has(nameWithNumber) ||
107311 (usedNamed2 && usedNamed2.has(nameWithNumber))
107312 ) {
107313 i++;
107314 nameWithNumber = Template.toIdentifier(`${name}_${i}`);
107315 }
107316 return nameWithNumber;
107317 }
107318
107319 /**
107320 * @param {Hash} hash the hash used to track dependencies
107321 * @returns {void}
107322 */
107323 updateHash(hash) {
107324 for (const info of this._orderedConcatenationList) {
107325 switch (info.type) {
107326 case "concatenated":
107327 info.module.updateHash(hash);
107328 break;
107329 case "external":
107330 hash.update(`${info.module.id}`);
107331 break;
107332 }
107333 }
107334 super.updateHash(hash);
107335 }
107336}
107337
107338class HarmonyImportSpecifierDependencyConcatenatedTemplate {
107339 constructor(originalTemplate, modulesMap) {
107340 this.originalTemplate = originalTemplate;
107341 this.modulesMap = modulesMap;
107342 }
107343
107344 getHarmonyInitOrder(dep) {
107345 const module = dep._module;
107346 const info = this.modulesMap.get(module);
107347 if (!info) {
107348 return this.originalTemplate.getHarmonyInitOrder(dep);
107349 }
107350 return NaN;
107351 }
107352
107353 harmonyInit(dep, source, runtimeTemplate, dependencyTemplates) {
107354 const module = dep._module;
107355 const info = this.modulesMap.get(module);
107356 if (!info) {
107357 this.originalTemplate.harmonyInit(
107358 dep,
107359 source,
107360 runtimeTemplate,
107361 dependencyTemplates
107362 );
107363 return;
107364 }
107365 }
107366
107367 apply(dep, source, runtime, dependencyTemplates) {
107368 const module = dep._module;
107369 const info = this.modulesMap.get(module);
107370 if (!info) {
107371 this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
107372 return;
107373 }
107374 let content;
107375 const callFlag = dep.call ? "_call" : "";
107376 const strictFlag = dep.originModule.buildMeta.strictHarmonyModule
107377 ? "_strict"
107378 : "";
107379 if (dep._id === null) {
107380 content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`;
107381 } else if (dep.namespaceObjectAsContext) {
107382 content = `__WEBPACK_MODULE_REFERENCE__${
107383 info.index
107384 }_ns${strictFlag}__[${JSON.stringify(dep._id)}]`;
107385 } else {
107386 const exportData = Buffer.from(dep._id, "utf-8").toString("hex");
107387 content = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${strictFlag}__`;
107388 }
107389 if (dep.shorthand) {
107390 content = dep.name + ": " + content;
107391 }
107392 source.replace(dep.range[0], dep.range[1] - 1, content);
107393 }
107394}
107395
107396class HarmonyImportSideEffectDependencyConcatenatedTemplate {
107397 constructor(originalTemplate, modulesMap) {
107398 this.originalTemplate = originalTemplate;
107399 this.modulesMap = modulesMap;
107400 }
107401
107402 getHarmonyInitOrder(dep) {
107403 const module = dep._module;
107404 const info = this.modulesMap.get(module);
107405 if (!info) {
107406 return this.originalTemplate.getHarmonyInitOrder(dep);
107407 }
107408 return NaN;
107409 }
107410
107411 harmonyInit(dep, source, runtime, dependencyTemplates) {
107412 const module = dep._module;
107413 const info = this.modulesMap.get(module);
107414 if (!info) {
107415 this.originalTemplate.harmonyInit(
107416 dep,
107417 source,
107418 runtime,
107419 dependencyTemplates
107420 );
107421 return;
107422 }
107423 }
107424
107425 apply(dep, source, runtime, dependencyTemplates) {
107426 const module = dep._module;
107427 const info = this.modulesMap.get(module);
107428 if (!info) {
107429 this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
107430 return;
107431 }
107432 }
107433}
107434
107435class HarmonyExportExpressionDependencyConcatenatedTemplate {
107436 constructor(originalTemplate, rootModule) {
107437 this.originalTemplate = originalTemplate;
107438 this.rootModule = rootModule;
107439 }
107440
107441 apply(dep, source, runtime, dependencyTemplates) {
107442 let content =
107443 "/* harmony default export */ var __WEBPACK_MODULE_DEFAULT_EXPORT__ = ";
107444 if (dep.originModule === this.rootModule) {
107445 const used = dep.originModule.isUsed("default");
107446 const exportsName = dep.originModule.exportsArgument;
107447 if (used) content += `${exportsName}[${JSON.stringify(used)}] = `;
107448 }
107449
107450 if (dep.range) {
107451 source.replace(
107452 dep.rangeStatement[0],
107453 dep.range[0] - 1,
107454 content + "(" + dep.prefix
107455 );
107456 source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
107457 return;
107458 }
107459
107460 source.replace(
107461 dep.rangeStatement[0],
107462 dep.rangeStatement[1] - 1,
107463 content + dep.prefix
107464 );
107465 }
107466}
107467
107468class NullTemplate {
107469 apply() {}
107470}
107471
107472module.exports = ConcatenatedModule;
107473
107474
107475/***/ }),
107476
107477/***/ 29720:
107478/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
107479
107480"use strict";
107481/*
107482 MIT License http://www.opensource.org/licenses/mit-license.php
107483 Author Tobias Koppers @sokra
107484*/
107485
107486
107487const GraphHelpers = __webpack_require__(32973);
107488
107489class EnsureChunkConditionsPlugin {
107490 apply(compiler) {
107491 compiler.hooks.compilation.tap(
107492 "EnsureChunkConditionsPlugin",
107493 compilation => {
107494 const handler = chunks => {
107495 let changed = false;
107496 for (const module of compilation.modules) {
107497 if (!module.chunkCondition) continue;
107498 const sourceChunks = new Set();
107499 const chunkGroups = new Set();
107500 for (const chunk of module.chunksIterable) {
107501 if (!module.chunkCondition(chunk)) {
107502 sourceChunks.add(chunk);
107503 for (const group of chunk.groupsIterable) {
107504 chunkGroups.add(group);
107505 }
107506 }
107507 }
107508 if (sourceChunks.size === 0) continue;
107509 const targetChunks = new Set();
107510 chunkGroupLoop: for (const chunkGroup of chunkGroups) {
107511 // Can module be placed in a chunk of this group?
107512 for (const chunk of chunkGroup.chunks) {
107513 if (module.chunkCondition(chunk)) {
107514 targetChunks.add(chunk);
107515 continue chunkGroupLoop;
107516 }
107517 }
107518 // We reached the entrypoint: fail
107519 if (chunkGroup.isInitial()) {
107520 throw new Error(
107521 "Cannot fullfil chunk condition of " + module.identifier()
107522 );
107523 }
107524 // Try placing in all parents
107525 for (const group of chunkGroup.parentsIterable) {
107526 chunkGroups.add(group);
107527 }
107528 }
107529 for (const sourceChunk of sourceChunks) {
107530 GraphHelpers.disconnectChunkAndModule(sourceChunk, module);
107531 }
107532 for (const targetChunk of targetChunks) {
107533 GraphHelpers.connectChunkAndModule(targetChunk, module);
107534 }
107535 }
107536 if (changed) return true;
107537 };
107538 compilation.hooks.optimizeChunksBasic.tap(
107539 "EnsureChunkConditionsPlugin",
107540 handler
107541 );
107542 compilation.hooks.optimizeExtractedChunksBasic.tap(
107543 "EnsureChunkConditionsPlugin",
107544 handler
107545 );
107546 }
107547 );
107548 }
107549}
107550module.exports = EnsureChunkConditionsPlugin;
107551
107552
107553/***/ }),
107554
107555/***/ 25850:
107556/***/ (function(module) {
107557
107558"use strict";
107559/*
107560 MIT License http://www.opensource.org/licenses/mit-license.php
107561 Author Tobias Koppers @sokra
107562*/
107563
107564
107565class FlagIncludedChunksPlugin {
107566 apply(compiler) {
107567 compiler.hooks.compilation.tap("FlagIncludedChunksPlugin", compilation => {
107568 compilation.hooks.optimizeChunkIds.tap(
107569 "FlagIncludedChunksPlugin",
107570 chunks => {
107571 // prepare two bit integers for each module
107572 // 2^31 is the max number represented as SMI in v8
107573 // we want the bits distributed this way:
107574 // the bit 2^31 is pretty rar and only one module should get it
107575 // so it has a probability of 1 / modulesCount
107576 // the first bit (2^0) is the easiest and every module could get it
107577 // if it doesn't get a better bit
107578 // from bit 2^n to 2^(n+1) there is a probability of p
107579 // so 1 / modulesCount == p^31
107580 // <=> p = sqrt31(1 / modulesCount)
107581 // so we use a modulo of 1 / sqrt31(1 / modulesCount)
107582 const moduleBits = new WeakMap();
107583 const modulesCount = compilation.modules.length;
107584
107585 // precalculate the modulo values for each bit
107586 const modulo = 1 / Math.pow(1 / modulesCount, 1 / 31);
107587 const modulos = Array.from(
107588 { length: 31 },
107589 (x, i) => Math.pow(modulo, i) | 0
107590 );
107591
107592 // iterate all modules to generate bit values
107593 let i = 0;
107594 for (const module of compilation.modules) {
107595 let bit = 30;
107596 while (i % modulos[bit] !== 0) {
107597 bit--;
107598 }
107599 moduleBits.set(module, 1 << bit);
107600 i++;
107601 }
107602
107603 // interate all chunks to generate bitmaps
107604 const chunkModulesHash = new WeakMap();
107605 for (const chunk of chunks) {
107606 let hash = 0;
107607 for (const module of chunk.modulesIterable) {
107608 hash |= moduleBits.get(module);
107609 }
107610 chunkModulesHash.set(chunk, hash);
107611 }
107612
107613 for (const chunkA of chunks) {
107614 const chunkAHash = chunkModulesHash.get(chunkA);
107615 const chunkAModulesCount = chunkA.getNumberOfModules();
107616 if (chunkAModulesCount === 0) continue;
107617 let bestModule = undefined;
107618 for (const module of chunkA.modulesIterable) {
107619 if (
107620 bestModule === undefined ||
107621 bestModule.getNumberOfChunks() > module.getNumberOfChunks()
107622 )
107623 bestModule = module;
107624 }
107625 loopB: for (const chunkB of bestModule.chunksIterable) {
107626 // as we iterate the same iterables twice
107627 // skip if we find ourselves
107628 if (chunkA === chunkB) continue;
107629
107630 const chunkBModulesCount = chunkB.getNumberOfModules();
107631
107632 // ids for empty chunks are not included
107633 if (chunkBModulesCount === 0) continue;
107634
107635 // instead of swapping A and B just bail
107636 // as we loop twice the current A will be B and B then A
107637 if (chunkAModulesCount > chunkBModulesCount) continue;
107638
107639 // is chunkA in chunkB?
107640
107641 // we do a cheap check for the hash value
107642 const chunkBHash = chunkModulesHash.get(chunkB);
107643 if ((chunkBHash & chunkAHash) !== chunkAHash) continue;
107644
107645 // compare all modules
107646 for (const m of chunkA.modulesIterable) {
107647 if (!chunkB.containsModule(m)) continue loopB;
107648 }
107649 chunkB.ids.push(chunkA.id);
107650 }
107651 }
107652 }
107653 );
107654 });
107655 }
107656}
107657module.exports = FlagIncludedChunksPlugin;
107658
107659
107660/***/ }),
107661
107662/***/ 3846:
107663/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
107664
107665"use strict";
107666/*
107667 MIT License http://www.opensource.org/licenses/mit-license.php
107668 Author Tobias Koppers @sokra
107669*/
107670
107671
107672const validateOptions = __webpack_require__(33225);
107673const schema = __webpack_require__(27993);
107674const LazyBucketSortedSet = __webpack_require__(52315);
107675
107676/** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */
107677/** @typedef {import("../Chunk")} Chunk */
107678/** @typedef {import("../Compiler")} Compiler */
107679
107680/**
107681 * @typedef {Object} ChunkCombination
107682 * @property {boolean} deleted this is set to true when combination was removed
107683 * @property {number} sizeDiff
107684 * @property {number} integratedSize
107685 * @property {Chunk} a
107686 * @property {Chunk} b
107687 * @property {number} aIdx
107688 * @property {number} bIdx
107689 * @property {number} aSize
107690 * @property {number} bSize
107691 */
107692
107693const addToSetMap = (map, key, value) => {
107694 const set = map.get(key);
107695 if (set === undefined) {
107696 map.set(key, new Set([value]));
107697 } else {
107698 set.add(value);
107699 }
107700};
107701
107702class LimitChunkCountPlugin {
107703 /**
107704 * @param {LimitChunkCountPluginOptions=} options options object
107705 */
107706 constructor(options) {
107707 if (!options) options = {};
107708
107709 validateOptions(schema, options, "Limit Chunk Count Plugin");
107710 this.options = options;
107711 }
107712
107713 /**
107714 * @param {Compiler} compiler the webpack compiler
107715 * @returns {void}
107716 */
107717 apply(compiler) {
107718 const options = this.options;
107719 compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => {
107720 compilation.hooks.optimizeChunksAdvanced.tap(
107721 "LimitChunkCountPlugin",
107722 chunks => {
107723 const maxChunks = options.maxChunks;
107724 if (!maxChunks) return;
107725 if (maxChunks < 1) return;
107726 if (chunks.length <= maxChunks) return;
107727
107728 let remainingChunksToMerge = chunks.length - maxChunks;
107729
107730 // order chunks in a deterministic way
107731 const orderedChunks = chunks.slice().sort((a, b) => a.compareTo(b));
107732
107733 // create a lazy sorted data structure to keep all combinations
107734 // this is large. Size = chunks * (chunks - 1) / 2
107735 // It uses a multi layer bucket sort plus normal sort in the last layer
107736 // It's also lazy so only accessed buckets are sorted
107737 const combinations = new LazyBucketSortedSet(
107738 // Layer 1: ordered by largest size benefit
107739 c => c.sizeDiff,
107740 (a, b) => b - a,
107741 // Layer 2: ordered by smallest combined size
107742 c => c.integratedSize,
107743 (a, b) => a - b,
107744 // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic)
107745 c => c.bIdx - c.aIdx,
107746 (a, b) => a - b,
107747 // Layer 4: ordered by position in orderedChunk (-> to be deterministic)
107748 (a, b) => a.bIdx - b.bIdx
107749 );
107750
107751 // we keep a mappng from chunk to all combinations
107752 // but this mapping is not kept up-to-date with deletions
107753 // so `deleted` flag need to be considered when iterating this
107754 /** @type {Map<Chunk, Set<ChunkCombination>>} */
107755 const combinationsByChunk = new Map();
107756
107757 orderedChunks.forEach((b, bIdx) => {
107758 // create combination pairs with size and integrated size
107759 for (let aIdx = 0; aIdx < bIdx; aIdx++) {
107760 const a = orderedChunks[aIdx];
107761 const integratedSize = a.integratedSize(b, options);
107762
107763 // filter pairs that do not have an integratedSize
107764 // meaning they can NOT be integrated!
107765 if (integratedSize === false) continue;
107766
107767 const aSize = a.size(options);
107768 const bSize = b.size(options);
107769 const c = {
107770 deleted: false,
107771 sizeDiff: aSize + bSize - integratedSize,
107772 integratedSize,
107773 a,
107774 b,
107775 aIdx,
107776 bIdx,
107777 aSize,
107778 bSize
107779 };
107780 combinations.add(c);
107781 addToSetMap(combinationsByChunk, a, c);
107782 addToSetMap(combinationsByChunk, b, c);
107783 }
107784 return combinations;
107785 });
107786
107787 // list of modified chunks during this run
107788 // combinations affected by this change are skipped to allow
107789 // futher optimizations
107790 /** @type {Set<Chunk>} */
107791 const modifiedChunks = new Set();
107792
107793 let changed = false;
107794 // eslint-disable-next-line no-constant-condition
107795 loop: while (true) {
107796 const combination = combinations.popFirst();
107797 if (combination === undefined) break;
107798
107799 combination.deleted = true;
107800 const { a, b, integratedSize } = combination;
107801
107802 // skip over pair when
107803 // one of the already merged chunks is a parent of one of the chunks
107804 if (modifiedChunks.size > 0) {
107805 const queue = new Set(a.groupsIterable);
107806 for (const group of b.groupsIterable) {
107807 queue.add(group);
107808 }
107809 for (const group of queue) {
107810 for (const mChunk of modifiedChunks) {
107811 if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) {
107812 // This is a potential pair which needs recalculation
107813 // We can't do that now, but it merge before following pairs
107814 // so we leave space for it, and consider chunks as modified
107815 // just for the worse case
107816 remainingChunksToMerge--;
107817 if (remainingChunksToMerge <= 0) break loop;
107818 modifiedChunks.add(a);
107819 modifiedChunks.add(b);
107820 continue loop;
107821 }
107822 }
107823 for (const parent of group.parentsIterable) {
107824 queue.add(parent);
107825 }
107826 }
107827 }
107828
107829 // merge the chunks
107830 if (a.integrate(b, "limit")) {
107831 chunks.splice(chunks.indexOf(b), 1);
107832
107833 // flag chunk a as modified as further optimization are possible for all children here
107834 modifiedChunks.add(a);
107835
107836 changed = true;
107837 remainingChunksToMerge--;
107838 if (remainingChunksToMerge <= 0) break;
107839
107840 // Update all affected combinations
107841 // delete all combination with the removed chunk
107842 // we will use combinations with the kept chunk instead
107843 for (const combination of combinationsByChunk.get(b)) {
107844 if (combination.deleted) continue;
107845 combination.deleted = true;
107846 combinations.delete(combination);
107847 }
107848
107849 // Update combinations with the kept chunk with new sizes
107850 for (const combination of combinationsByChunk.get(a)) {
107851 if (combination.deleted) continue;
107852 if (combination.a === a) {
107853 // Update size
107854 const newIntegratedSize = a.integratedSize(
107855 combination.b,
107856 options
107857 );
107858 if (newIntegratedSize === false) {
107859 combination.deleted = true;
107860 combinations.delete(combination);
107861 continue;
107862 }
107863 const finishUpdate = combinations.startUpdate(combination);
107864 combination.integratedSize = newIntegratedSize;
107865 combination.aSize = integratedSize;
107866 combination.sizeDiff =
107867 combination.bSize + integratedSize - newIntegratedSize;
107868 finishUpdate();
107869 } else if (combination.b === a) {
107870 // Update size
107871 const newIntegratedSize = combination.a.integratedSize(
107872 a,
107873 options
107874 );
107875 if (newIntegratedSize === false) {
107876 combination.deleted = true;
107877 combinations.delete(combination);
107878 continue;
107879 }
107880 const finishUpdate = combinations.startUpdate(combination);
107881 combination.integratedSize = newIntegratedSize;
107882 combination.bSize = integratedSize;
107883 combination.sizeDiff =
107884 integratedSize + combination.aSize - newIntegratedSize;
107885 finishUpdate();
107886 }
107887 }
107888 }
107889 }
107890 if (changed) return true;
107891 }
107892 );
107893 });
107894 }
107895}
107896module.exports = LimitChunkCountPlugin;
107897
107898
107899/***/ }),
107900
107901/***/ 46214:
107902/***/ (function(module) {
107903
107904"use strict";
107905/*
107906 MIT License http://www.opensource.org/licenses/mit-license.php
107907 Author Tobias Koppers @sokra
107908*/
107909
107910
107911class MergeDuplicateChunksPlugin {
107912 apply(compiler) {
107913 compiler.hooks.compilation.tap(
107914 "MergeDuplicateChunksPlugin",
107915 compilation => {
107916 compilation.hooks.optimizeChunksBasic.tap(
107917 "MergeDuplicateChunksPlugin",
107918 chunks => {
107919 // remember already tested chunks for performance
107920 const notDuplicates = new Set();
107921
107922 // for each chunk
107923 for (const chunk of chunks) {
107924 // track a Set of all chunk that could be duplicates
107925 let possibleDuplicates;
107926 for (const module of chunk.modulesIterable) {
107927 if (possibleDuplicates === undefined) {
107928 // when possibleDuplicates is not yet set,
107929 // create a new Set from chunks of the current module
107930 // including only chunks with the same number of modules
107931 for (const dup of module.chunksIterable) {
107932 if (
107933 dup !== chunk &&
107934 chunk.getNumberOfModules() === dup.getNumberOfModules() &&
107935 !notDuplicates.has(dup)
107936 ) {
107937 // delay allocating the new Set until here, reduce memory pressure
107938 if (possibleDuplicates === undefined) {
107939 possibleDuplicates = new Set();
107940 }
107941 possibleDuplicates.add(dup);
107942 }
107943 }
107944 // when no chunk is possible we can break here
107945 if (possibleDuplicates === undefined) break;
107946 } else {
107947 // validate existing possible duplicates
107948 for (const dup of possibleDuplicates) {
107949 // remove possible duplicate when module is not contained
107950 if (!dup.containsModule(module)) {
107951 possibleDuplicates.delete(dup);
107952 }
107953 }
107954 // when all chunks has been removed we can break here
107955 if (possibleDuplicates.size === 0) break;
107956 }
107957 }
107958
107959 // when we found duplicates
107960 if (
107961 possibleDuplicates !== undefined &&
107962 possibleDuplicates.size > 0
107963 ) {
107964 for (const otherChunk of possibleDuplicates) {
107965 if (otherChunk.hasRuntime() !== chunk.hasRuntime()) continue;
107966 // merge them
107967 if (chunk.integrate(otherChunk, "duplicate")) {
107968 chunks.splice(chunks.indexOf(otherChunk), 1);
107969 }
107970 }
107971 }
107972
107973 // don't check already processed chunks twice
107974 notDuplicates.add(chunk);
107975 }
107976 }
107977 );
107978 }
107979 );
107980 }
107981}
107982module.exports = MergeDuplicateChunksPlugin;
107983
107984
107985/***/ }),
107986
107987/***/ 55607:
107988/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
107989
107990"use strict";
107991/*
107992 MIT License http://www.opensource.org/licenses/mit-license.php
107993 Author Tobias Koppers @sokra
107994*/
107995
107996
107997const validateOptions = __webpack_require__(33225);
107998const schema = __webpack_require__(8670);
107999
108000/** @typedef {import("../../declarations/plugins/optimize/MinChunkSizePlugin").MinChunkSizePluginOptions} MinChunkSizePluginOptions */
108001
108002class MinChunkSizePlugin {
108003 /**
108004 * @param {MinChunkSizePluginOptions} options options object
108005 */
108006 constructor(options) {
108007 validateOptions(schema, options, "Min Chunk Size Plugin");
108008 this.options = options;
108009 }
108010
108011 apply(compiler) {
108012 const options = this.options;
108013 const minChunkSize = options.minChunkSize;
108014 compiler.hooks.compilation.tap("MinChunkSizePlugin", compilation => {
108015 compilation.hooks.optimizeChunksAdvanced.tap(
108016 "MinChunkSizePlugin",
108017 chunks => {
108018 const equalOptions = {
108019 chunkOverhead: 1,
108020 entryChunkMultiplicator: 1
108021 };
108022
108023 const sortedSizeFilteredExtendedPairCombinations = chunks
108024 .reduce((combinations, a, idx) => {
108025 // create combination pairs
108026 for (let i = 0; i < idx; i++) {
108027 const b = chunks[i];
108028 combinations.push([b, a]);
108029 }
108030 return combinations;
108031 }, [])
108032 .filter(pair => {
108033 // check if one of the chunks sizes is smaller than the minChunkSize
108034 const p0SmallerThanMinChunkSize =
108035 pair[0].size(equalOptions) < minChunkSize;
108036 const p1SmallerThanMinChunkSize =
108037 pair[1].size(equalOptions) < minChunkSize;
108038 return p0SmallerThanMinChunkSize || p1SmallerThanMinChunkSize;
108039 })
108040 .map(pair => {
108041 // extend combination pairs with size and integrated size
108042 const a = pair[0].size(options);
108043 const b = pair[1].size(options);
108044 const ab = pair[0].integratedSize(pair[1], options);
108045 return [a + b - ab, ab, pair[0], pair[1]];
108046 })
108047 .filter(pair => {
108048 // filter pairs that do not have an integratedSize
108049 // meaning they can NOT be integrated!
108050 return pair[1] !== false;
108051 })
108052 .sort((a, b) => {
108053 // sadly javascript does an inplace sort here
108054 // sort by size
108055 const diff = b[0] - a[0];
108056 if (diff !== 0) return diff;
108057 return a[1] - b[1];
108058 });
108059
108060 if (sortedSizeFilteredExtendedPairCombinations.length === 0) return;
108061
108062 const pair = sortedSizeFilteredExtendedPairCombinations[0];
108063
108064 pair[2].integrate(pair[3], "min-size");
108065 chunks.splice(chunks.indexOf(pair[3]), 1);
108066 return true;
108067 }
108068 );
108069 });
108070 }
108071}
108072module.exports = MinChunkSizePlugin;
108073
108074
108075/***/ }),
108076
108077/***/ 25472:
108078/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
108079
108080"use strict";
108081/*
108082 MIT License http://www.opensource.org/licenses/mit-license.php
108083 Author Tobias Koppers @sokra
108084*/
108085
108086
108087const WebpackError = __webpack_require__(97391);
108088const SizeFormatHelpers = __webpack_require__(12496);
108089
108090class MinMaxSizeWarning extends WebpackError {
108091 constructor(keys, minSize, maxSize) {
108092 let keysMessage = "Fallback cache group";
108093 if (keys) {
108094 keysMessage =
108095 keys.length > 1
108096 ? `Cache groups ${keys.sort().join(", ")}`
108097 : `Cache group ${keys[0]}`;
108098 }
108099 super(
108100 `SplitChunksPlugin\n` +
108101 `${keysMessage}\n` +
108102 `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` +
108103 `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` +
108104 "This seem to be a invalid optimiziation.splitChunks configuration."
108105 );
108106 }
108107}
108108
108109module.exports = MinMaxSizeWarning;
108110
108111
108112/***/ }),
108113
108114/***/ 45184:
108115/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
108116
108117"use strict";
108118/*
108119 MIT License http://www.opensource.org/licenses/mit-license.php
108120 Author Tobias Koppers @sokra
108121*/
108122
108123
108124const HarmonyImportDependency = __webpack_require__(81599);
108125const ModuleHotAcceptDependency = __webpack_require__(29018);
108126const ModuleHotDeclineDependency = __webpack_require__(60482);
108127const ConcatenatedModule = __webpack_require__(16953);
108128const HarmonyCompatibilityDependency = __webpack_require__(1533);
108129const StackedSetMap = __webpack_require__(92251);
108130
108131const formatBailoutReason = msg => {
108132 return "ModuleConcatenation bailout: " + msg;
108133};
108134
108135class ModuleConcatenationPlugin {
108136 constructor(options) {
108137 if (typeof options !== "object") options = {};
108138 this.options = options;
108139 }
108140
108141 apply(compiler) {
108142 compiler.hooks.compilation.tap(
108143 "ModuleConcatenationPlugin",
108144 (compilation, { normalModuleFactory }) => {
108145 const handler = (parser, parserOptions) => {
108146 parser.hooks.call.for("eval").tap("ModuleConcatenationPlugin", () => {
108147 // Because of variable renaming we can't use modules with eval.
108148 parser.state.module.buildMeta.moduleConcatenationBailout = "eval()";
108149 });
108150 };
108151
108152 normalModuleFactory.hooks.parser
108153 .for("javascript/auto")
108154 .tap("ModuleConcatenationPlugin", handler);
108155 normalModuleFactory.hooks.parser
108156 .for("javascript/dynamic")
108157 .tap("ModuleConcatenationPlugin", handler);
108158 normalModuleFactory.hooks.parser
108159 .for("javascript/esm")
108160 .tap("ModuleConcatenationPlugin", handler);
108161
108162 const bailoutReasonMap = new Map();
108163
108164 const setBailoutReason = (module, reason) => {
108165 bailoutReasonMap.set(module, reason);
108166 module.optimizationBailout.push(
108167 typeof reason === "function"
108168 ? rs => formatBailoutReason(reason(rs))
108169 : formatBailoutReason(reason)
108170 );
108171 };
108172
108173 const getBailoutReason = (module, requestShortener) => {
108174 const reason = bailoutReasonMap.get(module);
108175 if (typeof reason === "function") return reason(requestShortener);
108176 return reason;
108177 };
108178
108179 compilation.hooks.optimizeChunkModules.tap(
108180 "ModuleConcatenationPlugin",
108181 (allChunks, modules) => {
108182 const relevantModules = [];
108183 const possibleInners = new Set();
108184 for (const module of modules) {
108185 // Only harmony modules are valid for optimization
108186 if (
108187 !module.buildMeta ||
108188 module.buildMeta.exportsType !== "namespace" ||
108189 !module.dependencies.some(
108190 d => d instanceof HarmonyCompatibilityDependency
108191 )
108192 ) {
108193 setBailoutReason(module, "Module is not an ECMAScript module");
108194 continue;
108195 }
108196
108197 // Some expressions are not compatible with module concatenation
108198 // because they may produce unexpected results. The plugin bails out
108199 // if some were detected upfront.
108200 if (
108201 module.buildMeta &&
108202 module.buildMeta.moduleConcatenationBailout
108203 ) {
108204 setBailoutReason(
108205 module,
108206 `Module uses ${module.buildMeta.moduleConcatenationBailout}`
108207 );
108208 continue;
108209 }
108210
108211 // Exports must be known (and not dynamic)
108212 if (!Array.isArray(module.buildMeta.providedExports)) {
108213 setBailoutReason(module, "Module exports are unknown");
108214 continue;
108215 }
108216
108217 // Using dependency variables is not possible as this wraps the code in a function
108218 if (module.variables.length > 0) {
108219 setBailoutReason(
108220 module,
108221 `Module uses injected variables (${module.variables
108222 .map(v => v.name)
108223 .join(", ")})`
108224 );
108225 continue;
108226 }
108227
108228 // Hot Module Replacement need it's own module to work correctly
108229 if (
108230 module.dependencies.some(
108231 dep =>
108232 dep instanceof ModuleHotAcceptDependency ||
108233 dep instanceof ModuleHotDeclineDependency
108234 )
108235 ) {
108236 setBailoutReason(module, "Module uses Hot Module Replacement");
108237 continue;
108238 }
108239
108240 relevantModules.push(module);
108241
108242 // Module must not be the entry points
108243 if (module.isEntryModule()) {
108244 setBailoutReason(module, "Module is an entry point");
108245 continue;
108246 }
108247
108248 // Module must be in any chunk (we don't want to do useless work)
108249 if (module.getNumberOfChunks() === 0) {
108250 setBailoutReason(module, "Module is not in any chunk");
108251 continue;
108252 }
108253
108254 // Module must only be used by Harmony Imports
108255 const nonHarmonyReasons = module.reasons.filter(
108256 reason =>
108257 !reason.dependency ||
108258 !(reason.dependency instanceof HarmonyImportDependency)
108259 );
108260 if (nonHarmonyReasons.length > 0) {
108261 const importingModules = new Set(
108262 nonHarmonyReasons.map(r => r.module).filter(Boolean)
108263 );
108264 const importingExplanations = new Set(
108265 nonHarmonyReasons.map(r => r.explanation).filter(Boolean)
108266 );
108267 const importingModuleTypes = new Map(
108268 Array.from(importingModules).map(
108269 m => /** @type {[string, Set]} */ ([
108270 m,
108271 new Set(
108272 nonHarmonyReasons
108273 .filter(r => r.module === m)
108274 .map(r => r.dependency.type)
108275 .sort()
108276 )
108277 ])
108278 )
108279 );
108280 setBailoutReason(module, requestShortener => {
108281 const names = Array.from(importingModules)
108282 .map(
108283 m =>
108284 `${m.readableIdentifier(
108285 requestShortener
108286 )} (referenced with ${Array.from(
108287 importingModuleTypes.get(m)
108288 ).join(", ")})`
108289 )
108290 .sort();
108291 const explanations = Array.from(importingExplanations).sort();
108292 if (names.length > 0 && explanations.length === 0) {
108293 return `Module is referenced from these modules with unsupported syntax: ${names.join(
108294 ", "
108295 )}`;
108296 } else if (names.length === 0 && explanations.length > 0) {
108297 return `Module is referenced by: ${explanations.join(
108298 ", "
108299 )}`;
108300 } else if (names.length > 0 && explanations.length > 0) {
108301 return `Module is referenced from these modules with unsupported syntax: ${names.join(
108302 ", "
108303 )} and by: ${explanations.join(", ")}`;
108304 } else {
108305 return "Module is referenced in a unsupported way";
108306 }
108307 });
108308 continue;
108309 }
108310
108311 possibleInners.add(module);
108312 }
108313 // sort by depth
108314 // modules with lower depth are more likely suited as roots
108315 // this improves performance, because modules already selected as inner are skipped
108316 relevantModules.sort((a, b) => {
108317 return a.depth - b.depth;
108318 });
108319 const concatConfigurations = [];
108320 const usedAsInner = new Set();
108321 for (const currentRoot of relevantModules) {
108322 // when used by another configuration as inner:
108323 // the other configuration is better and we can skip this one
108324 if (usedAsInner.has(currentRoot)) continue;
108325
108326 // create a configuration with the root
108327 const currentConfiguration = new ConcatConfiguration(currentRoot);
108328
108329 // cache failures to add modules
108330 const failureCache = new Map();
108331
108332 // try to add all imports
108333 for (const imp of this._getImports(compilation, currentRoot)) {
108334 const problem = this._tryToAdd(
108335 compilation,
108336 currentConfiguration,
108337 imp,
108338 possibleInners,
108339 failureCache
108340 );
108341 if (problem) {
108342 failureCache.set(imp, problem);
108343 currentConfiguration.addWarning(imp, problem);
108344 }
108345 }
108346 if (!currentConfiguration.isEmpty()) {
108347 concatConfigurations.push(currentConfiguration);
108348 for (const module of currentConfiguration.getModules()) {
108349 if (module !== currentConfiguration.rootModule) {
108350 usedAsInner.add(module);
108351 }
108352 }
108353 }
108354 }
108355 // HACK: Sort configurations by length and start with the longest one
108356 // to get the biggers groups possible. Used modules are marked with usedModules
108357 // TODO: Allow to reuse existing configuration while trying to add dependencies.
108358 // This would improve performance. O(n^2) -> O(n)
108359 concatConfigurations.sort((a, b) => {
108360 return b.modules.size - a.modules.size;
108361 });
108362 const usedModules = new Set();
108363 for (const concatConfiguration of concatConfigurations) {
108364 if (usedModules.has(concatConfiguration.rootModule)) continue;
108365 const modules = concatConfiguration.getModules();
108366 const rootModule = concatConfiguration.rootModule;
108367 const newModule = new ConcatenatedModule(
108368 rootModule,
108369 Array.from(modules),
108370 ConcatenatedModule.createConcatenationList(
108371 rootModule,
108372 modules,
108373 compilation
108374 )
108375 );
108376 for (const warning of concatConfiguration.getWarningsSorted()) {
108377 newModule.optimizationBailout.push(requestShortener => {
108378 const reason = getBailoutReason(warning[0], requestShortener);
108379 const reasonWithPrefix = reason ? ` (<- ${reason})` : "";
108380 if (warning[0] === warning[1]) {
108381 return formatBailoutReason(
108382 `Cannot concat with ${warning[0].readableIdentifier(
108383 requestShortener
108384 )}${reasonWithPrefix}`
108385 );
108386 } else {
108387 return formatBailoutReason(
108388 `Cannot concat with ${warning[0].readableIdentifier(
108389 requestShortener
108390 )} because of ${warning[1].readableIdentifier(
108391 requestShortener
108392 )}${reasonWithPrefix}`
108393 );
108394 }
108395 });
108396 }
108397 const chunks = concatConfiguration.rootModule.getChunks();
108398 for (const m of modules) {
108399 usedModules.add(m);
108400 for (const chunk of chunks) {
108401 chunk.removeModule(m);
108402 }
108403 }
108404 for (const chunk of chunks) {
108405 chunk.addModule(newModule);
108406 newModule.addChunk(chunk);
108407 }
108408 for (const chunk of allChunks) {
108409 if (chunk.entryModule === concatConfiguration.rootModule) {
108410 chunk.entryModule = newModule;
108411 }
108412 }
108413 compilation.modules.push(newModule);
108414 for (const reason of newModule.reasons) {
108415 if (reason.dependency.module === concatConfiguration.rootModule)
108416 reason.dependency.module = newModule;
108417 if (
108418 reason.dependency.redirectedModule ===
108419 concatConfiguration.rootModule
108420 )
108421 reason.dependency.redirectedModule = newModule;
108422 }
108423 // TODO: remove when LTS node version contains fixed v8 version
108424 // @see https://github.com/webpack/webpack/pull/6613
108425 // Turbofan does not correctly inline for-of loops with polymorphic input arrays.
108426 // Work around issue by using a standard for loop and assigning dep.module.reasons
108427 for (let i = 0; i < newModule.dependencies.length; i++) {
108428 let dep = newModule.dependencies[i];
108429 if (dep.module) {
108430 let reasons = dep.module.reasons;
108431 for (let j = 0; j < reasons.length; j++) {
108432 let reason = reasons[j];
108433 if (reason.dependency === dep) {
108434 reason.module = newModule;
108435 }
108436 }
108437 }
108438 }
108439 }
108440 compilation.modules = compilation.modules.filter(
108441 m => !usedModules.has(m)
108442 );
108443 }
108444 );
108445 }
108446 );
108447 }
108448
108449 _getImports(compilation, module) {
108450 return new Set(
108451 module.dependencies
108452
108453 // Get reference info only for harmony Dependencies
108454 .map(dep => {
108455 if (!(dep instanceof HarmonyImportDependency)) return null;
108456 if (!compilation) return dep.getReference();
108457 return compilation.getDependencyReference(module, dep);
108458 })
108459
108460 // Reference is valid and has a module
108461 // Dependencies are simple enough to concat them
108462 .filter(
108463 ref =>
108464 ref &&
108465 ref.module &&
108466 (Array.isArray(ref.importedNames) ||
108467 Array.isArray(ref.module.buildMeta.providedExports))
108468 )
108469
108470 // Take the imported module
108471 .map(ref => ref.module)
108472 );
108473 }
108474
108475 _tryToAdd(compilation, config, module, possibleModules, failureCache) {
108476 const cacheEntry = failureCache.get(module);
108477 if (cacheEntry) {
108478 return cacheEntry;
108479 }
108480
108481 // Already added?
108482 if (config.has(module)) {
108483 return null;
108484 }
108485
108486 // Not possible to add?
108487 if (!possibleModules.has(module)) {
108488 failureCache.set(module, module); // cache failures for performance
108489 return module;
108490 }
108491
108492 // module must be in the same chunks
108493 if (!config.rootModule.hasEqualsChunks(module)) {
108494 failureCache.set(module, module); // cache failures for performance
108495 return module;
108496 }
108497
108498 // Clone config to make experimental changes
108499 const testConfig = config.clone();
108500
108501 // Add the module
108502 testConfig.add(module);
108503
108504 // Every module which depends on the added module must be in the configuration too.
108505 for (const reason of module.reasons) {
108506 // Modules that are not used can be ignored
108507 if (
108508 reason.module.factoryMeta.sideEffectFree &&
108509 reason.module.used === false
108510 )
108511 continue;
108512
108513 const problem = this._tryToAdd(
108514 compilation,
108515 testConfig,
108516 reason.module,
108517 possibleModules,
108518 failureCache
108519 );
108520 if (problem) {
108521 failureCache.set(module, problem); // cache failures for performance
108522 return problem;
108523 }
108524 }
108525
108526 // Commit experimental changes
108527 config.set(testConfig);
108528
108529 // Eagerly try to add imports too if possible
108530 for (const imp of this._getImports(compilation, module)) {
108531 const problem = this._tryToAdd(
108532 compilation,
108533 config,
108534 imp,
108535 possibleModules,
108536 failureCache
108537 );
108538 if (problem) {
108539 config.addWarning(imp, problem);
108540 }
108541 }
108542 return null;
108543 }
108544}
108545
108546class ConcatConfiguration {
108547 constructor(rootModule, cloneFrom) {
108548 this.rootModule = rootModule;
108549 if (cloneFrom) {
108550 this.modules = cloneFrom.modules.createChild(5);
108551 this.warnings = cloneFrom.warnings.createChild(5);
108552 } else {
108553 this.modules = new StackedSetMap();
108554 this.modules.add(rootModule);
108555 this.warnings = new StackedSetMap();
108556 }
108557 }
108558
108559 add(module) {
108560 this.modules.add(module);
108561 }
108562
108563 has(module) {
108564 return this.modules.has(module);
108565 }
108566
108567 isEmpty() {
108568 return this.modules.size === 1;
108569 }
108570
108571 addWarning(module, problem) {
108572 this.warnings.set(module, problem);
108573 }
108574
108575 getWarningsSorted() {
108576 return new Map(
108577 this.warnings.asPairArray().sort((a, b) => {
108578 const ai = a[0].identifier();
108579 const bi = b[0].identifier();
108580 if (ai < bi) return -1;
108581 if (ai > bi) return 1;
108582 return 0;
108583 })
108584 );
108585 }
108586
108587 getModules() {
108588 return this.modules.asSet();
108589 }
108590
108591 clone() {
108592 return new ConcatConfiguration(this.rootModule, this);
108593 }
108594
108595 set(config) {
108596 this.rootModule = config.rootModule;
108597 this.modules = config.modules;
108598 this.warnings = config.warnings;
108599 }
108600}
108601
108602module.exports = ModuleConcatenationPlugin;
108603
108604
108605/***/ }),
108606
108607/***/ 68053:
108608/***/ (function(module) {
108609
108610"use strict";
108611/*
108612 MIT License http://www.opensource.org/licenses/mit-license.php
108613 Author Tobias Koppers @sokra
108614*/
108615
108616
108617/** @typedef {import("../Compiler")} Compiler */
108618
108619class NaturalChunkOrderPlugin {
108620 /**
108621 * @param {Compiler} compiler webpack compiler
108622 * @returns {void}
108623 */
108624 apply(compiler) {
108625 compiler.hooks.compilation.tap("NaturalChunkOrderPlugin", compilation => {
108626 compilation.hooks.optimizeChunkOrder.tap(
108627 "NaturalChunkOrderPlugin",
108628 chunks => {
108629 chunks.sort((chunkA, chunkB) => {
108630 const a = chunkA.modulesIterable[Symbol.iterator]();
108631 const b = chunkB.modulesIterable[Symbol.iterator]();
108632 // eslint-disable-next-line no-constant-condition
108633 while (true) {
108634 const aItem = a.next();
108635 const bItem = b.next();
108636 if (aItem.done && bItem.done) return 0;
108637 if (aItem.done) return -1;
108638 if (bItem.done) return 1;
108639 const aModuleId = aItem.value.id;
108640 const bModuleId = bItem.value.id;
108641 if (aModuleId < bModuleId) return -1;
108642 if (aModuleId > bModuleId) return 1;
108643 }
108644 });
108645 }
108646 );
108647 });
108648 }
108649}
108650
108651module.exports = NaturalChunkOrderPlugin;
108652
108653
108654/***/ }),
108655
108656/***/ 83741:
108657/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
108658
108659"use strict";
108660/*
108661 MIT License http://www.opensource.org/licenses/mit-license.php
108662 Author Tobias Koppers @sokra
108663*/
108664
108665
108666const validateOptions = __webpack_require__(33225);
108667const schema = __webpack_require__(88771);
108668
108669/** @typedef {import("../../declarations/plugins/optimize/OccurrenceOrderChunkIdsPlugin").OccurrenceOrderChunkIdsPluginOptions} OccurrenceOrderChunkIdsPluginOptions */
108670
108671class OccurrenceOrderChunkIdsPlugin {
108672 /**
108673 * @param {OccurrenceOrderChunkIdsPluginOptions=} options options object
108674 */
108675 constructor(options = {}) {
108676 validateOptions(schema, options, "Occurrence Order Chunk Ids Plugin");
108677 this.options = options;
108678 }
108679
108680 apply(compiler) {
108681 const prioritiseInitial = this.options.prioritiseInitial;
108682 compiler.hooks.compilation.tap(
108683 "OccurrenceOrderChunkIdsPlugin",
108684 compilation => {
108685 compilation.hooks.optimizeChunkOrder.tap(
108686 "OccurrenceOrderChunkIdsPlugin",
108687 chunks => {
108688 const occursInInitialChunksMap = new Map();
108689 const originalOrder = new Map();
108690
108691 let i = 0;
108692 for (const c of chunks) {
108693 let occurs = 0;
108694 for (const chunkGroup of c.groupsIterable) {
108695 for (const parent of chunkGroup.parentsIterable) {
108696 if (parent.isInitial()) occurs++;
108697 }
108698 }
108699 occursInInitialChunksMap.set(c, occurs);
108700 originalOrder.set(c, i++);
108701 }
108702
108703 chunks.sort((a, b) => {
108704 if (prioritiseInitial) {
108705 const aEntryOccurs = occursInInitialChunksMap.get(a);
108706 const bEntryOccurs = occursInInitialChunksMap.get(b);
108707 if (aEntryOccurs > bEntryOccurs) return -1;
108708 if (aEntryOccurs < bEntryOccurs) return 1;
108709 }
108710 const aOccurs = a.getNumberOfGroups();
108711 const bOccurs = b.getNumberOfGroups();
108712 if (aOccurs > bOccurs) return -1;
108713 if (aOccurs < bOccurs) return 1;
108714 const orgA = originalOrder.get(a);
108715 const orgB = originalOrder.get(b);
108716 return orgA - orgB;
108717 });
108718 }
108719 );
108720 }
108721 );
108722 }
108723}
108724
108725module.exports = OccurrenceOrderChunkIdsPlugin;
108726
108727
108728/***/ }),
108729
108730/***/ 62000:
108731/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
108732
108733"use strict";
108734/*
108735 MIT License http://www.opensource.org/licenses/mit-license.php
108736 Author Tobias Koppers @sokra
108737*/
108738
108739
108740const validateOptions = __webpack_require__(33225);
108741const schema = __webpack_require__(81430);
108742
108743/** @typedef {import("../../declarations/plugins/optimize/OccurrenceOrderModuleIdsPlugin").OccurrenceOrderModuleIdsPluginOptions} OccurrenceOrderModuleIdsPluginOptions */
108744
108745class OccurrenceOrderModuleIdsPlugin {
108746 /**
108747 * @param {OccurrenceOrderModuleIdsPluginOptions=} options options object
108748 */
108749 constructor(options = {}) {
108750 validateOptions(schema, options, "Occurrence Order Module Ids Plugin");
108751 this.options = options;
108752 }
108753
108754 apply(compiler) {
108755 const prioritiseInitial = this.options.prioritiseInitial;
108756 compiler.hooks.compilation.tap(
108757 "OccurrenceOrderModuleIdsPlugin",
108758 compilation => {
108759 compilation.hooks.optimizeModuleOrder.tap(
108760 "OccurrenceOrderModuleIdsPlugin",
108761 modules => {
108762 const occursInInitialChunksMap = new Map();
108763 const occursInAllChunksMap = new Map();
108764
108765 const initialChunkChunkMap = new Map();
108766 const entryCountMap = new Map();
108767 for (const m of modules) {
108768 let initial = 0;
108769 let entry = 0;
108770 for (const c of m.chunksIterable) {
108771 if (c.canBeInitial()) initial++;
108772 if (c.entryModule === m) entry++;
108773 }
108774 initialChunkChunkMap.set(m, initial);
108775 entryCountMap.set(m, entry);
108776 }
108777
108778 const countOccursInEntry = (sum, r) => {
108779 if (!r.module) {
108780 return sum;
108781 }
108782 const count = initialChunkChunkMap.get(r.module);
108783 if (!count) {
108784 return sum;
108785 }
108786 return sum + count;
108787 };
108788 const countOccurs = (sum, r) => {
108789 if (!r.module) {
108790 return sum;
108791 }
108792 let factor = 1;
108793 if (typeof r.dependency.getNumberOfIdOccurrences === "function") {
108794 factor = r.dependency.getNumberOfIdOccurrences();
108795 }
108796 if (factor === 0) {
108797 return sum;
108798 }
108799 return sum + factor * r.module.getNumberOfChunks();
108800 };
108801
108802 if (prioritiseInitial) {
108803 for (const m of modules) {
108804 const result =
108805 m.reasons.reduce(countOccursInEntry, 0) +
108806 initialChunkChunkMap.get(m) +
108807 entryCountMap.get(m);
108808 occursInInitialChunksMap.set(m, result);
108809 }
108810 }
108811
108812 const originalOrder = new Map();
108813 let i = 0;
108814 for (const m of modules) {
108815 const result =
108816 m.reasons.reduce(countOccurs, 0) +
108817 m.getNumberOfChunks() +
108818 entryCountMap.get(m);
108819 occursInAllChunksMap.set(m, result);
108820 originalOrder.set(m, i++);
108821 }
108822
108823 modules.sort((a, b) => {
108824 if (prioritiseInitial) {
108825 const aEntryOccurs = occursInInitialChunksMap.get(a);
108826 const bEntryOccurs = occursInInitialChunksMap.get(b);
108827 if (aEntryOccurs > bEntryOccurs) return -1;
108828 if (aEntryOccurs < bEntryOccurs) return 1;
108829 }
108830 const aOccurs = occursInAllChunksMap.get(a);
108831 const bOccurs = occursInAllChunksMap.get(b);
108832 if (aOccurs > bOccurs) return -1;
108833 if (aOccurs < bOccurs) return 1;
108834 const orgA = originalOrder.get(a);
108835 const orgB = originalOrder.get(b);
108836 return orgA - orgB;
108837 });
108838 }
108839 );
108840 }
108841 );
108842 }
108843}
108844
108845module.exports = OccurrenceOrderModuleIdsPlugin;
108846
108847
108848/***/ }),
108849
108850/***/ 67340:
108851/***/ (function(module) {
108852
108853"use strict";
108854/*
108855 MIT License http://www.opensource.org/licenses/mit-license.php
108856 Author Tobias Koppers @sokra
108857*/
108858
108859
108860// TODO webpack 5 remove this plugin
108861// It has been splitted into separate plugins for modules and chunks
108862class OccurrenceOrderPlugin {
108863 constructor(preferEntry) {
108864 if (preferEntry !== undefined && typeof preferEntry !== "boolean") {
108865 throw new Error(
108866 "Argument should be a boolean.\nFor more info on this plugin, see https://webpack.js.org/plugins/"
108867 );
108868 }
108869 this.preferEntry = preferEntry;
108870 }
108871 apply(compiler) {
108872 const preferEntry = this.preferEntry;
108873 compiler.hooks.compilation.tap("OccurrenceOrderPlugin", compilation => {
108874 compilation.hooks.optimizeModuleOrder.tap(
108875 "OccurrenceOrderPlugin",
108876 modules => {
108877 const occursInInitialChunksMap = new Map();
108878 const occursInAllChunksMap = new Map();
108879
108880 const initialChunkChunkMap = new Map();
108881 const entryCountMap = new Map();
108882 for (const m of modules) {
108883 let initial = 0;
108884 let entry = 0;
108885 for (const c of m.chunksIterable) {
108886 if (c.canBeInitial()) initial++;
108887 if (c.entryModule === m) entry++;
108888 }
108889 initialChunkChunkMap.set(m, initial);
108890 entryCountMap.set(m, entry);
108891 }
108892
108893 const countOccursInEntry = (sum, r) => {
108894 if (!r.module) {
108895 return sum;
108896 }
108897 return sum + initialChunkChunkMap.get(r.module);
108898 };
108899 const countOccurs = (sum, r) => {
108900 if (!r.module) {
108901 return sum;
108902 }
108903 let factor = 1;
108904 if (typeof r.dependency.getNumberOfIdOccurrences === "function") {
108905 factor = r.dependency.getNumberOfIdOccurrences();
108906 }
108907 if (factor === 0) {
108908 return sum;
108909 }
108910 return sum + factor * r.module.getNumberOfChunks();
108911 };
108912
108913 if (preferEntry) {
108914 for (const m of modules) {
108915 const result =
108916 m.reasons.reduce(countOccursInEntry, 0) +
108917 initialChunkChunkMap.get(m) +
108918 entryCountMap.get(m);
108919 occursInInitialChunksMap.set(m, result);
108920 }
108921 }
108922
108923 const originalOrder = new Map();
108924 let i = 0;
108925 for (const m of modules) {
108926 const result =
108927 m.reasons.reduce(countOccurs, 0) +
108928 m.getNumberOfChunks() +
108929 entryCountMap.get(m);
108930 occursInAllChunksMap.set(m, result);
108931 originalOrder.set(m, i++);
108932 }
108933
108934 modules.sort((a, b) => {
108935 if (preferEntry) {
108936 const aEntryOccurs = occursInInitialChunksMap.get(a);
108937 const bEntryOccurs = occursInInitialChunksMap.get(b);
108938 if (aEntryOccurs > bEntryOccurs) return -1;
108939 if (aEntryOccurs < bEntryOccurs) return 1;
108940 }
108941 const aOccurs = occursInAllChunksMap.get(a);
108942 const bOccurs = occursInAllChunksMap.get(b);
108943 if (aOccurs > bOccurs) return -1;
108944 if (aOccurs < bOccurs) return 1;
108945 const orgA = originalOrder.get(a);
108946 const orgB = originalOrder.get(b);
108947 return orgA - orgB;
108948 });
108949 }
108950 );
108951 compilation.hooks.optimizeChunkOrder.tap(
108952 "OccurrenceOrderPlugin",
108953 chunks => {
108954 const occursInInitialChunksMap = new Map();
108955 const originalOrder = new Map();
108956
108957 let i = 0;
108958 for (const c of chunks) {
108959 let occurs = 0;
108960 for (const chunkGroup of c.groupsIterable) {
108961 for (const parent of chunkGroup.parentsIterable) {
108962 if (parent.isInitial()) occurs++;
108963 }
108964 }
108965 occursInInitialChunksMap.set(c, occurs);
108966 originalOrder.set(c, i++);
108967 }
108968
108969 chunks.sort((a, b) => {
108970 const aEntryOccurs = occursInInitialChunksMap.get(a);
108971 const bEntryOccurs = occursInInitialChunksMap.get(b);
108972 if (aEntryOccurs > bEntryOccurs) return -1;
108973 if (aEntryOccurs < bEntryOccurs) return 1;
108974 const aOccurs = a.getNumberOfGroups();
108975 const bOccurs = b.getNumberOfGroups();
108976 if (aOccurs > bOccurs) return -1;
108977 if (aOccurs < bOccurs) return 1;
108978 const orgA = originalOrder.get(a);
108979 const orgB = originalOrder.get(b);
108980 return orgA - orgB;
108981 });
108982 }
108983 );
108984 });
108985 }
108986}
108987
108988module.exports = OccurrenceOrderPlugin;
108989
108990
108991/***/ }),
108992
108993/***/ 78085:
108994/***/ (function(module) {
108995
108996"use strict";
108997/*
108998 MIT License http://www.opensource.org/licenses/mit-license.php
108999 Author Tobias Koppers @sokra
109000*/
109001
109002
109003class RemoveEmptyChunksPlugin {
109004 apply(compiler) {
109005 compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => {
109006 const handler = chunks => {
109007 for (let i = chunks.length - 1; i >= 0; i--) {
109008 const chunk = chunks[i];
109009 if (
109010 chunk.isEmpty() &&
109011 !chunk.hasRuntime() &&
109012 !chunk.hasEntryModule()
109013 ) {
109014 chunk.remove("empty");
109015 chunks.splice(i, 1);
109016 }
109017 }
109018 };
109019 compilation.hooks.optimizeChunksBasic.tap(
109020 "RemoveEmptyChunksPlugin",
109021 handler
109022 );
109023 compilation.hooks.optimizeChunksAdvanced.tap(
109024 "RemoveEmptyChunksPlugin",
109025 handler
109026 );
109027 compilation.hooks.optimizeExtractedChunksBasic.tap(
109028 "RemoveEmptyChunksPlugin",
109029 handler
109030 );
109031 compilation.hooks.optimizeExtractedChunksAdvanced.tap(
109032 "RemoveEmptyChunksPlugin",
109033 handler
109034 );
109035 });
109036 }
109037}
109038module.exports = RemoveEmptyChunksPlugin;
109039
109040
109041/***/ }),
109042
109043/***/ 58142:
109044/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
109045
109046"use strict";
109047/*
109048 MIT License http://www.opensource.org/licenses/mit-license.php
109049 Author Tobias Koppers @sokra
109050*/
109051
109052
109053const Queue = __webpack_require__(38637);
109054const { intersect } = __webpack_require__(54262);
109055
109056const getParentChunksWithModule = (currentChunk, module) => {
109057 const chunks = [];
109058 const stack = new Set(currentChunk.parentsIterable);
109059
109060 for (const chunk of stack) {
109061 if (chunk.containsModule(module)) {
109062 chunks.push(chunk);
109063 } else {
109064 for (const parent of chunk.parentsIterable) {
109065 stack.add(parent);
109066 }
109067 }
109068 }
109069
109070 return chunks;
109071};
109072
109073class RemoveParentModulesPlugin {
109074 apply(compiler) {
109075 compiler.hooks.compilation.tap("RemoveParentModulesPlugin", compilation => {
109076 const handler = (chunks, chunkGroups) => {
109077 const queue = new Queue();
109078 const availableModulesMap = new WeakMap();
109079
109080 for (const chunkGroup of compilation.entrypoints.values()) {
109081 // initialize available modules for chunks without parents
109082 availableModulesMap.set(chunkGroup, new Set());
109083 for (const child of chunkGroup.childrenIterable) {
109084 queue.enqueue(child);
109085 }
109086 }
109087
109088 while (queue.length > 0) {
109089 const chunkGroup = queue.dequeue();
109090 let availableModules = availableModulesMap.get(chunkGroup);
109091 let changed = false;
109092 for (const parent of chunkGroup.parentsIterable) {
109093 const availableModulesInParent = availableModulesMap.get(parent);
109094 if (availableModulesInParent !== undefined) {
109095 // If we know the available modules in parent: process these
109096 if (availableModules === undefined) {
109097 // if we have not own info yet: create new entry
109098 availableModules = new Set(availableModulesInParent);
109099 for (const chunk of parent.chunks) {
109100 for (const m of chunk.modulesIterable) {
109101 availableModules.add(m);
109102 }
109103 }
109104 availableModulesMap.set(chunkGroup, availableModules);
109105 changed = true;
109106 } else {
109107 for (const m of availableModules) {
109108 if (
109109 !parent.containsModule(m) &&
109110 !availableModulesInParent.has(m)
109111 ) {
109112 availableModules.delete(m);
109113 changed = true;
109114 }
109115 }
109116 }
109117 }
109118 }
109119 if (changed) {
109120 // if something changed: enqueue our children
109121 for (const child of chunkGroup.childrenIterable) {
109122 queue.enqueue(child);
109123 }
109124 }
109125 }
109126
109127 // now we have available modules for every chunk
109128 for (const chunk of chunks) {
109129 const availableModulesSets = Array.from(
109130 chunk.groupsIterable,
109131 chunkGroup => availableModulesMap.get(chunkGroup)
109132 );
109133 if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group
109134 const availableModules =
109135 availableModulesSets.length === 1
109136 ? availableModulesSets[0]
109137 : intersect(availableModulesSets);
109138 const numberOfModules = chunk.getNumberOfModules();
109139 const toRemove = new Set();
109140 if (numberOfModules < availableModules.size) {
109141 for (const m of chunk.modulesIterable) {
109142 if (availableModules.has(m)) {
109143 toRemove.add(m);
109144 }
109145 }
109146 } else {
109147 for (const m of availableModules) {
109148 if (chunk.containsModule(m)) {
109149 toRemove.add(m);
109150 }
109151 }
109152 }
109153 for (const module of toRemove) {
109154 module.rewriteChunkInReasons(
109155 chunk,
109156 getParentChunksWithModule(chunk, module)
109157 );
109158 chunk.removeModule(module);
109159 }
109160 }
109161 };
109162 compilation.hooks.optimizeChunksBasic.tap(
109163 "RemoveParentModulesPlugin",
109164 handler
109165 );
109166 compilation.hooks.optimizeExtractedChunksBasic.tap(
109167 "RemoveParentModulesPlugin",
109168 handler
109169 );
109170 });
109171 }
109172}
109173module.exports = RemoveParentModulesPlugin;
109174
109175
109176/***/ }),
109177
109178/***/ 76894:
109179/***/ (function(module) {
109180
109181"use strict";
109182/*
109183 MIT License http://www.opensource.org/licenses/mit-license.php
109184 Author Tobias Koppers @sokra
109185*/
109186
109187
109188module.exports = class RuntimeChunkPlugin {
109189 constructor(options) {
109190 this.options = Object.assign(
109191 {
109192 name: entrypoint => `runtime~${entrypoint.name}`
109193 },
109194 options
109195 );
109196 }
109197
109198 apply(compiler) {
109199 compiler.hooks.thisCompilation.tap("RuntimeChunkPlugin", compilation => {
109200 compilation.hooks.optimizeChunksAdvanced.tap("RuntimeChunkPlugin", () => {
109201 for (const entrypoint of compilation.entrypoints.values()) {
109202 const chunk = entrypoint.getRuntimeChunk();
109203 let name = this.options.name;
109204 if (typeof name === "function") {
109205 name = name(entrypoint);
109206 }
109207 if (
109208 chunk.getNumberOfModules() > 0 ||
109209 !chunk.preventIntegration ||
109210 chunk.name !== name
109211 ) {
109212 const newChunk = compilation.addChunk(name);
109213 newChunk.preventIntegration = true;
109214 entrypoint.unshiftChunk(newChunk);
109215 newChunk.addGroup(entrypoint);
109216 entrypoint.setRuntimeChunk(newChunk);
109217 }
109218 }
109219 });
109220 });
109221 }
109222};
109223
109224
109225/***/ }),
109226
109227/***/ 83654:
109228/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
109229
109230"use strict";
109231/*
109232 MIT License http://www.opensource.org/licenses/mit-license.php
109233 Author Tobias Koppers @sokra
109234*/
109235
109236
109237const mm = __webpack_require__(53024);
109238const HarmonyExportImportedSpecifierDependency = __webpack_require__(22864);
109239const HarmonyImportSideEffectDependency = __webpack_require__(79171);
109240const HarmonyImportSpecifierDependency = __webpack_require__(95966);
109241
109242/** @typedef {import("../Module")} Module */
109243/** @typedef {import("../Dependency")} Dependency */
109244
109245/**
109246 * @typedef {Object} ExportInModule
109247 * @property {Module} module the module
109248 * @property {string} exportName the name of the export
109249 * @property {boolean} checked if the export is conditional
109250 */
109251
109252/**
109253 * @typedef {Object} ReexportInfo
109254 * @property {Map<string, ExportInModule[]>} static
109255 * @property {Map<Module, Set<string>>} dynamic
109256 */
109257
109258/**
109259 * @param {ReexportInfo} info info object
109260 * @param {string} exportName name of export
109261 * @returns {ExportInModule | undefined} static export
109262 */
109263const getMappingFromInfo = (info, exportName) => {
109264 const staticMappings = info.static.get(exportName);
109265 if (staticMappings !== undefined) {
109266 if (staticMappings.length === 1) return staticMappings[0];
109267 return undefined;
109268 }
109269 const dynamicMappings = Array.from(info.dynamic).filter(
109270 ([_, ignored]) => !ignored.has(exportName)
109271 );
109272 if (dynamicMappings.length === 1) {
109273 return {
109274 module: dynamicMappings[0][0],
109275 exportName,
109276 checked: true
109277 };
109278 }
109279 return undefined;
109280};
109281
109282/**
109283 * @param {ReexportInfo} info info object
109284 * @param {string} exportName name of export of source module
109285 * @param {Module} module the target module
109286 * @param {string} innerExportName name of export of target module
109287 * @param {boolean} checked true, if existence of target module is checked
109288 */
109289const addStaticReexport = (
109290 info,
109291 exportName,
109292 module,
109293 innerExportName,
109294 checked
109295) => {
109296 let mappings = info.static.get(exportName);
109297 if (mappings !== undefined) {
109298 for (const mapping of mappings) {
109299 if (mapping.module === module && mapping.exportName === innerExportName) {
109300 mapping.checked = mapping.checked && checked;
109301 return;
109302 }
109303 }
109304 } else {
109305 mappings = [];
109306 info.static.set(exportName, mappings);
109307 }
109308 mappings.push({
109309 module,
109310 exportName: innerExportName,
109311 checked
109312 });
109313};
109314
109315/**
109316 * @param {ReexportInfo} info info object
109317 * @param {Module} module the reexport module
109318 * @param {Set<string>} ignored ignore list
109319 * @returns {void}
109320 */
109321const addDynamicReexport = (info, module, ignored) => {
109322 const existingList = info.dynamic.get(module);
109323 if (existingList !== undefined) {
109324 for (const key of existingList) {
109325 if (!ignored.has(key)) existingList.delete(key);
109326 }
109327 } else {
109328 info.dynamic.set(module, new Set(ignored));
109329 }
109330};
109331
109332class SideEffectsFlagPlugin {
109333 apply(compiler) {
109334 compiler.hooks.normalModuleFactory.tap("SideEffectsFlagPlugin", nmf => {
109335 nmf.hooks.module.tap("SideEffectsFlagPlugin", (module, data) => {
109336 const resolveData = data.resourceResolveData;
109337 if (
109338 resolveData &&
109339 resolveData.descriptionFileData &&
109340 resolveData.relativePath
109341 ) {
109342 const sideEffects = resolveData.descriptionFileData.sideEffects;
109343 const hasSideEffects = SideEffectsFlagPlugin.moduleHasSideEffects(
109344 resolveData.relativePath,
109345 sideEffects
109346 );
109347 if (!hasSideEffects) {
109348 module.factoryMeta.sideEffectFree = true;
109349 }
109350 }
109351
109352 return module;
109353 });
109354 nmf.hooks.module.tap("SideEffectsFlagPlugin", (module, data) => {
109355 if (data.settings.sideEffects === false) {
109356 module.factoryMeta.sideEffectFree = true;
109357 } else if (data.settings.sideEffects === true) {
109358 module.factoryMeta.sideEffectFree = false;
109359 }
109360 });
109361 });
109362 compiler.hooks.compilation.tap("SideEffectsFlagPlugin", compilation => {
109363 compilation.hooks.optimizeDependencies.tap(
109364 "SideEffectsFlagPlugin",
109365 modules => {
109366 /** @type {Map<Module, ReexportInfo>} */
109367 const reexportMaps = new Map();
109368
109369 // Capture reexports of sideEffectFree modules
109370 for (const module of modules) {
109371 /** @type {Dependency[]} */
109372 const removeDependencies = [];
109373 for (const dep of module.dependencies) {
109374 if (dep instanceof HarmonyImportSideEffectDependency) {
109375 if (dep.module && dep.module.factoryMeta.sideEffectFree) {
109376 removeDependencies.push(dep);
109377 }
109378 } else if (
109379 dep instanceof HarmonyExportImportedSpecifierDependency
109380 ) {
109381 if (module.factoryMeta.sideEffectFree) {
109382 const mode = dep.getMode(true);
109383 if (
109384 mode.type === "safe-reexport" ||
109385 mode.type === "checked-reexport" ||
109386 mode.type === "dynamic-reexport" ||
109387 mode.type === "reexport-non-harmony-default" ||
109388 mode.type === "reexport-non-harmony-default-strict" ||
109389 mode.type === "reexport-named-default"
109390 ) {
109391 let info = reexportMaps.get(module);
109392 if (!info) {
109393 reexportMaps.set(
109394 module,
109395 (info = {
109396 static: new Map(),
109397 dynamic: new Map()
109398 })
109399 );
109400 }
109401 const targetModule = dep._module;
109402 switch (mode.type) {
109403 case "safe-reexport":
109404 for (const [key, id] of mode.map) {
109405 if (id) {
109406 addStaticReexport(
109407 info,
109408 key,
109409 targetModule,
109410 id,
109411 false
109412 );
109413 }
109414 }
109415 break;
109416 case "checked-reexport":
109417 for (const [key, id] of mode.map) {
109418 if (id) {
109419 addStaticReexport(
109420 info,
109421 key,
109422 targetModule,
109423 id,
109424 true
109425 );
109426 }
109427 }
109428 break;
109429 case "dynamic-reexport":
109430 addDynamicReexport(info, targetModule, mode.ignored);
109431 break;
109432 case "reexport-non-harmony-default":
109433 case "reexport-non-harmony-default-strict":
109434 case "reexport-named-default":
109435 addStaticReexport(
109436 info,
109437 mode.name,
109438 targetModule,
109439 "default",
109440 false
109441 );
109442 break;
109443 }
109444 }
109445 }
109446 }
109447 }
109448 }
109449
109450 // Flatten reexports
109451 for (const info of reexportMaps.values()) {
109452 const dynamicReexports = info.dynamic;
109453 info.dynamic = new Map();
109454 for (const reexport of dynamicReexports) {
109455 let [targetModule, ignored] = reexport;
109456 for (;;) {
109457 const innerInfo = reexportMaps.get(targetModule);
109458 if (!innerInfo) break;
109459
109460 for (const [key, reexports] of innerInfo.static) {
109461 if (ignored.has(key)) continue;
109462 for (const { module, exportName, checked } of reexports) {
109463 addStaticReexport(info, key, module, exportName, checked);
109464 }
109465 }
109466
109467 // Follow dynamic reexport if there is only one
109468 if (innerInfo.dynamic.size !== 1) {
109469 // When there are more then one, we don't know which one
109470 break;
109471 }
109472
109473 ignored = new Set(ignored);
109474 for (const [innerModule, innerIgnored] of innerInfo.dynamic) {
109475 for (const key of innerIgnored) {
109476 if (ignored.has(key)) continue;
109477 // This reexports ends here
109478 addStaticReexport(info, key, targetModule, key, true);
109479 ignored.add(key);
109480 }
109481 targetModule = innerModule;
109482 }
109483 }
109484
109485 // Update reexport as all other cases has been handled
109486 addDynamicReexport(info, targetModule, ignored);
109487 }
109488 }
109489
109490 for (const info of reexportMaps.values()) {
109491 const staticReexports = info.static;
109492 info.static = new Map();
109493 for (const [key, reexports] of staticReexports) {
109494 for (let mapping of reexports) {
109495 for (;;) {
109496 const innerInfo = reexportMaps.get(mapping.module);
109497 if (!innerInfo) break;
109498
109499 const newMapping = getMappingFromInfo(
109500 innerInfo,
109501 mapping.exportName
109502 );
109503 if (!newMapping) break;
109504 mapping = newMapping;
109505 }
109506 addStaticReexport(
109507 info,
109508 key,
109509 mapping.module,
109510 mapping.exportName,
109511 mapping.checked
109512 );
109513 }
109514 }
109515 }
109516
109517 // Update imports along the reexports from sideEffectFree modules
109518 for (const pair of reexportMaps) {
109519 const module = pair[0];
109520 const info = pair[1];
109521 let newReasons = undefined;
109522 for (let i = 0; i < module.reasons.length; i++) {
109523 const reason = module.reasons[i];
109524 const dep = reason.dependency;
109525 if (
109526 (dep instanceof HarmonyExportImportedSpecifierDependency ||
109527 (dep instanceof HarmonyImportSpecifierDependency &&
109528 !dep.namespaceObjectAsContext)) &&
109529 dep._id
109530 ) {
109531 const mapping = getMappingFromInfo(info, dep._id);
109532 if (mapping) {
109533 dep.redirectedModule = mapping.module;
109534 dep.redirectedId = mapping.exportName;
109535 mapping.module.addReason(
109536 reason.module,
109537 dep,
109538 reason.explanation
109539 ? reason.explanation +
109540 " (skipped side-effect-free modules)"
109541 : "(skipped side-effect-free modules)"
109542 );
109543 // removing the currect reason, by not adding it to the newReasons array
109544 // lazily create the newReasons array
109545 if (newReasons === undefined) {
109546 newReasons = i === 0 ? [] : module.reasons.slice(0, i);
109547 }
109548 continue;
109549 }
109550 }
109551 if (newReasons !== undefined) newReasons.push(reason);
109552 }
109553 if (newReasons !== undefined) {
109554 module.reasons = newReasons;
109555 }
109556 }
109557 }
109558 );
109559 });
109560 }
109561
109562 static moduleHasSideEffects(moduleName, flagValue) {
109563 switch (typeof flagValue) {
109564 case "undefined":
109565 return true;
109566 case "boolean":
109567 return flagValue;
109568 case "string":
109569 if (process.platform === "win32") {
109570 flagValue = flagValue.replace(/\\/g, "/");
109571 }
109572 return mm.isMatch(moduleName, flagValue, {
109573 matchBase: true
109574 });
109575 case "object":
109576 return flagValue.some(glob =>
109577 SideEffectsFlagPlugin.moduleHasSideEffects(moduleName, glob)
109578 );
109579 }
109580 }
109581}
109582module.exports = SideEffectsFlagPlugin;
109583
109584
109585/***/ }),
109586
109587/***/ 60474:
109588/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
109589
109590"use strict";
109591/*
109592 MIT License http://www.opensource.org/licenses/mit-license.php
109593 Author Tobias Koppers @sokra
109594*/
109595
109596
109597const crypto = __webpack_require__(76417);
109598const SortableSet = __webpack_require__(50071);
109599const GraphHelpers = __webpack_require__(32973);
109600const { isSubset } = __webpack_require__(54262);
109601const deterministicGrouping = __webpack_require__(30815);
109602const MinMaxSizeWarning = __webpack_require__(25472);
109603const contextify = __webpack_require__(94658).contextify;
109604
109605/** @typedef {import("../Compiler")} Compiler */
109606/** @typedef {import("../Chunk")} Chunk */
109607/** @typedef {import("../Module")} Module */
109608/** @typedef {import("../util/deterministicGrouping").Options<Module>} DeterministicGroupingOptionsForModule */
109609/** @typedef {import("../util/deterministicGrouping").GroupedItems<Module>} DeterministicGroupingGroupedItemsForModule */
109610
109611const deterministicGroupingForModules = /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ (deterministicGrouping);
109612
109613const hashFilename = name => {
109614 return crypto
109615 .createHash("md4")
109616 .update(name)
109617 .digest("hex")
109618 .slice(0, 8);
109619};
109620
109621const sortByIdentifier = (a, b) => {
109622 if (a.identifier() > b.identifier()) return 1;
109623 if (a.identifier() < b.identifier()) return -1;
109624 return 0;
109625};
109626
109627const getRequests = chunk => {
109628 let requests = 0;
109629 for (const chunkGroup of chunk.groupsIterable) {
109630 requests = Math.max(requests, chunkGroup.chunks.length);
109631 }
109632 return requests;
109633};
109634
109635const getModulesSize = modules => {
109636 let sum = 0;
109637 for (const m of modules) {
109638 sum += m.size();
109639 }
109640 return sum;
109641};
109642
109643/**
109644 * @template T
109645 * @param {Set<T>} a set
109646 * @param {Set<T>} b other set
109647 * @returns {boolean} true if at least one item of a is in b
109648 */
109649const isOverlap = (a, b) => {
109650 for (const item of a) {
109651 if (b.has(item)) return true;
109652 }
109653 return false;
109654};
109655
109656const compareEntries = (a, b) => {
109657 // 1. by priority
109658 const diffPriority = a.cacheGroup.priority - b.cacheGroup.priority;
109659 if (diffPriority) return diffPriority;
109660 // 2. by number of chunks
109661 const diffCount = a.chunks.size - b.chunks.size;
109662 if (diffCount) return diffCount;
109663 // 3. by size reduction
109664 const aSizeReduce = a.size * (a.chunks.size - 1);
109665 const bSizeReduce = b.size * (b.chunks.size - 1);
109666 const diffSizeReduce = aSizeReduce - bSizeReduce;
109667 if (diffSizeReduce) return diffSizeReduce;
109668 // 4. by cache group index
109669 const indexDiff = a.cacheGroupIndex - b.cacheGroupIndex;
109670 if (indexDiff) return indexDiff;
109671 // 5. by number of modules (to be able to compare by identifier)
109672 const modulesA = a.modules;
109673 const modulesB = b.modules;
109674 const diff = modulesA.size - modulesB.size;
109675 if (diff) return diff;
109676 // 6. by module identifiers
109677 modulesA.sort();
109678 modulesB.sort();
109679 const aI = modulesA[Symbol.iterator]();
109680 const bI = modulesB[Symbol.iterator]();
109681 // eslint-disable-next-line no-constant-condition
109682 while (true) {
109683 const aItem = aI.next();
109684 const bItem = bI.next();
109685 if (aItem.done) return 0;
109686 const aModuleIdentifier = aItem.value.identifier();
109687 const bModuleIdentifier = bItem.value.identifier();
109688 if (aModuleIdentifier > bModuleIdentifier) return -1;
109689 if (aModuleIdentifier < bModuleIdentifier) return 1;
109690 }
109691};
109692
109693const compareNumbers = (a, b) => a - b;
109694
109695const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial();
109696const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial();
109697const ALL_CHUNK_FILTER = chunk => true;
109698
109699module.exports = class SplitChunksPlugin {
109700 constructor(options) {
109701 this.options = SplitChunksPlugin.normalizeOptions(options);
109702 }
109703
109704 static normalizeOptions(options = {}) {
109705 return {
109706 chunksFilter: SplitChunksPlugin.normalizeChunksFilter(
109707 options.chunks || "all"
109708 ),
109709 minSize: options.minSize || 0,
109710 enforceSizeThreshold: options.enforceSizeThreshold || 0,
109711 maxSize: options.maxSize || 0,
109712 minChunks: options.minChunks || 1,
109713 maxAsyncRequests: options.maxAsyncRequests || 1,
109714 maxInitialRequests: options.maxInitialRequests || 1,
109715 hidePathInfo: options.hidePathInfo || false,
109716 filename: options.filename || undefined,
109717 getCacheGroups: SplitChunksPlugin.normalizeCacheGroups({
109718 cacheGroups: options.cacheGroups,
109719 name: options.name,
109720 automaticNameDelimiter: options.automaticNameDelimiter,
109721 automaticNameMaxLength: options.automaticNameMaxLength
109722 }),
109723 automaticNameDelimiter: options.automaticNameDelimiter,
109724 automaticNameMaxLength: options.automaticNameMaxLength || 109,
109725 fallbackCacheGroup: SplitChunksPlugin.normalizeFallbackCacheGroup(
109726 options.fallbackCacheGroup || {},
109727 options
109728 )
109729 };
109730 }
109731
109732 static normalizeName({
109733 name,
109734 automaticNameDelimiter,
109735 automaticNamePrefix,
109736 automaticNameMaxLength
109737 }) {
109738 if (name === true) {
109739 /** @type {WeakMap<Chunk[], Record<string, string>>} */
109740 const cache = new WeakMap();
109741 const fn = (module, chunks, cacheGroup) => {
109742 let cacheEntry = cache.get(chunks);
109743 if (cacheEntry === undefined) {
109744 cacheEntry = {};
109745 cache.set(chunks, cacheEntry);
109746 } else if (cacheGroup in cacheEntry) {
109747 return cacheEntry[cacheGroup];
109748 }
109749 const names = chunks.map(c => c.name);
109750 if (!names.every(Boolean)) {
109751 cacheEntry[cacheGroup] = undefined;
109752 return;
109753 }
109754 names.sort();
109755 const prefix =
109756 typeof automaticNamePrefix === "string"
109757 ? automaticNamePrefix
109758 : cacheGroup;
109759 const namePrefix = prefix ? prefix + automaticNameDelimiter : "";
109760 let name = namePrefix + names.join(automaticNameDelimiter);
109761 // Filenames and paths can't be too long otherwise an
109762 // ENAMETOOLONG error is raised. If the generated name if too
109763 // long, it is truncated and a hash is appended. The limit has
109764 // been set to 109 to prevent `[name].[chunkhash].[ext]` from
109765 // generating a 256+ character string.
109766 if (name.length > automaticNameMaxLength) {
109767 const hashedFilename = hashFilename(name);
109768 const sliceLength =
109769 automaticNameMaxLength -
109770 (automaticNameDelimiter.length + hashedFilename.length);
109771 name =
109772 name.slice(0, sliceLength) +
109773 automaticNameDelimiter +
109774 hashedFilename;
109775 }
109776 cacheEntry[cacheGroup] = name;
109777 return name;
109778 };
109779 return fn;
109780 }
109781 if (typeof name === "string") {
109782 const fn = () => {
109783 return name;
109784 };
109785 return fn;
109786 }
109787 if (typeof name === "function") return name;
109788 }
109789
109790 static normalizeChunksFilter(chunks) {
109791 if (chunks === "initial") {
109792 return INITIAL_CHUNK_FILTER;
109793 }
109794 if (chunks === "async") {
109795 return ASYNC_CHUNK_FILTER;
109796 }
109797 if (chunks === "all") {
109798 return ALL_CHUNK_FILTER;
109799 }
109800 if (typeof chunks === "function") return chunks;
109801 }
109802
109803 static normalizeFallbackCacheGroup(
109804 {
109805 minSize = undefined,
109806 maxSize = undefined,
109807 automaticNameDelimiter = undefined
109808 },
109809 {
109810 minSize: defaultMinSize = undefined,
109811 maxSize: defaultMaxSize = undefined,
109812 automaticNameDelimiter: defaultAutomaticNameDelimiter = undefined
109813 }
109814 ) {
109815 return {
109816 minSize: typeof minSize === "number" ? minSize : defaultMinSize || 0,
109817 maxSize: typeof maxSize === "number" ? maxSize : defaultMaxSize || 0,
109818 automaticNameDelimiter:
109819 automaticNameDelimiter || defaultAutomaticNameDelimiter || "~"
109820 };
109821 }
109822
109823 static normalizeCacheGroups({
109824 cacheGroups,
109825 name,
109826 automaticNameDelimiter,
109827 automaticNameMaxLength
109828 }) {
109829 if (typeof cacheGroups === "function") {
109830 // TODO webpack 5 remove this
109831 if (cacheGroups.length !== 1) {
109832 return module => cacheGroups(module, module.getChunks());
109833 }
109834 return cacheGroups;
109835 }
109836 if (cacheGroups && typeof cacheGroups === "object") {
109837 const fn = module => {
109838 let results;
109839 for (const key of Object.keys(cacheGroups)) {
109840 let option = cacheGroups[key];
109841 if (option === false) continue;
109842 if (option instanceof RegExp || typeof option === "string") {
109843 option = {
109844 test: option
109845 };
109846 }
109847 if (typeof option === "function") {
109848 let result = option(module);
109849 if (result) {
109850 if (results === undefined) results = [];
109851 for (const r of Array.isArray(result) ? result : [result]) {
109852 const result = Object.assign({ key }, r);
109853 if (result.name) result.getName = () => result.name;
109854 if (result.chunks) {
109855 result.chunksFilter = SplitChunksPlugin.normalizeChunksFilter(
109856 result.chunks
109857 );
109858 }
109859 results.push(result);
109860 }
109861 }
109862 } else if (SplitChunksPlugin.checkTest(option.test, module)) {
109863 if (results === undefined) results = [];
109864 results.push({
109865 key: key,
109866 priority: option.priority,
109867 getName:
109868 SplitChunksPlugin.normalizeName({
109869 name: option.name || name,
109870 automaticNameDelimiter:
109871 typeof option.automaticNameDelimiter === "string"
109872 ? option.automaticNameDelimiter
109873 : automaticNameDelimiter,
109874 automaticNamePrefix: option.automaticNamePrefix,
109875 automaticNameMaxLength:
109876 option.automaticNameMaxLength || automaticNameMaxLength
109877 }) || (() => {}),
109878 chunksFilter: SplitChunksPlugin.normalizeChunksFilter(
109879 option.chunks
109880 ),
109881 enforce: option.enforce,
109882 minSize: option.minSize,
109883 enforceSizeThreshold: option.enforceSizeThreshold,
109884 maxSize: option.maxSize,
109885 minChunks: option.minChunks,
109886 maxAsyncRequests: option.maxAsyncRequests,
109887 maxInitialRequests: option.maxInitialRequests,
109888 filename: option.filename,
109889 reuseExistingChunk: option.reuseExistingChunk
109890 });
109891 }
109892 }
109893 return results;
109894 };
109895 return fn;
109896 }
109897 const fn = () => {};
109898 return fn;
109899 }
109900
109901 static checkTest(test, module) {
109902 if (test === undefined) return true;
109903 if (typeof test === "function") {
109904 if (test.length !== 1) {
109905 return test(module, module.getChunks());
109906 }
109907 return test(module);
109908 }
109909 if (typeof test === "boolean") return test;
109910 if (typeof test === "string") {
109911 if (
109912 module.nameForCondition &&
109913 module.nameForCondition().startsWith(test)
109914 ) {
109915 return true;
109916 }
109917 for (const chunk of module.chunksIterable) {
109918 if (chunk.name && chunk.name.startsWith(test)) {
109919 return true;
109920 }
109921 }
109922 return false;
109923 }
109924 if (test instanceof RegExp) {
109925 if (module.nameForCondition && test.test(module.nameForCondition())) {
109926 return true;
109927 }
109928 for (const chunk of module.chunksIterable) {
109929 if (chunk.name && test.test(chunk.name)) {
109930 return true;
109931 }
109932 }
109933 return false;
109934 }
109935 return false;
109936 }
109937
109938 /**
109939 * @param {Compiler} compiler webpack compiler
109940 * @returns {void}
109941 */
109942 apply(compiler) {
109943 compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => {
109944 let alreadyOptimized = false;
109945 compilation.hooks.unseal.tap("SplitChunksPlugin", () => {
109946 alreadyOptimized = false;
109947 });
109948 compilation.hooks.optimizeChunksAdvanced.tap(
109949 "SplitChunksPlugin",
109950 chunks => {
109951 if (alreadyOptimized) return;
109952 alreadyOptimized = true;
109953 // Give each selected chunk an index (to create strings from chunks)
109954 const indexMap = new Map();
109955 let index = 1;
109956 for (const chunk of chunks) {
109957 indexMap.set(chunk, index++);
109958 }
109959 const getKey = chunks => {
109960 return Array.from(chunks, c => indexMap.get(c))
109961 .sort(compareNumbers)
109962 .join();
109963 };
109964 /** @type {Map<string, Set<Chunk>>} */
109965 const chunkSetsInGraph = new Map();
109966 for (const module of compilation.modules) {
109967 const chunksKey = getKey(module.chunksIterable);
109968 if (!chunkSetsInGraph.has(chunksKey)) {
109969 chunkSetsInGraph.set(chunksKey, new Set(module.chunksIterable));
109970 }
109971 }
109972
109973 // group these set of chunks by count
109974 // to allow to check less sets via isSubset
109975 // (only smaller sets can be subset)
109976 /** @type {Map<number, Array<Set<Chunk>>>} */
109977 const chunkSetsByCount = new Map();
109978 for (const chunksSet of chunkSetsInGraph.values()) {
109979 const count = chunksSet.size;
109980 let array = chunkSetsByCount.get(count);
109981 if (array === undefined) {
109982 array = [];
109983 chunkSetsByCount.set(count, array);
109984 }
109985 array.push(chunksSet);
109986 }
109987
109988 // Create a list of possible combinations
109989 const combinationsCache = new Map(); // Map<string, Set<Chunk>[]>
109990
109991 const getCombinations = key => {
109992 const chunksSet = chunkSetsInGraph.get(key);
109993 var array = [chunksSet];
109994 if (chunksSet.size > 1) {
109995 for (const [count, setArray] of chunkSetsByCount) {
109996 // "equal" is not needed because they would have been merge in the first step
109997 if (count < chunksSet.size) {
109998 for (const set of setArray) {
109999 if (isSubset(chunksSet, set)) {
110000 array.push(set);
110001 }
110002 }
110003 }
110004 }
110005 }
110006 return array;
110007 };
110008
110009 /**
110010 * @typedef {Object} SelectedChunksResult
110011 * @property {Chunk[]} chunks the list of chunks
110012 * @property {string} key a key of the list
110013 */
110014
110015 /**
110016 * @typedef {function(Chunk): boolean} ChunkFilterFunction
110017 */
110018
110019 /** @type {WeakMap<Set<Chunk>, WeakMap<ChunkFilterFunction, SelectedChunksResult>>} */
110020 const selectedChunksCacheByChunksSet = new WeakMap();
110021
110022 /**
110023 * get list and key by applying the filter function to the list
110024 * It is cached for performance reasons
110025 * @param {Set<Chunk>} chunks list of chunks
110026 * @param {ChunkFilterFunction} chunkFilter filter function for chunks
110027 * @returns {SelectedChunksResult} list and key
110028 */
110029 const getSelectedChunks = (chunks, chunkFilter) => {
110030 let entry = selectedChunksCacheByChunksSet.get(chunks);
110031 if (entry === undefined) {
110032 entry = new WeakMap();
110033 selectedChunksCacheByChunksSet.set(chunks, entry);
110034 }
110035 /** @type {SelectedChunksResult} */
110036 let entry2 = entry.get(chunkFilter);
110037 if (entry2 === undefined) {
110038 /** @type {Chunk[]} */
110039 const selectedChunks = [];
110040 for (const chunk of chunks) {
110041 if (chunkFilter(chunk)) selectedChunks.push(chunk);
110042 }
110043 entry2 = {
110044 chunks: selectedChunks,
110045 key: getKey(selectedChunks)
110046 };
110047 entry.set(chunkFilter, entry2);
110048 }
110049 return entry2;
110050 };
110051
110052 /**
110053 * @typedef {Object} ChunksInfoItem
110054 * @property {SortableSet} modules
110055 * @property {TODO} cacheGroup
110056 * @property {number} cacheGroupIndex
110057 * @property {string} name
110058 * @property {number} size
110059 * @property {Set<Chunk>} chunks
110060 * @property {Set<Chunk>} reuseableChunks
110061 * @property {Set<string>} chunksKeys
110062 */
110063
110064 // Map a list of chunks to a list of modules
110065 // For the key the chunk "index" is used, the value is a SortableSet of modules
110066 /** @type {Map<string, ChunksInfoItem>} */
110067 const chunksInfoMap = new Map();
110068
110069 /**
110070 * @param {TODO} cacheGroup the current cache group
110071 * @param {number} cacheGroupIndex the index of the cache group of ordering
110072 * @param {Chunk[]} selectedChunks chunks selected for this module
110073 * @param {string} selectedChunksKey a key of selectedChunks
110074 * @param {Module} module the current module
110075 * @returns {void}
110076 */
110077 const addModuleToChunksInfoMap = (
110078 cacheGroup,
110079 cacheGroupIndex,
110080 selectedChunks,
110081 selectedChunksKey,
110082 module
110083 ) => {
110084 // Break if minimum number of chunks is not reached
110085 if (selectedChunks.length < cacheGroup.minChunks) return;
110086 // Determine name for split chunk
110087 const name = cacheGroup.getName(
110088 module,
110089 selectedChunks,
110090 cacheGroup.key
110091 );
110092 // Create key for maps
110093 // When it has a name we use the name as key
110094 // Elsewise we create the key from chunks and cache group key
110095 // This automatically merges equal names
110096 const key =
110097 cacheGroup.key +
110098 (name ? ` name:${name}` : ` chunks:${selectedChunksKey}`);
110099 // Add module to maps
110100 let info = chunksInfoMap.get(key);
110101 if (info === undefined) {
110102 chunksInfoMap.set(
110103 key,
110104 (info = {
110105 modules: new SortableSet(undefined, sortByIdentifier),
110106 cacheGroup,
110107 cacheGroupIndex,
110108 name,
110109 size: 0,
110110 chunks: new Set(),
110111 reuseableChunks: new Set(),
110112 chunksKeys: new Set()
110113 })
110114 );
110115 }
110116 info.modules.add(module);
110117 info.size += module.size();
110118 if (!info.chunksKeys.has(selectedChunksKey)) {
110119 info.chunksKeys.add(selectedChunksKey);
110120 for (const chunk of selectedChunks) {
110121 info.chunks.add(chunk);
110122 }
110123 }
110124 };
110125
110126 // Walk through all modules
110127 for (const module of compilation.modules) {
110128 // Get cache group
110129 let cacheGroups = this.options.getCacheGroups(module);
110130 if (!Array.isArray(cacheGroups) || cacheGroups.length === 0) {
110131 continue;
110132 }
110133
110134 // Prepare some values
110135 const chunksKey = getKey(module.chunksIterable);
110136 let combs = combinationsCache.get(chunksKey);
110137 if (combs === undefined) {
110138 combs = getCombinations(chunksKey);
110139 combinationsCache.set(chunksKey, combs);
110140 }
110141
110142 let cacheGroupIndex = 0;
110143 for (const cacheGroupSource of cacheGroups) {
110144 const minSize =
110145 cacheGroupSource.minSize !== undefined
110146 ? cacheGroupSource.minSize
110147 : cacheGroupSource.enforce
110148 ? 0
110149 : this.options.minSize;
110150 const enforceSizeThreshold =
110151 cacheGroupSource.enforceSizeThreshold !== undefined
110152 ? cacheGroupSource.enforceSizeThreshold
110153 : cacheGroupSource.enforce
110154 ? 0
110155 : this.options.enforceSizeThreshold;
110156 const cacheGroup = {
110157 key: cacheGroupSource.key,
110158 priority: cacheGroupSource.priority || 0,
110159 chunksFilter:
110160 cacheGroupSource.chunksFilter || this.options.chunksFilter,
110161 minSize,
110162 minSizeForMaxSize:
110163 cacheGroupSource.minSize !== undefined
110164 ? cacheGroupSource.minSize
110165 : this.options.minSize,
110166 enforceSizeThreshold,
110167 maxSize:
110168 cacheGroupSource.maxSize !== undefined
110169 ? cacheGroupSource.maxSize
110170 : cacheGroupSource.enforce
110171 ? 0
110172 : this.options.maxSize,
110173 minChunks:
110174 cacheGroupSource.minChunks !== undefined
110175 ? cacheGroupSource.minChunks
110176 : cacheGroupSource.enforce
110177 ? 1
110178 : this.options.minChunks,
110179 maxAsyncRequests:
110180 cacheGroupSource.maxAsyncRequests !== undefined
110181 ? cacheGroupSource.maxAsyncRequests
110182 : cacheGroupSource.enforce
110183 ? Infinity
110184 : this.options.maxAsyncRequests,
110185 maxInitialRequests:
110186 cacheGroupSource.maxInitialRequests !== undefined
110187 ? cacheGroupSource.maxInitialRequests
110188 : cacheGroupSource.enforce
110189 ? Infinity
110190 : this.options.maxInitialRequests,
110191 getName:
110192 cacheGroupSource.getName !== undefined
110193 ? cacheGroupSource.getName
110194 : this.options.getName,
110195 filename:
110196 cacheGroupSource.filename !== undefined
110197 ? cacheGroupSource.filename
110198 : this.options.filename,
110199 automaticNameDelimiter:
110200 cacheGroupSource.automaticNameDelimiter !== undefined
110201 ? cacheGroupSource.automaticNameDelimiter
110202 : this.options.automaticNameDelimiter,
110203 reuseExistingChunk: cacheGroupSource.reuseExistingChunk,
110204 _validateSize: minSize > 0,
110205 _conditionalEnforce: enforceSizeThreshold > 0
110206 };
110207 // For all combination of chunk selection
110208 for (const chunkCombination of combs) {
110209 // Break if minimum number of chunks is not reached
110210 if (chunkCombination.size < cacheGroup.minChunks) continue;
110211 // Select chunks by configuration
110212 const {
110213 chunks: selectedChunks,
110214 key: selectedChunksKey
110215 } = getSelectedChunks(
110216 chunkCombination,
110217 cacheGroup.chunksFilter
110218 );
110219
110220 addModuleToChunksInfoMap(
110221 cacheGroup,
110222 cacheGroupIndex,
110223 selectedChunks,
110224 selectedChunksKey,
110225 module
110226 );
110227 }
110228 cacheGroupIndex++;
110229 }
110230 }
110231
110232 // Filter items were size < minSize
110233 for (const pair of chunksInfoMap) {
110234 const info = pair[1];
110235 if (
110236 info.cacheGroup._validateSize &&
110237 info.size < info.cacheGroup.minSize
110238 ) {
110239 chunksInfoMap.delete(pair[0]);
110240 }
110241 }
110242
110243 /** @type {Map<Chunk, {minSize: number, maxSize: number, automaticNameDelimiter: string, keys: string[]}>} */
110244 const maxSizeQueueMap = new Map();
110245
110246 while (chunksInfoMap.size > 0) {
110247 // Find best matching entry
110248 let bestEntryKey;
110249 let bestEntry;
110250 for (const pair of chunksInfoMap) {
110251 const key = pair[0];
110252 const info = pair[1];
110253 if (bestEntry === undefined) {
110254 bestEntry = info;
110255 bestEntryKey = key;
110256 } else if (compareEntries(bestEntry, info) < 0) {
110257 bestEntry = info;
110258 bestEntryKey = key;
110259 }
110260 }
110261
110262 const item = bestEntry;
110263 chunksInfoMap.delete(bestEntryKey);
110264
110265 let chunkName = item.name;
110266 // Variable for the new chunk (lazy created)
110267 /** @type {Chunk} */
110268 let newChunk;
110269 // When no chunk name, check if we can reuse a chunk instead of creating a new one
110270 let isReused = false;
110271 if (item.cacheGroup.reuseExistingChunk) {
110272 outer: for (const chunk of item.chunks) {
110273 if (chunk.getNumberOfModules() !== item.modules.size) continue;
110274 if (chunk.hasEntryModule()) continue;
110275 for (const module of item.modules) {
110276 if (!chunk.containsModule(module)) continue outer;
110277 }
110278 if (!newChunk || !newChunk.name) {
110279 newChunk = chunk;
110280 } else if (
110281 chunk.name &&
110282 chunk.name.length < newChunk.name.length
110283 ) {
110284 newChunk = chunk;
110285 } else if (
110286 chunk.name &&
110287 chunk.name.length === newChunk.name.length &&
110288 chunk.name < newChunk.name
110289 ) {
110290 newChunk = chunk;
110291 }
110292 chunkName = undefined;
110293 isReused = true;
110294 }
110295 }
110296 // Check if maxRequests condition can be fulfilled
110297
110298 const selectedChunks = Array.from(item.chunks).filter(chunk => {
110299 // skip if we address ourself
110300 return (
110301 (!chunkName || chunk.name !== chunkName) && chunk !== newChunk
110302 );
110303 });
110304
110305 const enforced =
110306 item.cacheGroup._conditionalEnforce &&
110307 item.size >= item.cacheGroup.enforceSizeThreshold;
110308
110309 // Skip when no chunk selected
110310 if (selectedChunks.length === 0) continue;
110311
110312 const usedChunks = new Set(selectedChunks);
110313
110314 // Check if maxRequests condition can be fulfilled
110315 if (
110316 !enforced &&
110317 (Number.isFinite(item.cacheGroup.maxInitialRequests) ||
110318 Number.isFinite(item.cacheGroup.maxAsyncRequests))
110319 ) {
110320 for (const chunk of usedChunks) {
110321 // respect max requests
110322 const maxRequests = chunk.isOnlyInitial()
110323 ? item.cacheGroup.maxInitialRequests
110324 : chunk.canBeInitial()
110325 ? Math.min(
110326 item.cacheGroup.maxInitialRequests,
110327 item.cacheGroup.maxAsyncRequests
110328 )
110329 : item.cacheGroup.maxAsyncRequests;
110330 if (
110331 isFinite(maxRequests) &&
110332 getRequests(chunk) >= maxRequests
110333 ) {
110334 usedChunks.delete(chunk);
110335 }
110336 }
110337 }
110338
110339 outer: for (const chunk of usedChunks) {
110340 for (const module of item.modules) {
110341 if (chunk.containsModule(module)) continue outer;
110342 }
110343 usedChunks.delete(chunk);
110344 }
110345
110346 // Were some (invalid) chunks removed from usedChunks?
110347 // => readd all modules to the queue, as things could have been changed
110348 if (usedChunks.size < selectedChunks.length) {
110349 if (usedChunks.size >= item.cacheGroup.minChunks) {
110350 const chunksArr = Array.from(usedChunks);
110351 for (const module of item.modules) {
110352 addModuleToChunksInfoMap(
110353 item.cacheGroup,
110354 item.cacheGroupIndex,
110355 chunksArr,
110356 getKey(usedChunks),
110357 module
110358 );
110359 }
110360 }
110361 continue;
110362 }
110363
110364 // Create the new chunk if not reusing one
110365 if (!isReused) {
110366 newChunk = compilation.addChunk(chunkName);
110367 }
110368 // Walk through all chunks
110369 for (const chunk of usedChunks) {
110370 // Add graph connections for splitted chunk
110371 chunk.split(newChunk);
110372 }
110373
110374 // Add a note to the chunk
110375 newChunk.chunkReason = isReused
110376 ? "reused as split chunk"
110377 : "split chunk";
110378 if (item.cacheGroup.key) {
110379 newChunk.chunkReason += ` (cache group: ${item.cacheGroup.key})`;
110380 }
110381 if (chunkName) {
110382 newChunk.chunkReason += ` (name: ${chunkName})`;
110383 // If the chosen name is already an entry point we remove the entry point
110384 const entrypoint = compilation.entrypoints.get(chunkName);
110385 if (entrypoint) {
110386 compilation.entrypoints.delete(chunkName);
110387 entrypoint.remove();
110388 newChunk.entryModule = undefined;
110389 }
110390 }
110391 if (item.cacheGroup.filename) {
110392 if (!newChunk.isOnlyInitial()) {
110393 throw new Error(
110394 "SplitChunksPlugin: You are trying to set a filename for a chunk which is (also) loaded on demand. " +
110395 "The runtime can only handle loading of chunks which match the chunkFilename schema. " +
110396 "Using a custom filename would fail at runtime. " +
110397 `(cache group: ${item.cacheGroup.key})`
110398 );
110399 }
110400 newChunk.filenameTemplate = item.cacheGroup.filename;
110401 }
110402 if (!isReused) {
110403 // Add all modules to the new chunk
110404 for (const module of item.modules) {
110405 if (typeof module.chunkCondition === "function") {
110406 if (!module.chunkCondition(newChunk)) continue;
110407 }
110408 // Add module to new chunk
110409 GraphHelpers.connectChunkAndModule(newChunk, module);
110410 // Remove module from used chunks
110411 for (const chunk of usedChunks) {
110412 chunk.removeModule(module);
110413 module.rewriteChunkInReasons(chunk, [newChunk]);
110414 }
110415 }
110416 } else {
110417 // Remove all modules from used chunks
110418 for (const module of item.modules) {
110419 for (const chunk of usedChunks) {
110420 chunk.removeModule(module);
110421 module.rewriteChunkInReasons(chunk, [newChunk]);
110422 }
110423 }
110424 }
110425
110426 if (item.cacheGroup.maxSize > 0) {
110427 const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk);
110428 maxSizeQueueMap.set(newChunk, {
110429 minSize: Math.max(
110430 oldMaxSizeSettings ? oldMaxSizeSettings.minSize : 0,
110431 item.cacheGroup.minSizeForMaxSize
110432 ),
110433 maxSize: Math.min(
110434 oldMaxSizeSettings ? oldMaxSizeSettings.maxSize : Infinity,
110435 item.cacheGroup.maxSize
110436 ),
110437 automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter,
110438 keys: oldMaxSizeSettings
110439 ? oldMaxSizeSettings.keys.concat(item.cacheGroup.key)
110440 : [item.cacheGroup.key]
110441 });
110442 }
110443
110444 // remove all modules from other entries and update size
110445 for (const [key, info] of chunksInfoMap) {
110446 if (isOverlap(info.chunks, usedChunks)) {
110447 // update modules and total size
110448 // may remove it from the map when < minSize
110449 const oldSize = info.modules.size;
110450 for (const module of item.modules) {
110451 info.modules.delete(module);
110452 }
110453 if (info.modules.size !== oldSize) {
110454 if (info.modules.size === 0) {
110455 chunksInfoMap.delete(key);
110456 continue;
110457 }
110458 info.size = getModulesSize(info.modules);
110459 if (
110460 info.cacheGroup._validateSize &&
110461 info.size < info.cacheGroup.minSize
110462 ) {
110463 chunksInfoMap.delete(key);
110464 }
110465 if (info.modules.size === 0) {
110466 chunksInfoMap.delete(key);
110467 }
110468 }
110469 }
110470 }
110471 }
110472
110473 const incorrectMinMaxSizeSet = new Set();
110474
110475 // Make sure that maxSize is fulfilled
110476 for (const chunk of compilation.chunks.slice()) {
110477 const { minSize, maxSize, automaticNameDelimiter, keys } =
110478 maxSizeQueueMap.get(chunk) || this.options.fallbackCacheGroup;
110479 if (!maxSize) continue;
110480 if (minSize > maxSize) {
110481 const warningKey = `${keys && keys.join()} ${minSize} ${maxSize}`;
110482 if (!incorrectMinMaxSizeSet.has(warningKey)) {
110483 incorrectMinMaxSizeSet.add(warningKey);
110484 compilation.warnings.push(
110485 new MinMaxSizeWarning(keys, minSize, maxSize)
110486 );
110487 }
110488 }
110489 const results = deterministicGroupingForModules({
110490 maxSize: Math.max(minSize, maxSize),
110491 minSize,
110492 items: chunk.modulesIterable,
110493 getKey(module) {
110494 const ident = contextify(
110495 compilation.options.context,
110496 module.identifier()
110497 );
110498 const name = module.nameForCondition
110499 ? contextify(
110500 compilation.options.context,
110501 module.nameForCondition()
110502 )
110503 : ident.replace(/^.*!|\?[^?!]*$/g, "");
110504 const fullKey =
110505 name + automaticNameDelimiter + hashFilename(ident);
110506 return fullKey.replace(/[\\/?]/g, "_");
110507 },
110508 getSize(module) {
110509 return module.size();
110510 }
110511 });
110512 results.sort((a, b) => {
110513 if (a.key < b.key) return -1;
110514 if (a.key > b.key) return 1;
110515 return 0;
110516 });
110517 for (let i = 0; i < results.length; i++) {
110518 const group = results[i];
110519 const key = this.options.hidePathInfo
110520 ? hashFilename(group.key)
110521 : group.key;
110522 let name = chunk.name
110523 ? chunk.name + automaticNameDelimiter + key
110524 : null;
110525 if (name && name.length > 100) {
110526 name =
110527 name.slice(0, 100) +
110528 automaticNameDelimiter +
110529 hashFilename(name);
110530 }
110531 let newPart;
110532 if (i !== results.length - 1) {
110533 newPart = compilation.addChunk(name);
110534 chunk.split(newPart);
110535 newPart.chunkReason = chunk.chunkReason;
110536 // Add all modules to the new chunk
110537 for (const module of group.items) {
110538 if (typeof module.chunkCondition === "function") {
110539 if (!module.chunkCondition(newPart)) continue;
110540 }
110541 // Add module to new chunk
110542 GraphHelpers.connectChunkAndModule(newPart, module);
110543 // Remove module from used chunks
110544 chunk.removeModule(module);
110545 module.rewriteChunkInReasons(chunk, [newPart]);
110546 }
110547 } else {
110548 // change the chunk to be a part
110549 newPart = chunk;
110550 chunk.name = name;
110551 }
110552 }
110553 }
110554 }
110555 );
110556 });
110557 }
110558};
110559
110560
110561/***/ }),
110562
110563/***/ 89339:
110564/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
110565
110566"use strict";
110567/*
110568 MIT License http://www.opensource.org/licenses/mit-license.php
110569 Author Sean Larkin @thelarkinn
110570*/
110571
110572
110573const WebpackError = __webpack_require__(97391);
110574const SizeFormatHelpers = __webpack_require__(12496);
110575
110576module.exports = class AssetsOverSizeLimitWarning extends WebpackError {
110577 constructor(assetsOverSizeLimit, assetLimit) {
110578 const assetLists = assetsOverSizeLimit
110579 .map(
110580 asset =>
110581 `\n ${asset.name} (${SizeFormatHelpers.formatSize(asset.size)})`
110582 )
110583 .join("");
110584
110585 super(`asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize(
110586 assetLimit
110587 )}).
110588This can impact web performance.
110589Assets: ${assetLists}`);
110590
110591 this.name = "AssetsOverSizeLimitWarning";
110592 this.assets = assetsOverSizeLimit;
110593
110594 Error.captureStackTrace(this, this.constructor);
110595 }
110596};
110597
110598
110599/***/ }),
110600
110601/***/ 41336:
110602/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
110603
110604"use strict";
110605/*
110606 MIT License http://www.opensource.org/licenses/mit-license.php
110607 Author Sean Larkin @thelarkinn
110608*/
110609
110610
110611const WebpackError = __webpack_require__(97391);
110612const SizeFormatHelpers = __webpack_require__(12496);
110613
110614module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError {
110615 constructor(entrypoints, entrypointLimit) {
110616 const entrypointList = entrypoints
110617 .map(
110618 entrypoint =>
110619 `\n ${entrypoint.name} (${SizeFormatHelpers.formatSize(
110620 entrypoint.size
110621 )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}`
110622 )
110623 .join("");
110624 super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${SizeFormatHelpers.formatSize(
110625 entrypointLimit
110626 )}). This can impact web performance.
110627Entrypoints:${entrypointList}\n`);
110628
110629 this.name = "EntrypointsOverSizeLimitWarning";
110630 this.entrypoints = entrypoints;
110631
110632 Error.captureStackTrace(this, this.constructor);
110633 }
110634};
110635
110636
110637/***/ }),
110638
110639/***/ 53006:
110640/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
110641
110642"use strict";
110643/*
110644 MIT License http://www.opensource.org/licenses/mit-license.php
110645 Author Sean Larkin @thelarkinn
110646*/
110647
110648
110649const WebpackError = __webpack_require__(97391);
110650
110651module.exports = class NoAsyncChunksWarning extends WebpackError {
110652 constructor() {
110653 super(
110654 "webpack performance recommendations: \n" +
110655 "You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" +
110656 "For more info visit https://webpack.js.org/guides/code-splitting/"
110657 );
110658
110659 this.name = "NoAsyncChunksWarning";
110660
110661 Error.captureStackTrace(this, this.constructor);
110662 }
110663};
110664
110665
110666/***/ }),
110667
110668/***/ 68310:
110669/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
110670
110671"use strict";
110672/*
110673 MIT License http://www.opensource.org/licenses/mit-license.php
110674 Author Sean Larkin @thelarkinn
110675*/
110676
110677const EntrypointsOverSizeLimitWarning = __webpack_require__(41336);
110678const AssetsOverSizeLimitWarning = __webpack_require__(89339);
110679const NoAsyncChunksWarning = __webpack_require__(53006);
110680
110681/** @typedef {import("../Compiler")} Compiler */
110682/** @typedef {import("../Entrypoint")} Entrypoint */
110683
110684module.exports = class SizeLimitsPlugin {
110685 constructor(options) {
110686 this.hints = options.hints;
110687 this.maxAssetSize = options.maxAssetSize;
110688 this.maxEntrypointSize = options.maxEntrypointSize;
110689 this.assetFilter = options.assetFilter;
110690 }
110691
110692 /**
110693 * @param {Compiler} compiler webpack compiler
110694 * @returns {void}
110695 */
110696 apply(compiler) {
110697 const entrypointSizeLimit = this.maxEntrypointSize;
110698 const assetSizeLimit = this.maxAssetSize;
110699 const hints = this.hints;
110700 const assetFilter =
110701 this.assetFilter || ((name, source, info) => !info.development);
110702
110703 compiler.hooks.afterEmit.tap("SizeLimitsPlugin", compilation => {
110704 const warnings = [];
110705
110706 /**
110707 * @param {Entrypoint} entrypoint an entrypoint
110708 * @returns {number} the size of the entrypoint
110709 */
110710 const getEntrypointSize = entrypoint =>
110711 entrypoint.getFiles().reduce((currentSize, file) => {
110712 const asset = compilation.getAsset(file);
110713 if (
110714 asset &&
110715 assetFilter(asset.name, asset.source, asset.info) &&
110716 asset.source
110717 ) {
110718 return currentSize + (asset.info.size || asset.source.size());
110719 }
110720
110721 return currentSize;
110722 }, 0);
110723
110724 const assetsOverSizeLimit = [];
110725 for (const { name, source, info } of compilation.getAssets()) {
110726 if (!assetFilter(name, source, info) || !source) {
110727 continue;
110728 }
110729
110730 const size = info.size || source.size();
110731 if (size > assetSizeLimit) {
110732 assetsOverSizeLimit.push({
110733 name,
110734 size
110735 });
110736 /** @type {any} */ (source).isOverSizeLimit = true;
110737 }
110738 }
110739
110740 const fileFilter = name => {
110741 const asset = compilation.getAsset(name);
110742 return asset && assetFilter(asset.name, asset.source, asset.info);
110743 };
110744
110745 const entrypointsOverLimit = [];
110746 for (const [name, entry] of compilation.entrypoints) {
110747 const size = getEntrypointSize(entry);
110748
110749 if (size > entrypointSizeLimit) {
110750 entrypointsOverLimit.push({
110751 name: name,
110752 size: size,
110753 files: entry.getFiles().filter(fileFilter)
110754 });
110755 /** @type {any} */ (entry).isOverSizeLimit = true;
110756 }
110757 }
110758
110759 if (hints) {
110760 // 1. Individual Chunk: Size < 250kb
110761 // 2. Collective Initial Chunks [entrypoint] (Each Set?): Size < 250kb
110762 // 3. No Async Chunks
110763 // if !1, then 2, if !2 return
110764 if (assetsOverSizeLimit.length > 0) {
110765 warnings.push(
110766 new AssetsOverSizeLimitWarning(assetsOverSizeLimit, assetSizeLimit)
110767 );
110768 }
110769 if (entrypointsOverLimit.length > 0) {
110770 warnings.push(
110771 new EntrypointsOverSizeLimitWarning(
110772 entrypointsOverLimit,
110773 entrypointSizeLimit
110774 )
110775 );
110776 }
110777
110778 if (warnings.length > 0) {
110779 const hasAsyncChunks =
110780 compilation.chunks.filter(chunk => !chunk.canBeInitial()).length >
110781 0;
110782
110783 if (!hasAsyncChunks) {
110784 warnings.push(new NoAsyncChunksWarning());
110785 }
110786
110787 if (hints === "error") {
110788 compilation.errors.push(...warnings);
110789 } else {
110790 compilation.warnings.push(...warnings);
110791 }
110792 }
110793 }
110794 });
110795 }
110796};
110797
110798
110799/***/ }),
110800
110801/***/ 52315:
110802/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
110803
110804"use strict";
110805/*
110806 MIT License http://www.opensource.org/licenses/mit-license.php
110807 Author Tobias Koppers @sokra
110808*/
110809
110810
110811
110812const SortableSet = __webpack_require__(50071);
110813
110814/**
110815 * @template T
110816 * @template K
110817 * Multi layer bucket sorted set
110818 * Supports adding non-existing items (DO NOT ADD ITEM TWICE)
110819 * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET)
110820 * Supports popping the first items according to defined order
110821 * Supports iterating all items without order
110822 * Supports updating an item in an efficient way
110823 * Supports size property, which is the number of items
110824 * Items are lazy partially sorted when needed
110825 */
110826class LazyBucketSortedSet {
110827 /**
110828 * @param {function(T): K} getKey function to get key from item
110829 * @param {function(K, K): number} comparator comparator to sort keys
110830 * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer
110831 */
110832 constructor(getKey, comparator, ...args) {
110833 this._getKey = getKey;
110834 this._innerArgs = args;
110835 this._leaf = args.length <= 1;
110836 this._keys = new SortableSet(undefined, comparator);
110837 /** @type {Map<K, LazyBucketSortedSet<T, any> | SortableSet<T>>} */
110838 this._map = new Map();
110839 this._unsortedItems = new Set();
110840 this.size = 0;
110841 }
110842
110843 /**
110844 * @param {T} item an item
110845 * @returns {void}
110846 */
110847 add(item) {
110848 this.size++;
110849 this._unsortedItems.add(item);
110850 }
110851
110852 /**
110853 * @param {K} key key of item
110854 * @param {T} item the item
110855 * @returns {void}
110856 */
110857 _addInternal(key, item) {
110858 let entry = this._map.get(key);
110859 if (entry === undefined) {
110860 entry = this._leaf
110861 ? new SortableSet(undefined, this._innerArgs[0])
110862 : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs);
110863 this._keys.add(key);
110864 this._map.set(key, entry);
110865 }
110866 entry.add(item);
110867 }
110868
110869 /**
110870 * @param {T} item an item
110871 * @returns {void}
110872 */
110873 delete(item) {
110874 this.size--;
110875 if (this._unsortedItems.has(item)) {
110876 this._unsortedItems.delete(item);
110877 return;
110878 }
110879 const key = this._getKey(item);
110880 const entry = this._map.get(key);
110881 entry.delete(item);
110882 if (entry.size === 0) {
110883 this._deleteKey(key);
110884 }
110885 }
110886
110887 /**
110888 * @param {K} key key to be removed
110889 * @returns {void}
110890 */
110891 _deleteKey(key) {
110892 this._keys.delete(key);
110893 this._map.delete(key);
110894 }
110895
110896 /**
110897 * @returns {T | undefined} an item
110898 */
110899 popFirst() {
110900 if (this.size === 0) return undefined;
110901 this.size--;
110902 if (this._unsortedItems.size > 0) {
110903 for (const item of this._unsortedItems) {
110904 const key = this._getKey(item);
110905 this._addInternal(key, item);
110906 }
110907 this._unsortedItems.clear();
110908 }
110909 this._keys.sort();
110910 const key = this._keys.values().next().value;
110911 const entry = this._map.get(key);
110912 if (this._leaf) {
110913 const leafEntry = /** @type {SortableSet<T>} */ (entry);
110914 leafEntry.sort();
110915 const item = leafEntry.values().next().value;
110916 leafEntry.delete(item);
110917 if (leafEntry.size === 0) {
110918 this._deleteKey(key);
110919 }
110920 return item;
110921 } else {
110922 const nodeEntry = /** @type {LazyBucketSortedSet<T, any>} */ (entry);
110923 const item = nodeEntry.popFirst();
110924 if (nodeEntry.size === 0) {
110925 this._deleteKey(key);
110926 }
110927 return item;
110928 }
110929 }
110930
110931 /**
110932 * @param {T} item to be updated item
110933 * @returns {function(true=): void} finish update
110934 */
110935 startUpdate(item) {
110936 if (this._unsortedItems.has(item)) {
110937 return remove => {
110938 if (remove) {
110939 this._unsortedItems.delete(item);
110940 this.size--;
110941 return;
110942 }
110943 };
110944 }
110945 const key = this._getKey(item);
110946 if (this._leaf) {
110947 const oldEntry = /** @type {SortableSet<T>} */ (this._map.get(key));
110948 return remove => {
110949 if (remove) {
110950 this.size--;
110951 oldEntry.delete(item);
110952 if (oldEntry.size === 0) {
110953 this._deleteKey(key);
110954 }
110955 return;
110956 }
110957 const newKey = this._getKey(item);
110958 if (key === newKey) {
110959 // This flags the sortable set as unordered
110960 oldEntry.add(item);
110961 } else {
110962 oldEntry.delete(item);
110963 if (oldEntry.size === 0) {
110964 this._deleteKey(key);
110965 }
110966 this._addInternal(newKey, item);
110967 }
110968 };
110969 } else {
110970 const oldEntry = /** @type {LazyBucketSortedSet<T, any>} */ (this._map.get(
110971 key
110972 ));
110973 const finishUpdate = oldEntry.startUpdate(item);
110974 return remove => {
110975 if (remove) {
110976 this.size--;
110977 finishUpdate(true);
110978 if (oldEntry.size === 0) {
110979 this._deleteKey(key);
110980 }
110981 return;
110982 }
110983 const newKey = this._getKey(item);
110984 if (key === newKey) {
110985 finishUpdate();
110986 } else {
110987 finishUpdate(true);
110988 if (oldEntry.size === 0) {
110989 this._deleteKey(key);
110990 }
110991 this._addInternal(newKey, item);
110992 }
110993 };
110994 }
110995 }
110996
110997 /**
110998 * @param {Iterator<T>[]} iterators list of iterators to append to
110999 * @returns {void}
111000 */
111001 _appendIterators(iterators) {
111002 if (this._unsortedItems.size > 0)
111003 iterators.push(this._unsortedItems[Symbol.iterator]());
111004 for (const key of this._keys) {
111005 const entry = this._map.get(key);
111006 if (this._leaf) {
111007 const leafEntry = /** @type {SortableSet<T>} */ (entry);
111008 const iterator = leafEntry[Symbol.iterator]();
111009 iterators.push(iterator);
111010 } else {
111011 const nodeEntry = /** @type {LazyBucketSortedSet<T, any>} */ (entry);
111012 nodeEntry._appendIterators(iterators);
111013 }
111014 }
111015 }
111016
111017 /**
111018 * @returns {Iterator<T>} the iterator
111019 */
111020 [Symbol.iterator]() {
111021 const iterators = [];
111022 this._appendIterators(iterators);
111023 iterators.reverse();
111024 let currentIterator = iterators.pop();
111025 return {
111026 next: () => {
111027 const res = currentIterator.next();
111028 if (res.done) {
111029 if (iterators.length === 0) return res;
111030 currentIterator = iterators.pop();
111031 return currentIterator.next();
111032 }
111033 return res;
111034 }
111035 };
111036 }
111037}
111038
111039module.exports = LazyBucketSortedSet;
111040
111041
111042/***/ }),
111043
111044/***/ 38637:
111045/***/ (function(module) {
111046
111047"use strict";
111048
111049
111050/**
111051 * @template T
111052 */
111053class Queue {
111054 /**
111055 * @param {Iterable<T>=} items The initial elements.
111056 */
111057 constructor(items) {
111058 /** @private @type {Set<T>} */
111059 this.set = new Set(items);
111060 /** @private @type {Iterator<T>} */
111061 this.iterator = this.set[Symbol.iterator]();
111062 }
111063
111064 /**
111065 * Returns the number of elements in this queue.
111066 * @returns {number} The number of elements in this queue.
111067 */
111068 get length() {
111069 return this.set.size;
111070 }
111071
111072 /**
111073 * Appends the specified element to this queue.
111074 * @param {T} item The element to add.
111075 * @returns {void}
111076 */
111077 enqueue(item) {
111078 this.set.add(item);
111079 }
111080
111081 /**
111082 * Retrieves and removes the head of this queue.
111083 * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty.
111084 */
111085 dequeue() {
111086 const result = this.iterator.next();
111087 if (result.done) return undefined;
111088 this.set.delete(result.value);
111089 return result.value;
111090 }
111091}
111092
111093module.exports = Queue;
111094
111095
111096/***/ }),
111097
111098/***/ 33349:
111099/***/ (function(module) {
111100
111101"use strict";
111102/*
111103 MIT License http://www.opensource.org/licenses/mit-license.php
111104 Author Tobias Koppers @sokra
111105*/
111106
111107
111108class Semaphore {
111109 /**
111110 * Creates an instance of Semaphore.
111111 *
111112 * @param {number} available the amount available number of "tasks"
111113 * in the Semaphore
111114 */
111115 constructor(available) {
111116 this.available = available;
111117 /** @type {(function(): void)[]} */
111118 this.waiters = [];
111119 /** @private */
111120 this._continue = this._continue.bind(this);
111121 }
111122
111123 /**
111124 * @param {function(): void} callback function block to capture and run
111125 * @returns {void}
111126 */
111127 acquire(callback) {
111128 if (this.available > 0) {
111129 this.available--;
111130 callback();
111131 } else {
111132 this.waiters.push(callback);
111133 }
111134 }
111135
111136 release() {
111137 this.available++;
111138 if (this.waiters.length > 0) {
111139 process.nextTick(this._continue);
111140 }
111141 }
111142
111143 _continue() {
111144 if (this.available > 0) {
111145 if (this.waiters.length > 0) {
111146 this.available--;
111147 const callback = this.waiters.pop();
111148 callback();
111149 }
111150 }
111151 }
111152}
111153
111154module.exports = Semaphore;
111155
111156
111157/***/ }),
111158
111159/***/ 54262:
111160/***/ (function(__unused_webpack_module, exports) {
111161
111162"use strict";
111163
111164
111165/**
111166 * intersect creates Set containing the intersection of elements between all sets
111167 * @param {Set[]} sets an array of sets being checked for shared elements
111168 * @returns {Set<TODO>} returns a new Set containing the intersecting items
111169 */
111170const intersect = sets => {
111171 if (sets.length === 0) return new Set();
111172 if (sets.length === 1) return new Set(sets[0]);
111173 let minSize = Infinity;
111174 let minIndex = -1;
111175 for (let i = 0; i < sets.length; i++) {
111176 const size = sets[i].size;
111177 if (size < minSize) {
111178 minIndex = i;
111179 minSize = size;
111180 }
111181 }
111182 const current = new Set(sets[minIndex]);
111183 for (let i = 0; i < sets.length; i++) {
111184 if (i === minIndex) continue;
111185 const set = sets[i];
111186 for (const item of current) {
111187 if (!set.has(item)) {
111188 current.delete(item);
111189 }
111190 }
111191 }
111192 return current;
111193};
111194
111195/**
111196 * Checks if a set is the subset of another set
111197 * @param {Set<TODO>} bigSet a Set which contains the original elements to compare against
111198 * @param {Set<TODO>} smallSet the set whos elements might be contained inside of bigSet
111199 * @returns {boolean} returns true if smallSet contains all elements inside of the bigSet
111200 */
111201const isSubset = (bigSet, smallSet) => {
111202 if (bigSet.size < smallSet.size) return false;
111203 for (const item of smallSet) {
111204 if (!bigSet.has(item)) return false;
111205 }
111206 return true;
111207};
111208
111209exports.intersect = intersect;
111210exports.isSubset = isSubset;
111211
111212
111213/***/ }),
111214
111215/***/ 50071:
111216/***/ (function(module) {
111217
111218"use strict";
111219
111220
111221/**
111222 * A subset of Set that offers sorting functionality
111223 * @template T item type in set
111224 * @extends {Set<T>}
111225 */
111226class SortableSet extends Set {
111227 /**
111228 * Create a new sortable set
111229 * @param {Iterable<T>=} initialIterable The initial iterable value
111230 * @typedef {function(T, T): number} SortFunction
111231 * @param {SortFunction=} defaultSort Default sorting function
111232 */
111233 constructor(initialIterable, defaultSort) {
111234 super(initialIterable);
111235 /** @private @type {function(T, T): number}} */
111236 this._sortFn = defaultSort;
111237 /** @private @type {function(T, T): number} | null} */
111238 this._lastActiveSortFn = null;
111239 /** @private @type {Map<Function, T[]> | undefined} */
111240 this._cache = undefined;
111241 /** @private @type {Map<Function, T[]|string|number> | undefined} */
111242 this._cacheOrderIndependent = undefined;
111243 }
111244
111245 /**
111246 * @param {T} value value to add to set
111247 * @returns {this} returns itself
111248 */
111249 add(value) {
111250 this._lastActiveSortFn = null;
111251 this._invalidateCache();
111252 this._invalidateOrderedCache();
111253 super.add(value);
111254 return this;
111255 }
111256
111257 /**
111258 * @param {T} value value to delete
111259 * @returns {boolean} true if value existed in set, false otherwise
111260 */
111261 delete(value) {
111262 this._invalidateCache();
111263 this._invalidateOrderedCache();
111264 return super.delete(value);
111265 }
111266
111267 /**
111268 * @returns {void}
111269 */
111270 clear() {
111271 this._invalidateCache();
111272 this._invalidateOrderedCache();
111273 return super.clear();
111274 }
111275
111276 /**
111277 * Sort with a comparer function
111278 * @param {SortFunction} sortFn Sorting comparer function
111279 * @returns {void}
111280 */
111281 sortWith(sortFn) {
111282 if (this.size <= 1 || sortFn === this._lastActiveSortFn) {
111283 // already sorted - nothing to do
111284 return;
111285 }
111286
111287 const sortedArray = Array.from(this).sort(sortFn);
111288 super.clear();
111289 for (let i = 0; i < sortedArray.length; i += 1) {
111290 super.add(sortedArray[i]);
111291 }
111292 this._lastActiveSortFn = sortFn;
111293 this._invalidateCache();
111294 }
111295
111296 sort() {
111297 this.sortWith(this._sortFn);
111298 }
111299
111300 /**
111301 * Get data from cache
111302 * @param {function(SortableSet<T>): T[]} fn function to calculate value
111303 * @returns {T[]} returns result of fn(this), cached until set changes
111304 */
111305 getFromCache(fn) {
111306 if (this._cache === undefined) {
111307 this._cache = new Map();
111308 } else {
111309 const data = this._cache.get(fn);
111310 if (data !== undefined) {
111311 return data;
111312 }
111313 }
111314 const newData = fn(this);
111315 this._cache.set(fn, newData);
111316 return newData;
111317 }
111318
111319 /**
111320 * @param {function(SortableSet<T>): string|number|T[]} fn function to calculate value
111321 * @returns {any} returns result of fn(this), cached until set changes
111322 */
111323 getFromUnorderedCache(fn) {
111324 if (this._cacheOrderIndependent === undefined) {
111325 this._cacheOrderIndependent = new Map();
111326 } else {
111327 const data = this._cacheOrderIndependent.get(fn);
111328 if (data !== undefined) {
111329 return data;
111330 }
111331 }
111332 const newData = fn(this);
111333 this._cacheOrderIndependent.set(fn, newData);
111334 return newData;
111335 }
111336
111337 /**
111338 * @private
111339 * @returns {void}
111340 */
111341 _invalidateCache() {
111342 if (this._cache !== undefined) {
111343 this._cache.clear();
111344 }
111345 }
111346
111347 /**
111348 * @private
111349 * @returns {void}
111350 */
111351 _invalidateOrderedCache() {
111352 if (this._cacheOrderIndependent !== undefined) {
111353 this._cacheOrderIndependent.clear();
111354 }
111355 }
111356}
111357
111358module.exports = SortableSet;
111359
111360
111361/***/ }),
111362
111363/***/ 92251:
111364/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
111365
111366"use strict";
111367/*
111368 MIT License http://www.opensource.org/licenses/mit-license.php
111369 Author Tobias Koppers @sokra
111370*/
111371
111372
111373const util = __webpack_require__(31669);
111374
111375const TOMBSTONE = {};
111376const UNDEFINED_MARKER = {};
111377
111378class StackedSetMap {
111379 constructor(parentStack) {
111380 this.stack = parentStack === undefined ? [] : parentStack.slice();
111381 this.map = new Map();
111382 this.stack.push(this.map);
111383 }
111384
111385 add(item) {
111386 this.map.set(item, true);
111387 }
111388
111389 set(item, value) {
111390 this.map.set(item, value === undefined ? UNDEFINED_MARKER : value);
111391 }
111392
111393 delete(item) {
111394 if (this.stack.length > 1) {
111395 this.map.set(item, TOMBSTONE);
111396 } else {
111397 this.map.delete(item);
111398 }
111399 }
111400
111401 has(item) {
111402 const topValue = this.map.get(item);
111403 if (topValue !== undefined) return topValue !== TOMBSTONE;
111404 if (this.stack.length > 1) {
111405 for (var i = this.stack.length - 2; i >= 0; i--) {
111406 const value = this.stack[i].get(item);
111407 if (value !== undefined) {
111408 this.map.set(item, value);
111409 return value !== TOMBSTONE;
111410 }
111411 }
111412 this.map.set(item, TOMBSTONE);
111413 }
111414 return false;
111415 }
111416
111417 get(item) {
111418 const topValue = this.map.get(item);
111419 if (topValue !== undefined) {
111420 return topValue === TOMBSTONE || topValue === UNDEFINED_MARKER
111421 ? undefined
111422 : topValue;
111423 }
111424 if (this.stack.length > 1) {
111425 for (var i = this.stack.length - 2; i >= 0; i--) {
111426 const value = this.stack[i].get(item);
111427 if (value !== undefined) {
111428 this.map.set(item, value);
111429 return value === TOMBSTONE || value === UNDEFINED_MARKER
111430 ? undefined
111431 : value;
111432 }
111433 }
111434 this.map.set(item, TOMBSTONE);
111435 }
111436 return undefined;
111437 }
111438
111439 _compress() {
111440 if (this.stack.length === 1) return;
111441 this.map = new Map();
111442 for (const data of this.stack) {
111443 for (const pair of data) {
111444 if (pair[1] === TOMBSTONE) {
111445 this.map.delete(pair[0]);
111446 } else {
111447 this.map.set(pair[0], pair[1]);
111448 }
111449 }
111450 }
111451 this.stack = [this.map];
111452 }
111453
111454 asArray() {
111455 this._compress();
111456 return Array.from(this.map.entries(), pair => pair[0]);
111457 }
111458
111459 asSet() {
111460 return new Set(this.asArray());
111461 }
111462
111463 asPairArray() {
111464 this._compress();
111465 return Array.from(this.map.entries(), pair =>
111466 /** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER
111467 ? [pair[0], undefined]
111468 : pair)
111469 );
111470 }
111471
111472 asMap() {
111473 return new Map(this.asPairArray());
111474 }
111475
111476 get size() {
111477 this._compress();
111478 return this.map.size;
111479 }
111480
111481 createChild() {
111482 return new StackedSetMap(this.stack);
111483 }
111484
111485 get length() {
111486 throw new Error("This is no longer an Array");
111487 }
111488
111489 set length(value) {
111490 throw new Error("This is no longer an Array");
111491 }
111492}
111493
111494// TODO remove in webpack 5
111495StackedSetMap.prototype.push = util.deprecate(
111496 /**
111497 * @deprecated
111498 * @this {StackedSetMap}
111499 * @param {any} item Item to add
111500 * @returns {void}
111501 */
111502 function(item) {
111503 this.add(item);
111504 },
111505 "This is no longer an Array: Use add instead."
111506);
111507
111508module.exports = StackedSetMap;
111509
111510
111511/***/ }),
111512
111513/***/ 67916:
111514/***/ (function(__unused_webpack_module, exports) {
111515
111516"use strict";
111517/*
111518 MIT License http://www.opensource.org/licenses/mit-license.php
111519 Author Tobias Koppers @sokra
111520*/
111521
111522
111523
111524const mergeCache = new WeakMap();
111525
111526/**
111527 * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again.
111528 * @example
111529 * // performs cleverMerge(first, second), stores the result in WeakMap and returns result
111530 * cachedCleverMerge({a: 1}, {a: 2})
111531 * {a: 2}
111532 * // when same arguments passed, gets the result from WeakMap and returns it.
111533 * cachedCleverMerge({a: 1}, {a: 2})
111534 * {a: 2}
111535 * @param {object} first first object
111536 * @param {object} second second object
111537 * @returns {object} merged object of first and second object
111538 */
111539const cachedCleverMerge = (first, second) => {
111540 let innerCache = mergeCache.get(first);
111541 if (innerCache === undefined) {
111542 innerCache = new WeakMap();
111543 mergeCache.set(first, innerCache);
111544 }
111545 const prevMerge = innerCache.get(second);
111546 if (prevMerge !== undefined) return prevMerge;
111547 const newMerge = cleverMerge(first, second);
111548 innerCache.set(second, newMerge);
111549 return newMerge;
111550};
111551
111552/**
111553 * Merges two objects. Objects are not deeply merged.
111554 * TODO webpack 5: merge objects deeply clever.
111555 * Arrays might reference the old value with "..."
111556 * @param {object} first first object
111557 * @param {object} second second object
111558 * @returns {object} merged object of first and second object
111559 */
111560const cleverMerge = (first, second) => {
111561 const newObject = Object.assign({}, first);
111562 for (const key of Object.keys(second)) {
111563 if (!(key in newObject)) {
111564 newObject[key] = second[key];
111565 continue;
111566 }
111567 const secondValue = second[key];
111568 if (!Array.isArray(secondValue)) {
111569 newObject[key] = secondValue;
111570 continue;
111571 }
111572 const firstValue = newObject[key];
111573 if (Array.isArray(firstValue)) {
111574 const newArray = [];
111575 for (const item of secondValue) {
111576 if (item === "...") {
111577 for (const item of firstValue) {
111578 newArray.push(item);
111579 }
111580 } else {
111581 newArray.push(item);
111582 }
111583 }
111584 newObject[key] = newArray;
111585 } else {
111586 newObject[key] = secondValue;
111587 }
111588 }
111589 return newObject;
111590};
111591
111592exports.cachedCleverMerge = cachedCleverMerge;
111593exports.cleverMerge = cleverMerge;
111594
111595
111596/***/ }),
111597
111598/***/ 15660:
111599/***/ (function(module, exports, __webpack_require__) {
111600
111601"use strict";
111602/*
111603 MIT License http://www.opensource.org/licenses/mit-license.php
111604 Author Tobias Koppers @sokra
111605*/
111606
111607
111608const AbstractMethodError = __webpack_require__(36104);
111609
111610const BULK_SIZE = 1000;
111611
111612class Hash {
111613 /**
111614 * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
111615 * @param {string|Buffer} data data
111616 * @param {string=} inputEncoding data encoding
111617 * @returns {this} updated hash
111618 */
111619 update(data, inputEncoding) {
111620 throw new AbstractMethodError();
111621 }
111622
111623 /**
111624 * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
111625 * @param {string=} encoding encoding of the return value
111626 * @returns {string|Buffer} digest
111627 */
111628 digest(encoding) {
111629 throw new AbstractMethodError();
111630 }
111631}
111632
111633exports.Hash = Hash;
111634/** @typedef {typeof Hash} HashConstructor */
111635
111636class BulkUpdateDecorator extends Hash {
111637 /**
111638 * @param {Hash} hash hash
111639 */
111640 constructor(hash) {
111641 super();
111642 this.hash = hash;
111643 this.buffer = "";
111644 }
111645
111646 /**
111647 * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
111648 * @param {string|Buffer} data data
111649 * @param {string=} inputEncoding data encoding
111650 * @returns {this} updated hash
111651 */
111652 update(data, inputEncoding) {
111653 if (
111654 inputEncoding !== undefined ||
111655 typeof data !== "string" ||
111656 data.length > BULK_SIZE
111657 ) {
111658 if (this.buffer.length > 0) {
111659 this.hash.update(this.buffer);
111660 this.buffer = "";
111661 }
111662 this.hash.update(data, inputEncoding);
111663 } else {
111664 this.buffer += data;
111665 if (this.buffer.length > BULK_SIZE) {
111666 this.hash.update(this.buffer);
111667 this.buffer = "";
111668 }
111669 }
111670 return this;
111671 }
111672
111673 /**
111674 * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
111675 * @param {string=} encoding encoding of the return value
111676 * @returns {string|Buffer} digest
111677 */
111678 digest(encoding) {
111679 if (this.buffer.length > 0) {
111680 this.hash.update(this.buffer);
111681 }
111682 var digestResult = this.hash.digest(encoding);
111683 return typeof digestResult === "string"
111684 ? digestResult
111685 : digestResult.toString();
111686 }
111687}
111688
111689/**
111690 * istanbul ignore next
111691 */
111692class DebugHash extends Hash {
111693 constructor() {
111694 super();
111695 this.string = "";
111696 }
111697
111698 /**
111699 * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
111700 * @param {string|Buffer} data data
111701 * @param {string=} inputEncoding data encoding
111702 * @returns {this} updated hash
111703 */
111704 update(data, inputEncoding) {
111705 if (typeof data !== "string") data = data.toString("utf-8");
111706 this.string += data;
111707 return this;
111708 }
111709
111710 /**
111711 * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
111712 * @param {string=} encoding encoding of the return value
111713 * @returns {string|Buffer} digest
111714 */
111715 digest(encoding) {
111716 return this.string.replace(/[^a-z0-9]+/gi, m =>
111717 Buffer.from(m).toString("hex")
111718 );
111719 }
111720}
111721
111722/**
111723 * Creates a hash by name or function
111724 * @param {string | HashConstructor} algorithm the algorithm name or a constructor creating a hash
111725 * @returns {Hash} the hash
111726 */
111727module.exports = algorithm => {
111728 if (typeof algorithm === "function") {
111729 return new BulkUpdateDecorator(new algorithm());
111730 }
111731 switch (algorithm) {
111732 // TODO add non-cryptographic algorithm here
111733 case "debug":
111734 return new DebugHash();
111735 default:
111736 return new BulkUpdateDecorator(__webpack_require__(76417).createHash(algorithm));
111737 }
111738};
111739
111740
111741/***/ }),
111742
111743/***/ 30815:
111744/***/ (function(module) {
111745
111746"use strict";
111747
111748
111749// Simulations show these probabilities for a single change
111750// 93.1% that one group is invalidated
111751// 4.8% that two groups are invalidated
111752// 1.1% that 3 groups are invalidated
111753// 0.1% that 4 or more groups are invalidated
111754//
111755// And these for removing/adding 10 lexically adjacent files
111756// 64.5% that one group is invalidated
111757// 24.8% that two groups are invalidated
111758// 7.8% that 3 groups are invalidated
111759// 2.7% that 4 or more groups are invalidated
111760//
111761// And these for removing/adding 3 random files
111762// 0% that one group is invalidated
111763// 3.7% that two groups are invalidated
111764// 80.8% that 3 groups are invalidated
111765// 12.3% that 4 groups are invalidated
111766// 3.2% that 5 or more groups are invalidated
111767
111768/**
111769 *
111770 * @param {string} a key
111771 * @param {string} b key
111772 * @returns {number} the similarity as number
111773 */
111774const similarity = (a, b) => {
111775 const l = Math.min(a.length, b.length);
111776 let dist = 0;
111777 for (let i = 0; i < l; i++) {
111778 const ca = a.charCodeAt(i);
111779 const cb = b.charCodeAt(i);
111780 dist += Math.max(0, 10 - Math.abs(ca - cb));
111781 }
111782 return dist;
111783};
111784
111785/**
111786 * @param {string} a key
111787 * @param {string} b key
111788 * @returns {string} the common part and a single char for the difference
111789 */
111790const getName = (a, b) => {
111791 const l = Math.min(a.length, b.length);
111792 let r = "";
111793 for (let i = 0; i < l; i++) {
111794 const ca = a.charAt(i);
111795 const cb = b.charAt(i);
111796 r += ca;
111797 if (ca === cb) {
111798 continue;
111799 }
111800 return r;
111801 }
111802 return a;
111803};
111804
111805/**
111806 * @template T
111807 */
111808class Node {
111809 /**
111810 * @param {T} item item
111811 * @param {string} key key
111812 * @param {number} size size
111813 */
111814 constructor(item, key, size) {
111815 this.item = item;
111816 this.key = key;
111817 this.size = size;
111818 }
111819}
111820
111821/**
111822 * @template T
111823 */
111824class Group {
111825 /**
111826 * @param {Node<T>[]} nodes nodes
111827 * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1)
111828 */
111829 constructor(nodes, similarities) {
111830 this.nodes = nodes;
111831 this.similarities = similarities;
111832 this.size = nodes.reduce((size, node) => size + node.size, 0);
111833 /** @type {string} */
111834 this.key = undefined;
111835 }
111836}
111837
111838/**
111839 * @template T
111840 * @typedef {Object} GroupedItems<T>
111841 * @property {string} key
111842 * @property {T[]} items
111843 * @property {number} size
111844 */
111845
111846/**
111847 * @template T
111848 * @typedef {Object} Options
111849 * @property {number} maxSize maximum size of a group
111850 * @property {number} minSize minimum size of a group (preferred over maximum size)
111851 * @property {Iterable<T>} items a list of items
111852 * @property {function(T): number} getSize function to get size of an item
111853 * @property {function(T): string} getKey function to get the key of an item
111854 */
111855
111856/**
111857 * @template T
111858 * @param {Options<T>} options options object
111859 * @returns {GroupedItems<T>[]} grouped items
111860 */
111861module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
111862 /** @type {Group<T>[]} */
111863 const result = [];
111864
111865 const nodes = Array.from(
111866 items,
111867 item => new Node(item, getKey(item), getSize(item))
111868 );
111869
111870 /** @type {Node<T>[]} */
111871 const initialNodes = [];
111872
111873 // lexically ordering of keys
111874 nodes.sort((a, b) => {
111875 if (a.key < b.key) return -1;
111876 if (a.key > b.key) return 1;
111877 return 0;
111878 });
111879
111880 // return nodes bigger than maxSize directly as group
111881 for (const node of nodes) {
111882 if (node.size >= maxSize) {
111883 result.push(new Group([node], []));
111884 } else {
111885 initialNodes.push(node);
111886 }
111887 }
111888
111889 if (initialNodes.length > 0) {
111890 // calculate similarities between lexically adjacent nodes
111891 /** @type {number[]} */
111892 const similarities = [];
111893 for (let i = 1; i < initialNodes.length; i++) {
111894 const a = initialNodes[i - 1];
111895 const b = initialNodes[i];
111896 similarities.push(similarity(a.key, b.key));
111897 }
111898
111899 const initialGroup = new Group(initialNodes, similarities);
111900
111901 if (initialGroup.size < minSize) {
111902 // We hit an edgecase where the working set is already smaller than minSize
111903 // We merge it with the smallest result node to keep minSize intact
111904 if (result.length > 0) {
111905 const smallestGroup = result.reduce((min, group) =>
111906 min.size > group.size ? group : min
111907 );
111908 for (const node of initialGroup.nodes) smallestGroup.nodes.push(node);
111909 smallestGroup.nodes.sort((a, b) => {
111910 if (a.key < b.key) return -1;
111911 if (a.key > b.key) return 1;
111912 return 0;
111913 });
111914 } else {
111915 // There are no other nodes
111916 // We use all nodes and have to accept that it's smaller than minSize
111917 result.push(initialGroup);
111918 }
111919 } else {
111920 const queue = [initialGroup];
111921
111922 while (queue.length) {
111923 const group = queue.pop();
111924 // only groups bigger than maxSize need to be splitted
111925 if (group.size < maxSize) {
111926 result.push(group);
111927 continue;
111928 }
111929
111930 // find unsplittable area from left and right
111931 // going minSize from left and right
111932 // at least one node need to be included otherwise we get stuck
111933 let left = 0;
111934 let leftSize = 0;
111935 while (leftSize <= minSize) {
111936 leftSize += group.nodes[left].size;
111937 left++;
111938 }
111939 let right = group.nodes.length - 1;
111940 let rightSize = 0;
111941 while (rightSize <= minSize) {
111942 rightSize += group.nodes[right].size;
111943 right--;
111944 }
111945
111946 if (left - 1 > right) {
111947 // can't split group while holding minSize
111948 // because minSize is preferred of maxSize we return
111949 // the group here even while it's too big
111950 // To avoid this make sure maxSize > minSize * 3
111951 result.push(group);
111952 continue;
111953 }
111954 if (left <= right) {
111955 // when there is a area between left and right
111956 // we look for best split point
111957 // we split at the minimum similarity
111958 // here key space is separated the most
111959 let best = left - 1;
111960 let bestSimilarity = group.similarities[best];
111961 for (let i = left; i <= right; i++) {
111962 const similarity = group.similarities[i];
111963 if (similarity < bestSimilarity) {
111964 best = i;
111965 bestSimilarity = similarity;
111966 }
111967 }
111968 left = best + 1;
111969 right = best;
111970 }
111971
111972 // create two new groups for left and right area
111973 // and queue them up
111974 const rightNodes = [group.nodes[right + 1]];
111975 /** @type {number[]} */
111976 const rightSimilaries = [];
111977 for (let i = right + 2; i < group.nodes.length; i++) {
111978 rightSimilaries.push(group.similarities[i - 1]);
111979 rightNodes.push(group.nodes[i]);
111980 }
111981 queue.push(new Group(rightNodes, rightSimilaries));
111982
111983 const leftNodes = [group.nodes[0]];
111984 /** @type {number[]} */
111985 const leftSimilaries = [];
111986 for (let i = 1; i < left; i++) {
111987 leftSimilaries.push(group.similarities[i - 1]);
111988 leftNodes.push(group.nodes[i]);
111989 }
111990 queue.push(new Group(leftNodes, leftSimilaries));
111991 }
111992 }
111993 }
111994
111995 // lexically ordering
111996 result.sort((a, b) => {
111997 if (a.nodes[0].key < b.nodes[0].key) return -1;
111998 if (a.nodes[0].key > b.nodes[0].key) return 1;
111999 return 0;
112000 });
112001
112002 // give every group a name
112003 for (let i = 0; i < result.length; i++) {
112004 const group = result[i];
112005 const first = group.nodes[0];
112006 const last = group.nodes[group.nodes.length - 1];
112007 let name = getName(first.key, last.key);
112008 group.key = name;
112009 }
112010
112011 // return the results
112012 return result.map(group => {
112013 /** @type {GroupedItems} */
112014 return {
112015 key: group.key,
112016 items: group.nodes.map(node => node.item),
112017 size: group.size
112018 };
112019 });
112020};
112021
112022
112023/***/ }),
112024
112025/***/ 94658:
112026/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
112027
112028"use strict";
112029
112030const path = __webpack_require__(85622);
112031
112032/**
112033 * @param {string} context context for relative path
112034 * @param {string} relativePath path
112035 * @returns {string} absolute path
112036 */
112037const requestToAbsolute = (context, relativePath) => {
112038 if (relativePath.startsWith("./") || relativePath.startsWith("../"))
112039 return path.join(context, relativePath);
112040 return relativePath;
112041};
112042
112043/**
112044 * @typedef {Object} MakeRelativePathsCache
112045 * @property {Map<string, Map<string, string>>=} relativePaths
112046 */
112047
112048/**
112049 *
112050 * @param {string} maybeAbsolutePath path to check
112051 * @returns {boolean} returns true if path is "Absolute Path"-like
112052 */
112053const looksLikeAbsolutePath = maybeAbsolutePath => {
112054 if (/^\/.*\/$/.test(maybeAbsolutePath)) {
112055 // this 'path' is actually a regexp generated by dynamic requires.
112056 // Don't treat it as an absolute path.
112057 return false;
112058 }
112059 return /^(?:[a-z]:\\|\/)/i.test(maybeAbsolutePath);
112060};
112061
112062/**
112063 *
112064 * @param {string} p path to normalize
112065 * @returns {string} normalized version of path
112066 */
112067const normalizePathSeparator = p => p.replace(/\\/g, "/");
112068
112069/**
112070 *
112071 * @param {string} context context for relative path
112072 * @param {string} identifier identifier for path
112073 * @returns {string} a converted relative path
112074 */
112075const _makePathsRelative = (context, identifier) => {
112076 return identifier
112077 .split(/([|! ])/)
112078 .map(str =>
112079 looksLikeAbsolutePath(str)
112080 ? normalizePathSeparator(path.relative(context, str))
112081 : str
112082 )
112083 .join("");
112084};
112085
112086/**
112087 *
112088 * @param {string} context context used to create relative path
112089 * @param {string} identifier identifier used to create relative path
112090 * @param {MakeRelativePathsCache=} cache the cache object being set
112091 * @returns {string} the returned relative path
112092 */
112093exports.makePathsRelative = (context, identifier, cache) => {
112094 if (!cache) return _makePathsRelative(context, identifier);
112095
112096 const relativePaths =
112097 cache.relativePaths || (cache.relativePaths = new Map());
112098
112099 let cachedResult;
112100 let contextCache = relativePaths.get(context);
112101 if (contextCache === undefined) {
112102 relativePaths.set(context, (contextCache = new Map()));
112103 } else {
112104 cachedResult = contextCache.get(identifier);
112105 }
112106
112107 if (cachedResult !== undefined) {
112108 return cachedResult;
112109 } else {
112110 const relativePath = _makePathsRelative(context, identifier);
112111 contextCache.set(identifier, relativePath);
112112 return relativePath;
112113 }
112114};
112115
112116/**
112117 * @param {string} context absolute context path
112118 * @param {string} request any request string may containing absolute paths, query string, etc.
112119 * @returns {string} a new request string avoiding absolute paths when possible
112120 */
112121exports.contextify = (context, request) => {
112122 return request
112123 .split("!")
112124 .map(r => {
112125 const splitPath = r.split("?", 2);
112126 if (/^[a-zA-Z]:\\/.test(splitPath[0])) {
112127 splitPath[0] = path.win32.relative(context, splitPath[0]);
112128 if (!/^[a-zA-Z]:\\/.test(splitPath[0])) {
112129 splitPath[0] = splitPath[0].replace(/\\/g, "/");
112130 }
112131 }
112132 if (/^\//.test(splitPath[0])) {
112133 splitPath[0] = path.posix.relative(context, splitPath[0]);
112134 }
112135 if (!/^(\.\.\/|\/|[a-zA-Z]:\\)/.test(splitPath[0])) {
112136 splitPath[0] = "./" + splitPath[0];
112137 }
112138 return splitPath.join("?");
112139 })
112140 .join("!");
112141};
112142
112143/**
112144 * @param {string} context absolute context path
112145 * @param {string} request any request string
112146 * @returns {string} a new request string using absolute paths when possible
112147 */
112148const _absolutify = (context, request) => {
112149 return request
112150 .split("!")
112151 .map(r => requestToAbsolute(context, r))
112152 .join("!");
112153};
112154
112155exports.absolutify = _absolutify;
112156
112157
112158/***/ }),
112159
112160/***/ 1111:
112161/***/ (function(module) {
112162
112163/**
112164 * convert an object into its 2D array equivalent to be turned
112165 * into an ES6 map
112166 *
112167 * @param {object} obj any object type that works with Object.keys()
112168 * @returns {Map<TODO, TODO>} an ES6 Map of KV pairs
112169 */
112170module.exports = function objectToMap(obj) {
112171 return new Map(
112172 Object.keys(obj).map(key => {
112173 /** @type {[string, string]} */
112174 const pair = [key, obj[key]];
112175 return pair;
112176 })
112177 );
112178};
112179
112180
112181/***/ }),
112182
112183/***/ 68935:
112184/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
112185
112186"use strict";
112187/*
112188 MIT License http://www.opensource.org/licenses/mit-license.php
112189 Author Gajus Kuizinas @gajus
112190*/
112191
112192
112193const Ajv = __webpack_require__(21414);
112194const ajv = new Ajv({
112195 errorDataPath: "configuration",
112196 allErrors: true,
112197 verbose: true
112198});
112199__webpack_require__(82133)(ajv, ["instanceof"]);
112200__webpack_require__(51613)(ajv);
112201
112202const validateSchema = (schema, options) => {
112203 if (Array.isArray(options)) {
112204 const errors = options.map(options => validateObject(schema, options));
112205 errors.forEach((list, idx) => {
112206 const applyPrefix = err => {
112207 err.dataPath = `[${idx}]${err.dataPath}`;
112208 if (err.children) {
112209 err.children.forEach(applyPrefix);
112210 }
112211 };
112212 list.forEach(applyPrefix);
112213 });
112214 return errors.reduce((arr, items) => {
112215 return arr.concat(items);
112216 }, []);
112217 } else {
112218 return validateObject(schema, options);
112219 }
112220};
112221
112222const validateObject = (schema, options) => {
112223 const validate = ajv.compile(schema);
112224 const valid = validate(options);
112225 return valid ? [] : filterErrors(validate.errors);
112226};
112227
112228const filterErrors = errors => {
112229 let newErrors = [];
112230 for (const err of errors) {
112231 const dataPath = err.dataPath;
112232 let children = [];
112233 newErrors = newErrors.filter(oldError => {
112234 if (oldError.dataPath.includes(dataPath)) {
112235 if (oldError.children) {
112236 children = children.concat(oldError.children.slice(0));
112237 }
112238 oldError.children = undefined;
112239 children.push(oldError);
112240 return false;
112241 }
112242 return true;
112243 });
112244 if (children.length) {
112245 err.children = children;
112246 }
112247 newErrors.push(err);
112248 }
112249
112250 return newErrors;
112251};
112252
112253module.exports = validateSchema;
112254
112255
112256/***/ }),
112257
112258/***/ 43101:
112259/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
112260
112261"use strict";
112262/*
112263 MIT License http://www.opensource.org/licenses/mit-license.php
112264*/
112265
112266
112267const WebpackError = __webpack_require__(97391);
112268
112269module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError {
112270 /** @param {string} message Error message */
112271 constructor(message) {
112272 super(message);
112273 this.name = "UnsupportedWebAssemblyFeatureError";
112274 this.hideStack = true;
112275
112276 Error.captureStackTrace(this, this.constructor);
112277 }
112278};
112279
112280
112281/***/ }),
112282
112283/***/ 10557:
112284/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
112285
112286"use strict";
112287/*
112288 MIT License http://www.opensource.org/licenses/mit-license.php
112289 Author Tobias Koppers @sokra
112290 */
112291
112292
112293const UnsupportedWebAssemblyFeatureError = __webpack_require__(43101);
112294
112295class WasmFinalizeExportsPlugin {
112296 apply(compiler) {
112297 compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => {
112298 compilation.hooks.finishModules.tap(
112299 "WasmFinalizeExportsPlugin",
112300 modules => {
112301 for (const module of modules) {
112302 // 1. if a WebAssembly module
112303 if (module.type.startsWith("webassembly") === true) {
112304 const jsIncompatibleExports =
112305 module.buildMeta.jsIncompatibleExports;
112306
112307 if (jsIncompatibleExports === undefined) {
112308 continue;
112309 }
112310
112311 for (const reason of module.reasons) {
112312 // 2. is referenced by a non-WebAssembly module
112313 if (reason.module.type.startsWith("webassembly") === false) {
112314 const ref = compilation.getDependencyReference(
112315 reason.module,
112316 reason.dependency
112317 );
112318
112319 if (!ref) continue;
112320
112321 const importedNames = ref.importedNames;
112322
112323 if (Array.isArray(importedNames)) {
112324 importedNames.forEach(name => {
112325 // 3. and uses a func with an incompatible JS signature
112326 if (
112327 Object.prototype.hasOwnProperty.call(
112328 jsIncompatibleExports,
112329 name
112330 )
112331 ) {
112332 // 4. error
112333 /** @type {any} */
112334 const error = new UnsupportedWebAssemblyFeatureError(
112335 `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies`
112336 );
112337 error.module = module;
112338 error.origin = reason.module;
112339 error.originLoc = reason.dependency.loc;
112340 error.dependencies = [reason.dependency];
112341 compilation.errors.push(error);
112342 }
112343 });
112344 }
112345 }
112346 }
112347 }
112348 }
112349 }
112350 );
112351 });
112352 }
112353}
112354
112355module.exports = WasmFinalizeExportsPlugin;
112356
112357
112358/***/ }),
112359
112360/***/ 65331:
112361/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
112362
112363"use strict";
112364/*
112365 MIT License http://www.opensource.org/licenses/mit-license.php
112366 Author Tobias Koppers @sokra
112367*/
112368
112369
112370const Template = __webpack_require__(96066);
112371const WebAssemblyUtils = __webpack_require__(52136);
112372
112373/** @typedef {import("../Module")} Module */
112374/** @typedef {import("../MainTemplate")} MainTemplate */
112375
112376// Get all wasm modules
112377const getAllWasmModules = chunk => {
112378 const wasmModules = chunk.getAllAsyncChunks();
112379 const array = [];
112380 for (const chunk of wasmModules) {
112381 for (const m of chunk.modulesIterable) {
112382 if (m.type.startsWith("webassembly")) {
112383 array.push(m);
112384 }
112385 }
112386 }
112387
112388 return array;
112389};
112390
112391/**
112392 * generates the import object function for a module
112393 * @param {Module} module the module
112394 * @param {boolean} mangle mangle imports
112395 * @returns {string} source code
112396 */
112397const generateImportObject = (module, mangle) => {
112398 const waitForInstances = new Map();
112399 const properties = [];
112400 const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies(
112401 module,
112402 mangle
112403 );
112404 for (const usedDep of usedWasmDependencies) {
112405 const dep = usedDep.dependency;
112406 const importedModule = dep.module;
112407 const exportName = dep.name;
112408 const usedName = importedModule && importedModule.isUsed(exportName);
112409 const description = dep.description;
112410 const direct = dep.onlyDirectImport;
112411
112412 const module = usedDep.module;
112413 const name = usedDep.name;
112414
112415 if (direct) {
112416 const instanceVar = `m${waitForInstances.size}`;
112417 waitForInstances.set(instanceVar, importedModule.id);
112418 properties.push({
112419 module,
112420 name,
112421 value: `${instanceVar}[${JSON.stringify(usedName)}]`
112422 });
112423 } else {
112424 const params = description.signature.params.map(
112425 (param, k) => "p" + k + param.valtype
112426 );
112427
112428 const mod = `installedModules[${JSON.stringify(importedModule.id)}]`;
112429 const func = `${mod}.exports[${JSON.stringify(usedName)}]`;
112430
112431 properties.push({
112432 module,
112433 name,
112434 value: Template.asString([
112435 (importedModule.type.startsWith("webassembly")
112436 ? `${mod} ? ${func} : `
112437 : "") + `function(${params}) {`,
112438 Template.indent([`return ${func}(${params});`]),
112439 "}"
112440 ])
112441 });
112442 }
112443 }
112444
112445 let importObject;
112446 if (mangle) {
112447 importObject = [
112448 "return {",
112449 Template.indent([
112450 properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
112451 ]),
112452 "};"
112453 ];
112454 } else {
112455 const propertiesByModule = new Map();
112456 for (const p of properties) {
112457 let list = propertiesByModule.get(p.module);
112458 if (list === undefined) {
112459 propertiesByModule.set(p.module, (list = []));
112460 }
112461 list.push(p);
112462 }
112463 importObject = [
112464 "return {",
112465 Template.indent([
112466 Array.from(propertiesByModule, ([module, list]) => {
112467 return Template.asString([
112468 `${JSON.stringify(module)}: {`,
112469 Template.indent([
112470 list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
112471 ]),
112472 "}"
112473 ]);
112474 }).join(",\n")
112475 ]),
112476 "};"
112477 ];
112478 }
112479
112480 if (waitForInstances.size === 1) {
112481 const moduleId = Array.from(waitForInstances.values())[0];
112482 const promise = `installedWasmModules[${JSON.stringify(moduleId)}]`;
112483 const variable = Array.from(waitForInstances.keys())[0];
112484 return Template.asString([
112485 `${JSON.stringify(module.id)}: function() {`,
112486 Template.indent([
112487 `return promiseResolve().then(function() { return ${promise}; }).then(function(${variable}) {`,
112488 Template.indent(importObject),
112489 "});"
112490 ]),
112491 "},"
112492 ]);
112493 } else if (waitForInstances.size > 0) {
112494 const promises = Array.from(
112495 waitForInstances.values(),
112496 id => `installedWasmModules[${JSON.stringify(id)}]`
112497 ).join(", ");
112498 const variables = Array.from(
112499 waitForInstances.keys(),
112500 (name, i) => `${name} = array[${i}]`
112501 ).join(", ");
112502 return Template.asString([
112503 `${JSON.stringify(module.id)}: function() {`,
112504 Template.indent([
112505 `return promiseResolve().then(function() { return Promise.all([${promises}]); }).then(function(array) {`,
112506 Template.indent([`var ${variables};`, ...importObject]),
112507 "});"
112508 ]),
112509 "},"
112510 ]);
112511 } else {
112512 return Template.asString([
112513 `${JSON.stringify(module.id)}: function() {`,
112514 Template.indent(importObject),
112515 "},"
112516 ]);
112517 }
112518};
112519
112520class WasmMainTemplatePlugin {
112521 constructor({ generateLoadBinaryCode, supportsStreaming, mangleImports }) {
112522 this.generateLoadBinaryCode = generateLoadBinaryCode;
112523 this.supportsStreaming = supportsStreaming;
112524 this.mangleImports = mangleImports;
112525 }
112526
112527 /**
112528 * @param {MainTemplate} mainTemplate main template
112529 * @returns {void}
112530 */
112531 apply(mainTemplate) {
112532 mainTemplate.hooks.localVars.tap(
112533 "WasmMainTemplatePlugin",
112534 (source, chunk) => {
112535 const wasmModules = getAllWasmModules(chunk);
112536 if (wasmModules.length === 0) return source;
112537 const importObjects = wasmModules.map(module => {
112538 return generateImportObject(module, this.mangleImports);
112539 });
112540 return Template.asString([
112541 source,
112542 "",
112543 "// object to store loaded and loading wasm modules",
112544 "var installedWasmModules = {};",
112545 "",
112546 // This function is used to delay reading the installed wasm module promises
112547 // by a microtask. Sorting them doesn't help because there are egdecases where
112548 // sorting is not possible (modules splitted into different chunks).
112549 // So we not even trying and solve this by a microtask delay.
112550 "function promiseResolve() { return Promise.resolve(); }",
112551 "",
112552 "var wasmImportObjects = {",
112553 Template.indent(importObjects),
112554 "};"
112555 ]);
112556 }
112557 );
112558 mainTemplate.hooks.requireEnsure.tap(
112559 "WasmMainTemplatePlugin",
112560 (source, chunk, hash) => {
112561 const webassemblyModuleFilename =
112562 mainTemplate.outputOptions.webassemblyModuleFilename;
112563
112564 const chunkModuleMaps = chunk.getChunkModuleMaps(m =>
112565 m.type.startsWith("webassembly")
112566 );
112567 if (Object.keys(chunkModuleMaps.id).length === 0) return source;
112568 const wasmModuleSrcPath = mainTemplate.getAssetPath(
112569 JSON.stringify(webassemblyModuleFilename),
112570 {
112571 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
112572 hashWithLength: length =>
112573 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
112574 module: {
112575 id: '" + wasmModuleId + "',
112576 hash: `" + ${JSON.stringify(
112577 chunkModuleMaps.hash
112578 )}[wasmModuleId] + "`,
112579 hashWithLength(length) {
112580 const shortChunkHashMap = Object.create(null);
112581 for (const wasmModuleId of Object.keys(chunkModuleMaps.hash)) {
112582 if (typeof chunkModuleMaps.hash[wasmModuleId] === "string") {
112583 shortChunkHashMap[wasmModuleId] = chunkModuleMaps.hash[
112584 wasmModuleId
112585 ].substr(0, length);
112586 }
112587 }
112588 return `" + ${JSON.stringify(
112589 shortChunkHashMap
112590 )}[wasmModuleId] + "`;
112591 }
112592 }
112593 }
112594 );
112595 const createImportObject = content =>
112596 this.mangleImports
112597 ? `{ ${JSON.stringify(
112598 WebAssemblyUtils.MANGLED_MODULE
112599 )}: ${content} }`
112600 : content;
112601 return Template.asString([
112602 source,
112603 "",
112604 "// Fetch + compile chunk loading for webassembly",
112605 "",
112606 `var wasmModules = ${JSON.stringify(
112607 chunkModuleMaps.id
112608 )}[chunkId] || [];`,
112609 "",
112610 "wasmModules.forEach(function(wasmModuleId) {",
112611 Template.indent([
112612 "var installedWasmModuleData = installedWasmModules[wasmModuleId];",
112613 "",
112614 '// a Promise means "currently loading" or "already loaded".',
112615 "if(installedWasmModuleData)",
112616 Template.indent(["promises.push(installedWasmModuleData);"]),
112617 "else {",
112618 Template.indent([
112619 `var importObject = wasmImportObjects[wasmModuleId]();`,
112620 `var req = ${this.generateLoadBinaryCode(wasmModuleSrcPath)};`,
112621 "var promise;",
112622 this.supportsStreaming
112623 ? Template.asString([
112624 "if(importObject instanceof Promise && typeof WebAssembly.compileStreaming === 'function') {",
112625 Template.indent([
112626 "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {",
112627 Template.indent([
112628 `return WebAssembly.instantiate(items[0], ${createImportObject(
112629 "items[1]"
112630 )});`
112631 ]),
112632 "});"
112633 ]),
112634 "} else if(typeof WebAssembly.instantiateStreaming === 'function') {",
112635 Template.indent([
112636 `promise = WebAssembly.instantiateStreaming(req, ${createImportObject(
112637 "importObject"
112638 )});`
112639 ])
112640 ])
112641 : Template.asString([
112642 "if(importObject instanceof Promise) {",
112643 Template.indent([
112644 "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });",
112645 "promise = Promise.all([",
112646 Template.indent([
112647 "bytesPromise.then(function(bytes) { return WebAssembly.compile(bytes); }),",
112648 "importObject"
112649 ]),
112650 "]).then(function(items) {",
112651 Template.indent([
112652 `return WebAssembly.instantiate(items[0], ${createImportObject(
112653 "items[1]"
112654 )});`
112655 ]),
112656 "});"
112657 ])
112658 ]),
112659 "} else {",
112660 Template.indent([
112661 "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });",
112662 "promise = bytesPromise.then(function(bytes) {",
112663 Template.indent([
112664 `return WebAssembly.instantiate(bytes, ${createImportObject(
112665 "importObject"
112666 )});`
112667 ]),
112668 "});"
112669 ]),
112670 "}",
112671 "promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) {",
112672 Template.indent([
112673 `return ${mainTemplate.requireFn}.w[wasmModuleId] = (res.instance || res).exports;`
112674 ]),
112675 "}));"
112676 ]),
112677 "}"
112678 ]),
112679 "});"
112680 ]);
112681 }
112682 );
112683 mainTemplate.hooks.requireExtensions.tap(
112684 "WasmMainTemplatePlugin",
112685 (source, chunk) => {
112686 if (!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) {
112687 return source;
112688 }
112689 return Template.asString([
112690 source,
112691 "",
112692 "// object with all WebAssembly.instance exports",
112693 `${mainTemplate.requireFn}.w = {};`
112694 ]);
112695 }
112696 );
112697 mainTemplate.hooks.hash.tap("WasmMainTemplatePlugin", hash => {
112698 hash.update("WasmMainTemplatePlugin");
112699 hash.update("2");
112700 });
112701 }
112702}
112703
112704module.exports = WasmMainTemplatePlugin;
112705
112706
112707/***/ }),
112708
112709/***/ 13099:
112710/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
112711
112712"use strict";
112713/*
112714 MIT License http://www.opensource.org/licenses/mit-license.php
112715 Author Tobias Koppers @sokra
112716*/
112717
112718
112719const Generator = __webpack_require__(39172);
112720const Template = __webpack_require__(96066);
112721const WebAssemblyUtils = __webpack_require__(52136);
112722const { RawSource } = __webpack_require__(53665);
112723
112724const { editWithAST, addWithAST } = __webpack_require__(65584);
112725const { decode } = __webpack_require__(27352);
112726const t = __webpack_require__(81875);
112727const {
112728 moduleContextFromModuleAST
112729} = __webpack_require__(71234);
112730
112731const WebAssemblyExportImportedDependency = __webpack_require__(18925);
112732
112733/** @typedef {import("../Module")} Module */
112734/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */
112735/** @typedef {import("../NormalModule")} NormalModule */
112736/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
112737/** @typedef {import("webpack-sources").Source} Source */
112738/** @typedef {import("../Dependency").DependencyTemplate} DependencyTemplate */
112739
112740/**
112741 * @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform
112742 */
112743
112744/**
112745 * @template T
112746 * @param {Function[]} fns transforms
112747 * @returns {Function} composed transform
112748 */
112749const compose = (...fns) => {
112750 return fns.reduce(
112751 (prevFn, nextFn) => {
112752 return value => nextFn(prevFn(value));
112753 },
112754 value => value
112755 );
112756};
112757
112758// TODO replace with @callback
112759
112760/**
112761 * Removes the start instruction
112762 *
112763 * @param {Object} state unused state
112764 * @returns {ArrayBufferTransform} transform
112765 */
112766const removeStartFunc = state => bin => {
112767 return editWithAST(state.ast, bin, {
112768 Start(path) {
112769 path.remove();
112770 }
112771 });
112772};
112773
112774/**
112775 * Get imported globals
112776 *
112777 * @param {Object} ast Module's AST
112778 * @returns {Array<t.ModuleImport>} - nodes
112779 */
112780const getImportedGlobals = ast => {
112781 const importedGlobals = [];
112782
112783 t.traverse(ast, {
112784 ModuleImport({ node }) {
112785 if (t.isGlobalType(node.descr)) {
112786 importedGlobals.push(node);
112787 }
112788 }
112789 });
112790
112791 return importedGlobals;
112792};
112793
112794/**
112795 * Get the count for imported func
112796 *
112797 * @param {Object} ast Module's AST
112798 * @returns {Number} - count
112799 */
112800const getCountImportedFunc = ast => {
112801 let count = 0;
112802
112803 t.traverse(ast, {
112804 ModuleImport({ node }) {
112805 if (t.isFuncImportDescr(node.descr)) {
112806 count++;
112807 }
112808 }
112809 });
112810
112811 return count;
112812};
112813
112814/**
112815 * Get next type index
112816 *
112817 * @param {Object} ast Module's AST
112818 * @returns {t.Index} - index
112819 */
112820const getNextTypeIndex = ast => {
112821 const typeSectionMetadata = t.getSectionMetadata(ast, "type");
112822
112823 if (typeSectionMetadata === undefined) {
112824 return t.indexLiteral(0);
112825 }
112826
112827 return t.indexLiteral(typeSectionMetadata.vectorOfSize.value);
112828};
112829
112830/**
112831 * Get next func index
112832 *
112833 * The Func section metadata provide informations for implemented funcs
112834 * in order to have the correct index we shift the index by number of external
112835 * functions.
112836 *
112837 * @param {Object} ast Module's AST
112838 * @param {Number} countImportedFunc number of imported funcs
112839 * @returns {t.Index} - index
112840 */
112841const getNextFuncIndex = (ast, countImportedFunc) => {
112842 const funcSectionMetadata = t.getSectionMetadata(ast, "func");
112843
112844 if (funcSectionMetadata === undefined) {
112845 return t.indexLiteral(0 + countImportedFunc);
112846 }
112847
112848 const vectorOfSize = funcSectionMetadata.vectorOfSize.value;
112849
112850 return t.indexLiteral(vectorOfSize + countImportedFunc);
112851};
112852
112853/**
112854 * Creates an init instruction for a global type
112855 * @param {t.GlobalType} globalType the global type
112856 * @returns {t.Instruction} init expression
112857 */
112858const createDefaultInitForGlobal = globalType => {
112859 if (globalType.valtype[0] === "i") {
112860 // create NumberLiteral global initializer
112861 return t.objectInstruction("const", globalType.valtype, [
112862 t.numberLiteralFromRaw(66)
112863 ]);
112864 } else if (globalType.valtype[0] === "f") {
112865 // create FloatLiteral global initializer
112866 return t.objectInstruction("const", globalType.valtype, [
112867 t.floatLiteral(66, false, false, "66")
112868 ]);
112869 } else {
112870 throw new Error("unknown type: " + globalType.valtype);
112871 }
112872};
112873
112874/**
112875 * Rewrite the import globals:
112876 * - removes the ModuleImport instruction
112877 * - injects at the same offset a mutable global of the same type
112878 *
112879 * Since the imported globals are before the other global declarations, our
112880 * indices will be preserved.
112881 *
112882 * Note that globals will become mutable.
112883 *
112884 * @param {Object} state unused state
112885 * @returns {ArrayBufferTransform} transform
112886 */
112887const rewriteImportedGlobals = state => bin => {
112888 const additionalInitCode = state.additionalInitCode;
112889 const newGlobals = [];
112890
112891 bin = editWithAST(state.ast, bin, {
112892 ModuleImport(path) {
112893 if (t.isGlobalType(path.node.descr)) {
112894 const globalType = path.node.descr;
112895
112896 globalType.mutability = "var";
112897
112898 const init = [
112899 createDefaultInitForGlobal(globalType),
112900 t.instruction("end")
112901 ];
112902
112903 newGlobals.push(t.global(globalType, init));
112904
112905 path.remove();
112906 }
112907 },
112908
112909 // in order to preserve non-imported global's order we need to re-inject
112910 // those as well
112911 Global(path) {
112912 const { node } = path;
112913 const [init] = node.init;
112914
112915 if (init.id === "get_global") {
112916 node.globalType.mutability = "var";
112917
112918 const initialGlobalidx = init.args[0];
112919
112920 node.init = [
112921 createDefaultInitForGlobal(node.globalType),
112922 t.instruction("end")
112923 ];
112924
112925 additionalInitCode.push(
112926 /**
112927 * get_global in global initializer only works for imported globals.
112928 * They have the same indices as the init params, so use the
112929 * same index.
112930 */
112931 t.instruction("get_local", [initialGlobalidx]),
112932 t.instruction("set_global", [t.indexLiteral(newGlobals.length)])
112933 );
112934 }
112935
112936 newGlobals.push(node);
112937
112938 path.remove();
112939 }
112940 });
112941
112942 // Add global declaration instructions
112943 return addWithAST(state.ast, bin, newGlobals);
112944};
112945
112946/**
112947 * Rewrite the export names
112948 * @param {Object} state state
112949 * @param {Object} state.ast Module's ast
112950 * @param {Module} state.module Module
112951 * @param {Set<string>} state.externalExports Module
112952 * @returns {ArrayBufferTransform} transform
112953 */
112954const rewriteExportNames = ({ ast, module, externalExports }) => bin => {
112955 return editWithAST(ast, bin, {
112956 ModuleExport(path) {
112957 const isExternal = externalExports.has(path.node.name);
112958 if (isExternal) {
112959 path.remove();
112960 return;
112961 }
112962 const usedName = module.isUsed(path.node.name);
112963 if (!usedName) {
112964 path.remove();
112965 return;
112966 }
112967 path.node.name = usedName;
112968 }
112969 });
112970};
112971
112972/**
112973 * Mangle import names and modules
112974 * @param {Object} state state
112975 * @param {Object} state.ast Module's ast
112976 * @param {Map<string, UsedWasmDependency>} state.usedDependencyMap mappings to mangle names
112977 * @returns {ArrayBufferTransform} transform
112978 */
112979const rewriteImports = ({ ast, usedDependencyMap }) => bin => {
112980 return editWithAST(ast, bin, {
112981 ModuleImport(path) {
112982 const result = usedDependencyMap.get(
112983 path.node.module + ":" + path.node.name
112984 );
112985
112986 if (result !== undefined) {
112987 path.node.module = result.module;
112988 path.node.name = result.name;
112989 }
112990 }
112991 });
112992};
112993
112994/**
112995 * Add an init function.
112996 *
112997 * The init function fills the globals given input arguments.
112998 *
112999 * @param {Object} state transformation state
113000 * @param {Object} state.ast Module's ast
113001 * @param {t.Identifier} state.initFuncId identifier of the init function
113002 * @param {t.Index} state.startAtFuncOffset index of the start function
113003 * @param {t.ModuleImport[]} state.importedGlobals list of imported globals
113004 * @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function
113005 * @param {t.Index} state.nextFuncIndex index of the next function
113006 * @param {t.Index} state.nextTypeIndex index of the next type
113007 * @returns {ArrayBufferTransform} transform
113008 */
113009const addInitFunction = ({
113010 ast,
113011 initFuncId,
113012 startAtFuncOffset,
113013 importedGlobals,
113014 additionalInitCode,
113015 nextFuncIndex,
113016 nextTypeIndex
113017}) => bin => {
113018 const funcParams = importedGlobals.map(importedGlobal => {
113019 // used for debugging
113020 const id = t.identifier(`${importedGlobal.module}.${importedGlobal.name}`);
113021
113022 return t.funcParam(importedGlobal.descr.valtype, id);
113023 });
113024
113025 const funcBody = importedGlobals.reduce((acc, importedGlobal, index) => {
113026 const args = [t.indexLiteral(index)];
113027 const body = [
113028 t.instruction("get_local", args),
113029 t.instruction("set_global", args)
113030 ];
113031
113032 return [...acc, ...body];
113033 }, []);
113034
113035 if (typeof startAtFuncOffset === "number") {
113036 funcBody.push(t.callInstruction(t.numberLiteralFromRaw(startAtFuncOffset)));
113037 }
113038
113039 for (const instr of additionalInitCode) {
113040 funcBody.push(instr);
113041 }
113042
113043 funcBody.push(t.instruction("end"));
113044
113045 const funcResults = [];
113046
113047 // Code section
113048 const funcSignature = t.signature(funcParams, funcResults);
113049 const func = t.func(initFuncId, funcSignature, funcBody);
113050
113051 // Type section
113052 const functype = t.typeInstruction(undefined, funcSignature);
113053
113054 // Func section
113055 const funcindex = t.indexInFuncSection(nextTypeIndex);
113056
113057 // Export section
113058 const moduleExport = t.moduleExport(
113059 initFuncId.value,
113060 t.moduleExportDescr("Func", nextFuncIndex)
113061 );
113062
113063 return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]);
113064};
113065
113066/**
113067 * Extract mangle mappings from module
113068 * @param {Module} module current module
113069 * @param {boolean} mangle mangle imports
113070 * @returns {Map<string, UsedWasmDependency>} mappings to mangled names
113071 */
113072const getUsedDependencyMap = (module, mangle) => {
113073 /** @type {Map<string, UsedWasmDependency>} */
113074 const map = new Map();
113075 for (const usedDep of WebAssemblyUtils.getUsedDependencies(module, mangle)) {
113076 const dep = usedDep.dependency;
113077 const request = dep.request;
113078 const exportName = dep.name;
113079 map.set(request + ":" + exportName, usedDep);
113080 }
113081 return map;
113082};
113083
113084class WebAssemblyGenerator extends Generator {
113085 constructor(options) {
113086 super();
113087 this.options = options;
113088 }
113089
113090 /**
113091 * @param {NormalModule} module module for which the code should be generated
113092 * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
113093 * @param {RuntimeTemplate} runtimeTemplate the runtime template
113094 * @param {string} type which kind of code should be generated
113095 * @returns {Source} generated code
113096 */
113097 generate(module, dependencyTemplates, runtimeTemplate, type) {
113098 let bin = module.originalSource().source();
113099
113100 const initFuncId = t.identifier(
113101 Array.isArray(module.usedExports)
113102 ? Template.numberToIdentifer(module.usedExports.length)
113103 : "__webpack_init__"
113104 );
113105
113106 // parse it
113107 const ast = decode(bin, {
113108 ignoreDataSection: true,
113109 ignoreCodeSection: true,
113110 ignoreCustomNameSection: true
113111 });
113112
113113 const moduleContext = moduleContextFromModuleAST(ast.body[0]);
113114
113115 const importedGlobals = getImportedGlobals(ast);
113116 const countImportedFunc = getCountImportedFunc(ast);
113117 const startAtFuncOffset = moduleContext.getStart();
113118 const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc);
113119 const nextTypeIndex = getNextTypeIndex(ast);
113120
113121 const usedDependencyMap = getUsedDependencyMap(
113122 module,
113123 this.options.mangleImports
113124 );
113125 const externalExports = new Set(
113126 module.dependencies
113127 .filter(d => d instanceof WebAssemblyExportImportedDependency)
113128 .map(d => {
113129 const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ (d);
113130 return wasmDep.exportName;
113131 })
113132 );
113133
113134 /** @type {t.Instruction[]} */
113135 const additionalInitCode = [];
113136
113137 const transform = compose(
113138 rewriteExportNames({
113139 ast,
113140 module,
113141 externalExports
113142 }),
113143
113144 removeStartFunc({ ast }),
113145
113146 rewriteImportedGlobals({ ast, additionalInitCode }),
113147
113148 rewriteImports({
113149 ast,
113150 usedDependencyMap
113151 }),
113152
113153 addInitFunction({
113154 ast,
113155 initFuncId,
113156 importedGlobals,
113157 additionalInitCode,
113158 startAtFuncOffset,
113159 nextFuncIndex,
113160 nextTypeIndex
113161 })
113162 );
113163
113164 const newBin = transform(bin);
113165
113166 return new RawSource(newBin);
113167 }
113168}
113169
113170module.exports = WebAssemblyGenerator;
113171
113172
113173/***/ }),
113174
113175/***/ 45283:
113176/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113177
113178"use strict";
113179/*
113180 MIT License http://www.opensource.org/licenses/mit-license.php
113181*/
113182
113183
113184const WebpackError = __webpack_require__(97391);
113185
113186/** @typedef {import("../Module")} Module */
113187/** @typedef {import("../RequestShortener")} RequestShortener */
113188
113189/**
113190 * @param {Module} module module to get chains from
113191 * @param {RequestShortener} requestShortener to make readable identifiers
113192 * @returns {string[]} all chains to the module
113193 */
113194const getInitialModuleChains = (module, requestShortener) => {
113195 const queue = [
113196 { head: module, message: module.readableIdentifier(requestShortener) }
113197 ];
113198 /** @type {Set<string>} */
113199 const results = new Set();
113200 /** @type {Set<string>} */
113201 const incompleteResults = new Set();
113202 /** @type {Set<Module>} */
113203 const visitedModules = new Set();
113204
113205 for (const chain of queue) {
113206 const { head, message } = chain;
113207 let final = true;
113208 /** @type {Set<Module>} */
113209 const alreadyReferencedModules = new Set();
113210 for (const reason of head.reasons) {
113211 const newHead = reason.module;
113212 if (newHead) {
113213 if (!newHead.getChunks().some(c => c.canBeInitial())) continue;
113214 final = false;
113215 if (alreadyReferencedModules.has(newHead)) continue;
113216 alreadyReferencedModules.add(newHead);
113217 const moduleName = newHead.readableIdentifier(requestShortener);
113218 const detail = reason.explanation ? ` (${reason.explanation})` : "";
113219 const newMessage = `${moduleName}${detail} --> ${message}`;
113220 if (visitedModules.has(newHead)) {
113221 incompleteResults.add(`... --> ${newMessage}`);
113222 continue;
113223 }
113224 visitedModules.add(newHead);
113225 queue.push({
113226 head: newHead,
113227 message: newMessage
113228 });
113229 } else {
113230 final = false;
113231 const newMessage = reason.explanation
113232 ? `(${reason.explanation}) --> ${message}`
113233 : message;
113234 results.add(newMessage);
113235 }
113236 }
113237 if (final) {
113238 results.add(message);
113239 }
113240 }
113241 for (const result of incompleteResults) {
113242 results.add(result);
113243 }
113244 return Array.from(results);
113245};
113246
113247module.exports = class WebAssemblyInInitialChunkError extends WebpackError {
113248 /**
113249 * @param {Module} module WASM module
113250 * @param {RequestShortener} requestShortener request shortener
113251 */
113252 constructor(module, requestShortener) {
113253 const moduleChains = getInitialModuleChains(module, requestShortener);
113254 const message = `WebAssembly module is included in initial chunk.
113255This is not allowed, because WebAssembly download and compilation must happen asynchronous.
113256Add an async splitpoint (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
113257${moduleChains.map(s => `* ${s}`).join("\n")}`;
113258
113259 super(message);
113260 this.name = "WebAssemblyInInitialChunkError";
113261 this.hideStack = true;
113262 this.module = module;
113263
113264 Error.captureStackTrace(this, this.constructor);
113265 }
113266};
113267
113268
113269/***/ }),
113270
113271/***/ 13411:
113272/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113273
113274"use strict";
113275/*
113276 MIT License http://www.opensource.org/licenses/mit-license.php
113277 Author Tobias Koppers @sokra
113278*/
113279
113280
113281const Generator = __webpack_require__(39172);
113282const Template = __webpack_require__(96066);
113283const { RawSource } = __webpack_require__(53665);
113284const WebAssemblyImportDependency = __webpack_require__(52959);
113285const WebAssemblyExportImportedDependency = __webpack_require__(18925);
113286
113287/** @typedef {import("../NormalModule")} NormalModule */
113288/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
113289/** @typedef {import("webpack-sources").Source} Source */
113290/** @typedef {import("../Dependency").DependencyTemplate} DependencyTemplate */
113291
113292class WebAssemblyJavascriptGenerator extends Generator {
113293 /**
113294 * @param {NormalModule} module module for which the code should be generated
113295 * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
113296 * @param {RuntimeTemplate} runtimeTemplate the runtime template
113297 * @param {string} type which kind of code should be generated
113298 * @returns {Source} generated code
113299 */
113300 generate(module, dependencyTemplates, runtimeTemplate, type) {
113301 const initIdentifer = Array.isArray(module.usedExports)
113302 ? Template.numberToIdentifer(module.usedExports.length)
113303 : "__webpack_init__";
113304
113305 let needExportsCopy = false;
113306 const importedModules = new Map();
113307 const initParams = [];
113308 let index = 0;
113309 for (const dep of module.dependencies) {
113310 const depAsAny = /** @type {any} */ (dep);
113311 if (dep.module) {
113312 let importData = importedModules.get(dep.module);
113313 if (importData === undefined) {
113314 importedModules.set(
113315 dep.module,
113316 (importData = {
113317 importVar: `m${index}`,
113318 index,
113319 request:
113320 "userRequest" in depAsAny ? depAsAny.userRequest : undefined,
113321 names: new Set(),
113322 reexports: []
113323 })
113324 );
113325 index++;
113326 }
113327 if (dep instanceof WebAssemblyImportDependency) {
113328 importData.names.add(dep.name);
113329 if (dep.description.type === "GlobalType") {
113330 const exportName = dep.name;
113331 const usedName = dep.module && dep.module.isUsed(exportName);
113332
113333 if (dep.module) {
113334 if (usedName) {
113335 initParams.push(
113336 runtimeTemplate.exportFromImport({
113337 module: dep.module,
113338 request: dep.request,
113339 importVar: importData.importVar,
113340 originModule: module,
113341 exportName: dep.name,
113342 asiSafe: true,
113343 isCall: false,
113344 callContext: null
113345 })
113346 );
113347 }
113348 }
113349 }
113350 }
113351 if (dep instanceof WebAssemblyExportImportedDependency) {
113352 importData.names.add(dep.name);
113353 const usedName = module.isUsed(dep.exportName);
113354 if (usedName) {
113355 const exportProp = `${module.exportsArgument}[${JSON.stringify(
113356 usedName
113357 )}]`;
113358 const defineStatement = Template.asString([
113359 `${exportProp} = ${runtimeTemplate.exportFromImport({
113360 module: dep.module,
113361 request: dep.request,
113362 importVar: importData.importVar,
113363 originModule: module,
113364 exportName: dep.name,
113365 asiSafe: true,
113366 isCall: false,
113367 callContext: null
113368 })};`,
113369 `if(WebAssembly.Global) ${exportProp} = ` +
113370 `new WebAssembly.Global({ value: ${JSON.stringify(
113371 dep.valueType
113372 )} }, ${exportProp});`
113373 ]);
113374 importData.reexports.push(defineStatement);
113375 needExportsCopy = true;
113376 }
113377 }
113378 }
113379 }
113380 const importsCode = Template.asString(
113381 Array.from(
113382 importedModules,
113383 ([module, { importVar, request, reexports }]) => {
113384 const importStatement = runtimeTemplate.importStatement({
113385 module,
113386 request,
113387 importVar,
113388 originModule: module
113389 });
113390 return importStatement + reexports.join("\n");
113391 }
113392 )
113393 );
113394
113395 // create source
113396 const source = new RawSource(
113397 [
113398 '"use strict";',
113399 "// Instantiate WebAssembly module",
113400 "var wasmExports = __webpack_require__.w[module.i];",
113401
113402 !Array.isArray(module.usedExports)
113403 ? `__webpack_require__.r(${module.exportsArgument});`
113404 : "",
113405
113406 // this must be before import for circular dependencies
113407 "// export exports from WebAssembly module",
113408 Array.isArray(module.usedExports) && !needExportsCopy
113409 ? `${module.moduleArgument}.exports = wasmExports;`
113410 : "for(var name in wasmExports) " +
113411 `if(name != ${JSON.stringify(initIdentifer)}) ` +
113412 `${module.exportsArgument}[name] = wasmExports[name];`,
113413 "// exec imports from WebAssembly module (for esm order)",
113414 importsCode,
113415 "",
113416 "// exec wasm module",
113417 `wasmExports[${JSON.stringify(initIdentifer)}](${initParams.join(
113418 ", "
113419 )})`
113420 ].join("\n")
113421 );
113422 return source;
113423 }
113424}
113425
113426module.exports = WebAssemblyJavascriptGenerator;
113427
113428
113429/***/ }),
113430
113431/***/ 99510:
113432/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113433
113434"use strict";
113435/*
113436 MIT License http://www.opensource.org/licenses/mit-license.php
113437 Author Tobias Koppers @sokra
113438*/
113439
113440
113441const Generator = __webpack_require__(39172);
113442const WebAssemblyExportImportedDependency = __webpack_require__(18925);
113443const WebAssemblyImportDependency = __webpack_require__(52959);
113444const WebAssemblyInInitialChunkError = __webpack_require__(45283);
113445
113446/** @typedef {import("../Compiler")} Compiler */
113447
113448let WebAssemblyGenerator;
113449let WebAssemblyJavascriptGenerator;
113450let WebAssemblyParser;
113451
113452class WebAssemblyModulesPlugin {
113453 constructor(options) {
113454 this.options = options;
113455 }
113456
113457 /**
113458 * @param {Compiler} compiler compiler
113459 * @returns {void}
113460 */
113461 apply(compiler) {
113462 compiler.hooks.compilation.tap(
113463 "WebAssemblyModulesPlugin",
113464 (compilation, { normalModuleFactory }) => {
113465 compilation.dependencyFactories.set(
113466 WebAssemblyImportDependency,
113467 normalModuleFactory
113468 );
113469
113470 compilation.dependencyFactories.set(
113471 WebAssemblyExportImportedDependency,
113472 normalModuleFactory
113473 );
113474
113475 normalModuleFactory.hooks.createParser
113476 .for("webassembly/experimental")
113477 .tap("WebAssemblyModulesPlugin", () => {
113478 if (WebAssemblyParser === undefined) {
113479 WebAssemblyParser = __webpack_require__(77703);
113480 }
113481 return new WebAssemblyParser();
113482 });
113483
113484 normalModuleFactory.hooks.createGenerator
113485 .for("webassembly/experimental")
113486 .tap("WebAssemblyModulesPlugin", () => {
113487 if (WebAssemblyGenerator === undefined) {
113488 WebAssemblyGenerator = __webpack_require__(13099);
113489 }
113490 if (WebAssemblyJavascriptGenerator === undefined) {
113491 WebAssemblyJavascriptGenerator = __webpack_require__(13411);
113492 }
113493 return Generator.byType({
113494 javascript: new WebAssemblyJavascriptGenerator(),
113495 webassembly: new WebAssemblyGenerator(this.options)
113496 });
113497 });
113498
113499 compilation.chunkTemplate.hooks.renderManifest.tap(
113500 "WebAssemblyModulesPlugin",
113501 (result, options) => {
113502 const chunk = options.chunk;
113503 const outputOptions = options.outputOptions;
113504 const moduleTemplates = options.moduleTemplates;
113505 const dependencyTemplates = options.dependencyTemplates;
113506
113507 for (const module of chunk.modulesIterable) {
113508 if (module.type && module.type.startsWith("webassembly")) {
113509 const filenameTemplate =
113510 outputOptions.webassemblyModuleFilename;
113511
113512 result.push({
113513 render: () =>
113514 this.renderWebAssembly(
113515 module,
113516 moduleTemplates.webassembly,
113517 dependencyTemplates
113518 ),
113519 filenameTemplate,
113520 pathOptions: {
113521 module
113522 },
113523 identifier: `webassemblyModule${module.id}`,
113524 hash: module.hash
113525 });
113526 }
113527 }
113528
113529 return result;
113530 }
113531 );
113532
113533 compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => {
113534 const initialWasmModules = new Set();
113535 for (const chunk of compilation.chunks) {
113536 if (chunk.canBeInitial()) {
113537 for (const module of chunk.modulesIterable) {
113538 if (module.type.startsWith("webassembly")) {
113539 initialWasmModules.add(module);
113540 }
113541 }
113542 }
113543 }
113544 for (const module of initialWasmModules) {
113545 compilation.errors.push(
113546 new WebAssemblyInInitialChunkError(
113547 module,
113548 compilation.requestShortener
113549 )
113550 );
113551 }
113552 });
113553 }
113554 );
113555 }
113556
113557 renderWebAssembly(module, moduleTemplate, dependencyTemplates) {
113558 return moduleTemplate.render(module, dependencyTemplates, {});
113559 }
113560}
113561
113562module.exports = WebAssemblyModulesPlugin;
113563
113564
113565/***/ }),
113566
113567/***/ 77703:
113568/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113569
113570"use strict";
113571/*
113572 MIT License http://www.opensource.org/licenses/mit-license.php
113573 Author Tobias Koppers @sokra
113574*/
113575
113576
113577const t = __webpack_require__(81875);
113578const { decode } = __webpack_require__(27352);
113579const {
113580 moduleContextFromModuleAST
113581} = __webpack_require__(71234);
113582
113583const { Tapable } = __webpack_require__(56758);
113584const WebAssemblyImportDependency = __webpack_require__(52959);
113585const WebAssemblyExportImportedDependency = __webpack_require__(18925);
113586
113587/** @typedef {import("../Module")} Module */
113588
113589const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]);
113590
113591/**
113592 * @param {t.Signature} signature the func signature
113593 * @returns {null | string} the type incompatible with js types
113594 */
113595const getJsIncompatibleType = signature => {
113596 for (const param of signature.params) {
113597 if (!JS_COMPAT_TYPES.has(param.valtype)) {
113598 return `${param.valtype} as parameter`;
113599 }
113600 }
113601 for (const type of signature.results) {
113602 if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`;
113603 }
113604 return null;
113605};
113606
113607/**
113608 * TODO why are there two different Signature types?
113609 * @param {t.FuncSignature} signature the func signature
113610 * @returns {null | string} the type incompatible with js types
113611 */
113612const getJsIncompatibleTypeOfFuncSignature = signature => {
113613 for (const param of signature.args) {
113614 if (!JS_COMPAT_TYPES.has(param)) {
113615 return `${param} as parameter`;
113616 }
113617 }
113618 for (const type of signature.result) {
113619 if (!JS_COMPAT_TYPES.has(type)) return `${type} as result`;
113620 }
113621 return null;
113622};
113623
113624const decoderOpts = {
113625 ignoreCodeSection: true,
113626 ignoreDataSection: true,
113627
113628 // this will avoid having to lookup with identifiers in the ModuleContext
113629 ignoreCustomNameSection: true
113630};
113631
113632class WebAssemblyParser extends Tapable {
113633 constructor(options) {
113634 super();
113635 this.hooks = {};
113636 this.options = options;
113637 }
113638
113639 parse(binary, state) {
113640 // flag it as ESM
113641 state.module.buildMeta.exportsType = "namespace";
113642
113643 // parse it
113644 const program = decode(binary, decoderOpts);
113645 const module = program.body[0];
113646
113647 const moduleContext = moduleContextFromModuleAST(module);
113648
113649 // extract imports and exports
113650 const exports = (state.module.buildMeta.providedExports = []);
113651 const jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = []);
113652
113653 const importedGlobals = [];
113654 t.traverse(module, {
113655 ModuleExport({ node }) {
113656 const descriptor = node.descr;
113657
113658 if (descriptor.exportType === "Func") {
113659 const funcidx = descriptor.id.value;
113660
113661 /** @type {t.FuncSignature} */
113662 const funcSignature = moduleContext.getFunction(funcidx);
113663
113664 const incompatibleType = getJsIncompatibleTypeOfFuncSignature(
113665 funcSignature
113666 );
113667
113668 if (incompatibleType) {
113669 jsIncompatibleExports[node.name] = incompatibleType;
113670 }
113671 }
113672
113673 exports.push(node.name);
113674
113675 if (node.descr && node.descr.exportType === "Global") {
113676 const refNode = importedGlobals[node.descr.id.value];
113677 if (refNode) {
113678 const dep = new WebAssemblyExportImportedDependency(
113679 node.name,
113680 refNode.module,
113681 refNode.name,
113682 refNode.descr.valtype
113683 );
113684
113685 state.module.addDependency(dep);
113686 }
113687 }
113688 },
113689
113690 Global({ node }) {
113691 const init = node.init[0];
113692
113693 let importNode = null;
113694
113695 if (init.id === "get_global") {
113696 const globalIdx = init.args[0].value;
113697
113698 if (globalIdx < importedGlobals.length) {
113699 importNode = importedGlobals[globalIdx];
113700 }
113701 }
113702
113703 importedGlobals.push(importNode);
113704 },
113705
113706 ModuleImport({ node }) {
113707 /** @type {false | string} */
113708 let onlyDirectImport = false;
113709
113710 if (t.isMemory(node.descr) === true) {
113711 onlyDirectImport = "Memory";
113712 } else if (t.isTable(node.descr) === true) {
113713 onlyDirectImport = "Table";
113714 } else if (t.isFuncImportDescr(node.descr) === true) {
113715 const incompatibleType = getJsIncompatibleType(node.descr.signature);
113716 if (incompatibleType) {
113717 onlyDirectImport = `Non-JS-compatible Func Sigurature (${incompatibleType})`;
113718 }
113719 } else if (t.isGlobalType(node.descr) === true) {
113720 const type = node.descr.valtype;
113721 if (!JS_COMPAT_TYPES.has(type)) {
113722 onlyDirectImport = `Non-JS-compatible Global Type (${type})`;
113723 }
113724 }
113725
113726 const dep = new WebAssemblyImportDependency(
113727 node.module,
113728 node.name,
113729 node.descr,
113730 onlyDirectImport
113731 );
113732
113733 state.module.addDependency(dep);
113734
113735 if (t.isGlobalType(node.descr)) {
113736 importedGlobals.push(node);
113737 }
113738 }
113739 });
113740
113741 return state;
113742 }
113743}
113744
113745module.exports = WebAssemblyParser;
113746
113747
113748/***/ }),
113749
113750/***/ 52136:
113751/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
113752
113753"use strict";
113754/*
113755 MIT License http://www.opensource.org/licenses/mit-license.php
113756 Author Tobias Koppers @sokra
113757*/
113758
113759
113760const Template = __webpack_require__(96066);
113761const WebAssemblyImportDependency = __webpack_require__(52959);
113762
113763/** @typedef {import("../Module")} Module */
113764
113765/** @typedef {Object} UsedWasmDependency
113766 * @property {WebAssemblyImportDependency} dependency the dependency
113767 * @property {string} name the export name
113768 * @property {string} module the module name
113769 */
113770
113771const MANGLED_MODULE = "a";
113772
113773/**
113774 * @param {Module} module the module
113775 * @param {boolean} mangle mangle module and export names
113776 * @returns {UsedWasmDependency[]} used dependencies and (mangled) name
113777 */
113778const getUsedDependencies = (module, mangle) => {
113779 /** @type {UsedWasmDependency[]} */
113780 const array = [];
113781 let importIndex = 0;
113782 for (const dep of module.dependencies) {
113783 if (dep instanceof WebAssemblyImportDependency) {
113784 if (dep.description.type === "GlobalType" || dep.module === null) {
113785 continue;
113786 }
113787
113788 const exportName = dep.name;
113789 // TODO add the following 3 lines when removing of ModuleExport is possible
113790 // const importedModule = dep.module;
113791 // const usedName = importedModule && importedModule.isUsed(exportName);
113792 // if (usedName !== false) {
113793 if (mangle) {
113794 array.push({
113795 dependency: dep,
113796 name: Template.numberToIdentifer(importIndex++),
113797 module: MANGLED_MODULE
113798 });
113799 } else {
113800 array.push({
113801 dependency: dep,
113802 name: exportName,
113803 module: dep.request
113804 });
113805 }
113806 }
113807 }
113808 return array;
113809};
113810
113811exports.getUsedDependencies = getUsedDependencies;
113812exports.MANGLED_MODULE = MANGLED_MODULE;
113813
113814
113815/***/ }),
113816
113817/***/ 52669:
113818/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113819
113820"use strict";
113821/*
113822 MIT License http://www.opensource.org/licenses/mit-license.php
113823 Author Tobias Koppers @sokra
113824*/
113825
113826
113827const WasmMainTemplatePlugin = __webpack_require__(65331);
113828
113829class FetchCompileWasmTemplatePlugin {
113830 constructor(options) {
113831 this.options = options || {};
113832 }
113833
113834 apply(compiler) {
113835 compiler.hooks.thisCompilation.tap(
113836 "FetchCompileWasmTemplatePlugin",
113837 compilation => {
113838 const mainTemplate = compilation.mainTemplate;
113839 const generateLoadBinaryCode = path =>
113840 `fetch(${mainTemplate.requireFn}.p + ${path})`;
113841
113842 const plugin = new WasmMainTemplatePlugin(
113843 Object.assign(
113844 {
113845 generateLoadBinaryCode,
113846 supportsStreaming: true
113847 },
113848 this.options
113849 )
113850 );
113851 plugin.apply(mainTemplate);
113852 }
113853 );
113854 }
113855}
113856
113857module.exports = FetchCompileWasmTemplatePlugin;
113858
113859
113860/***/ }),
113861
113862/***/ 31898:
113863/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113864
113865"use strict";
113866/*
113867 MIT License http://www.opensource.org/licenses/mit-license.php
113868 Author Tobias Koppers @sokra
113869*/
113870
113871
113872const { ConcatSource } = __webpack_require__(53665);
113873
113874/** @typedef {import("../ChunkTemplate")} ChunkTemplate */
113875
113876const getEntryInfo = chunk => {
113877 return [chunk.entryModule].filter(Boolean).map(m =>
113878 [m.id].concat(
113879 Array.from(chunk.groupsIterable)[0]
113880 .chunks.filter(c => c !== chunk)
113881 .map(c => c.id)
113882 )
113883 );
113884};
113885
113886class JsonpChunkTemplatePlugin {
113887 /**
113888 * @param {ChunkTemplate} chunkTemplate the chunk template
113889 * @returns {void}
113890 */
113891 apply(chunkTemplate) {
113892 chunkTemplate.hooks.render.tap(
113893 "JsonpChunkTemplatePlugin",
113894 (modules, chunk) => {
113895 const jsonpFunction = chunkTemplate.outputOptions.jsonpFunction;
113896 const globalObject = chunkTemplate.outputOptions.globalObject;
113897 const source = new ConcatSource();
113898 const prefetchChunks = chunk.getChildIdsByOrders().prefetch;
113899 source.add(
113900 `(${globalObject}[${JSON.stringify(
113901 jsonpFunction
113902 )}] = ${globalObject}[${JSON.stringify(
113903 jsonpFunction
113904 )}] || []).push([${JSON.stringify(chunk.ids)},`
113905 );
113906 source.add(modules);
113907 const entries = getEntryInfo(chunk);
113908 if (entries.length > 0) {
113909 source.add(`,${JSON.stringify(entries)}`);
113910 } else if (prefetchChunks && prefetchChunks.length) {
113911 source.add(`,0`);
113912 }
113913
113914 if (prefetchChunks && prefetchChunks.length) {
113915 source.add(`,${JSON.stringify(prefetchChunks)}`);
113916 }
113917 source.add("])");
113918 return source;
113919 }
113920 );
113921 chunkTemplate.hooks.hash.tap("JsonpChunkTemplatePlugin", hash => {
113922 hash.update("JsonpChunkTemplatePlugin");
113923 hash.update("4");
113924 hash.update(`${chunkTemplate.outputOptions.jsonpFunction}`);
113925 hash.update(`${chunkTemplate.outputOptions.globalObject}`);
113926 });
113927 chunkTemplate.hooks.hashForChunk.tap(
113928 "JsonpChunkTemplatePlugin",
113929 (hash, chunk) => {
113930 hash.update(JSON.stringify(getEntryInfo(chunk)));
113931 hash.update(JSON.stringify(chunk.getChildIdsByOrders().prefetch) || "");
113932 }
113933 );
113934 }
113935}
113936module.exports = JsonpChunkTemplatePlugin;
113937
113938
113939/***/ }),
113940
113941/***/ 13732:
113942/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
113943
113944"use strict";
113945/*
113946 MIT License http://www.opensource.org/licenses/mit-license.php
113947 Author Tobias Koppers @sokra
113948*/
113949
113950
113951const { ConcatSource } = __webpack_require__(53665);
113952
113953class JsonpExportMainTemplatePlugin {
113954 /**
113955 * @param {string} name jsonp function name
113956 */
113957 constructor(name) {
113958 this.name = name;
113959 }
113960
113961 apply(compilation) {
113962 const { mainTemplate, chunkTemplate } = compilation;
113963
113964 const onRenderWithEntry = (source, chunk, hash) => {
113965 const name = mainTemplate.getAssetPath(this.name || "", {
113966 hash,
113967 chunk
113968 });
113969 return new ConcatSource(`${name}(`, source, ");");
113970 };
113971
113972 for (const template of [mainTemplate, chunkTemplate]) {
113973 template.hooks.renderWithEntry.tap(
113974 "JsonpExportMainTemplatePlugin",
113975 onRenderWithEntry
113976 );
113977 }
113978
113979 mainTemplate.hooks.globalHashPaths.tap(
113980 "JsonpExportMainTemplatePlugin",
113981 paths => {
113982 if (this.name) paths.push(this.name);
113983 return paths;
113984 }
113985 );
113986
113987 mainTemplate.hooks.hash.tap("JsonpExportMainTemplatePlugin", hash => {
113988 hash.update("jsonp export");
113989 hash.update(`${this.name}`);
113990 });
113991 }
113992}
113993
113994module.exports = JsonpExportMainTemplatePlugin;
113995
113996
113997/***/ }),
113998
113999/***/ 44458:
114000/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
114001
114002"use strict";
114003/*
114004 MIT License http://www.opensource.org/licenses/mit-license.php
114005 Author Tobias Koppers @sokra
114006*/
114007
114008
114009const { ConcatSource } = __webpack_require__(53665);
114010
114011class JsonpHotUpdateChunkTemplatePlugin {
114012 apply(hotUpdateChunkTemplate) {
114013 hotUpdateChunkTemplate.hooks.render.tap(
114014 "JsonpHotUpdateChunkTemplatePlugin",
114015 (modulesSource, modules, removedModules, hash, id) => {
114016 const source = new ConcatSource();
114017 source.add(
114018 `${
114019 hotUpdateChunkTemplate.outputOptions.hotUpdateFunction
114020 }(${JSON.stringify(id)},`
114021 );
114022 source.add(modulesSource);
114023 source.add(")");
114024 return source;
114025 }
114026 );
114027 hotUpdateChunkTemplate.hooks.hash.tap(
114028 "JsonpHotUpdateChunkTemplatePlugin",
114029 hash => {
114030 hash.update("JsonpHotUpdateChunkTemplatePlugin");
114031 hash.update("3");
114032 hash.update(
114033 `${hotUpdateChunkTemplate.outputOptions.hotUpdateFunction}`
114034 );
114035 hash.update(`${hotUpdateChunkTemplate.outputOptions.library}`);
114036 }
114037 );
114038 }
114039}
114040
114041module.exports = JsonpHotUpdateChunkTemplatePlugin;
114042
114043
114044/***/ }),
114045
114046/***/ 24916:
114047/***/ (function(module) {
114048
114049/*
114050 MIT License http://www.opensource.org/licenses/mit-license.php
114051 Author Tobias Koppers @sokra
114052*/
114053// eslint-disable-next-line no-unused-vars
114054var hotAddUpdateChunk = undefined;
114055var parentHotUpdateCallback = undefined;
114056var $require$ = undefined;
114057var $hotMainFilename$ = undefined;
114058var $hotChunkFilename$ = undefined;
114059var $crossOriginLoading$ = undefined;
114060
114061module.exports = function() {
114062 // eslint-disable-next-line no-unused-vars
114063 function webpackHotUpdateCallback(chunkId, moreModules) {
114064 hotAddUpdateChunk(chunkId, moreModules);
114065 if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
114066 } //$semicolon
114067
114068 // eslint-disable-next-line no-unused-vars
114069 function hotDownloadUpdateChunk(chunkId) {
114070 var script = document.createElement("script");
114071 script.charset = "utf-8";
114072 script.src = $require$.p + $hotChunkFilename$;
114073 if ($crossOriginLoading$) script.crossOrigin = $crossOriginLoading$;
114074 document.head.appendChild(script);
114075 }
114076
114077 // eslint-disable-next-line no-unused-vars
114078 function hotDownloadManifest(requestTimeout) {
114079 requestTimeout = requestTimeout || 10000;
114080 return new Promise(function(resolve, reject) {
114081 if (typeof XMLHttpRequest === "undefined") {
114082 return reject(new Error("No browser support"));
114083 }
114084 try {
114085 var request = new XMLHttpRequest();
114086 var requestPath = $require$.p + $hotMainFilename$;
114087 request.open("GET", requestPath, true);
114088 request.timeout = requestTimeout;
114089 request.send(null);
114090 } catch (err) {
114091 return reject(err);
114092 }
114093 request.onreadystatechange = function() {
114094 if (request.readyState !== 4) return;
114095 if (request.status === 0) {
114096 // timeout
114097 reject(
114098 new Error("Manifest request to " + requestPath + " timed out.")
114099 );
114100 } else if (request.status === 404) {
114101 // no update available
114102 resolve();
114103 } else if (request.status !== 200 && request.status !== 304) {
114104 // other failure
114105 reject(new Error("Manifest request to " + requestPath + " failed."));
114106 } else {
114107 // success
114108 try {
114109 var update = JSON.parse(request.responseText);
114110 } catch (e) {
114111 reject(e);
114112 return;
114113 }
114114 resolve(update);
114115 }
114116 };
114117 });
114118 }
114119};
114120
114121
114122/***/ }),
114123
114124/***/ 38017:
114125/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
114126
114127"use strict";
114128/*
114129 MIT License http://www.opensource.org/licenses/mit-license.php
114130 Author Tobias Koppers @sokra
114131*/
114132
114133
114134const { SyncWaterfallHook } = __webpack_require__(56758);
114135const Template = __webpack_require__(96066);
114136
114137class JsonpMainTemplatePlugin {
114138 apply(mainTemplate) {
114139 const needChunkOnDemandLoadingCode = chunk => {
114140 for (const chunkGroup of chunk.groupsIterable) {
114141 if (chunkGroup.getNumberOfChildren() > 0) return true;
114142 }
114143 return false;
114144 };
114145 const needChunkLoadingCode = chunk => {
114146 for (const chunkGroup of chunk.groupsIterable) {
114147 if (chunkGroup.chunks.length > 1) return true;
114148 if (chunkGroup.getNumberOfChildren() > 0) return true;
114149 }
114150 return false;
114151 };
114152 const needEntryDeferringCode = chunk => {
114153 for (const chunkGroup of chunk.groupsIterable) {
114154 if (chunkGroup.chunks.length > 1) return true;
114155 }
114156 return false;
114157 };
114158 const needPrefetchingCode = chunk => {
114159 const allPrefetchChunks = chunk.getChildIdsByOrdersMap(true).prefetch;
114160 return allPrefetchChunks && Object.keys(allPrefetchChunks).length;
114161 };
114162
114163 // TODO webpack 5, no adding to .hooks, use WeakMap and static methods
114164 ["jsonpScript", "linkPreload", "linkPrefetch"].forEach(hook => {
114165 if (!mainTemplate.hooks[hook]) {
114166 mainTemplate.hooks[hook] = new SyncWaterfallHook([
114167 "source",
114168 "chunk",
114169 "hash"
114170 ]);
114171 }
114172 });
114173
114174 const getScriptSrcPath = (hash, chunk, chunkIdExpression) => {
114175 const chunkFilename = mainTemplate.outputOptions.chunkFilename;
114176 const chunkMaps = chunk.getChunkMaps();
114177 return mainTemplate.getAssetPath(JSON.stringify(chunkFilename), {
114178 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
114179 hashWithLength: length =>
114180 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
114181 chunk: {
114182 id: `" + ${chunkIdExpression} + "`,
114183 hash: `" + ${JSON.stringify(
114184 chunkMaps.hash
114185 )}[${chunkIdExpression}] + "`,
114186 hashWithLength(length) {
114187 const shortChunkHashMap = Object.create(null);
114188 for (const chunkId of Object.keys(chunkMaps.hash)) {
114189 if (typeof chunkMaps.hash[chunkId] === "string") {
114190 shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(
114191 0,
114192 length
114193 );
114194 }
114195 }
114196 return `" + ${JSON.stringify(
114197 shortChunkHashMap
114198 )}[${chunkIdExpression}] + "`;
114199 },
114200 name: `" + (${JSON.stringify(
114201 chunkMaps.name
114202 )}[${chunkIdExpression}]||${chunkIdExpression}) + "`,
114203 contentHash: {
114204 javascript: `" + ${JSON.stringify(
114205 chunkMaps.contentHash.javascript
114206 )}[${chunkIdExpression}] + "`
114207 },
114208 contentHashWithLength: {
114209 javascript: length => {
114210 const shortContentHashMap = {};
114211 const contentHash = chunkMaps.contentHash.javascript;
114212 for (const chunkId of Object.keys(contentHash)) {
114213 if (typeof contentHash[chunkId] === "string") {
114214 shortContentHashMap[chunkId] = contentHash[chunkId].substr(
114215 0,
114216 length
114217 );
114218 }
114219 }
114220 return `" + ${JSON.stringify(
114221 shortContentHashMap
114222 )}[${chunkIdExpression}] + "`;
114223 }
114224 }
114225 },
114226 contentHashType: "javascript"
114227 });
114228 };
114229 mainTemplate.hooks.localVars.tap(
114230 "JsonpMainTemplatePlugin",
114231 (source, chunk, hash) => {
114232 const extraCode = [];
114233 if (needChunkLoadingCode(chunk)) {
114234 extraCode.push(
114235 "",
114236 "// object to store loaded and loading chunks",
114237 "// undefined = chunk not loaded, null = chunk preloaded/prefetched",
114238 "// Promise = chunk loading, 0 = chunk loaded",
114239 "var installedChunks = {",
114240 Template.indent(
114241 chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
114242 ),
114243 "};",
114244 "",
114245 needEntryDeferringCode(chunk)
114246 ? needPrefetchingCode(chunk)
114247 ? "var deferredModules = [], deferredPrefetch = [];"
114248 : "var deferredModules = [];"
114249 : ""
114250 );
114251 }
114252 if (needChunkOnDemandLoadingCode(chunk)) {
114253 extraCode.push(
114254 "",
114255 "// script path function",
114256 "function jsonpScriptSrc(chunkId) {",
114257 Template.indent([
114258 `return ${mainTemplate.requireFn}.p + ${getScriptSrcPath(
114259 hash,
114260 chunk,
114261 "chunkId"
114262 )}`
114263 ]),
114264 "}"
114265 );
114266 }
114267 if (extraCode.length === 0) return source;
114268 return Template.asString([source, ...extraCode]);
114269 }
114270 );
114271
114272 mainTemplate.hooks.jsonpScript.tap(
114273 "JsonpMainTemplatePlugin",
114274 (_, chunk, hash) => {
114275 const crossOriginLoading =
114276 mainTemplate.outputOptions.crossOriginLoading;
114277 const chunkLoadTimeout = mainTemplate.outputOptions.chunkLoadTimeout;
114278 const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType;
114279
114280 return Template.asString([
114281 "var script = document.createElement('script');",
114282 "var onScriptComplete;",
114283 jsonpScriptType
114284 ? `script.type = ${JSON.stringify(jsonpScriptType)};`
114285 : "",
114286 "script.charset = 'utf-8';",
114287 `script.timeout = ${chunkLoadTimeout / 1000};`,
114288 `if (${mainTemplate.requireFn}.nc) {`,
114289 Template.indent(
114290 `script.setAttribute("nonce", ${mainTemplate.requireFn}.nc);`
114291 ),
114292 "}",
114293 "script.src = jsonpScriptSrc(chunkId);",
114294 crossOriginLoading
114295 ? Template.asString([
114296 "if (script.src.indexOf(window.location.origin + '/') !== 0) {",
114297 Template.indent(
114298 `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
114299 ),
114300 "}"
114301 ])
114302 : "",
114303 "// create error before stack unwound to get useful stacktrace later",
114304 "var error = new Error();",
114305 "onScriptComplete = function (event) {",
114306 Template.indent([
114307 "// avoid mem leaks in IE.",
114308 "script.onerror = script.onload = null;",
114309 "clearTimeout(timeout);",
114310 "var chunk = installedChunks[chunkId];",
114311 "if(chunk !== 0) {",
114312 Template.indent([
114313 "if(chunk) {",
114314 Template.indent([
114315 "var errorType = event && (event.type === 'load' ? 'missing' : event.type);",
114316 "var realSrc = event && event.target && event.target.src;",
114317 "error.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';",
114318 "error.name = 'ChunkLoadError';",
114319 "error.type = errorType;",
114320 "error.request = realSrc;",
114321 "chunk[1](error);"
114322 ]),
114323 "}",
114324 "installedChunks[chunkId] = undefined;"
114325 ]),
114326 "}"
114327 ]),
114328 "};",
114329 "var timeout = setTimeout(function(){",
114330 Template.indent([
114331 "onScriptComplete({ type: 'timeout', target: script });"
114332 ]),
114333 `}, ${chunkLoadTimeout});`,
114334 "script.onerror = script.onload = onScriptComplete;"
114335 ]);
114336 }
114337 );
114338 mainTemplate.hooks.linkPreload.tap(
114339 "JsonpMainTemplatePlugin",
114340 (_, chunk, hash) => {
114341 const crossOriginLoading =
114342 mainTemplate.outputOptions.crossOriginLoading;
114343 const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType;
114344
114345 return Template.asString([
114346 "var link = document.createElement('link');",
114347 jsonpScriptType
114348 ? `link.type = ${JSON.stringify(jsonpScriptType)};`
114349 : "",
114350 "link.charset = 'utf-8';",
114351 `if (${mainTemplate.requireFn}.nc) {`,
114352 Template.indent(
114353 `link.setAttribute("nonce", ${mainTemplate.requireFn}.nc);`
114354 ),
114355 "}",
114356 'link.rel = "preload";',
114357 'link.as = "script";',
114358 "link.href = jsonpScriptSrc(chunkId);",
114359 crossOriginLoading
114360 ? Template.asString([
114361 "if (link.href.indexOf(window.location.origin + '/') !== 0) {",
114362 Template.indent(
114363 `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
114364 ),
114365 "}"
114366 ])
114367 : ""
114368 ]);
114369 }
114370 );
114371 mainTemplate.hooks.linkPrefetch.tap(
114372 "JsonpMainTemplatePlugin",
114373 (_, chunk, hash) => {
114374 const crossOriginLoading =
114375 mainTemplate.outputOptions.crossOriginLoading;
114376
114377 return Template.asString([
114378 "var link = document.createElement('link');",
114379 crossOriginLoading
114380 ? `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
114381 : "",
114382 `if (${mainTemplate.requireFn}.nc) {`,
114383 Template.indent(
114384 `link.setAttribute("nonce", ${mainTemplate.requireFn}.nc);`
114385 ),
114386 "}",
114387 'link.rel = "prefetch";',
114388 'link.as = "script";',
114389 "link.href = jsonpScriptSrc(chunkId);"
114390 ]);
114391 }
114392 );
114393 mainTemplate.hooks.requireEnsure.tap(
114394 "JsonpMainTemplatePlugin load",
114395 (source, chunk, hash) => {
114396 return Template.asString([
114397 source,
114398 "",
114399 "// JSONP chunk loading for javascript",
114400 "",
114401 "var installedChunkData = installedChunks[chunkId];",
114402 'if(installedChunkData !== 0) { // 0 means "already installed".',
114403 Template.indent([
114404 "",
114405 '// a Promise means "currently loading".',
114406 "if(installedChunkData) {",
114407 Template.indent(["promises.push(installedChunkData[2]);"]),
114408 "} else {",
114409 Template.indent([
114410 "// setup Promise in chunk cache",
114411 "var promise = new Promise(function(resolve, reject) {",
114412 Template.indent([
114413 "installedChunkData = installedChunks[chunkId] = [resolve, reject];"
114414 ]),
114415 "});",
114416 "promises.push(installedChunkData[2] = promise);",
114417 "",
114418 "// start chunk loading",
114419 mainTemplate.hooks.jsonpScript.call("", chunk, hash),
114420 "document.head.appendChild(script);"
114421 ]),
114422 "}"
114423 ]),
114424 "}"
114425 ]);
114426 }
114427 );
114428 mainTemplate.hooks.requireEnsure.tap(
114429 {
114430 name: "JsonpMainTemplatePlugin preload",
114431 stage: 10
114432 },
114433 (source, chunk, hash) => {
114434 const chunkMap = chunk.getChildIdsByOrdersMap().preload;
114435 if (!chunkMap || Object.keys(chunkMap).length === 0) return source;
114436 return Template.asString([
114437 source,
114438 "",
114439 "// chunk preloadng for javascript",
114440 "",
114441 `var chunkPreloadMap = ${JSON.stringify(chunkMap, null, "\t")};`,
114442 "",
114443 "var chunkPreloadData = chunkPreloadMap[chunkId];",
114444 "if(chunkPreloadData) {",
114445 Template.indent([
114446 "chunkPreloadData.forEach(function(chunkId) {",
114447 Template.indent([
114448 "if(installedChunks[chunkId] === undefined) {",
114449 Template.indent([
114450 "installedChunks[chunkId] = null;",
114451 mainTemplate.hooks.linkPreload.call("", chunk, hash),
114452 "document.head.appendChild(link);"
114453 ]),
114454 "}"
114455 ]),
114456 "});"
114457 ]),
114458 "}"
114459 ]);
114460 }
114461 );
114462 mainTemplate.hooks.requireExtensions.tap(
114463 "JsonpMainTemplatePlugin",
114464 (source, chunk) => {
114465 if (!needChunkOnDemandLoadingCode(chunk)) return source;
114466
114467 return Template.asString([
114468 source,
114469 "",
114470 "// on error function for async loading",
114471 `${mainTemplate.requireFn}.oe = function(err) { console.error(err); throw err; };`
114472 ]);
114473 }
114474 );
114475 mainTemplate.hooks.bootstrap.tap(
114476 "JsonpMainTemplatePlugin",
114477 (source, chunk, hash) => {
114478 if (needChunkLoadingCode(chunk)) {
114479 const withDefer = needEntryDeferringCode(chunk);
114480 const withPrefetch = needPrefetchingCode(chunk);
114481 return Template.asString([
114482 source,
114483 "",
114484 "// install a JSONP callback for chunk loading",
114485 "function webpackJsonpCallback(data) {",
114486 Template.indent([
114487 "var chunkIds = data[0];",
114488 "var moreModules = data[1];",
114489 withDefer ? "var executeModules = data[2];" : "",
114490 withPrefetch ? "var prefetchChunks = data[3] || [];" : "",
114491 '// add "moreModules" to the modules object,',
114492 '// then flag all "chunkIds" as loaded and fire callback',
114493 "var moduleId, chunkId, i = 0, resolves = [];",
114494 "for(;i < chunkIds.length; i++) {",
114495 Template.indent([
114496 "chunkId = chunkIds[i];",
114497 "if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {",
114498 Template.indent("resolves.push(installedChunks[chunkId][0]);"),
114499 "}",
114500 "installedChunks[chunkId] = 0;"
114501 ]),
114502 "}",
114503 "for(moduleId in moreModules) {",
114504 Template.indent([
114505 "if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {",
114506 Template.indent(
114507 mainTemplate.renderAddModule(
114508 hash,
114509 chunk,
114510 "moduleId",
114511 "moreModules[moduleId]"
114512 )
114513 ),
114514 "}"
114515 ]),
114516 "}",
114517 "if(parentJsonpFunction) parentJsonpFunction(data);",
114518 withPrefetch
114519 ? withDefer
114520 ? "deferredPrefetch.push.apply(deferredPrefetch, prefetchChunks);"
114521 : Template.asString([
114522 "// chunk prefetching for javascript",
114523 "prefetchChunks.forEach(function(chunkId) {",
114524 Template.indent([
114525 "if(installedChunks[chunkId] === undefined) {",
114526 Template.indent([
114527 "installedChunks[chunkId] = null;",
114528 mainTemplate.hooks.linkPrefetch.call("", chunk, hash),
114529 "document.head.appendChild(link);"
114530 ]),
114531 "}"
114532 ]),
114533 "});"
114534 ])
114535 : "",
114536 "while(resolves.length) {",
114537 Template.indent("resolves.shift()();"),
114538 "}",
114539 withDefer
114540 ? Template.asString([
114541 "",
114542 "// add entry modules from loaded chunk to deferred list",
114543 "deferredModules.push.apply(deferredModules, executeModules || []);",
114544 "",
114545 "// run deferred modules when all chunks ready",
114546 "return checkDeferredModules();"
114547 ])
114548 : ""
114549 ]),
114550 "};",
114551 withDefer
114552 ? Template.asString([
114553 "function checkDeferredModules() {",
114554 Template.indent([
114555 "var result;",
114556 "for(var i = 0; i < deferredModules.length; i++) {",
114557 Template.indent([
114558 "var deferredModule = deferredModules[i];",
114559 "var fulfilled = true;",
114560 "for(var j = 1; j < deferredModule.length; j++) {",
114561 Template.indent([
114562 "var depId = deferredModule[j];",
114563 "if(installedChunks[depId] !== 0) fulfilled = false;"
114564 ]),
114565 "}",
114566 "if(fulfilled) {",
114567 Template.indent([
114568 "deferredModules.splice(i--, 1);",
114569 "result = " +
114570 mainTemplate.requireFn +
114571 "(" +
114572 mainTemplate.requireFn +
114573 ".s = deferredModule[0]);"
114574 ]),
114575 "}"
114576 ]),
114577 "}",
114578 withPrefetch
114579 ? Template.asString([
114580 "if(deferredModules.length === 0) {",
114581 Template.indent([
114582 "// chunk prefetching for javascript",
114583 "deferredPrefetch.forEach(function(chunkId) {",
114584 Template.indent([
114585 "if(installedChunks[chunkId] === undefined) {",
114586 Template.indent([
114587 "installedChunks[chunkId] = null;",
114588 mainTemplate.hooks.linkPrefetch.call(
114589 "",
114590 chunk,
114591 hash
114592 ),
114593 "document.head.appendChild(link);"
114594 ]),
114595 "}"
114596 ]),
114597 "});",
114598 "deferredPrefetch.length = 0;"
114599 ]),
114600 "}"
114601 ])
114602 : "",
114603 "return result;"
114604 ]),
114605 "}"
114606 ])
114607 : ""
114608 ]);
114609 }
114610 return source;
114611 }
114612 );
114613 mainTemplate.hooks.beforeStartup.tap(
114614 "JsonpMainTemplatePlugin",
114615 (source, chunk, hash) => {
114616 if (needChunkLoadingCode(chunk)) {
114617 var jsonpFunction = mainTemplate.outputOptions.jsonpFunction;
114618 var globalObject = mainTemplate.outputOptions.globalObject;
114619 return Template.asString([
114620 `var jsonpArray = ${globalObject}[${JSON.stringify(
114621 jsonpFunction
114622 )}] = ${globalObject}[${JSON.stringify(jsonpFunction)}] || [];`,
114623 "var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);",
114624 "jsonpArray.push = webpackJsonpCallback;",
114625 "jsonpArray = jsonpArray.slice();",
114626 "for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);",
114627 "var parentJsonpFunction = oldJsonpFunction;",
114628 "",
114629 source
114630 ]);
114631 }
114632 return source;
114633 }
114634 );
114635 mainTemplate.hooks.afterStartup.tap(
114636 "JsonpMainTemplatePlugin",
114637 (source, chunk, hash) => {
114638 const prefetchChunks = chunk.getChildIdsByOrders().prefetch;
114639 if (
114640 needChunkLoadingCode(chunk) &&
114641 prefetchChunks &&
114642 prefetchChunks.length
114643 ) {
114644 return Template.asString([
114645 source,
114646 `webpackJsonpCallback([[], {}, 0, ${JSON.stringify(
114647 prefetchChunks
114648 )}]);`
114649 ]);
114650 }
114651 return source;
114652 }
114653 );
114654 mainTemplate.hooks.startup.tap(
114655 "JsonpMainTemplatePlugin",
114656 (source, chunk, hash) => {
114657 if (needEntryDeferringCode(chunk)) {
114658 if (chunk.hasEntryModule()) {
114659 const entries = [chunk.entryModule].filter(Boolean).map(m =>
114660 [m.id].concat(
114661 Array.from(chunk.groupsIterable)[0]
114662 .chunks.filter(c => c !== chunk)
114663 .map(c => c.id)
114664 )
114665 );
114666 return Template.asString([
114667 "// add entry module to deferred list",
114668 `deferredModules.push(${entries
114669 .map(e => JSON.stringify(e))
114670 .join(", ")});`,
114671 "// run deferred modules when ready",
114672 "return checkDeferredModules();"
114673 ]);
114674 } else {
114675 return Template.asString([
114676 "// run deferred modules from other chunks",
114677 "checkDeferredModules();"
114678 ]);
114679 }
114680 }
114681 return source;
114682 }
114683 );
114684 mainTemplate.hooks.hotBootstrap.tap(
114685 "JsonpMainTemplatePlugin",
114686 (source, chunk, hash) => {
114687 const globalObject = mainTemplate.outputOptions.globalObject;
114688 const hotUpdateChunkFilename =
114689 mainTemplate.outputOptions.hotUpdateChunkFilename;
114690 const hotUpdateMainFilename =
114691 mainTemplate.outputOptions.hotUpdateMainFilename;
114692 const crossOriginLoading =
114693 mainTemplate.outputOptions.crossOriginLoading;
114694 const hotUpdateFunction = mainTemplate.outputOptions.hotUpdateFunction;
114695 const currentHotUpdateChunkFilename = mainTemplate.getAssetPath(
114696 JSON.stringify(hotUpdateChunkFilename),
114697 {
114698 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
114699 hashWithLength: length =>
114700 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
114701 chunk: {
114702 id: '" + chunkId + "'
114703 }
114704 }
114705 );
114706 const currentHotUpdateMainFilename = mainTemplate.getAssetPath(
114707 JSON.stringify(hotUpdateMainFilename),
114708 {
114709 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
114710 hashWithLength: length =>
114711 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`
114712 }
114713 );
114714 const runtimeSource = Template.getFunctionContent(
114715 __webpack_require__(24916)
114716 )
114717 .replace(/\/\/\$semicolon/g, ";")
114718 .replace(/\$require\$/g, mainTemplate.requireFn)
114719 .replace(
114720 /\$crossOriginLoading\$/g,
114721 crossOriginLoading ? JSON.stringify(crossOriginLoading) : "null"
114722 )
114723 .replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
114724 .replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
114725 .replace(/\$hash\$/g, JSON.stringify(hash));
114726 return `${source}
114727function hotDisposeChunk(chunkId) {
114728 delete installedChunks[chunkId];
114729}
114730var parentHotUpdateCallback = ${globalObject}[${JSON.stringify(
114731 hotUpdateFunction
114732 )}];
114733${globalObject}[${JSON.stringify(hotUpdateFunction)}] = ${runtimeSource}`;
114734 }
114735 );
114736 mainTemplate.hooks.hash.tap("JsonpMainTemplatePlugin", hash => {
114737 hash.update("jsonp");
114738 hash.update("6");
114739 });
114740 }
114741}
114742module.exports = JsonpMainTemplatePlugin;
114743
114744
114745/***/ }),
114746
114747/***/ 92764:
114748/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
114749
114750"use strict";
114751/*
114752 MIT License http://www.opensource.org/licenses/mit-license.php
114753 Author Tobias Koppers @sokra
114754*/
114755
114756
114757const JsonpMainTemplatePlugin = __webpack_require__(38017);
114758const JsonpChunkTemplatePlugin = __webpack_require__(31898);
114759const JsonpHotUpdateChunkTemplatePlugin = __webpack_require__(44458);
114760
114761class JsonpTemplatePlugin {
114762 apply(compiler) {
114763 compiler.hooks.thisCompilation.tap("JsonpTemplatePlugin", compilation => {
114764 new JsonpMainTemplatePlugin().apply(compilation.mainTemplate);
114765 new JsonpChunkTemplatePlugin().apply(compilation.chunkTemplate);
114766 new JsonpHotUpdateChunkTemplatePlugin().apply(
114767 compilation.hotUpdateChunkTemplate
114768 );
114769 });
114770 }
114771}
114772
114773module.exports = JsonpTemplatePlugin;
114774
114775
114776/***/ }),
114777
114778/***/ 92929:
114779/***/ (function(module, exports, __webpack_require__) {
114780
114781"use strict";
114782/*
114783 MIT License http://www.opensource.org/licenses/mit-license.php
114784 Author Tobias Koppers @sokra
114785*/
114786
114787
114788const Compiler = __webpack_require__(58705);
114789const MultiCompiler = __webpack_require__(10238);
114790const NodeEnvironmentPlugin = __webpack_require__(52520);
114791const WebpackOptionsApply = __webpack_require__(2779);
114792const WebpackOptionsDefaulter = __webpack_require__(60016);
114793const validateSchema = __webpack_require__(68935);
114794const WebpackOptionsValidationError = __webpack_require__(285);
114795const webpackOptionsSchema = __webpack_require__(37863);
114796const RemovedPluginError = __webpack_require__(15377);
114797const version = __webpack_require__(71618)/* .version */ .i8;
114798
114799/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
114800
114801/**
114802 * @param {WebpackOptions} options options object
114803 * @param {function(Error=, Stats=): void=} callback callback
114804 * @returns {Compiler | MultiCompiler} the compiler object
114805 */
114806const webpack = (options, callback) => {
114807 const webpackOptionsValidationErrors = validateSchema(
114808 webpackOptionsSchema,
114809 options
114810 );
114811 if (webpackOptionsValidationErrors.length) {
114812 throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
114813 }
114814 let compiler;
114815 if (Array.isArray(options)) {
114816 compiler = new MultiCompiler(
114817 Array.from(options).map(options => webpack(options))
114818 );
114819 } else if (typeof options === "object") {
114820 options = new WebpackOptionsDefaulter().process(options);
114821
114822 compiler = new Compiler(options.context);
114823 compiler.options = options;
114824 new NodeEnvironmentPlugin({
114825 infrastructureLogging: options.infrastructureLogging
114826 }).apply(compiler);
114827 if (options.plugins && Array.isArray(options.plugins)) {
114828 for (const plugin of options.plugins) {
114829 if (typeof plugin === "function") {
114830 plugin.call(compiler, compiler);
114831 } else {
114832 plugin.apply(compiler);
114833 }
114834 }
114835 }
114836 compiler.hooks.environment.call();
114837 compiler.hooks.afterEnvironment.call();
114838 compiler.options = new WebpackOptionsApply().process(options, compiler);
114839 } else {
114840 throw new Error("Invalid argument: options");
114841 }
114842 if (callback) {
114843 if (typeof callback !== "function") {
114844 throw new Error("Invalid argument: callback");
114845 }
114846 if (
114847 options.watch === true ||
114848 (Array.isArray(options) && options.some(o => o.watch))
114849 ) {
114850 const watchOptions = Array.isArray(options)
114851 ? options.map(o => o.watchOptions || {})
114852 : options.watchOptions || {};
114853 return compiler.watch(watchOptions, callback);
114854 }
114855 compiler.run(callback);
114856 }
114857 return compiler;
114858};
114859
114860exports = module.exports = webpack;
114861exports.version = version;
114862
114863webpack.WebpackOptionsDefaulter = WebpackOptionsDefaulter;
114864webpack.WebpackOptionsApply = WebpackOptionsApply;
114865webpack.Compiler = Compiler;
114866webpack.MultiCompiler = MultiCompiler;
114867webpack.NodeEnvironmentPlugin = NodeEnvironmentPlugin;
114868// @ts-ignore Global @this directive is not supported
114869webpack.validate = validateSchema.bind(this, webpackOptionsSchema);
114870webpack.validateSchema = validateSchema;
114871webpack.WebpackOptionsValidationError = WebpackOptionsValidationError;
114872
114873const exportPlugins = (obj, mappings) => {
114874 for (const name of Object.keys(mappings)) {
114875 Object.defineProperty(obj, name, {
114876 configurable: false,
114877 enumerable: true,
114878 get: mappings[name]
114879 });
114880 }
114881};
114882
114883exportPlugins(exports, {
114884 AutomaticPrefetchPlugin: () => __webpack_require__(51596),
114885 BannerPlugin: () => __webpack_require__(4009),
114886 CachePlugin: () => __webpack_require__(6465),
114887 ContextExclusionPlugin: () => __webpack_require__(10706),
114888 ContextReplacementPlugin: () => __webpack_require__(27295),
114889 DefinePlugin: () => __webpack_require__(97374),
114890 Dependency: () => __webpack_require__(57282),
114891 DllPlugin: () => __webpack_require__(45255),
114892 DllReferencePlugin: () => __webpack_require__(86231),
114893 EnvironmentPlugin: () => __webpack_require__(6098),
114894 EvalDevToolModulePlugin: () => __webpack_require__(65200),
114895 EvalSourceMapDevToolPlugin: () => __webpack_require__(99994),
114896 ExtendedAPIPlugin: () => __webpack_require__(17270),
114897 ExternalsPlugin: () => __webpack_require__(75705),
114898 HashedModuleIdsPlugin: () => __webpack_require__(50268),
114899 HotModuleReplacementPlugin: () => __webpack_require__(69575),
114900 IgnorePlugin: () => __webpack_require__(41364),
114901 LibraryTemplatePlugin: () => __webpack_require__(65237),
114902 LoaderOptionsPlugin: () => __webpack_require__(48775),
114903 LoaderTargetPlugin: () => __webpack_require__(95154),
114904 MemoryOutputFileSystem: () => __webpack_require__(50332),
114905 Module: () => __webpack_require__(75993),
114906 ModuleFilenameHelpers: () => __webpack_require__(71474),
114907 NamedChunksPlugin: () => __webpack_require__(70419),
114908 NamedModulesPlugin: () => __webpack_require__(86707),
114909 NoEmitOnErrorsPlugin: () => __webpack_require__(22615),
114910 NormalModuleReplacementPlugin: () =>
114911 __webpack_require__(73253),
114912 PrefetchPlugin: () => __webpack_require__(27850),
114913 ProgressPlugin: () => __webpack_require__(63123),
114914 ProvidePlugin: () => __webpack_require__(72861),
114915 SetVarMainTemplatePlugin: () => __webpack_require__(37098),
114916 SingleEntryPlugin: () => __webpack_require__(19070),
114917 SourceMapDevToolPlugin: () => __webpack_require__(11851),
114918 Stats: () => __webpack_require__(99977),
114919 Template: () => __webpack_require__(96066),
114920 UmdMainTemplatePlugin: () => __webpack_require__(75374),
114921 WatchIgnorePlugin: () => __webpack_require__(88015)
114922});
114923exportPlugins((exports.dependencies = {}), {
114924 DependencyReference: () => __webpack_require__(71722)
114925});
114926exportPlugins((exports.optimize = {}), {
114927 AggressiveMergingPlugin: () => __webpack_require__(88197),
114928 AggressiveSplittingPlugin: () =>
114929 __webpack_require__(26688),
114930 ChunkModuleIdRangePlugin: () =>
114931 __webpack_require__(30346),
114932 LimitChunkCountPlugin: () => __webpack_require__(3846),
114933 MinChunkSizePlugin: () => __webpack_require__(55607),
114934 ModuleConcatenationPlugin: () =>
114935 __webpack_require__(45184),
114936 OccurrenceOrderPlugin: () => __webpack_require__(67340),
114937 OccurrenceModuleOrderPlugin: () =>
114938 __webpack_require__(62000),
114939 OccurrenceChunkOrderPlugin: () =>
114940 __webpack_require__(83741),
114941 RuntimeChunkPlugin: () => __webpack_require__(76894),
114942 SideEffectsFlagPlugin: () => __webpack_require__(83654),
114943 SplitChunksPlugin: () => __webpack_require__(60474)
114944});
114945exportPlugins((exports.web = {}), {
114946 FetchCompileWasmTemplatePlugin: () =>
114947 __webpack_require__(52669),
114948 JsonpTemplatePlugin: () => __webpack_require__(92764)
114949});
114950exportPlugins((exports.webworker = {}), {
114951 WebWorkerTemplatePlugin: () => __webpack_require__(21328)
114952});
114953exportPlugins((exports.node = {}), {
114954 NodeTemplatePlugin: () => __webpack_require__(90010),
114955 ReadFileCompileWasmTemplatePlugin: () =>
114956 __webpack_require__(73839)
114957});
114958exportPlugins((exports.debug = {}), {
114959 ProfilingPlugin: () => __webpack_require__(72890)
114960});
114961exportPlugins((exports.util = {}), {
114962 createHash: () => __webpack_require__(15660)
114963});
114964
114965const defineMissingPluginError = (namespace, pluginName, errorMessage) => {
114966 Object.defineProperty(namespace, pluginName, {
114967 configurable: false,
114968 enumerable: true,
114969 get() {
114970 throw new RemovedPluginError(errorMessage);
114971 }
114972 });
114973};
114974
114975// TODO remove in webpack 5
114976defineMissingPluginError(
114977 exports.optimize,
114978 "UglifyJsPlugin",
114979 "webpack.optimize.UglifyJsPlugin has been removed, please use config.optimization.minimize instead."
114980);
114981
114982// TODO remove in webpack 5
114983defineMissingPluginError(
114984 exports.optimize,
114985 "CommonsChunkPlugin",
114986 "webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead."
114987);
114988
114989
114990/***/ }),
114991
114992/***/ 37919:
114993/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
114994
114995"use strict";
114996/*
114997 MIT License http://www.opensource.org/licenses/mit-license.php
114998 Author Tobias Koppers @sokra
114999*/
115000
115001
115002const { ConcatSource } = __webpack_require__(53665);
115003
115004class WebWorkerChunkTemplatePlugin {
115005 apply(chunkTemplate) {
115006 chunkTemplate.hooks.render.tap(
115007 "WebWorkerChunkTemplatePlugin",
115008 (modules, chunk) => {
115009 const chunkCallbackName = chunkTemplate.outputOptions.chunkCallbackName;
115010 const globalObject = chunkTemplate.outputOptions.globalObject;
115011 const source = new ConcatSource();
115012 source.add(
115013 `${globalObject}[${JSON.stringify(
115014 chunkCallbackName
115015 )}](${JSON.stringify(chunk.ids)},`
115016 );
115017 source.add(modules);
115018 source.add(")");
115019 return source;
115020 }
115021 );
115022 chunkTemplate.hooks.hash.tap("WebWorkerChunkTemplatePlugin", hash => {
115023 hash.update("webworker");
115024 hash.update("3");
115025 hash.update(`${chunkTemplate.outputOptions.chunkCallbackName}`);
115026 hash.update(`${chunkTemplate.outputOptions.globalObject}`);
115027 });
115028 }
115029}
115030module.exports = WebWorkerChunkTemplatePlugin;
115031
115032
115033/***/ }),
115034
115035/***/ 45493:
115036/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
115037
115038"use strict";
115039/*
115040 MIT License http://www.opensource.org/licenses/mit-license.php
115041 Author Tobias Koppers @sokra
115042*/
115043
115044const { ConcatSource } = __webpack_require__(53665);
115045
115046class WebWorkerHotUpdateChunkTemplatePlugin {
115047 apply(hotUpdateChunkTemplate) {
115048 hotUpdateChunkTemplate.hooks.render.tap(
115049 "WebWorkerHotUpdateChunkTemplatePlugin",
115050 (modulesSource, modules, removedModules, hash, id) => {
115051 const hotUpdateFunction =
115052 hotUpdateChunkTemplate.outputOptions.hotUpdateFunction;
115053 const globalObject = hotUpdateChunkTemplate.outputOptions.globalObject;
115054 const source = new ConcatSource();
115055 source.add(
115056 `${globalObject}[${JSON.stringify(
115057 hotUpdateFunction
115058 )}](${JSON.stringify(id)},`
115059 );
115060 source.add(modulesSource);
115061 source.add(")");
115062 return source;
115063 }
115064 );
115065 hotUpdateChunkTemplate.hooks.hash.tap(
115066 "WebWorkerHotUpdateChunkTemplatePlugin",
115067 hash => {
115068 hash.update("WebWorkerHotUpdateChunkTemplatePlugin");
115069 hash.update("3");
115070 hash.update(
115071 hotUpdateChunkTemplate.outputOptions.hotUpdateFunction + ""
115072 );
115073 hash.update(hotUpdateChunkTemplate.outputOptions.globalObject + "");
115074 }
115075 );
115076 }
115077}
115078module.exports = WebWorkerHotUpdateChunkTemplatePlugin;
115079
115080
115081/***/ }),
115082
115083/***/ 72337:
115084/***/ (function(module) {
115085
115086/*
115087 MIT License http://www.opensource.org/licenses/mit-license.php
115088 Author Tobias Koppers @sokra
115089*/
115090// eslint-disable-next-line no-unused-vars
115091var hotAddUpdateChunk = undefined;
115092var parentHotUpdateCallback = undefined;
115093var $require$ = undefined;
115094var $hotChunkFilename$ = undefined;
115095var $hotMainFilename$ = undefined;
115096var installedChunks = undefined;
115097var importScripts = undefined;
115098
115099module.exports = function() {
115100 // eslint-disable-next-line no-unused-vars
115101 function webpackHotUpdateCallback(chunkId, moreModules) {
115102 hotAddUpdateChunk(chunkId, moreModules);
115103 if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
115104 } //$semicolon
115105
115106 // eslint-disable-next-line no-unused-vars
115107 function hotDownloadUpdateChunk(chunkId) {
115108 importScripts($require$.p + $hotChunkFilename$);
115109 }
115110
115111 // eslint-disable-next-line no-unused-vars
115112 function hotDownloadManifest(requestTimeout) {
115113 requestTimeout = requestTimeout || 10000;
115114 return new Promise(function(resolve, reject) {
115115 if (typeof XMLHttpRequest === "undefined") {
115116 return reject(new Error("No browser support"));
115117 }
115118 try {
115119 var request = new XMLHttpRequest();
115120 var requestPath = $require$.p + $hotMainFilename$;
115121 request.open("GET", requestPath, true);
115122 request.timeout = requestTimeout;
115123 request.send(null);
115124 } catch (err) {
115125 return reject(err);
115126 }
115127 request.onreadystatechange = function() {
115128 if (request.readyState !== 4) return;
115129 if (request.status === 0) {
115130 // timeout
115131 reject(
115132 new Error("Manifest request to " + requestPath + " timed out.")
115133 );
115134 } else if (request.status === 404) {
115135 // no update available
115136 resolve();
115137 } else if (request.status !== 200 && request.status !== 304) {
115138 // other failure
115139 reject(new Error("Manifest request to " + requestPath + " failed."));
115140 } else {
115141 // success
115142 try {
115143 var update = JSON.parse(request.responseText);
115144 } catch (e) {
115145 reject(e);
115146 return;
115147 }
115148 resolve(update);
115149 }
115150 };
115151 });
115152 }
115153
115154 //eslint-disable-next-line no-unused-vars
115155 function hotDisposeChunk(chunkId) {
115156 delete installedChunks[chunkId];
115157 }
115158};
115159
115160
115161/***/ }),
115162
115163/***/ 20482:
115164/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
115165
115166"use strict";
115167/*
115168 MIT License http://www.opensource.org/licenses/mit-license.php
115169 Author Tobias Koppers @sokra
115170*/
115171
115172
115173const Template = __webpack_require__(96066);
115174
115175class WebWorkerMainTemplatePlugin {
115176 apply(mainTemplate) {
115177 const needChunkOnDemandLoadingCode = chunk => {
115178 for (const chunkGroup of chunk.groupsIterable) {
115179 if (chunkGroup.getNumberOfChildren() > 0) return true;
115180 }
115181 return false;
115182 };
115183 mainTemplate.hooks.localVars.tap(
115184 "WebWorkerMainTemplatePlugin",
115185 (source, chunk) => {
115186 if (needChunkOnDemandLoadingCode(chunk)) {
115187 return Template.asString([
115188 source,
115189 "",
115190 "// object to store loaded chunks",
115191 '// "1" means "already loaded"',
115192 "var installedChunks = {",
115193 Template.indent(
115194 chunk.ids.map(id => `${JSON.stringify(id)}: 1`).join(",\n")
115195 ),
115196 "};"
115197 ]);
115198 }
115199 return source;
115200 }
115201 );
115202 mainTemplate.hooks.requireEnsure.tap(
115203 "WebWorkerMainTemplatePlugin",
115204 (_, chunk, hash) => {
115205 const chunkFilename = mainTemplate.outputOptions.chunkFilename;
115206 const chunkMaps = chunk.getChunkMaps();
115207 return Template.asString([
115208 "promises.push(Promise.resolve().then(function() {",
115209 Template.indent([
115210 '// "1" is the signal for "already loaded"',
115211 "if(!installedChunks[chunkId]) {",
115212 Template.indent([
115213 "importScripts(" +
115214 "__webpack_require__.p + " +
115215 mainTemplate.getAssetPath(JSON.stringify(chunkFilename), {
115216 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
115217 hashWithLength: length =>
115218 `" + ${mainTemplate.renderCurrentHashCode(
115219 hash,
115220 length
115221 )} + "`,
115222 chunk: {
115223 id: '" + chunkId + "',
115224 hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
115225 hashWithLength(length) {
115226 const shortChunkHashMap = Object.create(null);
115227 for (const chunkId of Object.keys(chunkMaps.hash)) {
115228 if (typeof chunkMaps.hash[chunkId] === "string") {
115229 shortChunkHashMap[chunkId] = chunkMaps.hash[
115230 chunkId
115231 ].substr(0, length);
115232 }
115233 }
115234 return `" + ${JSON.stringify(
115235 shortChunkHashMap
115236 )}[chunkId] + "`;
115237 },
115238 contentHash: {
115239 javascript: `" + ${JSON.stringify(
115240 chunkMaps.contentHash.javascript
115241 )}[chunkId] + "`
115242 },
115243 contentHashWithLength: {
115244 javascript: length => {
115245 const shortContentHashMap = {};
115246 const contentHash = chunkMaps.contentHash.javascript;
115247 for (const chunkId of Object.keys(contentHash)) {
115248 if (typeof contentHash[chunkId] === "string") {
115249 shortContentHashMap[chunkId] = contentHash[
115250 chunkId
115251 ].substr(0, length);
115252 }
115253 }
115254 return `" + ${JSON.stringify(
115255 shortContentHashMap
115256 )}[chunkId] + "`;
115257 }
115258 },
115259 name: `" + (${JSON.stringify(
115260 chunkMaps.name
115261 )}[chunkId]||chunkId) + "`
115262 },
115263 contentHashType: "javascript"
115264 }) +
115265 ");"
115266 ]),
115267 "}"
115268 ]),
115269 "}));"
115270 ]);
115271 }
115272 );
115273 mainTemplate.hooks.bootstrap.tap(
115274 "WebWorkerMainTemplatePlugin",
115275 (source, chunk, hash) => {
115276 if (needChunkOnDemandLoadingCode(chunk)) {
115277 const chunkCallbackName =
115278 mainTemplate.outputOptions.chunkCallbackName;
115279 const globalObject = mainTemplate.outputOptions.globalObject;
115280 return Template.asString([
115281 source,
115282 `${globalObject}[${JSON.stringify(
115283 chunkCallbackName
115284 )}] = function webpackChunkCallback(chunkIds, moreModules) {`,
115285 Template.indent([
115286 "for(var moduleId in moreModules) {",
115287 Template.indent(
115288 mainTemplate.renderAddModule(
115289 hash,
115290 chunk,
115291 "moduleId",
115292 "moreModules[moduleId]"
115293 )
115294 ),
115295 "}",
115296 "while(chunkIds.length)",
115297 Template.indent("installedChunks[chunkIds.pop()] = 1;")
115298 ]),
115299 "};"
115300 ]);
115301 }
115302 return source;
115303 }
115304 );
115305 mainTemplate.hooks.hotBootstrap.tap(
115306 "WebWorkerMainTemplatePlugin",
115307 (source, chunk, hash) => {
115308 const hotUpdateChunkFilename =
115309 mainTemplate.outputOptions.hotUpdateChunkFilename;
115310 const hotUpdateMainFilename =
115311 mainTemplate.outputOptions.hotUpdateMainFilename;
115312 const hotUpdateFunction = mainTemplate.outputOptions.hotUpdateFunction;
115313 const globalObject = mainTemplate.outputOptions.globalObject;
115314 const currentHotUpdateChunkFilename = mainTemplate.getAssetPath(
115315 JSON.stringify(hotUpdateChunkFilename),
115316 {
115317 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
115318 hashWithLength: length =>
115319 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
115320 chunk: {
115321 id: '" + chunkId + "'
115322 }
115323 }
115324 );
115325 const currentHotUpdateMainFilename = mainTemplate.getAssetPath(
115326 JSON.stringify(hotUpdateMainFilename),
115327 {
115328 hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
115329 hashWithLength: length =>
115330 `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`
115331 }
115332 );
115333
115334 return (
115335 source +
115336 "\n" +
115337 `var parentHotUpdateCallback = ${globalObject}[${JSON.stringify(
115338 hotUpdateFunction
115339 )}];\n` +
115340 `${globalObject}[${JSON.stringify(hotUpdateFunction)}] = ` +
115341 Template.getFunctionContent(
115342 __webpack_require__(72337)
115343 )
115344 .replace(/\/\/\$semicolon/g, ";")
115345 .replace(/\$require\$/g, mainTemplate.requireFn)
115346 .replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
115347 .replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
115348 .replace(/\$hash\$/g, JSON.stringify(hash))
115349 );
115350 }
115351 );
115352 mainTemplate.hooks.hash.tap("WebWorkerMainTemplatePlugin", hash => {
115353 hash.update("webworker");
115354 hash.update("4");
115355 });
115356 }
115357}
115358module.exports = WebWorkerMainTemplatePlugin;
115359
115360
115361/***/ }),
115362
115363/***/ 21328:
115364/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
115365
115366"use strict";
115367/*
115368 MIT License http://www.opensource.org/licenses/mit-license.php
115369 Author Tobias Koppers @sokra
115370*/
115371
115372
115373const WebWorkerMainTemplatePlugin = __webpack_require__(20482);
115374const WebWorkerChunkTemplatePlugin = __webpack_require__(37919);
115375const WebWorkerHotUpdateChunkTemplatePlugin = __webpack_require__(45493);
115376
115377class WebWorkerTemplatePlugin {
115378 apply(compiler) {
115379 compiler.hooks.thisCompilation.tap(
115380 "WebWorkerTemplatePlugin",
115381 compilation => {
115382 new WebWorkerMainTemplatePlugin().apply(compilation.mainTemplate);
115383 new WebWorkerChunkTemplatePlugin().apply(compilation.chunkTemplate);
115384 new WebWorkerHotUpdateChunkTemplatePlugin().apply(
115385 compilation.hotUpdateChunkTemplate
115386 );
115387 }
115388 );
115389 }
115390}
115391module.exports = WebWorkerTemplatePlugin;
115392
115393
115394/***/ }),
115395
115396/***/ 19728:
115397/***/ (function(__unused_webpack_module, exports) {
115398
115399"use strict";
115400
115401
115402Object.defineProperty(exports, "__esModule", ({
115403 value: true
115404}));
115405exports.cloneNode = cloneNode;
115406
115407function cloneNode(n) {
115408 // $FlowIgnore
115409 var newObj = {};
115410
115411 for (var k in n) {
115412 newObj[k] = n[k];
115413 }
115414
115415 return newObj;
115416}
115417
115418/***/ }),
115419
115420/***/ 81875:
115421/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
115422
115423"use strict";
115424
115425
115426Object.defineProperty(exports, "__esModule", ({
115427 value: true
115428}));
115429var _exportNames = {
115430 numberLiteralFromRaw: true,
115431 withLoc: true,
115432 withRaw: true,
115433 funcParam: true,
115434 indexLiteral: true,
115435 memIndexLiteral: true,
115436 instruction: true,
115437 objectInstruction: true,
115438 traverse: true,
115439 signatures: true,
115440 cloneNode: true
115441};
115442Object.defineProperty(exports, "numberLiteralFromRaw", ({
115443 enumerable: true,
115444 get: function get() {
115445 return _nodeHelpers.numberLiteralFromRaw;
115446 }
115447}));
115448Object.defineProperty(exports, "withLoc", ({
115449 enumerable: true,
115450 get: function get() {
115451 return _nodeHelpers.withLoc;
115452 }
115453}));
115454Object.defineProperty(exports, "withRaw", ({
115455 enumerable: true,
115456 get: function get() {
115457 return _nodeHelpers.withRaw;
115458 }
115459}));
115460Object.defineProperty(exports, "funcParam", ({
115461 enumerable: true,
115462 get: function get() {
115463 return _nodeHelpers.funcParam;
115464 }
115465}));
115466Object.defineProperty(exports, "indexLiteral", ({
115467 enumerable: true,
115468 get: function get() {
115469 return _nodeHelpers.indexLiteral;
115470 }
115471}));
115472Object.defineProperty(exports, "memIndexLiteral", ({
115473 enumerable: true,
115474 get: function get() {
115475 return _nodeHelpers.memIndexLiteral;
115476 }
115477}));
115478Object.defineProperty(exports, "instruction", ({
115479 enumerable: true,
115480 get: function get() {
115481 return _nodeHelpers.instruction;
115482 }
115483}));
115484Object.defineProperty(exports, "objectInstruction", ({
115485 enumerable: true,
115486 get: function get() {
115487 return _nodeHelpers.objectInstruction;
115488 }
115489}));
115490Object.defineProperty(exports, "traverse", ({
115491 enumerable: true,
115492 get: function get() {
115493 return _traverse.traverse;
115494 }
115495}));
115496Object.defineProperty(exports, "signatures", ({
115497 enumerable: true,
115498 get: function get() {
115499 return _signatures.signatures;
115500 }
115501}));
115502Object.defineProperty(exports, "cloneNode", ({
115503 enumerable: true,
115504 get: function get() {
115505 return _clone.cloneNode;
115506 }
115507}));
115508
115509var _nodes = __webpack_require__(94841);
115510
115511Object.keys(_nodes).forEach(function (key) {
115512 if (key === "default" || key === "__esModule") return;
115513 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
115514 Object.defineProperty(exports, key, {
115515 enumerable: true,
115516 get: function get() {
115517 return _nodes[key];
115518 }
115519 });
115520});
115521
115522var _nodeHelpers = __webpack_require__(1004);
115523
115524var _traverse = __webpack_require__(29436);
115525
115526var _signatures = __webpack_require__(77392);
115527
115528var _utils = __webpack_require__(38456);
115529
115530Object.keys(_utils).forEach(function (key) {
115531 if (key === "default" || key === "__esModule") return;
115532 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
115533 Object.defineProperty(exports, key, {
115534 enumerable: true,
115535 get: function get() {
115536 return _utils[key];
115537 }
115538 });
115539});
115540
115541var _clone = __webpack_require__(19728);
115542
115543/***/ }),
115544
115545/***/ 1004:
115546/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
115547
115548"use strict";
115549
115550
115551Object.defineProperty(exports, "__esModule", ({
115552 value: true
115553}));
115554exports.numberLiteralFromRaw = numberLiteralFromRaw;
115555exports.instruction = instruction;
115556exports.objectInstruction = objectInstruction;
115557exports.withLoc = withLoc;
115558exports.withRaw = withRaw;
115559exports.funcParam = funcParam;
115560exports.indexLiteral = indexLiteral;
115561exports.memIndexLiteral = memIndexLiteral;
115562
115563var _wastParser = __webpack_require__(9016);
115564
115565var _nodes = __webpack_require__(94841);
115566
115567function numberLiteralFromRaw(rawValue) {
115568 var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
115569 var original = rawValue; // Remove numeric separators _
115570
115571 if (typeof rawValue === "string") {
115572 rawValue = rawValue.replace(/_/g, "");
115573 }
115574
115575 if (typeof rawValue === "number") {
115576 return (0, _nodes.numberLiteral)(rawValue, String(original));
115577 } else {
115578 switch (instructionType) {
115579 case "i32":
115580 {
115581 return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
115582 }
115583
115584 case "u32":
115585 {
115586 return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
115587 }
115588
115589 case "i64":
115590 {
115591 return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
115592 }
115593
115594 case "f32":
115595 {
115596 return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
115597 }
115598 // f64
115599
115600 default:
115601 {
115602 return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
115603 }
115604 }
115605 }
115606}
115607
115608function instruction(id) {
115609 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
115610 var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
115611 return (0, _nodes.instr)(id, undefined, args, namedArgs);
115612}
115613
115614function objectInstruction(id, object) {
115615 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
115616 var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
115617 return (0, _nodes.instr)(id, object, args, namedArgs);
115618}
115619/**
115620 * Decorators
115621 */
115622
115623
115624function withLoc(n, end, start) {
115625 var loc = {
115626 start: start,
115627 end: end
115628 };
115629 n.loc = loc;
115630 return n;
115631}
115632
115633function withRaw(n, raw) {
115634 n.raw = raw;
115635 return n;
115636}
115637
115638function funcParam(valtype, id) {
115639 return {
115640 id: id,
115641 valtype: valtype
115642 };
115643}
115644
115645function indexLiteral(value) {
115646 // $FlowIgnore
115647 var x = numberLiteralFromRaw(value, "u32");
115648 return x;
115649}
115650
115651function memIndexLiteral(value) {
115652 // $FlowIgnore
115653 var x = numberLiteralFromRaw(value, "u32");
115654 return x;
115655}
115656
115657/***/ }),
115658
115659/***/ 89231:
115660/***/ (function(__unused_webpack_module, exports) {
115661
115662"use strict";
115663
115664
115665Object.defineProperty(exports, "__esModule", ({
115666 value: true
115667}));
115668exports.createPath = createPath;
115669
115670function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
115671
115672function findParent(_ref, cb) {
115673 var parentPath = _ref.parentPath;
115674
115675 if (parentPath == null) {
115676 throw new Error("node is root");
115677 }
115678
115679 var currentPath = parentPath;
115680
115681 while (cb(currentPath) !== false) {
115682 // Hit the root node, stop
115683 // $FlowIgnore
115684 if (currentPath.parentPath == null) {
115685 return null;
115686 } // $FlowIgnore
115687
115688
115689 currentPath = currentPath.parentPath;
115690 }
115691
115692 return currentPath.node;
115693}
115694
115695function insertBefore(context, newNode) {
115696 return insert(context, newNode);
115697}
115698
115699function insertAfter(context, newNode) {
115700 return insert(context, newNode, 1);
115701}
115702
115703function insert(_ref2, newNode) {
115704 var node = _ref2.node,
115705 inList = _ref2.inList,
115706 parentPath = _ref2.parentPath,
115707 parentKey = _ref2.parentKey;
115708 var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
115709
115710 if (!inList) {
115711 throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || 0));
115712 }
115713
115714 if (!(parentPath != null)) {
115715 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
115716 }
115717
115718 // $FlowIgnore
115719 var parentList = parentPath.node[parentKey];
115720 var indexInList = parentList.findIndex(function (n) {
115721 return n === node;
115722 });
115723 parentList.splice(indexInList + indexOffset, 0, newNode);
115724}
115725
115726function remove(_ref3) {
115727 var node = _ref3.node,
115728 parentKey = _ref3.parentKey,
115729 parentPath = _ref3.parentPath;
115730
115731 if (!(parentPath != null)) {
115732 throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || 0));
115733 }
115734
115735 // $FlowIgnore
115736 var parentNode = parentPath.node; // $FlowIgnore
115737
115738 var parentProperty = parentNode[parentKey];
115739
115740 if (Array.isArray(parentProperty)) {
115741 // $FlowIgnore
115742 parentNode[parentKey] = parentProperty.filter(function (n) {
115743 return n !== node;
115744 });
115745 } else {
115746 // $FlowIgnore
115747 delete parentNode[parentKey];
115748 }
115749
115750 node._deleted = true;
115751}
115752
115753function stop(context) {
115754 context.shouldStop = true;
115755}
115756
115757function replaceWith(context, newNode) {
115758 // $FlowIgnore
115759 var parentNode = context.parentPath.node; // $FlowIgnore
115760
115761 var parentProperty = parentNode[context.parentKey];
115762
115763 if (Array.isArray(parentProperty)) {
115764 var indexInList = parentProperty.findIndex(function (n) {
115765 return n === context.node;
115766 });
115767 parentProperty.splice(indexInList, 1, newNode);
115768 } else {
115769 // $FlowIgnore
115770 parentNode[context.parentKey] = newNode;
115771 }
115772
115773 context.node._deleted = true;
115774 context.node = newNode;
115775} // bind the context to the first argument of node operations
115776
115777
115778function bindNodeOperations(operations, context) {
115779 var keys = Object.keys(operations);
115780 var boundOperations = {};
115781 keys.forEach(function (key) {
115782 boundOperations[key] = operations[key].bind(null, context);
115783 });
115784 return boundOperations;
115785}
115786
115787function createPathOperations(context) {
115788 // $FlowIgnore
115789 return bindNodeOperations({
115790 findParent: findParent,
115791 replaceWith: replaceWith,
115792 remove: remove,
115793 insertBefore: insertBefore,
115794 insertAfter: insertAfter,
115795 stop: stop
115796 }, context);
115797}
115798
115799function createPath(context) {
115800 var path = _extends({}, context); // $FlowIgnore
115801
115802
115803 Object.assign(path, createPathOperations(path)); // $FlowIgnore
115804
115805 return path;
115806}
115807
115808/***/ }),
115809
115810/***/ 94841:
115811/***/ (function(__unused_webpack_module, exports) {
115812
115813"use strict";
115814
115815
115816Object.defineProperty(exports, "__esModule", ({
115817 value: true
115818}));
115819exports.module = _module;
115820exports.moduleMetadata = moduleMetadata;
115821exports.moduleNameMetadata = moduleNameMetadata;
115822exports.functionNameMetadata = functionNameMetadata;
115823exports.localNameMetadata = localNameMetadata;
115824exports.binaryModule = binaryModule;
115825exports.quoteModule = quoteModule;
115826exports.sectionMetadata = sectionMetadata;
115827exports.producersSectionMetadata = producersSectionMetadata;
115828exports.producerMetadata = producerMetadata;
115829exports.producerMetadataVersionedName = producerMetadataVersionedName;
115830exports.loopInstruction = loopInstruction;
115831exports.instr = instr;
115832exports.ifInstruction = ifInstruction;
115833exports.stringLiteral = stringLiteral;
115834exports.numberLiteral = numberLiteral;
115835exports.longNumberLiteral = longNumberLiteral;
115836exports.floatLiteral = floatLiteral;
115837exports.elem = elem;
115838exports.indexInFuncSection = indexInFuncSection;
115839exports.valtypeLiteral = valtypeLiteral;
115840exports.typeInstruction = typeInstruction;
115841exports.start = start;
115842exports.globalType = globalType;
115843exports.leadingComment = leadingComment;
115844exports.blockComment = blockComment;
115845exports.data = data;
115846exports.global = global;
115847exports.table = table;
115848exports.memory = memory;
115849exports.funcImportDescr = funcImportDescr;
115850exports.moduleImport = moduleImport;
115851exports.moduleExportDescr = moduleExportDescr;
115852exports.moduleExport = moduleExport;
115853exports.limit = limit;
115854exports.signature = signature;
115855exports.program = program;
115856exports.identifier = identifier;
115857exports.blockInstruction = blockInstruction;
115858exports.callInstruction = callInstruction;
115859exports.callIndirectInstruction = callIndirectInstruction;
115860exports.byteArray = byteArray;
115861exports.func = func;
115862exports.internalBrUnless = internalBrUnless;
115863exports.internalGoto = internalGoto;
115864exports.internalCallExtern = internalCallExtern;
115865exports.internalEndAndReturn = internalEndAndReturn;
115866exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
115867exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
115868
115869function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
115870
115871// THIS FILE IS AUTOGENERATED
115872// see scripts/generateNodeUtils.js
115873function isTypeOf(t) {
115874 return function (n) {
115875 return n.type === t;
115876 };
115877}
115878
115879function assertTypeOf(t) {
115880 return function (n) {
115881 return function () {
115882 if (!(n.type === t)) {
115883 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
115884 }
115885 }();
115886 };
115887}
115888
115889function _module(id, fields, metadata) {
115890 if (id !== null && id !== undefined) {
115891 if (!(typeof id === "string")) {
115892 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
115893 }
115894 }
115895
115896 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
115897 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
115898 }
115899
115900 var node = {
115901 type: "Module",
115902 id: id,
115903 fields: fields
115904 };
115905
115906 if (typeof metadata !== "undefined") {
115907 node.metadata = metadata;
115908 }
115909
115910 return node;
115911}
115912
115913function moduleMetadata(sections, functionNames, localNames, producers) {
115914 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
115915 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
115916 }
115917
115918 if (functionNames !== null && functionNames !== undefined) {
115919 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
115920 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
115921 }
115922 }
115923
115924 if (localNames !== null && localNames !== undefined) {
115925 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
115926 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
115927 }
115928 }
115929
115930 if (producers !== null && producers !== undefined) {
115931 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
115932 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
115933 }
115934 }
115935
115936 var node = {
115937 type: "ModuleMetadata",
115938 sections: sections
115939 };
115940
115941 if (typeof functionNames !== "undefined" && functionNames.length > 0) {
115942 node.functionNames = functionNames;
115943 }
115944
115945 if (typeof localNames !== "undefined" && localNames.length > 0) {
115946 node.localNames = localNames;
115947 }
115948
115949 if (typeof producers !== "undefined" && producers.length > 0) {
115950 node.producers = producers;
115951 }
115952
115953 return node;
115954}
115955
115956function moduleNameMetadata(value) {
115957 if (!(typeof value === "string")) {
115958 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
115959 }
115960
115961 var node = {
115962 type: "ModuleNameMetadata",
115963 value: value
115964 };
115965 return node;
115966}
115967
115968function functionNameMetadata(value, index) {
115969 if (!(typeof value === "string")) {
115970 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
115971 }
115972
115973 if (!(typeof index === "number")) {
115974 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || 0));
115975 }
115976
115977 var node = {
115978 type: "FunctionNameMetadata",
115979 value: value,
115980 index: index
115981 };
115982 return node;
115983}
115984
115985function localNameMetadata(value, localIndex, functionIndex) {
115986 if (!(typeof value === "string")) {
115987 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
115988 }
115989
115990 if (!(typeof localIndex === "number")) {
115991 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || 0));
115992 }
115993
115994 if (!(typeof functionIndex === "number")) {
115995 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || 0));
115996 }
115997
115998 var node = {
115999 type: "LocalNameMetadata",
116000 value: value,
116001 localIndex: localIndex,
116002 functionIndex: functionIndex
116003 };
116004 return node;
116005}
116006
116007function binaryModule(id, blob) {
116008 if (id !== null && id !== undefined) {
116009 if (!(typeof id === "string")) {
116010 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
116011 }
116012 }
116013
116014 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
116015 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
116016 }
116017
116018 var node = {
116019 type: "BinaryModule",
116020 id: id,
116021 blob: blob
116022 };
116023 return node;
116024}
116025
116026function quoteModule(id, string) {
116027 if (id !== null && id !== undefined) {
116028 if (!(typeof id === "string")) {
116029 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
116030 }
116031 }
116032
116033 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
116034 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
116035 }
116036
116037 var node = {
116038 type: "QuoteModule",
116039 id: id,
116040 string: string
116041 };
116042 return node;
116043}
116044
116045function sectionMetadata(section, startOffset, size, vectorOfSize) {
116046 if (!(typeof startOffset === "number")) {
116047 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || 0));
116048 }
116049
116050 var node = {
116051 type: "SectionMetadata",
116052 section: section,
116053 startOffset: startOffset,
116054 size: size,
116055 vectorOfSize: vectorOfSize
116056 };
116057 return node;
116058}
116059
116060function producersSectionMetadata(producers) {
116061 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
116062 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
116063 }
116064
116065 var node = {
116066 type: "ProducersSectionMetadata",
116067 producers: producers
116068 };
116069 return node;
116070}
116071
116072function producerMetadata(language, processedBy, sdk) {
116073 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
116074 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
116075 }
116076
116077 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
116078 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
116079 }
116080
116081 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
116082 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
116083 }
116084
116085 var node = {
116086 type: "ProducerMetadata",
116087 language: language,
116088 processedBy: processedBy,
116089 sdk: sdk
116090 };
116091 return node;
116092}
116093
116094function producerMetadataVersionedName(name, version) {
116095 if (!(typeof name === "string")) {
116096 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
116097 }
116098
116099 if (!(typeof version === "string")) {
116100 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || 0));
116101 }
116102
116103 var node = {
116104 type: "ProducerMetadataVersionedName",
116105 name: name,
116106 version: version
116107 };
116108 return node;
116109}
116110
116111function loopInstruction(label, resulttype, instr) {
116112 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
116113 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
116114 }
116115
116116 var node = {
116117 type: "LoopInstruction",
116118 id: "loop",
116119 label: label,
116120 resulttype: resulttype,
116121 instr: instr
116122 };
116123 return node;
116124}
116125
116126function instr(id, object, args, namedArgs) {
116127 if (!(typeof id === "string")) {
116128 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || 0));
116129 }
116130
116131 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
116132 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
116133 }
116134
116135 var node = {
116136 type: "Instr",
116137 id: id,
116138 args: args
116139 };
116140
116141 if (typeof object !== "undefined") {
116142 node.object = object;
116143 }
116144
116145 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
116146 node.namedArgs = namedArgs;
116147 }
116148
116149 return node;
116150}
116151
116152function ifInstruction(testLabel, test, result, consequent, alternate) {
116153 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
116154 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
116155 }
116156
116157 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
116158 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
116159 }
116160
116161 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
116162 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
116163 }
116164
116165 var node = {
116166 type: "IfInstruction",
116167 id: "if",
116168 testLabel: testLabel,
116169 test: test,
116170 result: result,
116171 consequent: consequent,
116172 alternate: alternate
116173 };
116174 return node;
116175}
116176
116177function stringLiteral(value) {
116178 if (!(typeof value === "string")) {
116179 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
116180 }
116181
116182 var node = {
116183 type: "StringLiteral",
116184 value: value
116185 };
116186 return node;
116187}
116188
116189function numberLiteral(value, raw) {
116190 if (!(typeof value === "number")) {
116191 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
116192 }
116193
116194 if (!(typeof raw === "string")) {
116195 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
116196 }
116197
116198 var node = {
116199 type: "NumberLiteral",
116200 value: value,
116201 raw: raw
116202 };
116203 return node;
116204}
116205
116206function longNumberLiteral(value, raw) {
116207 if (!(typeof raw === "string")) {
116208 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
116209 }
116210
116211 var node = {
116212 type: "LongNumberLiteral",
116213 value: value,
116214 raw: raw
116215 };
116216 return node;
116217}
116218
116219function floatLiteral(value, nan, inf, raw) {
116220 if (!(typeof value === "number")) {
116221 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || 0));
116222 }
116223
116224 if (nan !== null && nan !== undefined) {
116225 if (!(typeof nan === "boolean")) {
116226 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || 0));
116227 }
116228 }
116229
116230 if (inf !== null && inf !== undefined) {
116231 if (!(typeof inf === "boolean")) {
116232 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || 0));
116233 }
116234 }
116235
116236 if (!(typeof raw === "string")) {
116237 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
116238 }
116239
116240 var node = {
116241 type: "FloatLiteral",
116242 value: value,
116243 raw: raw
116244 };
116245
116246 if (nan === true) {
116247 node.nan = true;
116248 }
116249
116250 if (inf === true) {
116251 node.inf = true;
116252 }
116253
116254 return node;
116255}
116256
116257function elem(table, offset, funcs) {
116258 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
116259 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
116260 }
116261
116262 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
116263 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
116264 }
116265
116266 var node = {
116267 type: "Elem",
116268 table: table,
116269 offset: offset,
116270 funcs: funcs
116271 };
116272 return node;
116273}
116274
116275function indexInFuncSection(index) {
116276 var node = {
116277 type: "IndexInFuncSection",
116278 index: index
116279 };
116280 return node;
116281}
116282
116283function valtypeLiteral(name) {
116284 var node = {
116285 type: "ValtypeLiteral",
116286 name: name
116287 };
116288 return node;
116289}
116290
116291function typeInstruction(id, functype) {
116292 var node = {
116293 type: "TypeInstruction",
116294 id: id,
116295 functype: functype
116296 };
116297 return node;
116298}
116299
116300function start(index) {
116301 var node = {
116302 type: "Start",
116303 index: index
116304 };
116305 return node;
116306}
116307
116308function globalType(valtype, mutability) {
116309 var node = {
116310 type: "GlobalType",
116311 valtype: valtype,
116312 mutability: mutability
116313 };
116314 return node;
116315}
116316
116317function leadingComment(value) {
116318 if (!(typeof value === "string")) {
116319 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
116320 }
116321
116322 var node = {
116323 type: "LeadingComment",
116324 value: value
116325 };
116326 return node;
116327}
116328
116329function blockComment(value) {
116330 if (!(typeof value === "string")) {
116331 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
116332 }
116333
116334 var node = {
116335 type: "BlockComment",
116336 value: value
116337 };
116338 return node;
116339}
116340
116341function data(memoryIndex, offset, init) {
116342 var node = {
116343 type: "Data",
116344 memoryIndex: memoryIndex,
116345 offset: offset,
116346 init: init
116347 };
116348 return node;
116349}
116350
116351function global(globalType, init, name) {
116352 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
116353 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
116354 }
116355
116356 var node = {
116357 type: "Global",
116358 globalType: globalType,
116359 init: init,
116360 name: name
116361 };
116362 return node;
116363}
116364
116365function table(elementType, limits, name, elements) {
116366 if (!(limits.type === "Limit")) {
116367 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || 0));
116368 }
116369
116370 if (elements !== null && elements !== undefined) {
116371 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
116372 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
116373 }
116374 }
116375
116376 var node = {
116377 type: "Table",
116378 elementType: elementType,
116379 limits: limits,
116380 name: name
116381 };
116382
116383 if (typeof elements !== "undefined" && elements.length > 0) {
116384 node.elements = elements;
116385 }
116386
116387 return node;
116388}
116389
116390function memory(limits, id) {
116391 var node = {
116392 type: "Memory",
116393 limits: limits,
116394 id: id
116395 };
116396 return node;
116397}
116398
116399function funcImportDescr(id, signature) {
116400 var node = {
116401 type: "FuncImportDescr",
116402 id: id,
116403 signature: signature
116404 };
116405 return node;
116406}
116407
116408function moduleImport(module, name, descr) {
116409 if (!(typeof module === "string")) {
116410 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || 0));
116411 }
116412
116413 if (!(typeof name === "string")) {
116414 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
116415 }
116416
116417 var node = {
116418 type: "ModuleImport",
116419 module: module,
116420 name: name,
116421 descr: descr
116422 };
116423 return node;
116424}
116425
116426function moduleExportDescr(exportType, id) {
116427 var node = {
116428 type: "ModuleExportDescr",
116429 exportType: exportType,
116430 id: id
116431 };
116432 return node;
116433}
116434
116435function moduleExport(name, descr) {
116436 if (!(typeof name === "string")) {
116437 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || 0));
116438 }
116439
116440 var node = {
116441 type: "ModuleExport",
116442 name: name,
116443 descr: descr
116444 };
116445 return node;
116446}
116447
116448function limit(min, max) {
116449 if (!(typeof min === "number")) {
116450 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || 0));
116451 }
116452
116453 if (max !== null && max !== undefined) {
116454 if (!(typeof max === "number")) {
116455 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || 0));
116456 }
116457 }
116458
116459 var node = {
116460 type: "Limit",
116461 min: min
116462 };
116463
116464 if (typeof max !== "undefined") {
116465 node.max = max;
116466 }
116467
116468 return node;
116469}
116470
116471function signature(params, results) {
116472 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
116473 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
116474 }
116475
116476 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
116477 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
116478 }
116479
116480 var node = {
116481 type: "Signature",
116482 params: params,
116483 results: results
116484 };
116485 return node;
116486}
116487
116488function program(body) {
116489 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
116490 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
116491 }
116492
116493 var node = {
116494 type: "Program",
116495 body: body
116496 };
116497 return node;
116498}
116499
116500function identifier(value, raw) {
116501 if (!(typeof value === "string")) {
116502 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || 0));
116503 }
116504
116505 if (raw !== null && raw !== undefined) {
116506 if (!(typeof raw === "string")) {
116507 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || 0));
116508 }
116509 }
116510
116511 var node = {
116512 type: "Identifier",
116513 value: value
116514 };
116515
116516 if (typeof raw !== "undefined") {
116517 node.raw = raw;
116518 }
116519
116520 return node;
116521}
116522
116523function blockInstruction(label, instr, result) {
116524 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
116525 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
116526 }
116527
116528 var node = {
116529 type: "BlockInstruction",
116530 id: "block",
116531 label: label,
116532 instr: instr,
116533 result: result
116534 };
116535 return node;
116536}
116537
116538function callInstruction(index, instrArgs, numeric) {
116539 if (instrArgs !== null && instrArgs !== undefined) {
116540 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
116541 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
116542 }
116543 }
116544
116545 var node = {
116546 type: "CallInstruction",
116547 id: "call",
116548 index: index
116549 };
116550
116551 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
116552 node.instrArgs = instrArgs;
116553 }
116554
116555 if (typeof numeric !== "undefined") {
116556 node.numeric = numeric;
116557 }
116558
116559 return node;
116560}
116561
116562function callIndirectInstruction(signature, intrs) {
116563 if (intrs !== null && intrs !== undefined) {
116564 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
116565 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
116566 }
116567 }
116568
116569 var node = {
116570 type: "CallIndirectInstruction",
116571 id: "call_indirect",
116572 signature: signature
116573 };
116574
116575 if (typeof intrs !== "undefined" && intrs.length > 0) {
116576 node.intrs = intrs;
116577 }
116578
116579 return node;
116580}
116581
116582function byteArray(values) {
116583 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
116584 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
116585 }
116586
116587 var node = {
116588 type: "ByteArray",
116589 values: values
116590 };
116591 return node;
116592}
116593
116594function func(name, signature, body, isExternal, metadata) {
116595 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
116596 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
116597 }
116598
116599 if (isExternal !== null && isExternal !== undefined) {
116600 if (!(typeof isExternal === "boolean")) {
116601 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || 0));
116602 }
116603 }
116604
116605 var node = {
116606 type: "Func",
116607 name: name,
116608 signature: signature,
116609 body: body
116610 };
116611
116612 if (isExternal === true) {
116613 node.isExternal = true;
116614 }
116615
116616 if (typeof metadata !== "undefined") {
116617 node.metadata = metadata;
116618 }
116619
116620 return node;
116621}
116622
116623function internalBrUnless(target) {
116624 if (!(typeof target === "number")) {
116625 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
116626 }
116627
116628 var node = {
116629 type: "InternalBrUnless",
116630 target: target
116631 };
116632 return node;
116633}
116634
116635function internalGoto(target) {
116636 if (!(typeof target === "number")) {
116637 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
116638 }
116639
116640 var node = {
116641 type: "InternalGoto",
116642 target: target
116643 };
116644 return node;
116645}
116646
116647function internalCallExtern(target) {
116648 if (!(typeof target === "number")) {
116649 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || 0));
116650 }
116651
116652 var node = {
116653 type: "InternalCallExtern",
116654 target: target
116655 };
116656 return node;
116657}
116658
116659function internalEndAndReturn() {
116660 var node = {
116661 type: "InternalEndAndReturn"
116662 };
116663 return node;
116664}
116665
116666var isModule = isTypeOf("Module");
116667exports.isModule = isModule;
116668var isModuleMetadata = isTypeOf("ModuleMetadata");
116669exports.isModuleMetadata = isModuleMetadata;
116670var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
116671exports.isModuleNameMetadata = isModuleNameMetadata;
116672var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
116673exports.isFunctionNameMetadata = isFunctionNameMetadata;
116674var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
116675exports.isLocalNameMetadata = isLocalNameMetadata;
116676var isBinaryModule = isTypeOf("BinaryModule");
116677exports.isBinaryModule = isBinaryModule;
116678var isQuoteModule = isTypeOf("QuoteModule");
116679exports.isQuoteModule = isQuoteModule;
116680var isSectionMetadata = isTypeOf("SectionMetadata");
116681exports.isSectionMetadata = isSectionMetadata;
116682var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
116683exports.isProducersSectionMetadata = isProducersSectionMetadata;
116684var isProducerMetadata = isTypeOf("ProducerMetadata");
116685exports.isProducerMetadata = isProducerMetadata;
116686var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
116687exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
116688var isLoopInstruction = isTypeOf("LoopInstruction");
116689exports.isLoopInstruction = isLoopInstruction;
116690var isInstr = isTypeOf("Instr");
116691exports.isInstr = isInstr;
116692var isIfInstruction = isTypeOf("IfInstruction");
116693exports.isIfInstruction = isIfInstruction;
116694var isStringLiteral = isTypeOf("StringLiteral");
116695exports.isStringLiteral = isStringLiteral;
116696var isNumberLiteral = isTypeOf("NumberLiteral");
116697exports.isNumberLiteral = isNumberLiteral;
116698var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
116699exports.isLongNumberLiteral = isLongNumberLiteral;
116700var isFloatLiteral = isTypeOf("FloatLiteral");
116701exports.isFloatLiteral = isFloatLiteral;
116702var isElem = isTypeOf("Elem");
116703exports.isElem = isElem;
116704var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
116705exports.isIndexInFuncSection = isIndexInFuncSection;
116706var isValtypeLiteral = isTypeOf("ValtypeLiteral");
116707exports.isValtypeLiteral = isValtypeLiteral;
116708var isTypeInstruction = isTypeOf("TypeInstruction");
116709exports.isTypeInstruction = isTypeInstruction;
116710var isStart = isTypeOf("Start");
116711exports.isStart = isStart;
116712var isGlobalType = isTypeOf("GlobalType");
116713exports.isGlobalType = isGlobalType;
116714var isLeadingComment = isTypeOf("LeadingComment");
116715exports.isLeadingComment = isLeadingComment;
116716var isBlockComment = isTypeOf("BlockComment");
116717exports.isBlockComment = isBlockComment;
116718var isData = isTypeOf("Data");
116719exports.isData = isData;
116720var isGlobal = isTypeOf("Global");
116721exports.isGlobal = isGlobal;
116722var isTable = isTypeOf("Table");
116723exports.isTable = isTable;
116724var isMemory = isTypeOf("Memory");
116725exports.isMemory = isMemory;
116726var isFuncImportDescr = isTypeOf("FuncImportDescr");
116727exports.isFuncImportDescr = isFuncImportDescr;
116728var isModuleImport = isTypeOf("ModuleImport");
116729exports.isModuleImport = isModuleImport;
116730var isModuleExportDescr = isTypeOf("ModuleExportDescr");
116731exports.isModuleExportDescr = isModuleExportDescr;
116732var isModuleExport = isTypeOf("ModuleExport");
116733exports.isModuleExport = isModuleExport;
116734var isLimit = isTypeOf("Limit");
116735exports.isLimit = isLimit;
116736var isSignature = isTypeOf("Signature");
116737exports.isSignature = isSignature;
116738var isProgram = isTypeOf("Program");
116739exports.isProgram = isProgram;
116740var isIdentifier = isTypeOf("Identifier");
116741exports.isIdentifier = isIdentifier;
116742var isBlockInstruction = isTypeOf("BlockInstruction");
116743exports.isBlockInstruction = isBlockInstruction;
116744var isCallInstruction = isTypeOf("CallInstruction");
116745exports.isCallInstruction = isCallInstruction;
116746var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
116747exports.isCallIndirectInstruction = isCallIndirectInstruction;
116748var isByteArray = isTypeOf("ByteArray");
116749exports.isByteArray = isByteArray;
116750var isFunc = isTypeOf("Func");
116751exports.isFunc = isFunc;
116752var isInternalBrUnless = isTypeOf("InternalBrUnless");
116753exports.isInternalBrUnless = isInternalBrUnless;
116754var isInternalGoto = isTypeOf("InternalGoto");
116755exports.isInternalGoto = isInternalGoto;
116756var isInternalCallExtern = isTypeOf("InternalCallExtern");
116757exports.isInternalCallExtern = isInternalCallExtern;
116758var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
116759exports.isInternalEndAndReturn = isInternalEndAndReturn;
116760
116761var isNode = function isNode(node) {
116762 return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
116763};
116764
116765exports.isNode = isNode;
116766
116767var isBlock = function isBlock(node) {
116768 return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
116769};
116770
116771exports.isBlock = isBlock;
116772
116773var isInstruction = function isInstruction(node) {
116774 return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
116775};
116776
116777exports.isInstruction = isInstruction;
116778
116779var isExpression = function isExpression(node) {
116780 return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
116781};
116782
116783exports.isExpression = isExpression;
116784
116785var isNumericLiteral = function isNumericLiteral(node) {
116786 return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
116787};
116788
116789exports.isNumericLiteral = isNumericLiteral;
116790
116791var isImportDescr = function isImportDescr(node) {
116792 return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
116793};
116794
116795exports.isImportDescr = isImportDescr;
116796
116797var isIntrinsic = function isIntrinsic(node) {
116798 return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
116799};
116800
116801exports.isIntrinsic = isIntrinsic;
116802var assertModule = assertTypeOf("Module");
116803exports.assertModule = assertModule;
116804var assertModuleMetadata = assertTypeOf("ModuleMetadata");
116805exports.assertModuleMetadata = assertModuleMetadata;
116806var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
116807exports.assertModuleNameMetadata = assertModuleNameMetadata;
116808var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
116809exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
116810var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
116811exports.assertLocalNameMetadata = assertLocalNameMetadata;
116812var assertBinaryModule = assertTypeOf("BinaryModule");
116813exports.assertBinaryModule = assertBinaryModule;
116814var assertQuoteModule = assertTypeOf("QuoteModule");
116815exports.assertQuoteModule = assertQuoteModule;
116816var assertSectionMetadata = assertTypeOf("SectionMetadata");
116817exports.assertSectionMetadata = assertSectionMetadata;
116818var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
116819exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
116820var assertProducerMetadata = assertTypeOf("ProducerMetadata");
116821exports.assertProducerMetadata = assertProducerMetadata;
116822var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
116823exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
116824var assertLoopInstruction = assertTypeOf("LoopInstruction");
116825exports.assertLoopInstruction = assertLoopInstruction;
116826var assertInstr = assertTypeOf("Instr");
116827exports.assertInstr = assertInstr;
116828var assertIfInstruction = assertTypeOf("IfInstruction");
116829exports.assertIfInstruction = assertIfInstruction;
116830var assertStringLiteral = assertTypeOf("StringLiteral");
116831exports.assertStringLiteral = assertStringLiteral;
116832var assertNumberLiteral = assertTypeOf("NumberLiteral");
116833exports.assertNumberLiteral = assertNumberLiteral;
116834var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
116835exports.assertLongNumberLiteral = assertLongNumberLiteral;
116836var assertFloatLiteral = assertTypeOf("FloatLiteral");
116837exports.assertFloatLiteral = assertFloatLiteral;
116838var assertElem = assertTypeOf("Elem");
116839exports.assertElem = assertElem;
116840var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
116841exports.assertIndexInFuncSection = assertIndexInFuncSection;
116842var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
116843exports.assertValtypeLiteral = assertValtypeLiteral;
116844var assertTypeInstruction = assertTypeOf("TypeInstruction");
116845exports.assertTypeInstruction = assertTypeInstruction;
116846var assertStart = assertTypeOf("Start");
116847exports.assertStart = assertStart;
116848var assertGlobalType = assertTypeOf("GlobalType");
116849exports.assertGlobalType = assertGlobalType;
116850var assertLeadingComment = assertTypeOf("LeadingComment");
116851exports.assertLeadingComment = assertLeadingComment;
116852var assertBlockComment = assertTypeOf("BlockComment");
116853exports.assertBlockComment = assertBlockComment;
116854var assertData = assertTypeOf("Data");
116855exports.assertData = assertData;
116856var assertGlobal = assertTypeOf("Global");
116857exports.assertGlobal = assertGlobal;
116858var assertTable = assertTypeOf("Table");
116859exports.assertTable = assertTable;
116860var assertMemory = assertTypeOf("Memory");
116861exports.assertMemory = assertMemory;
116862var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
116863exports.assertFuncImportDescr = assertFuncImportDescr;
116864var assertModuleImport = assertTypeOf("ModuleImport");
116865exports.assertModuleImport = assertModuleImport;
116866var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
116867exports.assertModuleExportDescr = assertModuleExportDescr;
116868var assertModuleExport = assertTypeOf("ModuleExport");
116869exports.assertModuleExport = assertModuleExport;
116870var assertLimit = assertTypeOf("Limit");
116871exports.assertLimit = assertLimit;
116872var assertSignature = assertTypeOf("Signature");
116873exports.assertSignature = assertSignature;
116874var assertProgram = assertTypeOf("Program");
116875exports.assertProgram = assertProgram;
116876var assertIdentifier = assertTypeOf("Identifier");
116877exports.assertIdentifier = assertIdentifier;
116878var assertBlockInstruction = assertTypeOf("BlockInstruction");
116879exports.assertBlockInstruction = assertBlockInstruction;
116880var assertCallInstruction = assertTypeOf("CallInstruction");
116881exports.assertCallInstruction = assertCallInstruction;
116882var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
116883exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
116884var assertByteArray = assertTypeOf("ByteArray");
116885exports.assertByteArray = assertByteArray;
116886var assertFunc = assertTypeOf("Func");
116887exports.assertFunc = assertFunc;
116888var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
116889exports.assertInternalBrUnless = assertInternalBrUnless;
116890var assertInternalGoto = assertTypeOf("InternalGoto");
116891exports.assertInternalGoto = assertInternalGoto;
116892var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
116893exports.assertInternalCallExtern = assertInternalCallExtern;
116894var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
116895exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
116896var unionTypesMap = {
116897 Module: ["Node"],
116898 ModuleMetadata: ["Node"],
116899 ModuleNameMetadata: ["Node"],
116900 FunctionNameMetadata: ["Node"],
116901 LocalNameMetadata: ["Node"],
116902 BinaryModule: ["Node"],
116903 QuoteModule: ["Node"],
116904 SectionMetadata: ["Node"],
116905 ProducersSectionMetadata: ["Node"],
116906 ProducerMetadata: ["Node"],
116907 ProducerMetadataVersionedName: ["Node"],
116908 LoopInstruction: ["Node", "Block", "Instruction"],
116909 Instr: ["Node", "Expression", "Instruction"],
116910 IfInstruction: ["Node", "Instruction"],
116911 StringLiteral: ["Node", "Expression"],
116912 NumberLiteral: ["Node", "NumericLiteral", "Expression"],
116913 LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
116914 FloatLiteral: ["Node", "NumericLiteral", "Expression"],
116915 Elem: ["Node"],
116916 IndexInFuncSection: ["Node"],
116917 ValtypeLiteral: ["Node", "Expression"],
116918 TypeInstruction: ["Node", "Instruction"],
116919 Start: ["Node"],
116920 GlobalType: ["Node", "ImportDescr"],
116921 LeadingComment: ["Node"],
116922 BlockComment: ["Node"],
116923 Data: ["Node"],
116924 Global: ["Node"],
116925 Table: ["Node", "ImportDescr"],
116926 Memory: ["Node", "ImportDescr"],
116927 FuncImportDescr: ["Node", "ImportDescr"],
116928 ModuleImport: ["Node"],
116929 ModuleExportDescr: ["Node"],
116930 ModuleExport: ["Node"],
116931 Limit: ["Node"],
116932 Signature: ["Node"],
116933 Program: ["Node"],
116934 Identifier: ["Node", "Expression"],
116935 BlockInstruction: ["Node", "Block", "Instruction"],
116936 CallInstruction: ["Node", "Instruction"],
116937 CallIndirectInstruction: ["Node", "Instruction"],
116938 ByteArray: ["Node"],
116939 Func: ["Node", "Block"],
116940 InternalBrUnless: ["Node", "Intrinsic"],
116941 InternalGoto: ["Node", "Intrinsic"],
116942 InternalCallExtern: ["Node", "Intrinsic"],
116943 InternalEndAndReturn: ["Node", "Intrinsic"]
116944};
116945exports.unionTypesMap = unionTypesMap;
116946var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
116947exports.nodeAndUnionTypes = nodeAndUnionTypes;
116948
116949/***/ }),
116950
116951/***/ 77392:
116952/***/ (function(__unused_webpack_module, exports) {
116953
116954"use strict";
116955
116956
116957Object.defineProperty(exports, "__esModule", ({
116958 value: true
116959}));
116960exports.signatures = void 0;
116961
116962function sign(input, output) {
116963 return [input, output];
116964}
116965
116966var u32 = "u32";
116967var i32 = "i32";
116968var i64 = "i64";
116969var f32 = "f32";
116970var f64 = "f64";
116971
116972var vector = function vector(t) {
116973 var vecType = [t]; // $FlowIgnore
116974
116975 vecType.vector = true;
116976 return vecType;
116977};
116978
116979var controlInstructions = {
116980 unreachable: sign([], []),
116981 nop: sign([], []),
116982 // block ?
116983 // loop ?
116984 // if ?
116985 // if else ?
116986 br: sign([u32], []),
116987 br_if: sign([u32], []),
116988 br_table: sign(vector(u32), []),
116989 return: sign([], []),
116990 call: sign([u32], []),
116991 call_indirect: sign([u32], [])
116992};
116993var parametricInstructions = {
116994 drop: sign([], []),
116995 select: sign([], [])
116996};
116997var variableInstructions = {
116998 get_local: sign([u32], []),
116999 set_local: sign([u32], []),
117000 tee_local: sign([u32], []),
117001 get_global: sign([u32], []),
117002 set_global: sign([u32], [])
117003};
117004var memoryInstructions = {
117005 "i32.load": sign([u32, u32], [i32]),
117006 "i64.load": sign([u32, u32], []),
117007 "f32.load": sign([u32, u32], []),
117008 "f64.load": sign([u32, u32], []),
117009 "i32.load8_s": sign([u32, u32], [i32]),
117010 "i32.load8_u": sign([u32, u32], [i32]),
117011 "i32.load16_s": sign([u32, u32], [i32]),
117012 "i32.load16_u": sign([u32, u32], [i32]),
117013 "i64.load8_s": sign([u32, u32], [i64]),
117014 "i64.load8_u": sign([u32, u32], [i64]),
117015 "i64.load16_s": sign([u32, u32], [i64]),
117016 "i64.load16_u": sign([u32, u32], [i64]),
117017 "i64.load32_s": sign([u32, u32], [i64]),
117018 "i64.load32_u": sign([u32, u32], [i64]),
117019 "i32.store": sign([u32, u32], []),
117020 "i64.store": sign([u32, u32], []),
117021 "f32.store": sign([u32, u32], []),
117022 "f64.store": sign([u32, u32], []),
117023 "i32.store8": sign([u32, u32], []),
117024 "i32.store16": sign([u32, u32], []),
117025 "i64.store8": sign([u32, u32], []),
117026 "i64.store16": sign([u32, u32], []),
117027 "i64.store32": sign([u32, u32], []),
117028 current_memory: sign([], []),
117029 grow_memory: sign([], [])
117030};
117031var numericInstructions = {
117032 "i32.const": sign([i32], [i32]),
117033 "i64.const": sign([i64], [i64]),
117034 "f32.const": sign([f32], [f32]),
117035 "f64.const": sign([f64], [f64]),
117036 "i32.eqz": sign([i32], [i32]),
117037 "i32.eq": sign([i32, i32], [i32]),
117038 "i32.ne": sign([i32, i32], [i32]),
117039 "i32.lt_s": sign([i32, i32], [i32]),
117040 "i32.lt_u": sign([i32, i32], [i32]),
117041 "i32.gt_s": sign([i32, i32], [i32]),
117042 "i32.gt_u": sign([i32, i32], [i32]),
117043 "i32.le_s": sign([i32, i32], [i32]),
117044 "i32.le_u": sign([i32, i32], [i32]),
117045 "i32.ge_s": sign([i32, i32], [i32]),
117046 "i32.ge_u": sign([i32, i32], [i32]),
117047 "i64.eqz": sign([i64], [i64]),
117048 "i64.eq": sign([i64, i64], [i32]),
117049 "i64.ne": sign([i64, i64], [i32]),
117050 "i64.lt_s": sign([i64, i64], [i32]),
117051 "i64.lt_u": sign([i64, i64], [i32]),
117052 "i64.gt_s": sign([i64, i64], [i32]),
117053 "i64.gt_u": sign([i64, i64], [i32]),
117054 "i64.le_s": sign([i64, i64], [i32]),
117055 "i64.le_u": sign([i64, i64], [i32]),
117056 "i64.ge_s": sign([i64, i64], [i32]),
117057 "i64.ge_u": sign([i64, i64], [i32]),
117058 "f32.eq": sign([f32, f32], [i32]),
117059 "f32.ne": sign([f32, f32], [i32]),
117060 "f32.lt": sign([f32, f32], [i32]),
117061 "f32.gt": sign([f32, f32], [i32]),
117062 "f32.le": sign([f32, f32], [i32]),
117063 "f32.ge": sign([f32, f32], [i32]),
117064 "f64.eq": sign([f64, f64], [i32]),
117065 "f64.ne": sign([f64, f64], [i32]),
117066 "f64.lt": sign([f64, f64], [i32]),
117067 "f64.gt": sign([f64, f64], [i32]),
117068 "f64.le": sign([f64, f64], [i32]),
117069 "f64.ge": sign([f64, f64], [i32]),
117070 "i32.clz": sign([i32], [i32]),
117071 "i32.ctz": sign([i32], [i32]),
117072 "i32.popcnt": sign([i32], [i32]),
117073 "i32.add": sign([i32, i32], [i32]),
117074 "i32.sub": sign([i32, i32], [i32]),
117075 "i32.mul": sign([i32, i32], [i32]),
117076 "i32.div_s": sign([i32, i32], [i32]),
117077 "i32.div_u": sign([i32, i32], [i32]),
117078 "i32.rem_s": sign([i32, i32], [i32]),
117079 "i32.rem_u": sign([i32, i32], [i32]),
117080 "i32.and": sign([i32, i32], [i32]),
117081 "i32.or": sign([i32, i32], [i32]),
117082 "i32.xor": sign([i32, i32], [i32]),
117083 "i32.shl": sign([i32, i32], [i32]),
117084 "i32.shr_s": sign([i32, i32], [i32]),
117085 "i32.shr_u": sign([i32, i32], [i32]),
117086 "i32.rotl": sign([i32, i32], [i32]),
117087 "i32.rotr": sign([i32, i32], [i32]),
117088 "i64.clz": sign([i64], [i64]),
117089 "i64.ctz": sign([i64], [i64]),
117090 "i64.popcnt": sign([i64], [i64]),
117091 "i64.add": sign([i64, i64], [i64]),
117092 "i64.sub": sign([i64, i64], [i64]),
117093 "i64.mul": sign([i64, i64], [i64]),
117094 "i64.div_s": sign([i64, i64], [i64]),
117095 "i64.div_u": sign([i64, i64], [i64]),
117096 "i64.rem_s": sign([i64, i64], [i64]),
117097 "i64.rem_u": sign([i64, i64], [i64]),
117098 "i64.and": sign([i64, i64], [i64]),
117099 "i64.or": sign([i64, i64], [i64]),
117100 "i64.xor": sign([i64, i64], [i64]),
117101 "i64.shl": sign([i64, i64], [i64]),
117102 "i64.shr_s": sign([i64, i64], [i64]),
117103 "i64.shr_u": sign([i64, i64], [i64]),
117104 "i64.rotl": sign([i64, i64], [i64]),
117105 "i64.rotr": sign([i64, i64], [i64]),
117106 "f32.abs": sign([f32], [f32]),
117107 "f32.neg": sign([f32], [f32]),
117108 "f32.ceil": sign([f32], [f32]),
117109 "f32.floor": sign([f32], [f32]),
117110 "f32.trunc": sign([f32], [f32]),
117111 "f32.nearest": sign([f32], [f32]),
117112 "f32.sqrt": sign([f32], [f32]),
117113 "f32.add": sign([f32, f32], [f32]),
117114 "f32.sub": sign([f32, f32], [f32]),
117115 "f32.mul": sign([f32, f32], [f32]),
117116 "f32.div": sign([f32, f32], [f32]),
117117 "f32.min": sign([f32, f32], [f32]),
117118 "f32.max": sign([f32, f32], [f32]),
117119 "f32.copysign": sign([f32, f32], [f32]),
117120 "f64.abs": sign([f64], [f64]),
117121 "f64.neg": sign([f64], [f64]),
117122 "f64.ceil": sign([f64], [f64]),
117123 "f64.floor": sign([f64], [f64]),
117124 "f64.trunc": sign([f64], [f64]),
117125 "f64.nearest": sign([f64], [f64]),
117126 "f64.sqrt": sign([f64], [f64]),
117127 "f64.add": sign([f64, f64], [f64]),
117128 "f64.sub": sign([f64, f64], [f64]),
117129 "f64.mul": sign([f64, f64], [f64]),
117130 "f64.div": sign([f64, f64], [f64]),
117131 "f64.min": sign([f64, f64], [f64]),
117132 "f64.max": sign([f64, f64], [f64]),
117133 "f64.copysign": sign([f64, f64], [f64]),
117134 "i32.wrap/i64": sign([i64], [i32]),
117135 "i32.trunc_s/f32": sign([f32], [i32]),
117136 "i32.trunc_u/f32": sign([f32], [i32]),
117137 "i32.trunc_s/f64": sign([f32], [i32]),
117138 "i32.trunc_u/f64": sign([f64], [i32]),
117139 "i64.extend_s/i32": sign([i32], [i64]),
117140 "i64.extend_u/i32": sign([i32], [i64]),
117141 "i64.trunc_s/f32": sign([f32], [i64]),
117142 "i64.trunc_u/f32": sign([f32], [i64]),
117143 "i64.trunc_s/f64": sign([f64], [i64]),
117144 "i64.trunc_u/f64": sign([f64], [i64]),
117145 "f32.convert_s/i32": sign([i32], [f32]),
117146 "f32.convert_u/i32": sign([i32], [f32]),
117147 "f32.convert_s/i64": sign([i64], [f32]),
117148 "f32.convert_u/i64": sign([i64], [f32]),
117149 "f32.demote/f64": sign([f64], [f32]),
117150 "f64.convert_s/i32": sign([i32], [f64]),
117151 "f64.convert_u/i32": sign([i32], [f64]),
117152 "f64.convert_s/i64": sign([i64], [f64]),
117153 "f64.convert_u/i64": sign([i64], [f64]),
117154 "f64.promote/f32": sign([f32], [f64]),
117155 "i32.reinterpret/f32": sign([f32], [i32]),
117156 "i64.reinterpret/f64": sign([f64], [i64]),
117157 "f32.reinterpret/i32": sign([i32], [f32]),
117158 "f64.reinterpret/i64": sign([i64], [f64])
117159};
117160var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
117161exports.signatures = signatures;
117162
117163/***/ }),
117164
117165/***/ 29436:
117166/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
117167
117168"use strict";
117169
117170
117171Object.defineProperty(exports, "__esModule", ({
117172 value: true
117173}));
117174exports.traverse = traverse;
117175
117176var _nodePath = __webpack_require__(89231);
117177
117178var _nodes = __webpack_require__(94841);
117179
117180// recursively walks the AST starting at the given node. The callback is invoked for
117181// and object that has a 'type' property.
117182function walk(context, callback) {
117183 var stop = false;
117184
117185 function innerWalk(context, callback) {
117186 if (stop) {
117187 return;
117188 }
117189
117190 var node = context.node;
117191
117192 if (node === undefined) {
117193 console.warn("traversing with an empty context");
117194 return;
117195 }
117196
117197 if (node._deleted === true) {
117198 return;
117199 }
117200
117201 var path = (0, _nodePath.createPath)(context);
117202 callback(node.type, path);
117203
117204 if (path.shouldStop) {
117205 stop = true;
117206 return;
117207 }
117208
117209 Object.keys(node).forEach(function (prop) {
117210 var value = node[prop];
117211
117212 if (value === null || value === undefined) {
117213 return;
117214 }
117215
117216 var valueAsArray = Array.isArray(value) ? value : [value];
117217 valueAsArray.forEach(function (childNode) {
117218 if (typeof childNode.type === "string") {
117219 var childContext = {
117220 node: childNode,
117221 parentKey: prop,
117222 parentPath: path,
117223 shouldStop: false,
117224 inList: Array.isArray(value)
117225 };
117226 innerWalk(childContext, callback);
117227 }
117228 });
117229 });
117230 }
117231
117232 innerWalk(context, callback);
117233}
117234
117235var noop = function noop() {};
117236
117237function traverse(node, visitors) {
117238 var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
117239 var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
117240 Object.keys(visitors).forEach(function (visitor) {
117241 if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
117242 throw new Error("Unexpected visitor ".concat(visitor));
117243 }
117244 });
117245 var context = {
117246 node: node,
117247 inList: false,
117248 shouldStop: false,
117249 parentPath: null,
117250 parentKey: null
117251 };
117252 walk(context, function (type, path) {
117253 if (typeof visitors[type] === "function") {
117254 before(type, path);
117255 visitors[type](path);
117256 after(type, path);
117257 }
117258
117259 var unionTypes = _nodes.unionTypesMap[type];
117260
117261 if (!unionTypes) {
117262 throw new Error("Unexpected node type ".concat(type));
117263 }
117264
117265 unionTypes.forEach(function (unionType) {
117266 if (typeof visitors[unionType] === "function") {
117267 before(unionType, path);
117268 visitors[unionType](path);
117269 after(unionType, path);
117270 }
117271 });
117272 });
117273}
117274
117275/***/ }),
117276
117277/***/ 38456:
117278/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
117279
117280"use strict";
117281
117282
117283Object.defineProperty(exports, "__esModule", ({
117284 value: true
117285}));
117286exports.isAnonymous = isAnonymous;
117287exports.getSectionMetadata = getSectionMetadata;
117288exports.getSectionMetadatas = getSectionMetadatas;
117289exports.sortSectionMetadata = sortSectionMetadata;
117290exports.orderedInsertNode = orderedInsertNode;
117291exports.assertHasLoc = assertHasLoc;
117292exports.getEndOfSection = getEndOfSection;
117293exports.shiftLoc = shiftLoc;
117294exports.shiftSection = shiftSection;
117295exports.signatureForOpcode = signatureForOpcode;
117296exports.getUniqueNameGenerator = getUniqueNameGenerator;
117297exports.getStartByteOffset = getStartByteOffset;
117298exports.getEndByteOffset = getEndByteOffset;
117299exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
117300exports.getEndBlockByteOffset = getEndBlockByteOffset;
117301exports.getStartBlockByteOffset = getStartBlockByteOffset;
117302
117303var _signatures = __webpack_require__(77392);
117304
117305var _traverse = __webpack_require__(29436);
117306
117307var _helperWasmBytecode = _interopRequireWildcard(__webpack_require__(66921));
117308
117309function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
117310
117311function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
117312
117313function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
117314
117315function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
117316
117317function isAnonymous(ident) {
117318 return ident.raw === "";
117319}
117320
117321function getSectionMetadata(ast, name) {
117322 var section;
117323 (0, _traverse.traverse)(ast, {
117324 SectionMetadata: function (_SectionMetadata) {
117325 function SectionMetadata(_x) {
117326 return _SectionMetadata.apply(this, arguments);
117327 }
117328
117329 SectionMetadata.toString = function () {
117330 return _SectionMetadata.toString();
117331 };
117332
117333 return SectionMetadata;
117334 }(function (_ref) {
117335 var node = _ref.node;
117336
117337 if (node.section === name) {
117338 section = node;
117339 }
117340 })
117341 });
117342 return section;
117343}
117344
117345function getSectionMetadatas(ast, name) {
117346 var sections = [];
117347 (0, _traverse.traverse)(ast, {
117348 SectionMetadata: function (_SectionMetadata2) {
117349 function SectionMetadata(_x2) {
117350 return _SectionMetadata2.apply(this, arguments);
117351 }
117352
117353 SectionMetadata.toString = function () {
117354 return _SectionMetadata2.toString();
117355 };
117356
117357 return SectionMetadata;
117358 }(function (_ref2) {
117359 var node = _ref2.node;
117360
117361 if (node.section === name) {
117362 sections.push(node);
117363 }
117364 })
117365 });
117366 return sections;
117367}
117368
117369function sortSectionMetadata(m) {
117370 if (m.metadata == null) {
117371 console.warn("sortSectionMetadata: no metadata to sort");
117372 return;
117373 } // $FlowIgnore
117374
117375
117376 m.metadata.sections.sort(function (a, b) {
117377 var aId = _helperWasmBytecode.default.sections[a.section];
117378 var bId = _helperWasmBytecode.default.sections[b.section];
117379
117380 if (typeof aId !== "number" || typeof bId !== "number") {
117381 throw new Error("Section id not found");
117382 }
117383
117384 return aId - bId;
117385 });
117386}
117387
117388function orderedInsertNode(m, n) {
117389 assertHasLoc(n);
117390 var didInsert = false;
117391
117392 if (n.type === "ModuleExport") {
117393 m.fields.push(n);
117394 return;
117395 }
117396
117397 m.fields = m.fields.reduce(function (acc, field) {
117398 var fieldEndCol = Infinity;
117399
117400 if (field.loc != null) {
117401 // $FlowIgnore
117402 fieldEndCol = field.loc.end.column;
117403 } // $FlowIgnore: assertHasLoc ensures that
117404
117405
117406 if (didInsert === false && n.loc.start.column < fieldEndCol) {
117407 didInsert = true;
117408 acc.push(n);
117409 }
117410
117411 acc.push(field);
117412 return acc;
117413 }, []); // Handles empty modules or n is the last element
117414
117415 if (didInsert === false) {
117416 m.fields.push(n);
117417 }
117418}
117419
117420function assertHasLoc(n) {
117421 if (n.loc == null || n.loc.start == null || n.loc.end == null) {
117422 throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
117423 }
117424}
117425
117426function getEndOfSection(s) {
117427 assertHasLoc(s.size);
117428 return s.startOffset + s.size.value + ( // $FlowIgnore
117429 s.size.loc.end.column - s.size.loc.start.column);
117430}
117431
117432function shiftLoc(node, delta) {
117433 // $FlowIgnore
117434 node.loc.start.column += delta; // $FlowIgnore
117435
117436 node.loc.end.column += delta;
117437}
117438
117439function shiftSection(ast, node, delta) {
117440 if (node.type !== "SectionMetadata") {
117441 throw new Error("Can not shift node " + JSON.stringify(node.type));
117442 }
117443
117444 node.startOffset += delta;
117445
117446 if (_typeof(node.size.loc) === "object") {
117447 shiftLoc(node.size, delta);
117448 } // Custom sections doesn't have vectorOfSize
117449
117450
117451 if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
117452 shiftLoc(node.vectorOfSize, delta);
117453 }
117454
117455 var sectionName = node.section; // shift node locations within that section
117456
117457 (0, _traverse.traverse)(ast, {
117458 Node: function Node(_ref3) {
117459 var node = _ref3.node;
117460 var section = (0, _helperWasmBytecode.getSectionForNode)(node);
117461
117462 if (section === sectionName && _typeof(node.loc) === "object") {
117463 shiftLoc(node, delta);
117464 }
117465 }
117466 });
117467}
117468
117469function signatureForOpcode(object, name) {
117470 var opcodeName = name;
117471
117472 if (object !== undefined && object !== "") {
117473 opcodeName = object + "." + name;
117474 }
117475
117476 var sign = _signatures.signatures[opcodeName];
117477
117478 if (sign == undefined) {
117479 // TODO: Uncomment this when br_table and others has been done
117480 //throw new Error("Invalid opcode: "+opcodeName);
117481 return [object, object];
117482 }
117483
117484 return sign[0];
117485}
117486
117487function getUniqueNameGenerator() {
117488 var inc = {};
117489 return function () {
117490 var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
117491
117492 if (!(prefix in inc)) {
117493 inc[prefix] = 0;
117494 } else {
117495 inc[prefix] = inc[prefix] + 1;
117496 }
117497
117498 return prefix + "_" + inc[prefix];
117499 };
117500}
117501
117502function getStartByteOffset(n) {
117503 // $FlowIgnore
117504 if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
117505 throw new Error( // $FlowIgnore
117506 "Can not get byte offset without loc informations, node: " + String(n.id));
117507 }
117508
117509 return n.loc.start.column;
117510}
117511
117512function getEndByteOffset(n) {
117513 // $FlowIgnore
117514 if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
117515 throw new Error("Can not get byte offset without loc informations, node: " + n.type);
117516 }
117517
117518 return n.loc.end.column;
117519}
117520
117521function getFunctionBeginingByteOffset(n) {
117522 if (!(n.body.length > 0)) {
117523 throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
117524 }
117525
117526 var _n$body = _slicedToArray(n.body, 1),
117527 firstInstruction = _n$body[0];
117528
117529 return getStartByteOffset(firstInstruction);
117530}
117531
117532function getEndBlockByteOffset(n) {
117533 // $FlowIgnore
117534 if (!(n.instr.length > 0 || n.body.length > 0)) {
117535 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
117536 }
117537
117538 var lastInstruction;
117539
117540 if (n.instr) {
117541 // $FlowIgnore
117542 lastInstruction = n.instr[n.instr.length - 1];
117543 }
117544
117545 if (n.body) {
117546 // $FlowIgnore
117547 lastInstruction = n.body[n.body.length - 1];
117548 }
117549
117550 if (!(_typeof(lastInstruction) === "object")) {
117551 throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
117552 }
117553
117554 // $FlowIgnore
117555 return getStartByteOffset(lastInstruction);
117556}
117557
117558function getStartBlockByteOffset(n) {
117559 // $FlowIgnore
117560 if (!(n.instr.length > 0 || n.body.length > 0)) {
117561 throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
117562 }
117563
117564 var fistInstruction;
117565
117566 if (n.instr) {
117567 // $FlowIgnore
117568 var _n$instr = _slicedToArray(n.instr, 1);
117569
117570 fistInstruction = _n$instr[0];
117571 }
117572
117573 if (n.body) {
117574 // $FlowIgnore
117575 var _n$body2 = _slicedToArray(n.body, 1);
117576
117577 fistInstruction = _n$body2[0];
117578 }
117579
117580 if (!(_typeof(fistInstruction) === "object")) {
117581 throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
117582 }
117583
117584 // $FlowIgnore
117585 return getStartByteOffset(fistInstruction);
117586}
117587
117588/***/ }),
117589
117590/***/ 20193:
117591/***/ (function(__unused_webpack_module, exports) {
117592
117593"use strict";
117594
117595
117596Object.defineProperty(exports, "__esModule", ({
117597 value: true
117598}));
117599exports.LinkError = exports.CompileError = exports.RuntimeError = void 0;
117600
117601function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
117602
117603function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
117604
117605function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
117606
117607function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
117608
117609var RuntimeError =
117610/*#__PURE__*/
117611function (_Error) {
117612 _inherits(RuntimeError, _Error);
117613
117614 function RuntimeError() {
117615 _classCallCheck(this, RuntimeError);
117616
117617 return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
117618 }
117619
117620 return RuntimeError;
117621}(Error);
117622
117623exports.RuntimeError = RuntimeError;
117624
117625var CompileError =
117626/*#__PURE__*/
117627function (_Error2) {
117628 _inherits(CompileError, _Error2);
117629
117630 function CompileError() {
117631 _classCallCheck(this, CompileError);
117632
117633 return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
117634 }
117635
117636 return CompileError;
117637}(Error);
117638
117639exports.CompileError = CompileError;
117640
117641var LinkError =
117642/*#__PURE__*/
117643function (_Error3) {
117644 _inherits(LinkError, _Error3);
117645
117646 function LinkError() {
117647 _classCallCheck(this, LinkError);
117648
117649 return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
117650 }
117651
117652 return LinkError;
117653}(Error);
117654
117655exports.LinkError = LinkError;
117656
117657/***/ }),
117658
117659/***/ 66921:
117660/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
117661
117662"use strict";
117663
117664
117665Object.defineProperty(exports, "__esModule", ({
117666 value: true
117667}));
117668Object.defineProperty(exports, "getSectionForNode", ({
117669 enumerable: true,
117670 get: function get() {
117671 return _section.getSectionForNode;
117672 }
117673}));
117674exports.default = void 0;
117675
117676var _section = __webpack_require__(79348);
117677
117678var illegalop = "illegal";
117679var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
117680var moduleVersion = [0x01, 0x00, 0x00, 0x00];
117681
117682function invertMap(obj) {
117683 var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
117684 return k;
117685 };
117686 var result = {};
117687 var keys = Object.keys(obj);
117688
117689 for (var i = 0, length = keys.length; i < length; i++) {
117690 result[keyModifierFn(obj[keys[i]])] = keys[i];
117691 }
117692
117693 return result;
117694}
117695
117696function createSymbolObject(name
117697/*: string */
117698, object
117699/*: string */
117700)
117701/*: Symbol*/
117702{
117703 var numberOfArgs
117704 /*: number*/
117705 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
117706 return {
117707 name: name,
117708 object: object,
117709 numberOfArgs: numberOfArgs
117710 };
117711}
117712
117713function createSymbol(name
117714/*: string */
117715)
117716/*: Symbol*/
117717{
117718 var numberOfArgs
117719 /*: number*/
117720 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
117721 return {
117722 name: name,
117723 numberOfArgs: numberOfArgs
117724 };
117725}
117726
117727var types = {
117728 func: 0x60,
117729 result: 0x40
117730};
117731var exportTypes = {
117732 0x00: "Func",
117733 0x01: "Table",
117734 0x02: "Mem",
117735 0x03: "Global"
117736};
117737var exportTypesByName = invertMap(exportTypes);
117738var valtypes = {
117739 0x7f: "i32",
117740 0x7e: "i64",
117741 0x7d: "f32",
117742 0x7c: "f64",
117743 0x7b: "v128"
117744};
117745var valtypesByString = invertMap(valtypes);
117746var tableTypes = {
117747 0x70: "anyfunc"
117748};
117749var blockTypes = Object.assign({}, valtypes, {
117750 // https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
117751 0x40: null,
117752 // https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
117753 0x7f: "i32",
117754 0x7e: "i64",
117755 0x7d: "f32",
117756 0x7c: "f64"
117757});
117758var globalTypes = {
117759 0x00: "const",
117760 0x01: "var"
117761};
117762var globalTypesByString = invertMap(globalTypes);
117763var importTypes = {
117764 0x00: "func",
117765 0x01: "table",
117766 0x02: "mem",
117767 0x03: "global"
117768};
117769var sections = {
117770 custom: 0,
117771 type: 1,
117772 import: 2,
117773 func: 3,
117774 table: 4,
117775 memory: 5,
117776 global: 6,
117777 export: 7,
117778 start: 8,
117779 element: 9,
117780 code: 10,
117781 data: 11
117782};
117783var symbolsByByte = {
117784 0x00: createSymbol("unreachable"),
117785 0x01: createSymbol("nop"),
117786 0x02: createSymbol("block"),
117787 0x03: createSymbol("loop"),
117788 0x04: createSymbol("if"),
117789 0x05: createSymbol("else"),
117790 0x06: illegalop,
117791 0x07: illegalop,
117792 0x08: illegalop,
117793 0x09: illegalop,
117794 0x0a: illegalop,
117795 0x0b: createSymbol("end"),
117796 0x0c: createSymbol("br", 1),
117797 0x0d: createSymbol("br_if", 1),
117798 0x0e: createSymbol("br_table"),
117799 0x0f: createSymbol("return"),
117800 0x10: createSymbol("call", 1),
117801 0x11: createSymbol("call_indirect", 2),
117802 0x12: illegalop,
117803 0x13: illegalop,
117804 0x14: illegalop,
117805 0x15: illegalop,
117806 0x16: illegalop,
117807 0x17: illegalop,
117808 0x18: illegalop,
117809 0x19: illegalop,
117810 0x1a: createSymbol("drop"),
117811 0x1b: createSymbol("select"),
117812 0x1c: illegalop,
117813 0x1d: illegalop,
117814 0x1e: illegalop,
117815 0x1f: illegalop,
117816 0x20: createSymbol("get_local", 1),
117817 0x21: createSymbol("set_local", 1),
117818 0x22: createSymbol("tee_local", 1),
117819 0x23: createSymbol("get_global", 1),
117820 0x24: createSymbol("set_global", 1),
117821 0x25: illegalop,
117822 0x26: illegalop,
117823 0x27: illegalop,
117824 0x28: createSymbolObject("load", "u32", 1),
117825 0x29: createSymbolObject("load", "u64", 1),
117826 0x2a: createSymbolObject("load", "f32", 1),
117827 0x2b: createSymbolObject("load", "f64", 1),
117828 0x2c: createSymbolObject("load8_s", "u32", 1),
117829 0x2d: createSymbolObject("load8_u", "u32", 1),
117830 0x2e: createSymbolObject("load16_s", "u32", 1),
117831 0x2f: createSymbolObject("load16_u", "u32", 1),
117832 0x30: createSymbolObject("load8_s", "u64", 1),
117833 0x31: createSymbolObject("load8_u", "u64", 1),
117834 0x32: createSymbolObject("load16_s", "u64", 1),
117835 0x33: createSymbolObject("load16_u", "u64", 1),
117836 0x34: createSymbolObject("load32_s", "u64", 1),
117837 0x35: createSymbolObject("load32_u", "u64", 1),
117838 0x36: createSymbolObject("store", "u32", 1),
117839 0x37: createSymbolObject("store", "u64", 1),
117840 0x38: createSymbolObject("store", "f32", 1),
117841 0x39: createSymbolObject("store", "f64", 1),
117842 0x3a: createSymbolObject("store8", "u32", 1),
117843 0x3b: createSymbolObject("store16", "u32", 1),
117844 0x3c: createSymbolObject("store8", "u64", 1),
117845 0x3d: createSymbolObject("store16", "u64", 1),
117846 0x3e: createSymbolObject("store32", "u64", 1),
117847 0x3f: createSymbolObject("current_memory"),
117848 0x40: createSymbolObject("grow_memory"),
117849 0x41: createSymbolObject("const", "i32", 1),
117850 0x42: createSymbolObject("const", "i64", 1),
117851 0x43: createSymbolObject("const", "f32", 1),
117852 0x44: createSymbolObject("const", "f64", 1),
117853 0x45: createSymbolObject("eqz", "i32"),
117854 0x46: createSymbolObject("eq", "i32"),
117855 0x47: createSymbolObject("ne", "i32"),
117856 0x48: createSymbolObject("lt_s", "i32"),
117857 0x49: createSymbolObject("lt_u", "i32"),
117858 0x4a: createSymbolObject("gt_s", "i32"),
117859 0x4b: createSymbolObject("gt_u", "i32"),
117860 0x4c: createSymbolObject("le_s", "i32"),
117861 0x4d: createSymbolObject("le_u", "i32"),
117862 0x4e: createSymbolObject("ge_s", "i32"),
117863 0x4f: createSymbolObject("ge_u", "i32"),
117864 0x50: createSymbolObject("eqz", "i64"),
117865 0x51: createSymbolObject("eq", "i64"),
117866 0x52: createSymbolObject("ne", "i64"),
117867 0x53: createSymbolObject("lt_s", "i64"),
117868 0x54: createSymbolObject("lt_u", "i64"),
117869 0x55: createSymbolObject("gt_s", "i64"),
117870 0x56: createSymbolObject("gt_u", "i64"),
117871 0x57: createSymbolObject("le_s", "i64"),
117872 0x58: createSymbolObject("le_u", "i64"),
117873 0x59: createSymbolObject("ge_s", "i64"),
117874 0x5a: createSymbolObject("ge_u", "i64"),
117875 0x5b: createSymbolObject("eq", "f32"),
117876 0x5c: createSymbolObject("ne", "f32"),
117877 0x5d: createSymbolObject("lt", "f32"),
117878 0x5e: createSymbolObject("gt", "f32"),
117879 0x5f: createSymbolObject("le", "f32"),
117880 0x60: createSymbolObject("ge", "f32"),
117881 0x61: createSymbolObject("eq", "f64"),
117882 0x62: createSymbolObject("ne", "f64"),
117883 0x63: createSymbolObject("lt", "f64"),
117884 0x64: createSymbolObject("gt", "f64"),
117885 0x65: createSymbolObject("le", "f64"),
117886 0x66: createSymbolObject("ge", "f64"),
117887 0x67: createSymbolObject("clz", "i32"),
117888 0x68: createSymbolObject("ctz", "i32"),
117889 0x69: createSymbolObject("popcnt", "i32"),
117890 0x6a: createSymbolObject("add", "i32"),
117891 0x6b: createSymbolObject("sub", "i32"),
117892 0x6c: createSymbolObject("mul", "i32"),
117893 0x6d: createSymbolObject("div_s", "i32"),
117894 0x6e: createSymbolObject("div_u", "i32"),
117895 0x6f: createSymbolObject("rem_s", "i32"),
117896 0x70: createSymbolObject("rem_u", "i32"),
117897 0x71: createSymbolObject("and", "i32"),
117898 0x72: createSymbolObject("or", "i32"),
117899 0x73: createSymbolObject("xor", "i32"),
117900 0x74: createSymbolObject("shl", "i32"),
117901 0x75: createSymbolObject("shr_s", "i32"),
117902 0x76: createSymbolObject("shr_u", "i32"),
117903 0x77: createSymbolObject("rotl", "i32"),
117904 0x78: createSymbolObject("rotr", "i32"),
117905 0x79: createSymbolObject("clz", "i64"),
117906 0x7a: createSymbolObject("ctz", "i64"),
117907 0x7b: createSymbolObject("popcnt", "i64"),
117908 0x7c: createSymbolObject("add", "i64"),
117909 0x7d: createSymbolObject("sub", "i64"),
117910 0x7e: createSymbolObject("mul", "i64"),
117911 0x7f: createSymbolObject("div_s", "i64"),
117912 0x80: createSymbolObject("div_u", "i64"),
117913 0x81: createSymbolObject("rem_s", "i64"),
117914 0x82: createSymbolObject("rem_u", "i64"),
117915 0x83: createSymbolObject("and", "i64"),
117916 0x84: createSymbolObject("or", "i64"),
117917 0x85: createSymbolObject("xor", "i64"),
117918 0x86: createSymbolObject("shl", "i64"),
117919 0x87: createSymbolObject("shr_s", "i64"),
117920 0x88: createSymbolObject("shr_u", "i64"),
117921 0x89: createSymbolObject("rotl", "i64"),
117922 0x8a: createSymbolObject("rotr", "i64"),
117923 0x8b: createSymbolObject("abs", "f32"),
117924 0x8c: createSymbolObject("neg", "f32"),
117925 0x8d: createSymbolObject("ceil", "f32"),
117926 0x8e: createSymbolObject("floor", "f32"),
117927 0x8f: createSymbolObject("trunc", "f32"),
117928 0x90: createSymbolObject("nearest", "f32"),
117929 0x91: createSymbolObject("sqrt", "f32"),
117930 0x92: createSymbolObject("add", "f32"),
117931 0x93: createSymbolObject("sub", "f32"),
117932 0x94: createSymbolObject("mul", "f32"),
117933 0x95: createSymbolObject("div", "f32"),
117934 0x96: createSymbolObject("min", "f32"),
117935 0x97: createSymbolObject("max", "f32"),
117936 0x98: createSymbolObject("copysign", "f32"),
117937 0x99: createSymbolObject("abs", "f64"),
117938 0x9a: createSymbolObject("neg", "f64"),
117939 0x9b: createSymbolObject("ceil", "f64"),
117940 0x9c: createSymbolObject("floor", "f64"),
117941 0x9d: createSymbolObject("trunc", "f64"),
117942 0x9e: createSymbolObject("nearest", "f64"),
117943 0x9f: createSymbolObject("sqrt", "f64"),
117944 0xa0: createSymbolObject("add", "f64"),
117945 0xa1: createSymbolObject("sub", "f64"),
117946 0xa2: createSymbolObject("mul", "f64"),
117947 0xa3: createSymbolObject("div", "f64"),
117948 0xa4: createSymbolObject("min", "f64"),
117949 0xa5: createSymbolObject("max", "f64"),
117950 0xa6: createSymbolObject("copysign", "f64"),
117951 0xa7: createSymbolObject("wrap/i64", "i32"),
117952 0xa8: createSymbolObject("trunc_s/f32", "i32"),
117953 0xa9: createSymbolObject("trunc_u/f32", "i32"),
117954 0xaa: createSymbolObject("trunc_s/f64", "i32"),
117955 0xab: createSymbolObject("trunc_u/f64", "i32"),
117956 0xac: createSymbolObject("extend_s/i32", "i64"),
117957 0xad: createSymbolObject("extend_u/i32", "i64"),
117958 0xae: createSymbolObject("trunc_s/f32", "i64"),
117959 0xaf: createSymbolObject("trunc_u/f32", "i64"),
117960 0xb0: createSymbolObject("trunc_s/f64", "i64"),
117961 0xb1: createSymbolObject("trunc_u/f64", "i64"),
117962 0xb2: createSymbolObject("convert_s/i32", "f32"),
117963 0xb3: createSymbolObject("convert_u/i32", "f32"),
117964 0xb4: createSymbolObject("convert_s/i64", "f32"),
117965 0xb5: createSymbolObject("convert_u/i64", "f32"),
117966 0xb6: createSymbolObject("demote/f64", "f32"),
117967 0xb7: createSymbolObject("convert_s/i32", "f64"),
117968 0xb8: createSymbolObject("convert_u/i32", "f64"),
117969 0xb9: createSymbolObject("convert_s/i64", "f64"),
117970 0xba: createSymbolObject("convert_u/i64", "f64"),
117971 0xbb: createSymbolObject("promote/f32", "f64"),
117972 0xbc: createSymbolObject("reinterpret/f32", "i32"),
117973 0xbd: createSymbolObject("reinterpret/f64", "i64"),
117974 0xbe: createSymbolObject("reinterpret/i32", "f32"),
117975 0xbf: createSymbolObject("reinterpret/i64", "f64")
117976};
117977var symbolsByName = invertMap(symbolsByByte, function (obj) {
117978 if (typeof obj.object === "string") {
117979 return "".concat(obj.object, ".").concat(obj.name);
117980 }
117981
117982 return obj.name;
117983});
117984var _default = {
117985 symbolsByByte: symbolsByByte,
117986 sections: sections,
117987 magicModuleHeader: magicModuleHeader,
117988 moduleVersion: moduleVersion,
117989 types: types,
117990 valtypes: valtypes,
117991 exportTypes: exportTypes,
117992 blockTypes: blockTypes,
117993 tableTypes: tableTypes,
117994 globalTypes: globalTypes,
117995 importTypes: importTypes,
117996 valtypesByString: valtypesByString,
117997 globalTypesByString: globalTypesByString,
117998 exportTypesByName: exportTypesByName,
117999 symbolsByName: symbolsByName
118000};
118001exports.default = _default;
118002
118003/***/ }),
118004
118005/***/ 79348:
118006/***/ (function(__unused_webpack_module, exports) {
118007
118008"use strict";
118009
118010
118011Object.defineProperty(exports, "__esModule", ({
118012 value: true
118013}));
118014exports.getSectionForNode = getSectionForNode;
118015
118016function getSectionForNode(n) {
118017 switch (n.type) {
118018 case "ModuleImport":
118019 return "import";
118020
118021 case "CallInstruction":
118022 case "CallIndirectInstruction":
118023 case "Func":
118024 case "Instr":
118025 return "code";
118026
118027 case "ModuleExport":
118028 return "export";
118029
118030 case "Start":
118031 return "start";
118032
118033 case "TypeInstruction":
118034 return "type";
118035
118036 case "IndexInFuncSection":
118037 return "func";
118038
118039 case "Global":
118040 return "global";
118041 // No section
118042
118043 default:
118044 return;
118045 }
118046}
118047
118048/***/ }),
118049
118050/***/ 57732:
118051/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
118052
118053"use strict";
118054
118055
118056Object.defineProperty(exports, "__esModule", ({
118057 value: true
118058}));
118059exports.encodeF32 = encodeF32;
118060exports.encodeF64 = encodeF64;
118061exports.decodeF32 = decodeF32;
118062exports.decodeF64 = decodeF64;
118063exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0;
118064
118065var _ieee = __webpack_require__(30848);
118066
118067/**
118068 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
118069 * n = 32/8
118070 */
118071var NUMBER_OF_BYTE_F32 = 4;
118072/**
118073 * According to https://webassembly.github.io/spec/binary/values.html#binary-float
118074 * n = 64/8
118075 */
118076
118077exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32;
118078var NUMBER_OF_BYTE_F64 = 8;
118079exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64;
118080var SINGLE_PRECISION_MANTISSA = 23;
118081exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA;
118082var DOUBLE_PRECISION_MANTISSA = 52;
118083exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA;
118084
118085function encodeF32(v) {
118086 var buffer = [];
118087 (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
118088 return buffer;
118089}
118090
118091function encodeF64(v) {
118092 var buffer = [];
118093 (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
118094 return buffer;
118095}
118096
118097function decodeF32(bytes) {
118098 var buffer = Buffer.from(bytes);
118099 return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
118100}
118101
118102function decodeF64(bytes) {
118103 var buffer = Buffer.from(bytes);
118104 return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
118105}
118106
118107/***/ }),
118108
118109/***/ 62904:
118110/***/ (function(__unused_webpack_module, exports) {
118111
118112"use strict";
118113// Copyright 2012 The Obvious Corporation.
118114
118115/*
118116 * bits: Bitwise buffer utilities. The utilities here treat a buffer
118117 * as a little-endian bigint, so the lowest-order bit is bit #0 of
118118 * `buffer[0]`, and the highest-order bit is bit #7 of
118119 * `buffer[buffer.length - 1]`.
118120 */
118121
118122/*
118123 * Modules used
118124 */
118125
118126/*
118127 * Exported bindings
118128 */
118129
118130/**
118131 * Extracts the given number of bits from the buffer at the indicated
118132 * index, returning a simple number as the result. If bits are requested
118133 * that aren't covered by the buffer, the `defaultBit` is used as their
118134 * value.
118135 *
118136 * The `bitLength` must be no more than 32. The `defaultBit` if not
118137 * specified is taken to be `0`.
118138 */
118139
118140Object.defineProperty(exports, "__esModule", ({
118141 value: true
118142}));
118143exports.extract = extract;
118144exports.inject = inject;
118145exports.getSign = getSign;
118146exports.highOrder = highOrder;
118147
118148function extract(buffer, bitIndex, bitLength, defaultBit) {
118149 if (bitLength < 0 || bitLength > 32) {
118150 throw new Error("Bad value for bitLength.");
118151 }
118152
118153 if (defaultBit === undefined) {
118154 defaultBit = 0;
118155 } else if (defaultBit !== 0 && defaultBit !== 1) {
118156 throw new Error("Bad value for defaultBit.");
118157 }
118158
118159 var defaultByte = defaultBit * 0xff;
118160 var result = 0; // All starts are inclusive. The {endByte, endBit} pair is exclusive, but
118161 // if endBit !== 0, then endByte is inclusive.
118162
118163 var lastBit = bitIndex + bitLength;
118164 var startByte = Math.floor(bitIndex / 8);
118165 var startBit = bitIndex % 8;
118166 var endByte = Math.floor(lastBit / 8);
118167 var endBit = lastBit % 8;
118168
118169 if (endBit !== 0) {
118170 // `(1 << endBit) - 1` is the mask of all bits up to but not including
118171 // the endBit.
118172 result = get(endByte) & (1 << endBit) - 1;
118173 }
118174
118175 while (endByte > startByte) {
118176 endByte--;
118177 result = result << 8 | get(endByte);
118178 }
118179
118180 result >>>= startBit;
118181 return result;
118182
118183 function get(index) {
118184 var result = buffer[index];
118185 return result === undefined ? defaultByte : result;
118186 }
118187}
118188/**
118189 * Injects the given bits into the given buffer at the given index. Any
118190 * bits in the value beyond the length to set are ignored.
118191 */
118192
118193
118194function inject(buffer, bitIndex, bitLength, value) {
118195 if (bitLength < 0 || bitLength > 32) {
118196 throw new Error("Bad value for bitLength.");
118197 }
118198
118199 var lastByte = Math.floor((bitIndex + bitLength - 1) / 8);
118200
118201 if (bitIndex < 0 || lastByte >= buffer.length) {
118202 throw new Error("Index out of range.");
118203 } // Just keeping it simple, until / unless profiling shows that this
118204 // is a problem.
118205
118206
118207 var atByte = Math.floor(bitIndex / 8);
118208 var atBit = bitIndex % 8;
118209
118210 while (bitLength > 0) {
118211 if (value & 1) {
118212 buffer[atByte] |= 1 << atBit;
118213 } else {
118214 buffer[atByte] &= ~(1 << atBit);
118215 }
118216
118217 value >>= 1;
118218 bitLength--;
118219 atBit = (atBit + 1) % 8;
118220
118221 if (atBit === 0) {
118222 atByte++;
118223 }
118224 }
118225}
118226/**
118227 * Gets the sign bit of the given buffer.
118228 */
118229
118230
118231function getSign(buffer) {
118232 return buffer[buffer.length - 1] >>> 7;
118233}
118234/**
118235 * Gets the zero-based bit number of the highest-order bit with the
118236 * given value in the given buffer.
118237 *
118238 * If the buffer consists entirely of the other bit value, then this returns
118239 * `-1`.
118240 */
118241
118242
118243function highOrder(bit, buffer) {
118244 var length = buffer.length;
118245 var fullyWrongByte = (bit ^ 1) * 0xff; // the other-bit extended to a full byte
118246
118247 while (length > 0 && buffer[length - 1] === fullyWrongByte) {
118248 length--;
118249 }
118250
118251 if (length === 0) {
118252 // Degenerate case. The buffer consists entirely of ~bit.
118253 return -1;
118254 }
118255
118256 var byteToCheck = buffer[length - 1];
118257 var result = length * 8 - 1;
118258
118259 for (var i = 7; i > 0; i--) {
118260 if ((byteToCheck >> i & 1) === bit) {
118261 break;
118262 }
118263
118264 result--;
118265 }
118266
118267 return result;
118268}
118269
118270/***/ }),
118271
118272/***/ 7276:
118273/***/ (function(__unused_webpack_module, exports) {
118274
118275"use strict";
118276
118277
118278Object.defineProperty(exports, "__esModule", ({
118279 value: true
118280}));
118281exports.alloc = alloc;
118282exports.free = free;
118283exports.resize = resize;
118284exports.readInt = readInt;
118285exports.readUInt = readUInt;
118286exports.writeInt64 = writeInt64;
118287exports.writeUInt64 = writeUInt64;
118288// Copyright 2012 The Obvious Corporation.
118289
118290/*
118291 * bufs: Buffer utilities.
118292 */
118293
118294/*
118295 * Module variables
118296 */
118297
118298/** Pool of buffers, where `bufPool[x].length === x`. */
118299var bufPool = [];
118300/** Maximum length of kept temporary buffers. */
118301
118302var TEMP_BUF_MAXIMUM_LENGTH = 20;
118303/** Minimum exactly-representable 64-bit int. */
118304
118305var MIN_EXACT_INT64 = -0x8000000000000000;
118306/** Maximum exactly-representable 64-bit int. */
118307
118308var MAX_EXACT_INT64 = 0x7ffffffffffffc00;
118309/** Maximum exactly-representable 64-bit uint. */
118310
118311var MAX_EXACT_UINT64 = 0xfffffffffffff800;
118312/**
118313 * The int value consisting just of a 1 in bit #32 (that is, one more
118314 * than the maximum 32-bit unsigned value).
118315 */
118316
118317var BIT_32 = 0x100000000;
118318/**
118319 * The int value consisting just of a 1 in bit #64 (that is, one more
118320 * than the maximum 64-bit unsigned value).
118321 */
118322
118323var BIT_64 = 0x10000000000000000;
118324/*
118325 * Helper functions
118326 */
118327
118328/**
118329 * Masks off all but the lowest bit set of the given number.
118330 */
118331
118332function lowestBit(num) {
118333 return num & -num;
118334}
118335/**
118336 * Gets whether trying to add the second number to the first is lossy
118337 * (inexact). The first number is meant to be an accumulated result.
118338 */
118339
118340
118341function isLossyToAdd(accum, num) {
118342 if (num === 0) {
118343 return false;
118344 }
118345
118346 var lowBit = lowestBit(num);
118347 var added = accum + lowBit;
118348
118349 if (added === accum) {
118350 return true;
118351 }
118352
118353 if (added - lowBit !== accum) {
118354 return true;
118355 }
118356
118357 return false;
118358}
118359/*
118360 * Exported functions
118361 */
118362
118363/**
118364 * Allocates a buffer of the given length, which is initialized
118365 * with all zeroes. This returns a buffer from the pool if it is
118366 * available, or a freshly-allocated buffer if not.
118367 */
118368
118369
118370function alloc(length) {
118371 var result = bufPool[length];
118372
118373 if (result) {
118374 bufPool[length] = undefined;
118375 } else {
118376 result = new Buffer(length);
118377 }
118378
118379 result.fill(0);
118380 return result;
118381}
118382/**
118383 * Releases a buffer back to the pool.
118384 */
118385
118386
118387function free(buffer) {
118388 var length = buffer.length;
118389
118390 if (length < TEMP_BUF_MAXIMUM_LENGTH) {
118391 bufPool[length] = buffer;
118392 }
118393}
118394/**
118395 * Resizes a buffer, returning a new buffer. Returns the argument if
118396 * the length wouldn't actually change. This function is only safe to
118397 * use if the given buffer was allocated within this module (since
118398 * otherwise the buffer might possibly be shared externally).
118399 */
118400
118401
118402function resize(buffer, length) {
118403 if (length === buffer.length) {
118404 return buffer;
118405 }
118406
118407 var newBuf = alloc(length);
118408 buffer.copy(newBuf);
118409 free(buffer);
118410 return newBuf;
118411}
118412/**
118413 * Reads an arbitrary signed int from a buffer.
118414 */
118415
118416
118417function readInt(buffer) {
118418 var length = buffer.length;
118419 var positive = buffer[length - 1] < 0x80;
118420 var result = positive ? 0 : -1;
118421 var lossy = false; // Note: We can't use bit manipulation here, since that stops
118422 // working if the result won't fit in a 32-bit int.
118423
118424 if (length < 7) {
118425 // Common case which can't possibly be lossy (because the result has
118426 // no more than 48 bits, and loss only happens with 54 or more).
118427 for (var i = length - 1; i >= 0; i--) {
118428 result = result * 0x100 + buffer[i];
118429 }
118430 } else {
118431 for (var _i = length - 1; _i >= 0; _i--) {
118432 var one = buffer[_i];
118433 result *= 0x100;
118434
118435 if (isLossyToAdd(result, one)) {
118436 lossy = true;
118437 }
118438
118439 result += one;
118440 }
118441 }
118442
118443 return {
118444 value: result,
118445 lossy: lossy
118446 };
118447}
118448/**
118449 * Reads an arbitrary unsigned int from a buffer.
118450 */
118451
118452
118453function readUInt(buffer) {
118454 var length = buffer.length;
118455 var result = 0;
118456 var lossy = false; // Note: See above in re bit manipulation.
118457
118458 if (length < 7) {
118459 // Common case which can't possibly be lossy (see above).
118460 for (var i = length - 1; i >= 0; i--) {
118461 result = result * 0x100 + buffer[i];
118462 }
118463 } else {
118464 for (var _i2 = length - 1; _i2 >= 0; _i2--) {
118465 var one = buffer[_i2];
118466 result *= 0x100;
118467
118468 if (isLossyToAdd(result, one)) {
118469 lossy = true;
118470 }
118471
118472 result += one;
118473 }
118474 }
118475
118476 return {
118477 value: result,
118478 lossy: lossy
118479 };
118480}
118481/**
118482 * Writes a little-endian 64-bit signed int into a buffer.
118483 */
118484
118485
118486function writeInt64(value, buffer) {
118487 if (value < MIN_EXACT_INT64 || value > MAX_EXACT_INT64) {
118488 throw new Error("Value out of range.");
118489 }
118490
118491 if (value < 0) {
118492 value += BIT_64;
118493 }
118494
118495 writeUInt64(value, buffer);
118496}
118497/**
118498 * Writes a little-endian 64-bit unsigned int into a buffer.
118499 */
118500
118501
118502function writeUInt64(value, buffer) {
118503 if (value < 0 || value > MAX_EXACT_UINT64) {
118504 throw new Error("Value out of range.");
118505 }
118506
118507 var lowWord = value % BIT_32;
118508 var highWord = Math.floor(value / BIT_32);
118509 buffer.writeUInt32LE(lowWord, 0);
118510 buffer.writeUInt32LE(highWord, 4);
118511}
118512
118513/***/ }),
118514
118515/***/ 89943:
118516/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
118517
118518"use strict";
118519
118520
118521Object.defineProperty(exports, "__esModule", ({
118522 value: true
118523}));
118524exports.decodeInt64 = decodeInt64;
118525exports.decodeUInt64 = decodeUInt64;
118526exports.decodeInt32 = decodeInt32;
118527exports.decodeUInt32 = decodeUInt32;
118528exports.encodeU32 = encodeU32;
118529exports.encodeI32 = encodeI32;
118530exports.encodeI64 = encodeI64;
118531exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0;
118532
118533var _leb = _interopRequireDefault(__webpack_require__(80881));
118534
118535function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
118536
118537/**
118538 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
118539 * max = ceil(32/7)
118540 */
118541var MAX_NUMBER_OF_BYTE_U32 = 5;
118542/**
118543 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
118544 * max = ceil(64/7)
118545 */
118546
118547exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32;
118548var MAX_NUMBER_OF_BYTE_U64 = 10;
118549exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64;
118550
118551function decodeInt64(encodedBuffer, index) {
118552 return _leb.default.decodeInt64(encodedBuffer, index);
118553}
118554
118555function decodeUInt64(encodedBuffer, index) {
118556 return _leb.default.decodeUInt64(encodedBuffer, index);
118557}
118558
118559function decodeInt32(encodedBuffer, index) {
118560 return _leb.default.decodeInt32(encodedBuffer, index);
118561}
118562
118563function decodeUInt32(encodedBuffer, index) {
118564 return _leb.default.decodeUInt32(encodedBuffer, index);
118565}
118566
118567function encodeU32(v) {
118568 return _leb.default.encodeUInt32(v);
118569}
118570
118571function encodeI32(v) {
118572 return _leb.default.encodeInt32(v);
118573}
118574
118575function encodeI64(v) {
118576 return _leb.default.encodeInt64(v);
118577}
118578
118579/***/ }),
118580
118581/***/ 80881:
118582/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
118583
118584"use strict";
118585// Copyright 2012 The Obvious Corporation.
118586
118587/*
118588 * leb: LEB128 utilities.
118589 */
118590
118591/*
118592 * Modules used
118593 */
118594
118595
118596Object.defineProperty(exports, "__esModule", ({
118597 value: true
118598}));
118599exports.default = void 0;
118600
118601var _long = _interopRequireDefault(__webpack_require__(77960));
118602
118603var bits = _interopRequireWildcard(__webpack_require__(62904));
118604
118605var bufs = _interopRequireWildcard(__webpack_require__(7276));
118606
118607function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
118608
118609function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
118610
118611/*
118612 * Module variables
118613 */
118614
118615/** The minimum possible 32-bit signed int. */
118616var MIN_INT32 = -0x80000000;
118617/** The maximum possible 32-bit signed int. */
118618
118619var MAX_INT32 = 0x7fffffff;
118620/** The maximum possible 32-bit unsigned int. */
118621
118622var MAX_UINT32 = 0xffffffff;
118623/** The minimum possible 64-bit signed int. */
118624// const MIN_INT64 = -0x8000000000000000;
118625
118626/**
118627 * The maximum possible 64-bit signed int that is representable as a
118628 * JavaScript number.
118629 */
118630// const MAX_INT64 = 0x7ffffffffffffc00;
118631
118632/**
118633 * The maximum possible 64-bit unsigned int that is representable as a
118634 * JavaScript number.
118635 */
118636// const MAX_UINT64 = 0xfffffffffffff800;
118637
118638/*
118639 * Helper functions
118640 */
118641
118642/**
118643 * Determines the number of bits required to encode the number
118644 * represented in the given buffer as a signed value. The buffer is
118645 * taken to represent a signed number in little-endian form.
118646 *
118647 * The number of bits to encode is the (zero-based) bit number of the
118648 * highest-order non-sign-matching bit, plus two. For example:
118649 *
118650 * 11111011 01110101
118651 * high low
118652 *
118653 * The sign bit here is 1 (that is, it's a negative number). The highest
118654 * bit number that doesn't match the sign is bit #10 (where the lowest-order
118655 * bit is bit #0). So, we have to encode at least 12 bits total.
118656 *
118657 * As a special degenerate case, the numbers 0 and -1 each require just one bit.
118658 */
118659
118660function signedBitCount(buffer) {
118661 return bits.highOrder(bits.getSign(buffer) ^ 1, buffer) + 2;
118662}
118663/**
118664 * Determines the number of bits required to encode the number
118665 * represented in the given buffer as an unsigned value. The buffer is
118666 * taken to represent an unsigned number in little-endian form.
118667 *
118668 * The number of bits to encode is the (zero-based) bit number of the
118669 * highest-order 1 bit, plus one. For example:
118670 *
118671 * 00011000 01010011
118672 * high low
118673 *
118674 * The highest-order 1 bit here is bit #12 (where the lowest-order bit
118675 * is bit #0). So, we have to encode at least 13 bits total.
118676 *
118677 * As a special degenerate case, the number 0 requires 1 bit.
118678 */
118679
118680
118681function unsignedBitCount(buffer) {
118682 var result = bits.highOrder(1, buffer) + 1;
118683 return result ? result : 1;
118684}
118685/**
118686 * Common encoder for both signed and unsigned ints. This takes a
118687 * bigint-ish buffer, returning an LEB128-encoded buffer.
118688 */
118689
118690
118691function encodeBufferCommon(buffer, signed) {
118692 var signBit;
118693 var bitCount;
118694
118695 if (signed) {
118696 signBit = bits.getSign(buffer);
118697 bitCount = signedBitCount(buffer);
118698 } else {
118699 signBit = 0;
118700 bitCount = unsignedBitCount(buffer);
118701 }
118702
118703 var byteCount = Math.ceil(bitCount / 7);
118704 var result = bufs.alloc(byteCount);
118705
118706 for (var i = 0; i < byteCount; i++) {
118707 var payload = bits.extract(buffer, i * 7, 7, signBit);
118708 result[i] = payload | 0x80;
118709 } // Mask off the top bit of the last byte, to indicate the end of the
118710 // encoding.
118711
118712
118713 result[byteCount - 1] &= 0x7f;
118714 return result;
118715}
118716/**
118717 * Gets the byte-length of the value encoded in the given buffer at
118718 * the given index.
118719 */
118720
118721
118722function encodedLength(encodedBuffer, index) {
118723 var result = 0;
118724
118725 while (encodedBuffer[index + result] >= 0x80) {
118726 result++;
118727 }
118728
118729 result++; // to account for the last byte
118730
118731 if (index + result > encodedBuffer.length) {// FIXME(sven): seems to cause false positives
118732 // throw new Error("integer representation too long");
118733 }
118734
118735 return result;
118736}
118737/**
118738 * Common decoder for both signed and unsigned ints. This takes an
118739 * LEB128-encoded buffer, returning a bigint-ish buffer.
118740 */
118741
118742
118743function decodeBufferCommon(encodedBuffer, index, signed) {
118744 index = index === undefined ? 0 : index;
118745 var length = encodedLength(encodedBuffer, index);
118746 var bitLength = length * 7;
118747 var byteLength = Math.ceil(bitLength / 8);
118748 var result = bufs.alloc(byteLength);
118749 var outIndex = 0;
118750
118751 while (length > 0) {
118752 bits.inject(result, outIndex, 7, encodedBuffer[index]);
118753 outIndex += 7;
118754 index++;
118755 length--;
118756 }
118757
118758 var signBit;
118759 var signByte;
118760
118761 if (signed) {
118762 // Sign-extend the last byte.
118763 var lastByte = result[byteLength - 1];
118764 var endBit = outIndex % 8;
118765
118766 if (endBit !== 0) {
118767 var shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
118768
118769 lastByte = result[byteLength - 1] = lastByte << shift >> shift & 0xff;
118770 }
118771
118772 signBit = lastByte >> 7;
118773 signByte = signBit * 0xff;
118774 } else {
118775 signBit = 0;
118776 signByte = 0;
118777 } // Slice off any superfluous bytes, that is, ones that add no meaningful
118778 // bits (because the value would be the same if they were removed).
118779
118780
118781 while (byteLength > 1 && result[byteLength - 1] === signByte && (!signed || result[byteLength - 2] >> 7 === signBit)) {
118782 byteLength--;
118783 }
118784
118785 result = bufs.resize(result, byteLength);
118786 return {
118787 value: result,
118788 nextIndex: index
118789 };
118790}
118791/*
118792 * Exported bindings
118793 */
118794
118795
118796function encodeIntBuffer(buffer) {
118797 return encodeBufferCommon(buffer, true);
118798}
118799
118800function decodeIntBuffer(encodedBuffer, index) {
118801 return decodeBufferCommon(encodedBuffer, index, true);
118802}
118803
118804function encodeInt32(num) {
118805 var buf = bufs.alloc(4);
118806 buf.writeInt32LE(num, 0);
118807 var result = encodeIntBuffer(buf);
118808 bufs.free(buf);
118809 return result;
118810}
118811
118812function decodeInt32(encodedBuffer, index) {
118813 var result = decodeIntBuffer(encodedBuffer, index);
118814 var parsed = bufs.readInt(result.value);
118815 var value = parsed.value;
118816 bufs.free(result.value);
118817
118818 if (value < MIN_INT32 || value > MAX_INT32) {
118819 throw new Error("integer too large");
118820 }
118821
118822 return {
118823 value: value,
118824 nextIndex: result.nextIndex
118825 };
118826}
118827
118828function encodeInt64(num) {
118829 var buf = bufs.alloc(8);
118830 bufs.writeInt64(num, buf);
118831 var result = encodeIntBuffer(buf);
118832 bufs.free(buf);
118833 return result;
118834}
118835
118836function decodeInt64(encodedBuffer, index) {
118837 var result = decodeIntBuffer(encodedBuffer, index);
118838
118839 var value = _long.default.fromBytesLE(result.value, false);
118840
118841 bufs.free(result.value);
118842 return {
118843 value: value,
118844 nextIndex: result.nextIndex,
118845 lossy: false
118846 };
118847}
118848
118849function encodeUIntBuffer(buffer) {
118850 return encodeBufferCommon(buffer, false);
118851}
118852
118853function decodeUIntBuffer(encodedBuffer, index) {
118854 return decodeBufferCommon(encodedBuffer, index, false);
118855}
118856
118857function encodeUInt32(num) {
118858 var buf = bufs.alloc(4);
118859 buf.writeUInt32LE(num, 0);
118860 var result = encodeUIntBuffer(buf);
118861 bufs.free(buf);
118862 return result;
118863}
118864
118865function decodeUInt32(encodedBuffer, index) {
118866 var result = decodeUIntBuffer(encodedBuffer, index);
118867 var parsed = bufs.readUInt(result.value);
118868 var value = parsed.value;
118869 bufs.free(result.value);
118870
118871 if (value > MAX_UINT32) {
118872 throw new Error("integer too large");
118873 }
118874
118875 return {
118876 value: value,
118877 nextIndex: result.nextIndex
118878 };
118879}
118880
118881function encodeUInt64(num) {
118882 var buf = bufs.alloc(8);
118883 bufs.writeUInt64(num, buf);
118884 var result = encodeUIntBuffer(buf);
118885 bufs.free(buf);
118886 return result;
118887}
118888
118889function decodeUInt64(encodedBuffer, index) {
118890 var result = decodeUIntBuffer(encodedBuffer, index);
118891
118892 var value = _long.default.fromBytesLE(result.value, true);
118893
118894 bufs.free(result.value);
118895 return {
118896 value: value,
118897 nextIndex: result.nextIndex,
118898 lossy: false
118899 };
118900}
118901
118902var _default = {
118903 decodeInt32: decodeInt32,
118904 decodeInt64: decodeInt64,
118905 decodeIntBuffer: decodeIntBuffer,
118906 decodeUInt32: decodeUInt32,
118907 decodeUInt64: decodeUInt64,
118908 decodeUIntBuffer: decodeUIntBuffer,
118909 encodeInt32: encodeInt32,
118910 encodeInt64: encodeInt64,
118911 encodeIntBuffer: encodeIntBuffer,
118912 encodeUInt32: encodeUInt32,
118913 encodeUInt64: encodeUInt64,
118914 encodeUIntBuffer: encodeUIntBuffer
118915};
118916exports.default = _default;
118917
118918/***/ }),
118919
118920/***/ 19418:
118921/***/ (function(__unused_webpack_module, exports) {
118922
118923"use strict";
118924
118925
118926Object.defineProperty(exports, "__esModule", ({
118927 value: true
118928}));
118929exports.decode = decode;
118930
118931function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
118932
118933function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
118934
118935function con(b) {
118936 if ((b & 0xc0) === 0x80) {
118937 return b & 0x3f;
118938 } else {
118939 throw new Error("invalid UTF-8 encoding");
118940 }
118941}
118942
118943function code(min, n) {
118944 if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
118945 throw new Error("invalid UTF-8 encoding");
118946 } else {
118947 return n;
118948 }
118949}
118950
118951function decode(bytes) {
118952 return _decode(bytes).map(function (x) {
118953 return String.fromCharCode(x);
118954 }).join("");
118955}
118956
118957function _decode(bytes) {
118958 if (bytes.length === 0) {
118959 return [];
118960 }
118961 /**
118962 * 1 byte
118963 */
118964
118965
118966 {
118967 var _bytes = _toArray(bytes),
118968 b1 = _bytes[0],
118969 bs = _bytes.slice(1);
118970
118971 if (b1 < 0x80) {
118972 return [code(0x0, b1)].concat(_toConsumableArray(_decode(bs)));
118973 }
118974
118975 if (b1 < 0xc0) {
118976 throw new Error("invalid UTF-8 encoding");
118977 }
118978 }
118979 /**
118980 * 2 bytes
118981 */
118982
118983 {
118984 var _bytes2 = _toArray(bytes),
118985 _b = _bytes2[0],
118986 b2 = _bytes2[1],
118987 _bs = _bytes2.slice(2);
118988
118989 if (_b < 0xe0) {
118990 return [code(0x80, ((_b & 0x1f) << 6) + con(b2))].concat(_toConsumableArray(_decode(_bs)));
118991 }
118992 }
118993 /**
118994 * 3 bytes
118995 */
118996
118997 {
118998 var _bytes3 = _toArray(bytes),
118999 _b2 = _bytes3[0],
119000 _b3 = _bytes3[1],
119001 b3 = _bytes3[2],
119002 _bs2 = _bytes3.slice(3);
119003
119004 if (_b2 < 0xf0) {
119005 return [code(0x800, ((_b2 & 0x0f) << 12) + (con(_b3) << 6) + con(b3))].concat(_toConsumableArray(_decode(_bs2)));
119006 }
119007 }
119008 /**
119009 * 4 bytes
119010 */
119011
119012 {
119013 var _bytes4 = _toArray(bytes),
119014 _b4 = _bytes4[0],
119015 _b5 = _bytes4[1],
119016 _b6 = _bytes4[2],
119017 b4 = _bytes4[3],
119018 _bs3 = _bytes4.slice(4);
119019
119020 if (_b4 < 0xf8) {
119021 return [code(0x10000, (((_b4 & 0x07) << 18) + con(_b5) << 12) + (con(_b6) << 6) + con(b4))].concat(_toConsumableArray(_decode(_bs3)));
119022 }
119023 }
119024 throw new Error("invalid UTF-8 encoding");
119025}
119026
119027/***/ }),
119028
119029/***/ 43882:
119030/***/ (function(__unused_webpack_module, exports) {
119031
119032"use strict";
119033
119034
119035Object.defineProperty(exports, "__esModule", ({
119036 value: true
119037}));
119038exports.encode = encode;
119039
119040function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
119041
119042function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
119043
119044function con(n) {
119045 return 0x80 | n & 0x3f;
119046}
119047
119048function encode(str) {
119049 var arr = str.split("").map(function (x) {
119050 return x.charCodeAt(0);
119051 });
119052 return _encode(arr);
119053}
119054
119055function _encode(arr) {
119056 if (arr.length === 0) {
119057 return [];
119058 }
119059
119060 var _arr = _toArray(arr),
119061 n = _arr[0],
119062 ns = _arr.slice(1);
119063
119064 if (n < 0) {
119065 throw new Error("utf8");
119066 }
119067
119068 if (n < 0x80) {
119069 return [n].concat(_toConsumableArray(_encode(ns)));
119070 }
119071
119072 if (n < 0x800) {
119073 return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
119074 }
119075
119076 if (n < 0x10000) {
119077 return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
119078 }
119079
119080 if (n < 0x110000) {
119081 return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
119082 }
119083
119084 throw new Error("utf8");
119085}
119086
119087/***/ }),
119088
119089/***/ 81637:
119090/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
119091
119092"use strict";
119093
119094
119095Object.defineProperty(exports, "__esModule", ({
119096 value: true
119097}));
119098Object.defineProperty(exports, "decode", ({
119099 enumerable: true,
119100 get: function get() {
119101 return _decoder.decode;
119102 }
119103}));
119104Object.defineProperty(exports, "encode", ({
119105 enumerable: true,
119106 get: function get() {
119107 return _encoder.encode;
119108 }
119109}));
119110
119111var _decoder = __webpack_require__(19418);
119112
119113var _encoder = __webpack_require__(43882);
119114
119115/***/ }),
119116
119117/***/ 28458:
119118/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
119119
119120"use strict";
119121
119122
119123Object.defineProperty(exports, "__esModule", ({
119124 value: true
119125}));
119126exports.decode = decode;
119127
119128var _helperApiError = __webpack_require__(20193);
119129
119130var ieee754 = _interopRequireWildcard(__webpack_require__(57732));
119131
119132var utf8 = _interopRequireWildcard(__webpack_require__(81637));
119133
119134var t = _interopRequireWildcard(__webpack_require__(81875));
119135
119136var _leb = __webpack_require__(89943);
119137
119138var _helperWasmBytecode = _interopRequireDefault(__webpack_require__(66921));
119139
119140function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
119141
119142function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
119143
119144function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
119145
119146function toHex(n) {
119147 return "0x" + Number(n).toString(16);
119148}
119149
119150function byteArrayEq(l, r) {
119151 if (l.length !== r.length) {
119152 return false;
119153 }
119154
119155 for (var i = 0; i < l.length; i++) {
119156 if (l[i] !== r[i]) {
119157 return false;
119158 }
119159 }
119160
119161 return true;
119162}
119163
119164function decode(ab, opts) {
119165 var buf = new Uint8Array(ab);
119166 var getUniqueName = t.getUniqueNameGenerator();
119167 var offset = 0;
119168
119169 function getPosition() {
119170 return {
119171 line: -1,
119172 column: offset
119173 };
119174 }
119175
119176 function dump(b, msg) {
119177 if (opts.dump === false) return;
119178 var pad = "\t\t\t\t\t\t\t\t\t\t";
119179 var str = "";
119180
119181 if (b.length < 5) {
119182 str = b.map(toHex).join(" ");
119183 } else {
119184 str = "...";
119185 }
119186
119187 console.log(toHex(offset) + ":\t", str, pad, ";", msg);
119188 }
119189
119190 function dumpSep(msg) {
119191 if (opts.dump === false) return;
119192 console.log(";", msg);
119193 }
119194 /**
119195 * TODO(sven): we can atually use a same structure
119196 * we are adding incrementally new features
119197 */
119198
119199
119200 var state = {
119201 elementsInFuncSection: [],
119202 elementsInExportSection: [],
119203 elementsInCodeSection: [],
119204
119205 /**
119206 * Decode memory from:
119207 * - Memory section
119208 */
119209 memoriesInModule: [],
119210
119211 /**
119212 * Decoded types from:
119213 * - Type section
119214 */
119215 typesInModule: [],
119216
119217 /**
119218 * Decoded functions from:
119219 * - Function section
119220 * - Import section
119221 */
119222 functionsInModule: [],
119223
119224 /**
119225 * Decoded tables from:
119226 * - Table section
119227 */
119228 tablesInModule: [],
119229
119230 /**
119231 * Decoded globals from:
119232 * - Global section
119233 */
119234 globalsInModule: []
119235 };
119236
119237 function isEOF() {
119238 return offset >= buf.length;
119239 }
119240
119241 function eatBytes(n) {
119242 offset = offset + n;
119243 }
119244
119245 function readBytesAtOffset(_offset, numberOfBytes) {
119246 var arr = [];
119247
119248 for (var i = 0; i < numberOfBytes; i++) {
119249 arr.push(buf[_offset + i]);
119250 }
119251
119252 return arr;
119253 }
119254
119255 function readBytes(numberOfBytes) {
119256 return readBytesAtOffset(offset, numberOfBytes);
119257 }
119258
119259 function readF64() {
119260 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F64);
119261 var value = ieee754.decodeF64(bytes);
119262
119263 if (Math.sign(value) * value === Infinity) {
119264 return {
119265 value: Math.sign(value),
119266 inf: true,
119267 nextIndex: ieee754.NUMBER_OF_BYTE_F64
119268 };
119269 }
119270
119271 if (isNaN(value)) {
119272 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
119273 var mantissa = 0;
119274
119275 for (var i = 0; i < bytes.length - 2; ++i) {
119276 mantissa += bytes[i] * Math.pow(256, i);
119277 }
119278
119279 mantissa += bytes[bytes.length - 2] % 16 * Math.pow(256, bytes.length - 2);
119280 return {
119281 value: sign * mantissa,
119282 nan: true,
119283 nextIndex: ieee754.NUMBER_OF_BYTE_F64
119284 };
119285 }
119286
119287 return {
119288 value: value,
119289 nextIndex: ieee754.NUMBER_OF_BYTE_F64
119290 };
119291 }
119292
119293 function readF32() {
119294 var bytes = readBytes(ieee754.NUMBER_OF_BYTE_F32);
119295 var value = ieee754.decodeF32(bytes);
119296
119297 if (Math.sign(value) * value === Infinity) {
119298 return {
119299 value: Math.sign(value),
119300 inf: true,
119301 nextIndex: ieee754.NUMBER_OF_BYTE_F32
119302 };
119303 }
119304
119305 if (isNaN(value)) {
119306 var sign = bytes[bytes.length - 1] >> 7 ? -1 : 1;
119307 var mantissa = 0;
119308
119309 for (var i = 0; i < bytes.length - 2; ++i) {
119310 mantissa += bytes[i] * Math.pow(256, i);
119311 }
119312
119313 mantissa += bytes[bytes.length - 2] % 128 * Math.pow(256, bytes.length - 2);
119314 return {
119315 value: sign * mantissa,
119316 nan: true,
119317 nextIndex: ieee754.NUMBER_OF_BYTE_F32
119318 };
119319 }
119320
119321 return {
119322 value: value,
119323 nextIndex: ieee754.NUMBER_OF_BYTE_F32
119324 };
119325 }
119326
119327 function readUTF8String() {
119328 var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
119329 // readBytesAtOffset below. This keeps readUTF8String neutral with respect
119330 // to the current offset, just like the other readX functions.
119331
119332 var strlen = lenu32.value;
119333 dump([strlen], "string length");
119334 var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
119335 var value = utf8.decode(bytes);
119336 return {
119337 value: value,
119338 nextIndex: strlen + lenu32.nextIndex
119339 };
119340 }
119341 /**
119342 * Decode an unsigned 32bits integer
119343 *
119344 * The length will be handled by the leb librairy, we pass the max number of
119345 * byte.
119346 */
119347
119348
119349 function readU32() {
119350 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
119351 var buffer = Buffer.from(bytes);
119352 return (0, _leb.decodeUInt32)(buffer);
119353 }
119354
119355 function readVaruint32() {
119356 // where 32 bits = max 4 bytes
119357 var bytes = readBytes(4);
119358 var buffer = Buffer.from(bytes);
119359 return (0, _leb.decodeUInt32)(buffer);
119360 }
119361
119362 function readVaruint7() {
119363 // where 7 bits = max 1 bytes
119364 var bytes = readBytes(1);
119365 var buffer = Buffer.from(bytes);
119366 return (0, _leb.decodeUInt32)(buffer);
119367 }
119368 /**
119369 * Decode a signed 32bits interger
119370 */
119371
119372
119373 function read32() {
119374 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U32);
119375 var buffer = Buffer.from(bytes);
119376 return (0, _leb.decodeInt32)(buffer);
119377 }
119378 /**
119379 * Decode a signed 64bits integer
119380 */
119381
119382
119383 function read64() {
119384 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
119385 var buffer = Buffer.from(bytes);
119386 return (0, _leb.decodeInt64)(buffer);
119387 }
119388
119389 function readU64() {
119390 var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);
119391 var buffer = Buffer.from(bytes);
119392 return (0, _leb.decodeUInt64)(buffer);
119393 }
119394
119395 function readByte() {
119396 return readBytes(1)[0];
119397 }
119398
119399 function parseModuleHeader() {
119400 if (isEOF() === true || offset + 4 > buf.length) {
119401 throw new Error("unexpected end");
119402 }
119403
119404 var header = readBytes(4);
119405
119406 if (byteArrayEq(_helperWasmBytecode.default.magicModuleHeader, header) === false) {
119407 throw new _helperApiError.CompileError("magic header not detected");
119408 }
119409
119410 dump(header, "wasm magic header");
119411 eatBytes(4);
119412 }
119413
119414 function parseVersion() {
119415 if (isEOF() === true || offset + 4 > buf.length) {
119416 throw new Error("unexpected end");
119417 }
119418
119419 var version = readBytes(4);
119420
119421 if (byteArrayEq(_helperWasmBytecode.default.moduleVersion, version) === false) {
119422 throw new _helperApiError.CompileError("unknown binary version");
119423 }
119424
119425 dump(version, "wasm version");
119426 eatBytes(4);
119427 }
119428
119429 function parseVec(cast) {
119430 var u32 = readU32();
119431 var length = u32.value;
119432 eatBytes(u32.nextIndex);
119433 dump([length], "number");
119434
119435 if (length === 0) {
119436 return [];
119437 }
119438
119439 var elements = [];
119440
119441 for (var i = 0; i < length; i++) {
119442 var byte = readByte();
119443 eatBytes(1);
119444 var value = cast(byte);
119445 dump([byte], value);
119446
119447 if (typeof value === "undefined") {
119448 throw new _helperApiError.CompileError("Internal failure: parseVec could not cast the value");
119449 }
119450
119451 elements.push(value);
119452 }
119453
119454 return elements;
119455 } // Type section
119456 // https://webassembly.github.io/spec/binary/modules.html#binary-typesec
119457
119458
119459 function parseTypeSection(numberOfTypes) {
119460 var typeInstructionNodes = [];
119461 dump([numberOfTypes], "num types");
119462
119463 for (var i = 0; i < numberOfTypes; i++) {
119464 var _startLoc = getPosition();
119465
119466 dumpSep("type " + i);
119467 var type = readByte();
119468 eatBytes(1);
119469
119470 if (type == _helperWasmBytecode.default.types.func) {
119471 dump([type], "func");
119472 var paramValtypes = parseVec(function (b) {
119473 return _helperWasmBytecode.default.valtypes[b];
119474 });
119475 var params = paramValtypes.map(function (v) {
119476 return t.funcParam(
119477 /*valtype*/
119478 v);
119479 });
119480 var result = parseVec(function (b) {
119481 return _helperWasmBytecode.default.valtypes[b];
119482 });
119483 typeInstructionNodes.push(function () {
119484 var endLoc = getPosition();
119485 return t.withLoc(t.typeInstruction(undefined, t.signature(params, result)), endLoc, _startLoc);
119486 }());
119487 state.typesInModule.push({
119488 params: params,
119489 result: result
119490 });
119491 } else {
119492 throw new Error("Unsupported type: " + toHex(type));
119493 }
119494 }
119495
119496 return typeInstructionNodes;
119497 } // Import section
119498 // https://webassembly.github.io/spec/binary/modules.html#binary-importsec
119499
119500
119501 function parseImportSection(numberOfImports) {
119502 var imports = [];
119503
119504 for (var i = 0; i < numberOfImports; i++) {
119505 dumpSep("import header " + i);
119506
119507 var _startLoc2 = getPosition();
119508 /**
119509 * Module name
119510 */
119511
119512
119513 var moduleName = readUTF8String();
119514 eatBytes(moduleName.nextIndex);
119515 dump([], "module name (".concat(moduleName.value, ")"));
119516 /**
119517 * Name
119518 */
119519
119520 var name = readUTF8String();
119521 eatBytes(name.nextIndex);
119522 dump([], "name (".concat(name.value, ")"));
119523 /**
119524 * Import descr
119525 */
119526
119527 var descrTypeByte = readByte();
119528 eatBytes(1);
119529 var descrType = _helperWasmBytecode.default.importTypes[descrTypeByte];
119530 dump([descrTypeByte], "import kind");
119531
119532 if (typeof descrType === "undefined") {
119533 throw new _helperApiError.CompileError("Unknown import description type: " + toHex(descrTypeByte));
119534 }
119535
119536 var importDescr = void 0;
119537
119538 if (descrType === "func") {
119539 var indexU32 = readU32();
119540 var typeindex = indexU32.value;
119541 eatBytes(indexU32.nextIndex);
119542 dump([typeindex], "type index");
119543 var signature = state.typesInModule[typeindex];
119544
119545 if (typeof signature === "undefined") {
119546 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
119547 }
119548
119549 var id = getUniqueName("func");
119550 importDescr = t.funcImportDescr(id, t.signature(signature.params, signature.result));
119551 state.functionsInModule.push({
119552 id: t.identifier(name.value),
119553 signature: signature,
119554 isExternal: true
119555 });
119556 } else if (descrType === "global") {
119557 importDescr = parseGlobalType();
119558 var globalNode = t.global(importDescr, []);
119559 state.globalsInModule.push(globalNode);
119560 } else if (descrType === "table") {
119561 importDescr = parseTableType(i);
119562 } else if (descrType === "mem") {
119563 var memoryNode = parseMemoryType(0);
119564 state.memoriesInModule.push(memoryNode);
119565 importDescr = memoryNode;
119566 } else {
119567 throw new _helperApiError.CompileError("Unsupported import of type: " + descrType);
119568 }
119569
119570 imports.push(function () {
119571 var endLoc = getPosition();
119572 return t.withLoc(t.moduleImport(moduleName.value, name.value, importDescr), endLoc, _startLoc2);
119573 }());
119574 }
119575
119576 return imports;
119577 } // Function section
119578 // https://webassembly.github.io/spec/binary/modules.html#function-section
119579
119580
119581 function parseFuncSection(numberOfFunctions) {
119582 dump([numberOfFunctions], "num funcs");
119583
119584 for (var i = 0; i < numberOfFunctions; i++) {
119585 var indexU32 = readU32();
119586 var typeindex = indexU32.value;
119587 eatBytes(indexU32.nextIndex);
119588 dump([typeindex], "type index");
119589 var signature = state.typesInModule[typeindex];
119590
119591 if (typeof signature === "undefined") {
119592 throw new _helperApiError.CompileError("function signature not found (".concat(typeindex, ")"));
119593 } // preserve anonymous, a name might be resolved later
119594
119595
119596 var id = t.withRaw(t.identifier(getUniqueName("func")), "");
119597 state.functionsInModule.push({
119598 id: id,
119599 signature: signature,
119600 isExternal: false
119601 });
119602 }
119603 } // Export section
119604 // https://webassembly.github.io/spec/binary/modules.html#export-section
119605
119606
119607 function parseExportSection(numberOfExport) {
119608 dump([numberOfExport], "num exports"); // Parse vector of exports
119609
119610 for (var i = 0; i < numberOfExport; i++) {
119611 var _startLoc3 = getPosition();
119612 /**
119613 * Name
119614 */
119615
119616
119617 var name = readUTF8String();
119618 eatBytes(name.nextIndex);
119619 dump([], "export name (".concat(name.value, ")"));
119620 /**
119621 * exportdescr
119622 */
119623
119624 var typeIndex = readByte();
119625 eatBytes(1);
119626 dump([typeIndex], "export kind");
119627 var indexu32 = readU32();
119628 var index = indexu32.value;
119629 eatBytes(indexu32.nextIndex);
119630 dump([index], "export index");
119631 var id = void 0,
119632 signature = void 0;
119633
119634 if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Func") {
119635 var func = state.functionsInModule[index];
119636
119637 if (typeof func === "undefined") {
119638 throw new _helperApiError.CompileError("unknown function (".concat(index, ")"));
119639 }
119640
119641 id = t.numberLiteralFromRaw(index, String(index));
119642 signature = func.signature;
119643 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Table") {
119644 var table = state.tablesInModule[index];
119645
119646 if (typeof table === "undefined") {
119647 throw new _helperApiError.CompileError("unknown table ".concat(index));
119648 }
119649
119650 id = t.numberLiteralFromRaw(index, String(index));
119651 signature = null;
119652 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Mem") {
119653 var memNode = state.memoriesInModule[index];
119654
119655 if (typeof memNode === "undefined") {
119656 throw new _helperApiError.CompileError("unknown memory ".concat(index));
119657 }
119658
119659 id = t.numberLiteralFromRaw(index, String(index));
119660 signature = null;
119661 } else if (_helperWasmBytecode.default.exportTypes[typeIndex] === "Global") {
119662 var global = state.globalsInModule[index];
119663
119664 if (typeof global === "undefined") {
119665 throw new _helperApiError.CompileError("unknown global ".concat(index));
119666 }
119667
119668 id = t.numberLiteralFromRaw(index, String(index));
119669 signature = null;
119670 } else {
119671 console.warn("Unsupported export type: " + toHex(typeIndex));
119672 return;
119673 }
119674
119675 var endLoc = getPosition();
119676 state.elementsInExportSection.push({
119677 name: name.value,
119678 type: _helperWasmBytecode.default.exportTypes[typeIndex],
119679 signature: signature,
119680 id: id,
119681 index: index,
119682 endLoc: endLoc,
119683 startLoc: _startLoc3
119684 });
119685 }
119686 } // Code section
119687 // https://webassembly.github.io/spec/binary/modules.html#code-section
119688
119689
119690 function parseCodeSection(numberOfFuncs) {
119691 dump([numberOfFuncs], "number functions"); // Parse vector of function
119692
119693 for (var i = 0; i < numberOfFuncs; i++) {
119694 var _startLoc4 = getPosition();
119695
119696 dumpSep("function body " + i); // the u32 size of the function code in bytes
119697 // Ignore it for now
119698
119699 var bodySizeU32 = readU32();
119700 eatBytes(bodySizeU32.nextIndex);
119701 dump([bodySizeU32.value], "function body size");
119702 var code = [];
119703 /**
119704 * Parse locals
119705 */
119706
119707 var funcLocalNumU32 = readU32();
119708 var funcLocalNum = funcLocalNumU32.value;
119709 eatBytes(funcLocalNumU32.nextIndex);
119710 dump([funcLocalNum], "num locals");
119711 var locals = [];
119712
119713 for (var _i = 0; _i < funcLocalNum; _i++) {
119714 var _startLoc5 = getPosition();
119715
119716 var localCountU32 = readU32();
119717 var localCount = localCountU32.value;
119718 eatBytes(localCountU32.nextIndex);
119719 dump([localCount], "num local");
119720 var valtypeByte = readByte();
119721 eatBytes(1);
119722 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
119723 var args = [];
119724
119725 for (var _i2 = 0; _i2 < localCount; _i2++) {
119726 args.push(t.valtypeLiteral(type));
119727 }
119728
119729 var localNode = function () {
119730 var endLoc = getPosition();
119731 return t.withLoc(t.instruction("local", args), endLoc, _startLoc5);
119732 }();
119733
119734 locals.push(localNode);
119735 dump([valtypeByte], type);
119736
119737 if (typeof type === "undefined") {
119738 throw new _helperApiError.CompileError("Unexpected valtype: " + toHex(valtypeByte));
119739 }
119740 }
119741
119742 code.push.apply(code, locals); // Decode instructions until the end
119743
119744 parseInstructionBlock(code);
119745 var endLoc = getPosition();
119746 state.elementsInCodeSection.push({
119747 code: code,
119748 locals: locals,
119749 endLoc: endLoc,
119750 startLoc: _startLoc4,
119751 bodySize: bodySizeU32.value
119752 });
119753 }
119754 }
119755
119756 function parseInstructionBlock(code) {
119757 while (true) {
119758 var _startLoc6 = getPosition();
119759
119760 var instructionAlreadyCreated = false;
119761 var instructionByte = readByte();
119762 eatBytes(1);
119763
119764 if (instructionByte === 0xfe) {
119765 throw new _helperApiError.CompileError("Atomic instructions are not implemented");
119766 }
119767
119768 var instruction = _helperWasmBytecode.default.symbolsByByte[instructionByte];
119769
119770 if (typeof instruction === "undefined") {
119771 throw new _helperApiError.CompileError("Unexpected instruction: " + toHex(instructionByte));
119772 }
119773
119774 if (typeof instruction.object === "string") {
119775 dump([instructionByte], "".concat(instruction.object, ".").concat(instruction.name));
119776 } else {
119777 dump([instructionByte], instruction.name);
119778 }
119779 /**
119780 * End of the function
119781 */
119782
119783
119784 if (instruction.name === "end") {
119785 var node = function () {
119786 var endLoc = getPosition();
119787 return t.withLoc(t.instruction(instruction.name), endLoc, _startLoc6);
119788 }();
119789
119790 code.push(node);
119791 break;
119792 }
119793
119794 var args = [];
119795
119796 if (instruction.name === "loop") {
119797 var _startLoc7 = getPosition();
119798
119799 var blocktypeByte = readByte();
119800 eatBytes(1);
119801 var blocktype = _helperWasmBytecode.default.blockTypes[blocktypeByte];
119802 dump([blocktypeByte], "blocktype");
119803
119804 if (typeof blocktype === "undefined") {
119805 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(blocktypeByte));
119806 }
119807
119808 var instr = [];
119809 parseInstructionBlock(instr); // preserve anonymous
119810
119811 var label = t.withRaw(t.identifier(getUniqueName("loop")), "");
119812
119813 var loopNode = function () {
119814 var endLoc = getPosition();
119815 return t.withLoc(t.loopInstruction(label, blocktype, instr), endLoc, _startLoc7);
119816 }();
119817
119818 code.push(loopNode);
119819 instructionAlreadyCreated = true;
119820 } else if (instruction.name === "if") {
119821 var _startLoc8 = getPosition();
119822
119823 var _blocktypeByte = readByte();
119824
119825 eatBytes(1);
119826 var _blocktype = _helperWasmBytecode.default.blockTypes[_blocktypeByte];
119827 dump([_blocktypeByte], "blocktype");
119828
119829 if (typeof _blocktype === "undefined") {
119830 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte));
119831 }
119832
119833 var testIndex = t.withRaw(t.identifier(getUniqueName("if")), "");
119834 var ifBody = [];
119835 parseInstructionBlock(ifBody); // Defaults to no alternate
119836
119837 var elseIndex = 0;
119838
119839 for (elseIndex = 0; elseIndex < ifBody.length; ++elseIndex) {
119840 var _instr = ifBody[elseIndex];
119841
119842 if (_instr.type === "Instr" && _instr.id === "else") {
119843 break;
119844 }
119845 }
119846
119847 var consequentInstr = ifBody.slice(0, elseIndex);
119848 var alternate = ifBody.slice(elseIndex + 1); // wast sugar
119849
119850 var testInstrs = [];
119851
119852 var ifNode = function () {
119853 var endLoc = getPosition();
119854 return t.withLoc(t.ifInstruction(testIndex, testInstrs, _blocktype, consequentInstr, alternate), endLoc, _startLoc8);
119855 }();
119856
119857 code.push(ifNode);
119858 instructionAlreadyCreated = true;
119859 } else if (instruction.name === "block") {
119860 var _startLoc9 = getPosition();
119861
119862 var _blocktypeByte2 = readByte();
119863
119864 eatBytes(1);
119865 var _blocktype2 = _helperWasmBytecode.default.blockTypes[_blocktypeByte2];
119866 dump([_blocktypeByte2], "blocktype");
119867
119868 if (typeof _blocktype2 === "undefined") {
119869 throw new _helperApiError.CompileError("Unexpected blocktype: " + toHex(_blocktypeByte2));
119870 }
119871
119872 var _instr2 = [];
119873 parseInstructionBlock(_instr2); // preserve anonymous
119874
119875 var _label = t.withRaw(t.identifier(getUniqueName("block")), "");
119876
119877 var blockNode = function () {
119878 var endLoc = getPosition();
119879 return t.withLoc(t.blockInstruction(_label, _instr2, _blocktype2), endLoc, _startLoc9);
119880 }();
119881
119882 code.push(blockNode);
119883 instructionAlreadyCreated = true;
119884 } else if (instruction.name === "call") {
119885 var indexu32 = readU32();
119886 var index = indexu32.value;
119887 eatBytes(indexu32.nextIndex);
119888 dump([index], "index");
119889
119890 var callNode = function () {
119891 var endLoc = getPosition();
119892 return t.withLoc(t.callInstruction(t.indexLiteral(index)), endLoc, _startLoc6);
119893 }();
119894
119895 code.push(callNode);
119896 instructionAlreadyCreated = true;
119897 } else if (instruction.name === "call_indirect") {
119898 var _startLoc10 = getPosition();
119899
119900 var indexU32 = readU32();
119901 var typeindex = indexU32.value;
119902 eatBytes(indexU32.nextIndex);
119903 dump([typeindex], "type index");
119904 var signature = state.typesInModule[typeindex];
119905
119906 if (typeof signature === "undefined") {
119907 throw new _helperApiError.CompileError("call_indirect signature not found (".concat(typeindex, ")"));
119908 }
119909
119910 var _callNode = t.callIndirectInstruction(t.signature(signature.params, signature.result), []);
119911
119912 var flagU32 = readU32();
119913 var flag = flagU32.value; // 0x00 - reserved byte
119914
119915 eatBytes(flagU32.nextIndex);
119916
119917 if (flag !== 0) {
119918 throw new _helperApiError.CompileError("zero flag expected");
119919 }
119920
119921 code.push(function () {
119922 var endLoc = getPosition();
119923 return t.withLoc(_callNode, endLoc, _startLoc10);
119924 }());
119925 instructionAlreadyCreated = true;
119926 } else if (instruction.name === "br_table") {
119927 var indicesu32 = readU32();
119928 var indices = indicesu32.value;
119929 eatBytes(indicesu32.nextIndex);
119930 dump([indices], "num indices");
119931
119932 for (var i = 0; i <= indices; i++) {
119933 var _indexu = readU32();
119934
119935 var _index = _indexu.value;
119936 eatBytes(_indexu.nextIndex);
119937 dump([_index], "index");
119938 args.push(t.numberLiteralFromRaw(_indexu.value.toString(), "u32"));
119939 }
119940 } else if (instructionByte >= 0x28 && instructionByte <= 0x40) {
119941 /**
119942 * Memory instructions
119943 */
119944 if (instruction.name === "grow_memory" || instruction.name === "current_memory") {
119945 var _indexU = readU32();
119946
119947 var _index2 = _indexU.value;
119948 eatBytes(_indexU.nextIndex);
119949
119950 if (_index2 !== 0) {
119951 throw new Error("zero flag expected");
119952 }
119953
119954 dump([_index2], "index");
119955 } else {
119956 var aligun32 = readU32();
119957 var align = aligun32.value;
119958 eatBytes(aligun32.nextIndex);
119959 dump([align], "align");
119960 var offsetu32 = readU32();
119961 var _offset2 = offsetu32.value;
119962 eatBytes(offsetu32.nextIndex);
119963 dump([_offset2], "offset");
119964 }
119965 } else if (instructionByte >= 0x41 && instructionByte <= 0x44) {
119966 /**
119967 * Numeric instructions
119968 */
119969 if (instruction.object === "i32") {
119970 var value32 = read32();
119971 var value = value32.value;
119972 eatBytes(value32.nextIndex);
119973 dump([value], "i32 value");
119974 args.push(t.numberLiteralFromRaw(value));
119975 }
119976
119977 if (instruction.object === "u32") {
119978 var valueu32 = readU32();
119979 var _value = valueu32.value;
119980 eatBytes(valueu32.nextIndex);
119981 dump([_value], "u32 value");
119982 args.push(t.numberLiteralFromRaw(_value));
119983 }
119984
119985 if (instruction.object === "i64") {
119986 var value64 = read64();
119987 var _value2 = value64.value;
119988 eatBytes(value64.nextIndex);
119989 dump([Number(_value2.toString())], "i64 value");
119990 var high = _value2.high,
119991 low = _value2.low;
119992 var _node = {
119993 type: "LongNumberLiteral",
119994 value: {
119995 high: high,
119996 low: low
119997 }
119998 };
119999 args.push(_node);
120000 }
120001
120002 if (instruction.object === "u64") {
120003 var valueu64 = readU64();
120004 var _value3 = valueu64.value;
120005 eatBytes(valueu64.nextIndex);
120006 dump([Number(_value3.toString())], "u64 value");
120007 var _high = _value3.high,
120008 _low = _value3.low;
120009 var _node2 = {
120010 type: "LongNumberLiteral",
120011 value: {
120012 high: _high,
120013 low: _low
120014 }
120015 };
120016 args.push(_node2);
120017 }
120018
120019 if (instruction.object === "f32") {
120020 var valuef32 = readF32();
120021 var _value4 = valuef32.value;
120022 eatBytes(valuef32.nextIndex);
120023 dump([_value4], "f32 value");
120024 args.push( // $FlowIgnore
120025 t.floatLiteral(_value4, valuef32.nan, valuef32.inf, String(_value4)));
120026 }
120027
120028 if (instruction.object === "f64") {
120029 var valuef64 = readF64();
120030 var _value5 = valuef64.value;
120031 eatBytes(valuef64.nextIndex);
120032 dump([_value5], "f64 value");
120033 args.push( // $FlowIgnore
120034 t.floatLiteral(_value5, valuef64.nan, valuef64.inf, String(_value5)));
120035 }
120036 } else {
120037 for (var _i3 = 0; _i3 < instruction.numberOfArgs; _i3++) {
120038 var u32 = readU32();
120039 eatBytes(u32.nextIndex);
120040 dump([u32.value], "argument " + _i3);
120041 args.push(t.numberLiteralFromRaw(u32.value));
120042 }
120043 }
120044
120045 if (instructionAlreadyCreated === false) {
120046 if (typeof instruction.object === "string") {
120047 var _node3 = function () {
120048 var endLoc = getPosition();
120049 return t.withLoc(t.objectInstruction(instruction.name, instruction.object, args), endLoc, _startLoc6);
120050 }();
120051
120052 code.push(_node3);
120053 } else {
120054 var _node4 = function () {
120055 var endLoc = getPosition();
120056 return t.withLoc(t.instruction(instruction.name, args), endLoc, _startLoc6);
120057 }();
120058
120059 code.push(_node4);
120060 }
120061 }
120062 }
120063 } // https://webassembly.github.io/spec/core/binary/types.html#limits
120064
120065
120066 function parseLimits() {
120067 var limitType = readByte();
120068 eatBytes(1);
120069 dump([limitType], "limit type");
120070 var min, max;
120071
120072 if (limitType === 0x01 || limitType === 0x03 // shared limits
120073 ) {
120074 var u32min = readU32();
120075 min = parseInt(u32min.value);
120076 eatBytes(u32min.nextIndex);
120077 dump([min], "min");
120078 var u32max = readU32();
120079 max = parseInt(u32max.value);
120080 eatBytes(u32max.nextIndex);
120081 dump([max], "max");
120082 }
120083
120084 if (limitType === 0x00) {
120085 var _u32min = readU32();
120086
120087 min = parseInt(_u32min.value);
120088 eatBytes(_u32min.nextIndex);
120089 dump([min], "min");
120090 }
120091
120092 return t.limit(min, max);
120093 } // https://webassembly.github.io/spec/core/binary/types.html#binary-tabletype
120094
120095
120096 function parseTableType(index) {
120097 var name = t.withRaw(t.identifier(getUniqueName("table")), String(index));
120098 var elementTypeByte = readByte();
120099 eatBytes(1);
120100 dump([elementTypeByte], "element type");
120101 var elementType = _helperWasmBytecode.default.tableTypes[elementTypeByte];
120102
120103 if (typeof elementType === "undefined") {
120104 throw new _helperApiError.CompileError("Unknown element type in table: " + toHex(elementType));
120105 }
120106
120107 var limits = parseLimits();
120108 return t.table(elementType, limits, name);
120109 } // https://webassembly.github.io/spec/binary/types.html#global-types
120110
120111
120112 function parseGlobalType() {
120113 var valtypeByte = readByte();
120114 eatBytes(1);
120115 var type = _helperWasmBytecode.default.valtypes[valtypeByte];
120116 dump([valtypeByte], type);
120117
120118 if (typeof type === "undefined") {
120119 throw new _helperApiError.CompileError("Unknown valtype: " + toHex(valtypeByte));
120120 }
120121
120122 var globalTypeByte = readByte();
120123 eatBytes(1);
120124 var globalType = _helperWasmBytecode.default.globalTypes[globalTypeByte];
120125 dump([globalTypeByte], "global type (".concat(globalType, ")"));
120126
120127 if (typeof globalType === "undefined") {
120128 throw new _helperApiError.CompileError("Invalid mutability: " + toHex(globalTypeByte));
120129 }
120130
120131 return t.globalType(type, globalType);
120132 } // function parseNameModule() {
120133 // const lenu32 = readVaruint32();
120134 // eatBytes(lenu32.nextIndex);
120135 // console.log("len", lenu32);
120136 // const strlen = lenu32.value;
120137 // dump([strlen], "string length");
120138 // const bytes = readBytes(strlen);
120139 // eatBytes(strlen);
120140 // const value = utf8.decode(bytes);
120141 // return [t.moduleNameMetadata(value)];
120142 // }
120143 // this section contains an array of function names and indices
120144
120145
120146 function parseNameSectionFunctions() {
120147 var functionNames = [];
120148 var numberOfFunctionsu32 = readU32();
120149 var numbeOfFunctions = numberOfFunctionsu32.value;
120150 eatBytes(numberOfFunctionsu32.nextIndex);
120151
120152 for (var i = 0; i < numbeOfFunctions; i++) {
120153 var indexu32 = readU32();
120154 var index = indexu32.value;
120155 eatBytes(indexu32.nextIndex);
120156 var name = readUTF8String();
120157 eatBytes(name.nextIndex);
120158 functionNames.push(t.functionNameMetadata(name.value, index));
120159 }
120160
120161 return functionNames;
120162 }
120163
120164 function parseNameSectionLocals() {
120165 var localNames = [];
120166 var numbeOfFunctionsu32 = readU32();
120167 var numbeOfFunctions = numbeOfFunctionsu32.value;
120168 eatBytes(numbeOfFunctionsu32.nextIndex);
120169
120170 for (var i = 0; i < numbeOfFunctions; i++) {
120171 var functionIndexu32 = readU32();
120172 var functionIndex = functionIndexu32.value;
120173 eatBytes(functionIndexu32.nextIndex);
120174 var numLocalsu32 = readU32();
120175 var numLocals = numLocalsu32.value;
120176 eatBytes(numLocalsu32.nextIndex);
120177
120178 for (var _i4 = 0; _i4 < numLocals; _i4++) {
120179 var localIndexu32 = readU32();
120180 var localIndex = localIndexu32.value;
120181 eatBytes(localIndexu32.nextIndex);
120182 var name = readUTF8String();
120183 eatBytes(name.nextIndex);
120184 localNames.push(t.localNameMetadata(name.value, localIndex, functionIndex));
120185 }
120186 }
120187
120188 return localNames;
120189 } // this is a custom section used for name resolution
120190 // https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
120191
120192
120193 function parseNameSection(remainingBytes) {
120194 var nameMetadata = [];
120195 var initialOffset = offset;
120196
120197 while (offset - initialOffset < remainingBytes) {
120198 // name_type
120199 var sectionTypeByte = readVaruint7();
120200 eatBytes(sectionTypeByte.nextIndex); // name_payload_len
120201
120202 var subSectionSizeInBytesu32 = readVaruint32();
120203 eatBytes(subSectionSizeInBytesu32.nextIndex);
120204
120205 switch (sectionTypeByte.value) {
120206 // case 0: {
120207 // TODO(sven): re-enable that
120208 // Current status: it seems that when we decode the module's name
120209 // no name_payload_len is used.
120210 //
120211 // See https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#name-section
120212 //
120213 // nameMetadata.push(...parseNameModule());
120214 // break;
120215 // }
120216 case 1:
120217 {
120218 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions()));
120219 break;
120220 }
120221
120222 case 2:
120223 {
120224 nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals()));
120225 break;
120226 }
120227
120228 default:
120229 {
120230 // skip unknown subsection
120231 eatBytes(subSectionSizeInBytesu32.value);
120232 }
120233 }
120234 }
120235
120236 return nameMetadata;
120237 } // this is a custom section used for information about the producers
120238 // https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md
120239
120240
120241 function parseProducersSection() {
120242 var metadata = t.producersSectionMetadata([]); // field_count
120243
120244 var sectionTypeByte = readVaruint32();
120245 eatBytes(sectionTypeByte.nextIndex);
120246 dump([sectionTypeByte.value], "num of producers");
120247 var fields = {
120248 language: [],
120249 "processed-by": [],
120250 sdk: []
120251 }; // fields
120252
120253 for (var fieldI = 0; fieldI < sectionTypeByte.value; fieldI++) {
120254 // field_name
120255 var fieldName = readUTF8String();
120256 eatBytes(fieldName.nextIndex); // field_value_count
120257
120258 var valueCount = readVaruint32();
120259 eatBytes(valueCount.nextIndex); // field_values
120260
120261 for (var producerI = 0; producerI < valueCount.value; producerI++) {
120262 var producerName = readUTF8String();
120263 eatBytes(producerName.nextIndex);
120264 var producerVersion = readUTF8String();
120265 eatBytes(producerVersion.nextIndex);
120266 fields[fieldName.value].push(t.producerMetadataVersionedName(producerName.value, producerVersion.value));
120267 }
120268
120269 metadata.producers.push(fields[fieldName.value]);
120270 }
120271
120272 return metadata;
120273 }
120274
120275 function parseGlobalSection(numberOfGlobals) {
120276 var globals = [];
120277 dump([numberOfGlobals], "num globals");
120278
120279 for (var i = 0; i < numberOfGlobals; i++) {
120280 var _startLoc11 = getPosition();
120281
120282 var globalType = parseGlobalType();
120283 /**
120284 * Global expressions
120285 */
120286
120287 var init = [];
120288 parseInstructionBlock(init);
120289
120290 var node = function () {
120291 var endLoc = getPosition();
120292 return t.withLoc(t.global(globalType, init), endLoc, _startLoc11);
120293 }();
120294
120295 globals.push(node);
120296 state.globalsInModule.push(node);
120297 }
120298
120299 return globals;
120300 }
120301
120302 function parseElemSection(numberOfElements) {
120303 var elems = [];
120304 dump([numberOfElements], "num elements");
120305
120306 for (var i = 0; i < numberOfElements; i++) {
120307 var _startLoc12 = getPosition();
120308
120309 var tableindexu32 = readU32();
120310 var tableindex = tableindexu32.value;
120311 eatBytes(tableindexu32.nextIndex);
120312 dump([tableindex], "table index");
120313 /**
120314 * Parse instructions
120315 */
120316
120317 var instr = [];
120318 parseInstructionBlock(instr);
120319 /**
120320 * Parse ( vector function index ) *
120321 */
120322
120323 var indicesu32 = readU32();
120324 var indices = indicesu32.value;
120325 eatBytes(indicesu32.nextIndex);
120326 dump([indices], "num indices");
120327 var indexValues = [];
120328
120329 for (var _i5 = 0; _i5 < indices; _i5++) {
120330 var indexu32 = readU32();
120331 var index = indexu32.value;
120332 eatBytes(indexu32.nextIndex);
120333 dump([index], "index");
120334 indexValues.push(t.indexLiteral(index));
120335 }
120336
120337 var elemNode = function () {
120338 var endLoc = getPosition();
120339 return t.withLoc(t.elem(t.indexLiteral(tableindex), instr, indexValues), endLoc, _startLoc12);
120340 }();
120341
120342 elems.push(elemNode);
120343 }
120344
120345 return elems;
120346 } // https://webassembly.github.io/spec/core/binary/types.html#memory-types
120347
120348
120349 function parseMemoryType(i) {
120350 var limits = parseLimits();
120351 return t.memory(limits, t.indexLiteral(i));
120352 } // https://webassembly.github.io/spec/binary/modules.html#table-section
120353
120354
120355 function parseTableSection(numberOfElements) {
120356 var tables = [];
120357 dump([numberOfElements], "num elements");
120358
120359 for (var i = 0; i < numberOfElements; i++) {
120360 var tablesNode = parseTableType(i);
120361 state.tablesInModule.push(tablesNode);
120362 tables.push(tablesNode);
120363 }
120364
120365 return tables;
120366 } // https://webassembly.github.io/spec/binary/modules.html#memory-section
120367
120368
120369 function parseMemorySection(numberOfElements) {
120370 var memories = [];
120371 dump([numberOfElements], "num elements");
120372
120373 for (var i = 0; i < numberOfElements; i++) {
120374 var memoryNode = parseMemoryType(i);
120375 state.memoriesInModule.push(memoryNode);
120376 memories.push(memoryNode);
120377 }
120378
120379 return memories;
120380 } // https://webassembly.github.io/spec/binary/modules.html#binary-startsec
120381
120382
120383 function parseStartSection() {
120384 var startLoc = getPosition();
120385 var u32 = readU32();
120386 var startFuncIndex = u32.value;
120387 eatBytes(u32.nextIndex);
120388 dump([startFuncIndex], "index");
120389 return function () {
120390 var endLoc = getPosition();
120391 return t.withLoc(t.start(t.indexLiteral(startFuncIndex)), endLoc, startLoc);
120392 }();
120393 } // https://webassembly.github.io/spec/binary/modules.html#data-section
120394
120395
120396 function parseDataSection(numberOfElements) {
120397 var dataEntries = [];
120398 dump([numberOfElements], "num elements");
120399
120400 for (var i = 0; i < numberOfElements; i++) {
120401 var memoryIndexu32 = readU32();
120402 var memoryIndex = memoryIndexu32.value;
120403 eatBytes(memoryIndexu32.nextIndex);
120404 dump([memoryIndex], "memory index");
120405 var instrs = [];
120406 parseInstructionBlock(instrs);
120407 var hasExtraInstrs = instrs.filter(function (i) {
120408 return i.id !== "end";
120409 }).length !== 1;
120410
120411 if (hasExtraInstrs) {
120412 throw new _helperApiError.CompileError("data section offset must be a single instruction");
120413 }
120414
120415 var bytes = parseVec(function (b) {
120416 return b;
120417 });
120418 dump([], "init");
120419 dataEntries.push(t.data(t.memIndexLiteral(memoryIndex), instrs[0], t.byteArray(bytes)));
120420 }
120421
120422 return dataEntries;
120423 } // https://webassembly.github.io/spec/binary/modules.html#binary-section
120424
120425
120426 function parseSection(sectionIndex) {
120427 var sectionId = readByte();
120428 eatBytes(1);
120429
120430 if (sectionId >= sectionIndex || sectionIndex === _helperWasmBytecode.default.sections.custom) {
120431 sectionIndex = sectionId + 1;
120432 } else {
120433 if (sectionId !== _helperWasmBytecode.default.sections.custom) throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
120434 }
120435
120436 var nextSectionIndex = sectionIndex;
120437 var startOffset = offset;
120438 var startLoc = getPosition();
120439 var u32 = readU32();
120440 var sectionSizeInBytes = u32.value;
120441 eatBytes(u32.nextIndex);
120442
120443 var sectionSizeInBytesNode = function () {
120444 var endLoc = getPosition();
120445 return t.withLoc(t.numberLiteralFromRaw(sectionSizeInBytes), endLoc, startLoc);
120446 }();
120447
120448 switch (sectionId) {
120449 case _helperWasmBytecode.default.sections.type:
120450 {
120451 dumpSep("section Type");
120452 dump([sectionId], "section code");
120453 dump([sectionSizeInBytes], "section size");
120454
120455 var _startLoc13 = getPosition();
120456
120457 var _u = readU32();
120458
120459 var numberOfTypes = _u.value;
120460 eatBytes(_u.nextIndex);
120461
120462 var _metadata = t.sectionMetadata("type", startOffset, sectionSizeInBytesNode, function () {
120463 var endLoc = getPosition();
120464 return t.withLoc(t.numberLiteralFromRaw(numberOfTypes), endLoc, _startLoc13);
120465 }());
120466
120467 var _nodes = parseTypeSection(numberOfTypes);
120468
120469 return {
120470 nodes: _nodes,
120471 metadata: _metadata,
120472 nextSectionIndex: nextSectionIndex
120473 };
120474 }
120475
120476 case _helperWasmBytecode.default.sections.table:
120477 {
120478 dumpSep("section Table");
120479 dump([sectionId], "section code");
120480 dump([sectionSizeInBytes], "section size");
120481
120482 var _startLoc14 = getPosition();
120483
120484 var _u2 = readU32();
120485
120486 var numberOfTable = _u2.value;
120487 eatBytes(_u2.nextIndex);
120488 dump([numberOfTable], "num tables");
120489
120490 var _metadata2 = t.sectionMetadata("table", startOffset, sectionSizeInBytesNode, function () {
120491 var endLoc = getPosition();
120492 return t.withLoc(t.numberLiteralFromRaw(numberOfTable), endLoc, _startLoc14);
120493 }());
120494
120495 var _nodes2 = parseTableSection(numberOfTable);
120496
120497 return {
120498 nodes: _nodes2,
120499 metadata: _metadata2,
120500 nextSectionIndex: nextSectionIndex
120501 };
120502 }
120503
120504 case _helperWasmBytecode.default.sections.import:
120505 {
120506 dumpSep("section Import");
120507 dump([sectionId], "section code");
120508 dump([sectionSizeInBytes], "section size");
120509
120510 var _startLoc15 = getPosition();
120511
120512 var numberOfImportsu32 = readU32();
120513 var numberOfImports = numberOfImportsu32.value;
120514 eatBytes(numberOfImportsu32.nextIndex);
120515 dump([numberOfImports], "number of imports");
120516
120517 var _metadata3 = t.sectionMetadata("import", startOffset, sectionSizeInBytesNode, function () {
120518 var endLoc = getPosition();
120519 return t.withLoc(t.numberLiteralFromRaw(numberOfImports), endLoc, _startLoc15);
120520 }());
120521
120522 var _nodes3 = parseImportSection(numberOfImports);
120523
120524 return {
120525 nodes: _nodes3,
120526 metadata: _metadata3,
120527 nextSectionIndex: nextSectionIndex
120528 };
120529 }
120530
120531 case _helperWasmBytecode.default.sections.func:
120532 {
120533 dumpSep("section Function");
120534 dump([sectionId], "section code");
120535 dump([sectionSizeInBytes], "section size");
120536
120537 var _startLoc16 = getPosition();
120538
120539 var numberOfFunctionsu32 = readU32();
120540 var numberOfFunctions = numberOfFunctionsu32.value;
120541 eatBytes(numberOfFunctionsu32.nextIndex);
120542
120543 var _metadata4 = t.sectionMetadata("func", startOffset, sectionSizeInBytesNode, function () {
120544 var endLoc = getPosition();
120545 return t.withLoc(t.numberLiteralFromRaw(numberOfFunctions), endLoc, _startLoc16);
120546 }());
120547
120548 parseFuncSection(numberOfFunctions);
120549 var _nodes4 = [];
120550 return {
120551 nodes: _nodes4,
120552 metadata: _metadata4,
120553 nextSectionIndex: nextSectionIndex
120554 };
120555 }
120556
120557 case _helperWasmBytecode.default.sections.export:
120558 {
120559 dumpSep("section Export");
120560 dump([sectionId], "section code");
120561 dump([sectionSizeInBytes], "section size");
120562
120563 var _startLoc17 = getPosition();
120564
120565 var _u3 = readU32();
120566
120567 var numberOfExport = _u3.value;
120568 eatBytes(_u3.nextIndex);
120569
120570 var _metadata5 = t.sectionMetadata("export", startOffset, sectionSizeInBytesNode, function () {
120571 var endLoc = getPosition();
120572 return t.withLoc(t.numberLiteralFromRaw(numberOfExport), endLoc, _startLoc17);
120573 }());
120574
120575 parseExportSection(numberOfExport);
120576 var _nodes5 = [];
120577 return {
120578 nodes: _nodes5,
120579 metadata: _metadata5,
120580 nextSectionIndex: nextSectionIndex
120581 };
120582 }
120583
120584 case _helperWasmBytecode.default.sections.code:
120585 {
120586 dumpSep("section Code");
120587 dump([sectionId], "section code");
120588 dump([sectionSizeInBytes], "section size");
120589
120590 var _startLoc18 = getPosition();
120591
120592 var _u4 = readU32();
120593
120594 var numberOfFuncs = _u4.value;
120595 eatBytes(_u4.nextIndex);
120596
120597 var _metadata6 = t.sectionMetadata("code", startOffset, sectionSizeInBytesNode, function () {
120598 var endLoc = getPosition();
120599 return t.withLoc(t.numberLiteralFromRaw(numberOfFuncs), endLoc, _startLoc18);
120600 }());
120601
120602 if (opts.ignoreCodeSection === true) {
120603 var remainingBytes = sectionSizeInBytes - _u4.nextIndex;
120604 eatBytes(remainingBytes); // eat the entire section
120605 } else {
120606 parseCodeSection(numberOfFuncs);
120607 }
120608
120609 var _nodes6 = [];
120610 return {
120611 nodes: _nodes6,
120612 metadata: _metadata6,
120613 nextSectionIndex: nextSectionIndex
120614 };
120615 }
120616
120617 case _helperWasmBytecode.default.sections.start:
120618 {
120619 dumpSep("section Start");
120620 dump([sectionId], "section code");
120621 dump([sectionSizeInBytes], "section size");
120622
120623 var _metadata7 = t.sectionMetadata("start", startOffset, sectionSizeInBytesNode);
120624
120625 var _nodes7 = [parseStartSection()];
120626 return {
120627 nodes: _nodes7,
120628 metadata: _metadata7,
120629 nextSectionIndex: nextSectionIndex
120630 };
120631 }
120632
120633 case _helperWasmBytecode.default.sections.element:
120634 {
120635 dumpSep("section Element");
120636 dump([sectionId], "section code");
120637 dump([sectionSizeInBytes], "section size");
120638
120639 var _startLoc19 = getPosition();
120640
120641 var numberOfElementsu32 = readU32();
120642 var numberOfElements = numberOfElementsu32.value;
120643 eatBytes(numberOfElementsu32.nextIndex);
120644
120645 var _metadata8 = t.sectionMetadata("element", startOffset, sectionSizeInBytesNode, function () {
120646 var endLoc = getPosition();
120647 return t.withLoc(t.numberLiteralFromRaw(numberOfElements), endLoc, _startLoc19);
120648 }());
120649
120650 var _nodes8 = parseElemSection(numberOfElements);
120651
120652 return {
120653 nodes: _nodes8,
120654 metadata: _metadata8,
120655 nextSectionIndex: nextSectionIndex
120656 };
120657 }
120658
120659 case _helperWasmBytecode.default.sections.global:
120660 {
120661 dumpSep("section Global");
120662 dump([sectionId], "section code");
120663 dump([sectionSizeInBytes], "section size");
120664
120665 var _startLoc20 = getPosition();
120666
120667 var numberOfGlobalsu32 = readU32();
120668 var numberOfGlobals = numberOfGlobalsu32.value;
120669 eatBytes(numberOfGlobalsu32.nextIndex);
120670
120671 var _metadata9 = t.sectionMetadata("global", startOffset, sectionSizeInBytesNode, function () {
120672 var endLoc = getPosition();
120673 return t.withLoc(t.numberLiteralFromRaw(numberOfGlobals), endLoc, _startLoc20);
120674 }());
120675
120676 var _nodes9 = parseGlobalSection(numberOfGlobals);
120677
120678 return {
120679 nodes: _nodes9,
120680 metadata: _metadata9,
120681 nextSectionIndex: nextSectionIndex
120682 };
120683 }
120684
120685 case _helperWasmBytecode.default.sections.memory:
120686 {
120687 dumpSep("section Memory");
120688 dump([sectionId], "section code");
120689 dump([sectionSizeInBytes], "section size");
120690
120691 var _startLoc21 = getPosition();
120692
120693 var _numberOfElementsu = readU32();
120694
120695 var _numberOfElements = _numberOfElementsu.value;
120696 eatBytes(_numberOfElementsu.nextIndex);
120697
120698 var _metadata10 = t.sectionMetadata("memory", startOffset, sectionSizeInBytesNode, function () {
120699 var endLoc = getPosition();
120700 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements), endLoc, _startLoc21);
120701 }());
120702
120703 var _nodes10 = parseMemorySection(_numberOfElements);
120704
120705 return {
120706 nodes: _nodes10,
120707 metadata: _metadata10,
120708 nextSectionIndex: nextSectionIndex
120709 };
120710 }
120711
120712 case _helperWasmBytecode.default.sections.data:
120713 {
120714 dumpSep("section Data");
120715 dump([sectionId], "section code");
120716 dump([sectionSizeInBytes], "section size");
120717
120718 var _metadata11 = t.sectionMetadata("data", startOffset, sectionSizeInBytesNode);
120719
120720 var _startLoc22 = getPosition();
120721
120722 var _numberOfElementsu2 = readU32();
120723
120724 var _numberOfElements2 = _numberOfElementsu2.value;
120725 eatBytes(_numberOfElementsu2.nextIndex);
120726
120727 _metadata11.vectorOfSize = function () {
120728 var endLoc = getPosition();
120729 return t.withLoc(t.numberLiteralFromRaw(_numberOfElements2), endLoc, _startLoc22);
120730 }();
120731
120732 if (opts.ignoreDataSection === true) {
120733 var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex;
120734
120735 eatBytes(_remainingBytes); // eat the entire section
120736
120737 dumpSep("ignore data (" + sectionSizeInBytes + " bytes)");
120738 return {
120739 nodes: [],
120740 metadata: _metadata11,
120741 nextSectionIndex: nextSectionIndex
120742 };
120743 } else {
120744 var _nodes11 = parseDataSection(_numberOfElements2);
120745
120746 return {
120747 nodes: _nodes11,
120748 metadata: _metadata11,
120749 nextSectionIndex: nextSectionIndex
120750 };
120751 }
120752 }
120753
120754 case _helperWasmBytecode.default.sections.custom:
120755 {
120756 dumpSep("section Custom");
120757 dump([sectionId], "section code");
120758 dump([sectionSizeInBytes], "section size");
120759 var _metadata12 = [t.sectionMetadata("custom", startOffset, sectionSizeInBytesNode)];
120760 var sectionName = readUTF8String();
120761 eatBytes(sectionName.nextIndex);
120762 dump([], "section name (".concat(sectionName.value, ")"));
120763
120764 var _remainingBytes2 = sectionSizeInBytes - sectionName.nextIndex;
120765
120766 if (sectionName.value === "name") {
120767 var initialOffset = offset;
120768
120769 try {
120770 _metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
120771 } catch (e) {
120772 console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
120773 eatBytes(offset - (initialOffset + _remainingBytes2));
120774 }
120775 } else if (sectionName.value === "producers") {
120776 var _initialOffset = offset;
120777
120778 try {
120779 _metadata12.push(parseProducersSection());
120780 } catch (e) {
120781 console.warn("Failed to decode custom \"producers\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
120782 eatBytes(offset - (_initialOffset + _remainingBytes2));
120783 }
120784 } else {
120785 // We don't parse the custom section
120786 eatBytes(_remainingBytes2);
120787 dumpSep("ignore custom " + JSON.stringify(sectionName.value) + " section (" + _remainingBytes2 + " bytes)");
120788 }
120789
120790 return {
120791 nodes: [],
120792 metadata: _metadata12,
120793 nextSectionIndex: nextSectionIndex
120794 };
120795 }
120796 }
120797
120798 throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
120799 }
120800
120801 parseModuleHeader();
120802 parseVersion();
120803 var moduleFields = [];
120804 var sectionIndex = 0;
120805 var moduleMetadata = {
120806 sections: [],
120807 functionNames: [],
120808 localNames: [],
120809 producers: []
120810 };
120811 /**
120812 * All the generate declaration are going to be stored in our state
120813 */
120814
120815 while (offset < buf.length) {
120816 var _parseSection = parseSection(sectionIndex),
120817 _nodes12 = _parseSection.nodes,
120818 _metadata13 = _parseSection.metadata,
120819 nextSectionIndex = _parseSection.nextSectionIndex;
120820
120821 moduleFields.push.apply(moduleFields, _toConsumableArray(_nodes12));
120822 var metadataArray = Array.isArray(_metadata13) ? _metadata13 : [_metadata13];
120823 metadataArray.forEach(function (metadataItem) {
120824 if (metadataItem.type === "FunctionNameMetadata") {
120825 moduleMetadata.functionNames.push(metadataItem);
120826 } else if (metadataItem.type === "LocalNameMetadata") {
120827 moduleMetadata.localNames.push(metadataItem);
120828 } else if (metadataItem.type === "ProducersSectionMetadata") {
120829 moduleMetadata.producers.push(metadataItem);
120830 } else {
120831 moduleMetadata.sections.push(metadataItem);
120832 }
120833 }); // Ignore custom section
120834
120835 if (nextSectionIndex) {
120836 sectionIndex = nextSectionIndex;
120837 }
120838 }
120839 /**
120840 * Transform the state into AST nodes
120841 */
120842
120843
120844 var funcIndex = 0;
120845 state.functionsInModule.forEach(function (func) {
120846 var params = func.signature.params;
120847 var result = func.signature.result;
120848 var body = []; // External functions doesn't provide any code, can skip it here
120849
120850 if (func.isExternal === true) {
120851 return;
120852 }
120853
120854 var decodedElementInCodeSection = state.elementsInCodeSection[funcIndex];
120855
120856 if (opts.ignoreCodeSection === false) {
120857 if (typeof decodedElementInCodeSection === "undefined") {
120858 throw new _helperApiError.CompileError("func " + toHex(funcIndex) + " code not found");
120859 }
120860
120861 body = decodedElementInCodeSection.code;
120862 }
120863
120864 funcIndex++;
120865 var funcNode = t.func(func.id, t.signature(params, result), body);
120866
120867 if (func.isExternal === true) {
120868 funcNode.isExternal = func.isExternal;
120869 } // Add function position in the binary if possible
120870
120871
120872 if (opts.ignoreCodeSection === false) {
120873 var _startLoc23 = decodedElementInCodeSection.startLoc,
120874 endLoc = decodedElementInCodeSection.endLoc,
120875 bodySize = decodedElementInCodeSection.bodySize;
120876 funcNode = t.withLoc(funcNode, endLoc, _startLoc23);
120877 funcNode.metadata = {
120878 bodySize: bodySize
120879 };
120880 }
120881
120882 moduleFields.push(funcNode);
120883 });
120884 state.elementsInExportSection.forEach(function (moduleExport) {
120885 /**
120886 * If the export has no id, we won't be able to call it from the outside
120887 * so we can omit it
120888 */
120889 if (moduleExport.id != null) {
120890 moduleFields.push(t.withLoc(t.moduleExport(moduleExport.name, t.moduleExportDescr(moduleExport.type, moduleExport.id)), moduleExport.endLoc, moduleExport.startLoc));
120891 }
120892 });
120893 dumpSep("end of program");
120894 var module = t.module(null, moduleFields, t.moduleMetadata(moduleMetadata.sections, moduleMetadata.functionNames, moduleMetadata.localNames, moduleMetadata.producers));
120895 return t.program([module]);
120896}
120897
120898/***/ }),
120899
120900/***/ 27352:
120901/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
120902
120903"use strict";
120904
120905
120906Object.defineProperty(exports, "__esModule", ({
120907 value: true
120908}));
120909exports.decode = decode;
120910
120911var decoder = _interopRequireWildcard(__webpack_require__(28458));
120912
120913var t = _interopRequireWildcard(__webpack_require__(81875));
120914
120915function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
120916
120917/**
120918 * TODO(sven): I added initial props, but we should rather fix
120919 * https://github.com/xtuc/webassemblyjs/issues/405
120920 */
120921var defaultDecoderOpts = {
120922 dump: false,
120923 ignoreCodeSection: false,
120924 ignoreDataSection: false,
120925 ignoreCustomNameSection: false
120926}; // traverses the AST, locating function name metadata, which is then
120927// used to update index-based identifiers with function names
120928
120929function restoreFunctionNames(ast) {
120930 var functionNames = [];
120931 t.traverse(ast, {
120932 FunctionNameMetadata: function FunctionNameMetadata(_ref) {
120933 var node = _ref.node;
120934 functionNames.push({
120935 name: node.value,
120936 index: node.index
120937 });
120938 }
120939 });
120940
120941 if (functionNames.length === 0) {
120942 return;
120943 }
120944
120945 t.traverse(ast, {
120946 Func: function (_Func) {
120947 function Func(_x) {
120948 return _Func.apply(this, arguments);
120949 }
120950
120951 Func.toString = function () {
120952 return _Func.toString();
120953 };
120954
120955 return Func;
120956 }(function (_ref2) {
120957 var node = _ref2.node;
120958 // $FlowIgnore
120959 var nodeName = node.name;
120960 var indexBasedFunctionName = nodeName.value;
120961 var index = Number(indexBasedFunctionName.replace("func_", ""));
120962 var functionName = functionNames.find(function (f) {
120963 return f.index === index;
120964 });
120965
120966 if (functionName) {
120967 var oldValue = nodeName.value;
120968 nodeName.value = functionName.name;
120969 nodeName.numeric = oldValue; // $FlowIgnore
120970
120971 delete nodeName.raw;
120972 }
120973 }),
120974 // Also update the reference in the export
120975 ModuleExport: function (_ModuleExport) {
120976 function ModuleExport(_x2) {
120977 return _ModuleExport.apply(this, arguments);
120978 }
120979
120980 ModuleExport.toString = function () {
120981 return _ModuleExport.toString();
120982 };
120983
120984 return ModuleExport;
120985 }(function (_ref3) {
120986 var node = _ref3.node;
120987
120988 if (node.descr.exportType === "Func") {
120989 // $FlowIgnore
120990 var nodeName = node.descr.id;
120991 var index = nodeName.value;
120992 var functionName = functionNames.find(function (f) {
120993 return f.index === index;
120994 });
120995
120996 if (functionName) {
120997 node.descr.id = t.identifier(functionName.name);
120998 }
120999 }
121000 }),
121001 ModuleImport: function (_ModuleImport) {
121002 function ModuleImport(_x3) {
121003 return _ModuleImport.apply(this, arguments);
121004 }
121005
121006 ModuleImport.toString = function () {
121007 return _ModuleImport.toString();
121008 };
121009
121010 return ModuleImport;
121011 }(function (_ref4) {
121012 var node = _ref4.node;
121013
121014 if (node.descr.type === "FuncImportDescr") {
121015 // $FlowIgnore
121016 var indexBasedFunctionName = node.descr.id;
121017 var index = Number(indexBasedFunctionName.replace("func_", ""));
121018 var functionName = functionNames.find(function (f) {
121019 return f.index === index;
121020 });
121021
121022 if (functionName) {
121023 // $FlowIgnore
121024 node.descr.id = t.identifier(functionName.name);
121025 }
121026 }
121027 }),
121028 CallInstruction: function (_CallInstruction) {
121029 function CallInstruction(_x4) {
121030 return _CallInstruction.apply(this, arguments);
121031 }
121032
121033 CallInstruction.toString = function () {
121034 return _CallInstruction.toString();
121035 };
121036
121037 return CallInstruction;
121038 }(function (nodePath) {
121039 var node = nodePath.node;
121040 var index = node.index.value;
121041 var functionName = functionNames.find(function (f) {
121042 return f.index === index;
121043 });
121044
121045 if (functionName) {
121046 var oldValue = node.index;
121047 node.index = t.identifier(functionName.name);
121048 node.numeric = oldValue; // $FlowIgnore
121049
121050 delete node.raw;
121051 }
121052 })
121053 });
121054}
121055
121056function restoreLocalNames(ast) {
121057 var localNames = [];
121058 t.traverse(ast, {
121059 LocalNameMetadata: function LocalNameMetadata(_ref5) {
121060 var node = _ref5.node;
121061 localNames.push({
121062 name: node.value,
121063 localIndex: node.localIndex,
121064 functionIndex: node.functionIndex
121065 });
121066 }
121067 });
121068
121069 if (localNames.length === 0) {
121070 return;
121071 }
121072
121073 t.traverse(ast, {
121074 Func: function (_Func2) {
121075 function Func(_x5) {
121076 return _Func2.apply(this, arguments);
121077 }
121078
121079 Func.toString = function () {
121080 return _Func2.toString();
121081 };
121082
121083 return Func;
121084 }(function (_ref6) {
121085 var node = _ref6.node;
121086 var signature = node.signature;
121087
121088 if (signature.type !== "Signature") {
121089 return;
121090 } // $FlowIgnore
121091
121092
121093 var nodeName = node.name;
121094 var indexBasedFunctionName = nodeName.value;
121095 var functionIndex = Number(indexBasedFunctionName.replace("func_", ""));
121096 signature.params.forEach(function (param, paramIndex) {
121097 var paramName = localNames.find(function (f) {
121098 return f.localIndex === paramIndex && f.functionIndex === functionIndex;
121099 });
121100
121101 if (paramName && paramName.name !== "") {
121102 param.id = paramName.name;
121103 }
121104 });
121105 })
121106 });
121107}
121108
121109function restoreModuleName(ast) {
121110 t.traverse(ast, {
121111 ModuleNameMetadata: function (_ModuleNameMetadata) {
121112 function ModuleNameMetadata(_x6) {
121113 return _ModuleNameMetadata.apply(this, arguments);
121114 }
121115
121116 ModuleNameMetadata.toString = function () {
121117 return _ModuleNameMetadata.toString();
121118 };
121119
121120 return ModuleNameMetadata;
121121 }(function (moduleNameMetadataPath) {
121122 // update module
121123 t.traverse(ast, {
121124 Module: function (_Module) {
121125 function Module(_x7) {
121126 return _Module.apply(this, arguments);
121127 }
121128
121129 Module.toString = function () {
121130 return _Module.toString();
121131 };
121132
121133 return Module;
121134 }(function (_ref7) {
121135 var node = _ref7.node;
121136 var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
121137
121138 if (name === "") {
121139 name = null;
121140 }
121141
121142 node.id = name;
121143 })
121144 });
121145 })
121146 });
121147}
121148
121149function decode(buf, customOpts) {
121150 var opts = Object.assign({}, defaultDecoderOpts, customOpts);
121151 var ast = decoder.decode(buf, opts);
121152
121153 if (opts.ignoreCustomNameSection === false) {
121154 restoreFunctionNames(ast);
121155 restoreLocalNames(ast);
121156 restoreModuleName(ast);
121157 }
121158
121159 return ast;
121160}
121161
121162/***/ }),
121163
121164/***/ 77087:
121165/***/ (function(__unused_webpack_module, exports) {
121166
121167(function (global, factory) {
121168 true ? factory(exports) :
121169 0;
121170}(this, function (exports) { 'use strict';
121171
121172 // Reserved word lists for various dialects of the language
121173
121174 var reservedWords = {
121175 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
121176 5: "class enum extends super const export import",
121177 6: "enum",
121178 strict: "implements interface let package private protected public static yield",
121179 strictBind: "eval arguments"
121180 };
121181
121182 // And the keywords
121183
121184 var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
121185
121186 var keywords = {
121187 5: ecma5AndLessKeywords,
121188 "5module": ecma5AndLessKeywords + " export import",
121189 6: ecma5AndLessKeywords + " const class extends export import super"
121190 };
121191
121192 var keywordRelationalOperator = /^in(stanceof)?$/;
121193
121194 // ## Character categories
121195
121196 // Big ugly regular expressions that match characters in the
121197 // whitespace, identifier, and identifier-start categories. These
121198 // are only applied when a character is found to actually have a
121199 // code point above 128.
121200 // Generated by `bin/generate-identifier-regex.js`.
121201 var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
121202 var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
121203
121204 var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
121205 var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
121206
121207 nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
121208
121209 // These are a run-length and offset encoded representation of the
121210 // >0xffff code points that are a valid part of identifiers. The
121211 // offset starts at 0x10000, and each pair of numbers represents an
121212 // offset to the next range, and then a size of the range. They were
121213 // generated by bin/generate-identifier-regex.js
121214
121215 // eslint-disable-next-line comma-spacing
121216 var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541];
121217
121218 // eslint-disable-next-line comma-spacing
121219 var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239];
121220
121221 // This has a complexity linear to the value of the code. The
121222 // assumption is that looking up astral identifier characters is
121223 // rare.
121224 function isInAstralSet(code, set) {
121225 var pos = 0x10000;
121226 for (var i = 0; i < set.length; i += 2) {
121227 pos += set[i];
121228 if (pos > code) { return false }
121229 pos += set[i + 1];
121230 if (pos >= code) { return true }
121231 }
121232 }
121233
121234 // Test whether a given character code starts an identifier.
121235
121236 function isIdentifierStart(code, astral) {
121237 if (code < 65) { return code === 36 }
121238 if (code < 91) { return true }
121239 if (code < 97) { return code === 95 }
121240 if (code < 123) { return true }
121241 if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
121242 if (astral === false) { return false }
121243 return isInAstralSet(code, astralIdentifierStartCodes)
121244 }
121245
121246 // Test whether a given character is part of an identifier.
121247
121248 function isIdentifierChar(code, astral) {
121249 if (code < 48) { return code === 36 }
121250 if (code < 58) { return true }
121251 if (code < 65) { return false }
121252 if (code < 91) { return true }
121253 if (code < 97) { return code === 95 }
121254 if (code < 123) { return true }
121255 if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
121256 if (astral === false) { return false }
121257 return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
121258 }
121259
121260 // ## Token types
121261
121262 // The assignment of fine-grained, information-carrying type objects
121263 // allows the tokenizer to store the information it has about a
121264 // token in a way that is very cheap for the parser to look up.
121265
121266 // All token type variables start with an underscore, to make them
121267 // easy to recognize.
121268
121269 // The `beforeExpr` property is used to disambiguate between regular
121270 // expressions and divisions. It is set on all token types that can
121271 // be followed by an expression (thus, a slash after them would be a
121272 // regular expression).
121273 //
121274 // The `startsExpr` property is used to check if the token ends a
121275 // `yield` expression. It is set on all token types that either can
121276 // directly start an expression (like a quotation mark) or can
121277 // continue an expression (like the body of a string).
121278 //
121279 // `isLoop` marks a keyword as starting a loop, which is important
121280 // to know when parsing a label, in order to allow or disallow
121281 // continue jumps to that label.
121282
121283 var TokenType = function TokenType(label, conf) {
121284 if ( conf === void 0 ) conf = {};
121285
121286 this.label = label;
121287 this.keyword = conf.keyword;
121288 this.beforeExpr = !!conf.beforeExpr;
121289 this.startsExpr = !!conf.startsExpr;
121290 this.isLoop = !!conf.isLoop;
121291 this.isAssign = !!conf.isAssign;
121292 this.prefix = !!conf.prefix;
121293 this.postfix = !!conf.postfix;
121294 this.binop = conf.binop || null;
121295 this.updateContext = null;
121296 };
121297
121298 function binop(name, prec) {
121299 return new TokenType(name, {beforeExpr: true, binop: prec})
121300 }
121301 var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
121302
121303 // Map keyword names to token types.
121304
121305 var keywords$1 = {};
121306
121307 // Succinct definitions of keyword token types
121308 function kw(name, options) {
121309 if ( options === void 0 ) options = {};
121310
121311 options.keyword = name;
121312 return keywords$1[name] = new TokenType(name, options)
121313 }
121314
121315 var types = {
121316 num: new TokenType("num", startsExpr),
121317 regexp: new TokenType("regexp", startsExpr),
121318 string: new TokenType("string", startsExpr),
121319 name: new TokenType("name", startsExpr),
121320 eof: new TokenType("eof"),
121321
121322 // Punctuation token types.
121323 bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
121324 bracketR: new TokenType("]"),
121325 braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
121326 braceR: new TokenType("}"),
121327 parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
121328 parenR: new TokenType(")"),
121329 comma: new TokenType(",", beforeExpr),
121330 semi: new TokenType(";", beforeExpr),
121331 colon: new TokenType(":", beforeExpr),
121332 dot: new TokenType("."),
121333 question: new TokenType("?", beforeExpr),
121334 arrow: new TokenType("=>", beforeExpr),
121335 template: new TokenType("template"),
121336 invalidTemplate: new TokenType("invalidTemplate"),
121337 ellipsis: new TokenType("...", beforeExpr),
121338 backQuote: new TokenType("`", startsExpr),
121339 dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
121340
121341 // Operators. These carry several kinds of properties to help the
121342 // parser use them properly (the presence of these properties is
121343 // what categorizes them as operators).
121344 //
121345 // `binop`, when present, specifies that this operator is a binary
121346 // operator, and will refer to its precedence.
121347 //
121348 // `prefix` and `postfix` mark the operator as a prefix or postfix
121349 // unary operator.
121350 //
121351 // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
121352 // binary operators with a very low precedence, that should result
121353 // in AssignmentExpression nodes.
121354
121355 eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
121356 assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
121357 incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
121358 prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
121359 logicalOR: binop("||", 1),
121360 logicalAND: binop("&&", 2),
121361 bitwiseOR: binop("|", 3),
121362 bitwiseXOR: binop("^", 4),
121363 bitwiseAND: binop("&", 5),
121364 equality: binop("==/!=/===/!==", 6),
121365 relational: binop("</>/<=/>=", 7),
121366 bitShift: binop("<</>>/>>>", 8),
121367 plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
121368 modulo: binop("%", 10),
121369 star: binop("*", 10),
121370 slash: binop("/", 10),
121371 starstar: new TokenType("**", {beforeExpr: true}),
121372
121373 // Keyword token types.
121374 _break: kw("break"),
121375 _case: kw("case", beforeExpr),
121376 _catch: kw("catch"),
121377 _continue: kw("continue"),
121378 _debugger: kw("debugger"),
121379 _default: kw("default", beforeExpr),
121380 _do: kw("do", {isLoop: true, beforeExpr: true}),
121381 _else: kw("else", beforeExpr),
121382 _finally: kw("finally"),
121383 _for: kw("for", {isLoop: true}),
121384 _function: kw("function", startsExpr),
121385 _if: kw("if"),
121386 _return: kw("return", beforeExpr),
121387 _switch: kw("switch"),
121388 _throw: kw("throw", beforeExpr),
121389 _try: kw("try"),
121390 _var: kw("var"),
121391 _const: kw("const"),
121392 _while: kw("while", {isLoop: true}),
121393 _with: kw("with"),
121394 _new: kw("new", {beforeExpr: true, startsExpr: true}),
121395 _this: kw("this", startsExpr),
121396 _super: kw("super", startsExpr),
121397 _class: kw("class", startsExpr),
121398 _extends: kw("extends", beforeExpr),
121399 _export: kw("export"),
121400 _import: kw("import", startsExpr),
121401 _null: kw("null", startsExpr),
121402 _true: kw("true", startsExpr),
121403 _false: kw("false", startsExpr),
121404 _in: kw("in", {beforeExpr: true, binop: 7}),
121405 _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
121406 _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
121407 _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
121408 _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
121409 };
121410
121411 // Matches a whole line break (where CRLF is considered a single
121412 // line break). Used to count lines.
121413
121414 var lineBreak = /\r\n?|\n|\u2028|\u2029/;
121415 var lineBreakG = new RegExp(lineBreak.source, "g");
121416
121417 function isNewLine(code, ecma2019String) {
121418 return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
121419 }
121420
121421 var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
121422
121423 var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
121424
121425 var ref = Object.prototype;
121426 var hasOwnProperty = ref.hasOwnProperty;
121427 var toString = ref.toString;
121428
121429 // Checks if an object has a property.
121430
121431 function has(obj, propName) {
121432 return hasOwnProperty.call(obj, propName)
121433 }
121434
121435 var isArray = Array.isArray || (function (obj) { return (
121436 toString.call(obj) === "[object Array]"
121437 ); });
121438
121439 function wordsRegexp(words) {
121440 return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
121441 }
121442
121443 // These are used when `options.locations` is on, for the
121444 // `startLoc` and `endLoc` properties.
121445
121446 var Position = function Position(line, col) {
121447 this.line = line;
121448 this.column = col;
121449 };
121450
121451 Position.prototype.offset = function offset (n) {
121452 return new Position(this.line, this.column + n)
121453 };
121454
121455 var SourceLocation = function SourceLocation(p, start, end) {
121456 this.start = start;
121457 this.end = end;
121458 if (p.sourceFile !== null) { this.source = p.sourceFile; }
121459 };
121460
121461 // The `getLineInfo` function is mostly useful when the
121462 // `locations` option is off (for performance reasons) and you
121463 // want to find the line/column position for a given character
121464 // offset. `input` should be the code string that the offset refers
121465 // into.
121466
121467 function getLineInfo(input, offset) {
121468 for (var line = 1, cur = 0;;) {
121469 lineBreakG.lastIndex = cur;
121470 var match = lineBreakG.exec(input);
121471 if (match && match.index < offset) {
121472 ++line;
121473 cur = match.index + match[0].length;
121474 } else {
121475 return new Position(line, offset - cur)
121476 }
121477 }
121478 }
121479
121480 // A second optional argument can be given to further configure
121481 // the parser process. These options are recognized:
121482
121483 var defaultOptions = {
121484 // `ecmaVersion` indicates the ECMAScript version to parse. Must be
121485 // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10
121486 // (2019). This influences support for strict mode, the set of
121487 // reserved words, and support for new syntax features. The default
121488 // is 9.
121489 ecmaVersion: 9,
121490 // `sourceType` indicates the mode the code should be parsed in.
121491 // Can be either `"script"` or `"module"`. This influences global
121492 // strict mode and parsing of `import` and `export` declarations.
121493 sourceType: "script",
121494 // `onInsertedSemicolon` can be a callback that will be called
121495 // when a semicolon is automatically inserted. It will be passed
121496 // the position of the comma as an offset, and if `locations` is
121497 // enabled, it is given the location as a `{line, column}` object
121498 // as second argument.
121499 onInsertedSemicolon: null,
121500 // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
121501 // trailing commas.
121502 onTrailingComma: null,
121503 // By default, reserved words are only enforced if ecmaVersion >= 5.
121504 // Set `allowReserved` to a boolean value to explicitly turn this on
121505 // an off. When this option has the value "never", reserved words
121506 // and keywords can also not be used as property names.
121507 allowReserved: null,
121508 // When enabled, a return at the top level is not considered an
121509 // error.
121510 allowReturnOutsideFunction: false,
121511 // When enabled, import/export statements are not constrained to
121512 // appearing at the top of the program.
121513 allowImportExportEverywhere: false,
121514 // When enabled, await identifiers are allowed to appear at the top-level scope,
121515 // but they are still not allowed in non-async functions.
121516 allowAwaitOutsideFunction: false,
121517 // When enabled, hashbang directive in the beginning of file
121518 // is allowed and treated as a line comment.
121519 allowHashBang: false,
121520 // When `locations` is on, `loc` properties holding objects with
121521 // `start` and `end` properties in `{line, column}` form (with
121522 // line being 1-based and column 0-based) will be attached to the
121523 // nodes.
121524 locations: false,
121525 // A function can be passed as `onToken` option, which will
121526 // cause Acorn to call that function with object in the same
121527 // format as tokens returned from `tokenizer().getToken()`. Note
121528 // that you are not allowed to call the parser from the
121529 // callback—that will corrupt its internal state.
121530 onToken: null,
121531 // A function can be passed as `onComment` option, which will
121532 // cause Acorn to call that function with `(block, text, start,
121533 // end)` parameters whenever a comment is skipped. `block` is a
121534 // boolean indicating whether this is a block (`/* */`) comment,
121535 // `text` is the content of the comment, and `start` and `end` are
121536 // character offsets that denote the start and end of the comment.
121537 // When the `locations` option is on, two more parameters are
121538 // passed, the full `{line, column}` locations of the start and
121539 // end of the comments. Note that you are not allowed to call the
121540 // parser from the callback—that will corrupt its internal state.
121541 onComment: null,
121542 // Nodes have their start and end characters offsets recorded in
121543 // `start` and `end` properties (directly on the node, rather than
121544 // the `loc` object, which holds line/column data. To also add a
121545 // [semi-standardized][range] `range` property holding a `[start,
121546 // end]` array with the same numbers, set the `ranges` option to
121547 // `true`.
121548 //
121549 // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
121550 ranges: false,
121551 // It is possible to parse multiple files into a single AST by
121552 // passing the tree produced by parsing the first file as
121553 // `program` option in subsequent parses. This will add the
121554 // toplevel forms of the parsed file to the `Program` (top) node
121555 // of an existing parse tree.
121556 program: null,
121557 // When `locations` is on, you can pass this to record the source
121558 // file in every node's `loc` object.
121559 sourceFile: null,
121560 // This value, if given, is stored in every node, whether
121561 // `locations` is on or off.
121562 directSourceFile: null,
121563 // When enabled, parenthesized expressions are represented by
121564 // (non-standard) ParenthesizedExpression nodes
121565 preserveParens: false
121566 };
121567
121568 // Interpret and default an options object
121569
121570 function getOptions(opts) {
121571 var options = {};
121572
121573 for (var opt in defaultOptions)
121574 { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }
121575
121576 if (options.ecmaVersion >= 2015)
121577 { options.ecmaVersion -= 2009; }
121578
121579 if (options.allowReserved == null)
121580 { options.allowReserved = options.ecmaVersion < 5; }
121581
121582 if (isArray(options.onToken)) {
121583 var tokens = options.onToken;
121584 options.onToken = function (token) { return tokens.push(token); };
121585 }
121586 if (isArray(options.onComment))
121587 { options.onComment = pushComment(options, options.onComment); }
121588
121589 return options
121590 }
121591
121592 function pushComment(options, array) {
121593 return function(block, text, start, end, startLoc, endLoc) {
121594 var comment = {
121595 type: block ? "Block" : "Line",
121596 value: text,
121597 start: start,
121598 end: end
121599 };
121600 if (options.locations)
121601 { comment.loc = new SourceLocation(this, startLoc, endLoc); }
121602 if (options.ranges)
121603 { comment.range = [start, end]; }
121604 array.push(comment);
121605 }
121606 }
121607
121608 // Each scope gets a bitset that may contain these flags
121609 var
121610 SCOPE_TOP = 1,
121611 SCOPE_FUNCTION = 2,
121612 SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
121613 SCOPE_ASYNC = 4,
121614 SCOPE_GENERATOR = 8,
121615 SCOPE_ARROW = 16,
121616 SCOPE_SIMPLE_CATCH = 32,
121617 SCOPE_SUPER = 64,
121618 SCOPE_DIRECT_SUPER = 128;
121619
121620 function functionFlags(async, generator) {
121621 return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
121622 }
121623
121624 // Used in checkLVal and declareName to determine the type of a binding
121625 var
121626 BIND_NONE = 0, // Not a binding
121627 BIND_VAR = 1, // Var-style binding
121628 BIND_LEXICAL = 2, // Let- or const-style binding
121629 BIND_FUNCTION = 3, // Function declaration
121630 BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
121631 BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
121632
121633 var Parser = function Parser(options, input, startPos) {
121634 this.options = options = getOptions(options);
121635 this.sourceFile = options.sourceFile;
121636 this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
121637 var reserved = "";
121638 if (options.allowReserved !== true) {
121639 for (var v = options.ecmaVersion;; v--)
121640 { if (reserved = reservedWords[v]) { break } }
121641 if (options.sourceType === "module") { reserved += " await"; }
121642 }
121643 this.reservedWords = wordsRegexp(reserved);
121644 var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
121645 this.reservedWordsStrict = wordsRegexp(reservedStrict);
121646 this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
121647 this.input = String(input);
121648
121649 // Used to signal to callers of `readWord1` whether the word
121650 // contained any escape sequences. This is needed because words with
121651 // escape sequences must not be interpreted as keywords.
121652 this.containsEsc = false;
121653
121654 // Set up token state
121655
121656 // The current position of the tokenizer in the input.
121657 if (startPos) {
121658 this.pos = startPos;
121659 this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
121660 this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
121661 } else {
121662 this.pos = this.lineStart = 0;
121663 this.curLine = 1;
121664 }
121665
121666 // Properties of the current token:
121667 // Its type
121668 this.type = types.eof;
121669 // For tokens that include more information than their type, the value
121670 this.value = null;
121671 // Its start and end offset
121672 this.start = this.end = this.pos;
121673 // And, if locations are used, the {line, column} object
121674 // corresponding to those offsets
121675 this.startLoc = this.endLoc = this.curPosition();
121676
121677 // Position information for the previous token
121678 this.lastTokEndLoc = this.lastTokStartLoc = null;
121679 this.lastTokStart = this.lastTokEnd = this.pos;
121680
121681 // The context stack is used to superficially track syntactic
121682 // context to predict whether a regular expression is allowed in a
121683 // given position.
121684 this.context = this.initialContext();
121685 this.exprAllowed = true;
121686
121687 // Figure out if it's a module code.
121688 this.inModule = options.sourceType === "module";
121689 this.strict = this.inModule || this.strictDirective(this.pos);
121690
121691 // Used to signify the start of a potential arrow function
121692 this.potentialArrowAt = -1;
121693
121694 // Positions to delayed-check that yield/await does not exist in default parameters.
121695 this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
121696 // Labels in scope.
121697 this.labels = [];
121698 // Thus-far undefined exports.
121699 this.undefinedExports = {};
121700
121701 // If enabled, skip leading hashbang line.
121702 if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
121703 { this.skipLineComment(2); }
121704
121705 // Scope tracking for duplicate variable names (see scope.js)
121706 this.scopeStack = [];
121707 this.enterScope(SCOPE_TOP);
121708
121709 // For RegExp validation
121710 this.regexpState = null;
121711 };
121712
121713 var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true } };
121714
121715 Parser.prototype.parse = function parse () {
121716 var node = this.options.program || this.startNode();
121717 this.nextToken();
121718 return this.parseTopLevel(node)
121719 };
121720
121721 prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
121722 prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
121723 prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
121724 prototypeAccessors.allowSuper.get = function () { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 };
121725 prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
121726 prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
121727
121728 // Switch to a getter for 7.0.0.
121729 Parser.prototype.inNonArrowFunction = function inNonArrowFunction () { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 };
121730
121731 Parser.extend = function extend () {
121732 var plugins = [], len = arguments.length;
121733 while ( len-- ) plugins[ len ] = arguments[ len ];
121734
121735 var cls = this;
121736 for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
121737 return cls
121738 };
121739
121740 Parser.parse = function parse (input, options) {
121741 return new this(options, input).parse()
121742 };
121743
121744 Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) {
121745 var parser = new this(options, input, pos);
121746 parser.nextToken();
121747 return parser.parseExpression()
121748 };
121749
121750 Parser.tokenizer = function tokenizer (input, options) {
121751 return new this(options, input)
121752 };
121753
121754 Object.defineProperties( Parser.prototype, prototypeAccessors );
121755
121756 var pp = Parser.prototype;
121757
121758 // ## Parser utilities
121759
121760 var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/;
121761 pp.strictDirective = function(start) {
121762 for (;;) {
121763 // Try to find string literal.
121764 skipWhiteSpace.lastIndex = start;
121765 start += skipWhiteSpace.exec(this.input)[0].length;
121766 var match = literal.exec(this.input.slice(start));
121767 if (!match) { return false }
121768 if ((match[1] || match[2]) === "use strict") { return true }
121769 start += match[0].length;
121770
121771 // Skip semicolon, if any.
121772 skipWhiteSpace.lastIndex = start;
121773 start += skipWhiteSpace.exec(this.input)[0].length;
121774 if (this.input[start] === ";")
121775 { start++; }
121776 }
121777 };
121778
121779 // Predicate that tests whether the next token is of the given
121780 // type, and if yes, consumes it as a side effect.
121781
121782 pp.eat = function(type) {
121783 if (this.type === type) {
121784 this.next();
121785 return true
121786 } else {
121787 return false
121788 }
121789 };
121790
121791 // Tests whether parsed token is a contextual keyword.
121792
121793 pp.isContextual = function(name) {
121794 return this.type === types.name && this.value === name && !this.containsEsc
121795 };
121796
121797 // Consumes contextual keyword if possible.
121798
121799 pp.eatContextual = function(name) {
121800 if (!this.isContextual(name)) { return false }
121801 this.next();
121802 return true
121803 };
121804
121805 // Asserts that following token is given contextual keyword.
121806
121807 pp.expectContextual = function(name) {
121808 if (!this.eatContextual(name)) { this.unexpected(); }
121809 };
121810
121811 // Test whether a semicolon can be inserted at the current position.
121812
121813 pp.canInsertSemicolon = function() {
121814 return this.type === types.eof ||
121815 this.type === types.braceR ||
121816 lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
121817 };
121818
121819 pp.insertSemicolon = function() {
121820 if (this.canInsertSemicolon()) {
121821 if (this.options.onInsertedSemicolon)
121822 { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
121823 return true
121824 }
121825 };
121826
121827 // Consume a semicolon, or, failing that, see if we are allowed to
121828 // pretend that there is a semicolon at this position.
121829
121830 pp.semicolon = function() {
121831 if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
121832 };
121833
121834 pp.afterTrailingComma = function(tokType, notNext) {
121835 if (this.type === tokType) {
121836 if (this.options.onTrailingComma)
121837 { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
121838 if (!notNext)
121839 { this.next(); }
121840 return true
121841 }
121842 };
121843
121844 // Expect a token of a given type. If found, consume it, otherwise,
121845 // raise an unexpected token error.
121846
121847 pp.expect = function(type) {
121848 this.eat(type) || this.unexpected();
121849 };
121850
121851 // Raise an unexpected token error.
121852
121853 pp.unexpected = function(pos) {
121854 this.raise(pos != null ? pos : this.start, "Unexpected token");
121855 };
121856
121857 function DestructuringErrors() {
121858 this.shorthandAssign =
121859 this.trailingComma =
121860 this.parenthesizedAssign =
121861 this.parenthesizedBind =
121862 this.doubleProto =
121863 -1;
121864 }
121865
121866 pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
121867 if (!refDestructuringErrors) { return }
121868 if (refDestructuringErrors.trailingComma > -1)
121869 { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
121870 var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
121871 if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
121872 };
121873
121874 pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
121875 if (!refDestructuringErrors) { return false }
121876 var shorthandAssign = refDestructuringErrors.shorthandAssign;
121877 var doubleProto = refDestructuringErrors.doubleProto;
121878 if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
121879 if (shorthandAssign >= 0)
121880 { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
121881 if (doubleProto >= 0)
121882 { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
121883 };
121884
121885 pp.checkYieldAwaitInDefaultParams = function() {
121886 if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
121887 { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
121888 if (this.awaitPos)
121889 { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
121890 };
121891
121892 pp.isSimpleAssignTarget = function(expr) {
121893 if (expr.type === "ParenthesizedExpression")
121894 { return this.isSimpleAssignTarget(expr.expression) }
121895 return expr.type === "Identifier" || expr.type === "MemberExpression"
121896 };
121897
121898 var pp$1 = Parser.prototype;
121899
121900 // ### Statement parsing
121901
121902 // Parse a program. Initializes the parser, reads any number of
121903 // statements, and wraps them in a Program node. Optionally takes a
121904 // `program` argument. If present, the statements will be appended
121905 // to its body instead of creating a new node.
121906
121907 pp$1.parseTopLevel = function(node) {
121908 var exports = {};
121909 if (!node.body) { node.body = []; }
121910 while (this.type !== types.eof) {
121911 var stmt = this.parseStatement(null, true, exports);
121912 node.body.push(stmt);
121913 }
121914 if (this.inModule)
121915 { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
121916 {
121917 var name = list[i];
121918
121919 this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
121920 } }
121921 this.adaptDirectivePrologue(node.body);
121922 this.next();
121923 node.sourceType = this.options.sourceType;
121924 return this.finishNode(node, "Program")
121925 };
121926
121927 var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
121928
121929 pp$1.isLet = function(context) {
121930 if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
121931 skipWhiteSpace.lastIndex = this.pos;
121932 var skip = skipWhiteSpace.exec(this.input);
121933 var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
121934 // For ambiguous cases, determine if a LexicalDeclaration (or only a
121935 // Statement) is allowed here. If context is not empty then only a Statement
121936 // is allowed. However, `let [` is an explicit negative lookahead for
121937 // ExpressionStatement, so special-case it first.
121938 if (nextCh === 91) { return true } // '['
121939 if (context) { return false }
121940
121941 if (nextCh === 123) { return true } // '{'
121942 if (isIdentifierStart(nextCh, true)) {
121943 var pos = next + 1;
121944 while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
121945 var ident = this.input.slice(next, pos);
121946 if (!keywordRelationalOperator.test(ident)) { return true }
121947 }
121948 return false
121949 };
121950
121951 // check 'async [no LineTerminator here] function'
121952 // - 'async /*foo*/ function' is OK.
121953 // - 'async /*\n*/ function' is invalid.
121954 pp$1.isAsyncFunction = function() {
121955 if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
121956 { return false }
121957
121958 skipWhiteSpace.lastIndex = this.pos;
121959 var skip = skipWhiteSpace.exec(this.input);
121960 var next = this.pos + skip[0].length;
121961 return !lineBreak.test(this.input.slice(this.pos, next)) &&
121962 this.input.slice(next, next + 8) === "function" &&
121963 (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))
121964 };
121965
121966 // Parse a single statement.
121967 //
121968 // If expecting a statement and finding a slash operator, parse a
121969 // regular expression literal. This is to handle cases like
121970 // `if (foo) /blah/.exec(foo)`, where looking at the previous token
121971 // does not help.
121972
121973 pp$1.parseStatement = function(context, topLevel, exports) {
121974 var starttype = this.type, node = this.startNode(), kind;
121975
121976 if (this.isLet(context)) {
121977 starttype = types._var;
121978 kind = "let";
121979 }
121980
121981 // Most types of statements are recognized by the keyword they
121982 // start with. Many are trivial to parse, some require a bit of
121983 // complexity.
121984
121985 switch (starttype) {
121986 case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
121987 case types._debugger: return this.parseDebuggerStatement(node)
121988 case types._do: return this.parseDoStatement(node)
121989 case types._for: return this.parseForStatement(node)
121990 case types._function:
121991 // Function as sole body of either an if statement or a labeled statement
121992 // works, but not when it is part of a labeled statement that is the sole
121993 // body of an if statement.
121994 if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
121995 return this.parseFunctionStatement(node, false, !context)
121996 case types._class:
121997 if (context) { this.unexpected(); }
121998 return this.parseClass(node, true)
121999 case types._if: return this.parseIfStatement(node)
122000 case types._return: return this.parseReturnStatement(node)
122001 case types._switch: return this.parseSwitchStatement(node)
122002 case types._throw: return this.parseThrowStatement(node)
122003 case types._try: return this.parseTryStatement(node)
122004 case types._const: case types._var:
122005 kind = kind || this.value;
122006 if (context && kind !== "var") { this.unexpected(); }
122007 return this.parseVarStatement(node, kind)
122008 case types._while: return this.parseWhileStatement(node)
122009 case types._with: return this.parseWithStatement(node)
122010 case types.braceL: return this.parseBlock(true, node)
122011 case types.semi: return this.parseEmptyStatement(node)
122012 case types._export:
122013 case types._import:
122014 if (this.options.ecmaVersion > 10 && starttype === types._import) {
122015 skipWhiteSpace.lastIndex = this.pos;
122016 var skip = skipWhiteSpace.exec(this.input);
122017 var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
122018 if (nextCh === 40) // '('
122019 { return this.parseExpressionStatement(node, this.parseExpression()) }
122020 }
122021
122022 if (!this.options.allowImportExportEverywhere) {
122023 if (!topLevel)
122024 { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
122025 if (!this.inModule)
122026 { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
122027 }
122028 return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
122029
122030 // If the statement does not start with a statement keyword or a
122031 // brace, it's an ExpressionStatement or LabeledStatement. We
122032 // simply start parsing an expression, and afterwards, if the
122033 // next token is a colon and the expression was a simple
122034 // Identifier node, we switch to interpreting it as a label.
122035 default:
122036 if (this.isAsyncFunction()) {
122037 if (context) { this.unexpected(); }
122038 this.next();
122039 return this.parseFunctionStatement(node, true, !context)
122040 }
122041
122042 var maybeName = this.value, expr = this.parseExpression();
122043 if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
122044 { return this.parseLabeledStatement(node, maybeName, expr, context) }
122045 else { return this.parseExpressionStatement(node, expr) }
122046 }
122047 };
122048
122049 pp$1.parseBreakContinueStatement = function(node, keyword) {
122050 var isBreak = keyword === "break";
122051 this.next();
122052 if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
122053 else if (this.type !== types.name) { this.unexpected(); }
122054 else {
122055 node.label = this.parseIdent();
122056 this.semicolon();
122057 }
122058
122059 // Verify that there is an actual destination to break or
122060 // continue to.
122061 var i = 0;
122062 for (; i < this.labels.length; ++i) {
122063 var lab = this.labels[i];
122064 if (node.label == null || lab.name === node.label.name) {
122065 if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
122066 if (node.label && isBreak) { break }
122067 }
122068 }
122069 if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
122070 return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
122071 };
122072
122073 pp$1.parseDebuggerStatement = function(node) {
122074 this.next();
122075 this.semicolon();
122076 return this.finishNode(node, "DebuggerStatement")
122077 };
122078
122079 pp$1.parseDoStatement = function(node) {
122080 this.next();
122081 this.labels.push(loopLabel);
122082 node.body = this.parseStatement("do");
122083 this.labels.pop();
122084 this.expect(types._while);
122085 node.test = this.parseParenExpression();
122086 if (this.options.ecmaVersion >= 6)
122087 { this.eat(types.semi); }
122088 else
122089 { this.semicolon(); }
122090 return this.finishNode(node, "DoWhileStatement")
122091 };
122092
122093 // Disambiguating between a `for` and a `for`/`in` or `for`/`of`
122094 // loop is non-trivial. Basically, we have to parse the init `var`
122095 // statement or expression, disallowing the `in` operator (see
122096 // the second parameter to `parseExpression`), and then check
122097 // whether the next token is `in` or `of`. When there is no init
122098 // part (semicolon immediately after the opening parenthesis), it
122099 // is a regular `for` loop.
122100
122101 pp$1.parseForStatement = function(node) {
122102 this.next();
122103 var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1;
122104 this.labels.push(loopLabel);
122105 this.enterScope(0);
122106 this.expect(types.parenL);
122107 if (this.type === types.semi) {
122108 if (awaitAt > -1) { this.unexpected(awaitAt); }
122109 return this.parseFor(node, null)
122110 }
122111 var isLet = this.isLet();
122112 if (this.type === types._var || this.type === types._const || isLet) {
122113 var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
122114 this.next();
122115 this.parseVar(init$1, true, kind);
122116 this.finishNode(init$1, "VariableDeclaration");
122117 if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
122118 if (this.options.ecmaVersion >= 9) {
122119 if (this.type === types._in) {
122120 if (awaitAt > -1) { this.unexpected(awaitAt); }
122121 } else { node.await = awaitAt > -1; }
122122 }
122123 return this.parseForIn(node, init$1)
122124 }
122125 if (awaitAt > -1) { this.unexpected(awaitAt); }
122126 return this.parseFor(node, init$1)
122127 }
122128 var refDestructuringErrors = new DestructuringErrors;
122129 var init = this.parseExpression(true, refDestructuringErrors);
122130 if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
122131 if (this.options.ecmaVersion >= 9) {
122132 if (this.type === types._in) {
122133 if (awaitAt > -1) { this.unexpected(awaitAt); }
122134 } else { node.await = awaitAt > -1; }
122135 }
122136 this.toAssignable(init, false, refDestructuringErrors);
122137 this.checkLVal(init);
122138 return this.parseForIn(node, init)
122139 } else {
122140 this.checkExpressionErrors(refDestructuringErrors, true);
122141 }
122142 if (awaitAt > -1) { this.unexpected(awaitAt); }
122143 return this.parseFor(node, init)
122144 };
122145
122146 pp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {
122147 this.next();
122148 return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
122149 };
122150
122151 pp$1.parseIfStatement = function(node) {
122152 this.next();
122153 node.test = this.parseParenExpression();
122154 // allow function declarations in branches, but only in non-strict mode
122155 node.consequent = this.parseStatement("if");
122156 node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
122157 return this.finishNode(node, "IfStatement")
122158 };
122159
122160 pp$1.parseReturnStatement = function(node) {
122161 if (!this.inFunction && !this.options.allowReturnOutsideFunction)
122162 { this.raise(this.start, "'return' outside of function"); }
122163 this.next();
122164
122165 // In `return` (and `break`/`continue`), the keywords with
122166 // optional arguments, we eagerly look for a semicolon or the
122167 // possibility to insert one.
122168
122169 if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
122170 else { node.argument = this.parseExpression(); this.semicolon(); }
122171 return this.finishNode(node, "ReturnStatement")
122172 };
122173
122174 pp$1.parseSwitchStatement = function(node) {
122175 this.next();
122176 node.discriminant = this.parseParenExpression();
122177 node.cases = [];
122178 this.expect(types.braceL);
122179 this.labels.push(switchLabel);
122180 this.enterScope(0);
122181
122182 // Statements under must be grouped (by label) in SwitchCase
122183 // nodes. `cur` is used to keep the node that we are currently
122184 // adding statements to.
122185
122186 var cur;
122187 for (var sawDefault = false; this.type !== types.braceR;) {
122188 if (this.type === types._case || this.type === types._default) {
122189 var isCase = this.type === types._case;
122190 if (cur) { this.finishNode(cur, "SwitchCase"); }
122191 node.cases.push(cur = this.startNode());
122192 cur.consequent = [];
122193 this.next();
122194 if (isCase) {
122195 cur.test = this.parseExpression();
122196 } else {
122197 if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
122198 sawDefault = true;
122199 cur.test = null;
122200 }
122201 this.expect(types.colon);
122202 } else {
122203 if (!cur) { this.unexpected(); }
122204 cur.consequent.push(this.parseStatement(null));
122205 }
122206 }
122207 this.exitScope();
122208 if (cur) { this.finishNode(cur, "SwitchCase"); }
122209 this.next(); // Closing brace
122210 this.labels.pop();
122211 return this.finishNode(node, "SwitchStatement")
122212 };
122213
122214 pp$1.parseThrowStatement = function(node) {
122215 this.next();
122216 if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
122217 { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
122218 node.argument = this.parseExpression();
122219 this.semicolon();
122220 return this.finishNode(node, "ThrowStatement")
122221 };
122222
122223 // Reused empty array added for node fields that are always empty.
122224
122225 var empty = [];
122226
122227 pp$1.parseTryStatement = function(node) {
122228 this.next();
122229 node.block = this.parseBlock();
122230 node.handler = null;
122231 if (this.type === types._catch) {
122232 var clause = this.startNode();
122233 this.next();
122234 if (this.eat(types.parenL)) {
122235 clause.param = this.parseBindingAtom();
122236 var simple = clause.param.type === "Identifier";
122237 this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
122238 this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
122239 this.expect(types.parenR);
122240 } else {
122241 if (this.options.ecmaVersion < 10) { this.unexpected(); }
122242 clause.param = null;
122243 this.enterScope(0);
122244 }
122245 clause.body = this.parseBlock(false);
122246 this.exitScope();
122247 node.handler = this.finishNode(clause, "CatchClause");
122248 }
122249 node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
122250 if (!node.handler && !node.finalizer)
122251 { this.raise(node.start, "Missing catch or finally clause"); }
122252 return this.finishNode(node, "TryStatement")
122253 };
122254
122255 pp$1.parseVarStatement = function(node, kind) {
122256 this.next();
122257 this.parseVar(node, false, kind);
122258 this.semicolon();
122259 return this.finishNode(node, "VariableDeclaration")
122260 };
122261
122262 pp$1.parseWhileStatement = function(node) {
122263 this.next();
122264 node.test = this.parseParenExpression();
122265 this.labels.push(loopLabel);
122266 node.body = this.parseStatement("while");
122267 this.labels.pop();
122268 return this.finishNode(node, "WhileStatement")
122269 };
122270
122271 pp$1.parseWithStatement = function(node) {
122272 if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
122273 this.next();
122274 node.object = this.parseParenExpression();
122275 node.body = this.parseStatement("with");
122276 return this.finishNode(node, "WithStatement")
122277 };
122278
122279 pp$1.parseEmptyStatement = function(node) {
122280 this.next();
122281 return this.finishNode(node, "EmptyStatement")
122282 };
122283
122284 pp$1.parseLabeledStatement = function(node, maybeName, expr, context) {
122285 for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
122286 {
122287 var label = list[i$1];
122288
122289 if (label.name === maybeName)
122290 { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
122291 } }
122292 var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
122293 for (var i = this.labels.length - 1; i >= 0; i--) {
122294 var label$1 = this.labels[i];
122295 if (label$1.statementStart === node.start) {
122296 // Update information about previous labels on this node
122297 label$1.statementStart = this.start;
122298 label$1.kind = kind;
122299 } else { break }
122300 }
122301 this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
122302 node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
122303 this.labels.pop();
122304 node.label = expr;
122305 return this.finishNode(node, "LabeledStatement")
122306 };
122307
122308 pp$1.parseExpressionStatement = function(node, expr) {
122309 node.expression = expr;
122310 this.semicolon();
122311 return this.finishNode(node, "ExpressionStatement")
122312 };
122313
122314 // Parse a semicolon-enclosed block of statements, handling `"use
122315 // strict"` declarations when `allowStrict` is true (used for
122316 // function bodies).
122317
122318 pp$1.parseBlock = function(createNewLexicalScope, node) {
122319 if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
122320 if ( node === void 0 ) node = this.startNode();
122321
122322 node.body = [];
122323 this.expect(types.braceL);
122324 if (createNewLexicalScope) { this.enterScope(0); }
122325 while (!this.eat(types.braceR)) {
122326 var stmt = this.parseStatement(null);
122327 node.body.push(stmt);
122328 }
122329 if (createNewLexicalScope) { this.exitScope(); }
122330 return this.finishNode(node, "BlockStatement")
122331 };
122332
122333 // Parse a regular `for` loop. The disambiguation code in
122334 // `parseStatement` will already have parsed the init statement or
122335 // expression.
122336
122337 pp$1.parseFor = function(node, init) {
122338 node.init = init;
122339 this.expect(types.semi);
122340 node.test = this.type === types.semi ? null : this.parseExpression();
122341 this.expect(types.semi);
122342 node.update = this.type === types.parenR ? null : this.parseExpression();
122343 this.expect(types.parenR);
122344 node.body = this.parseStatement("for");
122345 this.exitScope();
122346 this.labels.pop();
122347 return this.finishNode(node, "ForStatement")
122348 };
122349
122350 // Parse a `for`/`in` and `for`/`of` loop, which are almost
122351 // same from parser's perspective.
122352
122353 pp$1.parseForIn = function(node, init) {
122354 var isForIn = this.type === types._in;
122355 this.next();
122356
122357 if (
122358 init.type === "VariableDeclaration" &&
122359 init.declarations[0].init != null &&
122360 (
122361 !isForIn ||
122362 this.options.ecmaVersion < 8 ||
122363 this.strict ||
122364 init.kind !== "var" ||
122365 init.declarations[0].id.type !== "Identifier"
122366 )
122367 ) {
122368 this.raise(
122369 init.start,
122370 ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
122371 );
122372 } else if (init.type === "AssignmentPattern") {
122373 this.raise(init.start, "Invalid left-hand side in for-loop");
122374 }
122375 node.left = init;
122376 node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
122377 this.expect(types.parenR);
122378 node.body = this.parseStatement("for");
122379 this.exitScope();
122380 this.labels.pop();
122381 return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
122382 };
122383
122384 // Parse a list of variable declarations.
122385
122386 pp$1.parseVar = function(node, isFor, kind) {
122387 node.declarations = [];
122388 node.kind = kind;
122389 for (;;) {
122390 var decl = this.startNode();
122391 this.parseVarId(decl, kind);
122392 if (this.eat(types.eq)) {
122393 decl.init = this.parseMaybeAssign(isFor);
122394 } else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
122395 this.unexpected();
122396 } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
122397 this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
122398 } else {
122399 decl.init = null;
122400 }
122401 node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
122402 if (!this.eat(types.comma)) { break }
122403 }
122404 return node
122405 };
122406
122407 pp$1.parseVarId = function(decl, kind) {
122408 decl.id = this.parseBindingAtom();
122409 this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
122410 };
122411
122412 var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
122413
122414 // Parse a function declaration or literal (depending on the
122415 // `statement & FUNC_STATEMENT`).
122416
122417 // Remove `allowExpressionBody` for 7.0.0, as it is only called with false
122418 pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) {
122419 this.initFunction(node);
122420 if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
122421 if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
122422 { this.unexpected(); }
122423 node.generator = this.eat(types.star);
122424 }
122425 if (this.options.ecmaVersion >= 8)
122426 { node.async = !!isAsync; }
122427
122428 if (statement & FUNC_STATEMENT) {
122429 node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
122430 if (node.id && !(statement & FUNC_HANGING_STATEMENT))
122431 // If it is a regular function declaration in sloppy mode, then it is
122432 // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
122433 // mode depends on properties of the current scope (see
122434 // treatFunctionsAsVar).
122435 { this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
122436 }
122437
122438 var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
122439 this.yieldPos = 0;
122440 this.awaitPos = 0;
122441 this.awaitIdentPos = 0;
122442 this.enterScope(functionFlags(node.async, node.generator));
122443
122444 if (!(statement & FUNC_STATEMENT))
122445 { node.id = this.type === types.name ? this.parseIdent() : null; }
122446
122447 this.parseFunctionParams(node);
122448 this.parseFunctionBody(node, allowExpressionBody, false);
122449
122450 this.yieldPos = oldYieldPos;
122451 this.awaitPos = oldAwaitPos;
122452 this.awaitIdentPos = oldAwaitIdentPos;
122453 return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
122454 };
122455
122456 pp$1.parseFunctionParams = function(node) {
122457 this.expect(types.parenL);
122458 node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
122459 this.checkYieldAwaitInDefaultParams();
122460 };
122461
122462 // Parse a class declaration or literal (depending on the
122463 // `isStatement` parameter).
122464
122465 pp$1.parseClass = function(node, isStatement) {
122466 this.next();
122467
122468 // ecma-262 14.6 Class Definitions
122469 // A class definition is always strict mode code.
122470 var oldStrict = this.strict;
122471 this.strict = true;
122472
122473 this.parseClassId(node, isStatement);
122474 this.parseClassSuper(node);
122475 var classBody = this.startNode();
122476 var hadConstructor = false;
122477 classBody.body = [];
122478 this.expect(types.braceL);
122479 while (!this.eat(types.braceR)) {
122480 var element = this.parseClassElement(node.superClass !== null);
122481 if (element) {
122482 classBody.body.push(element);
122483 if (element.type === "MethodDefinition" && element.kind === "constructor") {
122484 if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
122485 hadConstructor = true;
122486 }
122487 }
122488 }
122489 node.body = this.finishNode(classBody, "ClassBody");
122490 this.strict = oldStrict;
122491 return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
122492 };
122493
122494 pp$1.parseClassElement = function(constructorAllowsSuper) {
122495 var this$1 = this;
122496
122497 if (this.eat(types.semi)) { return null }
122498
122499 var method = this.startNode();
122500 var tryContextual = function (k, noLineBreak) {
122501 if ( noLineBreak === void 0 ) noLineBreak = false;
122502
122503 var start = this$1.start, startLoc = this$1.startLoc;
122504 if (!this$1.eatContextual(k)) { return false }
122505 if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
122506 if (method.key) { this$1.unexpected(); }
122507 method.computed = false;
122508 method.key = this$1.startNodeAt(start, startLoc);
122509 method.key.name = k;
122510 this$1.finishNode(method.key, "Identifier");
122511 return false
122512 };
122513
122514 method.kind = "method";
122515 method.static = tryContextual("static");
122516 var isGenerator = this.eat(types.star);
122517 var isAsync = false;
122518 if (!isGenerator) {
122519 if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
122520 isAsync = true;
122521 isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
122522 } else if (tryContextual("get")) {
122523 method.kind = "get";
122524 } else if (tryContextual("set")) {
122525 method.kind = "set";
122526 }
122527 }
122528 if (!method.key) { this.parsePropertyName(method); }
122529 var key = method.key;
122530 var allowsDirectSuper = false;
122531 if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
122532 key.type === "Literal" && key.value === "constructor")) {
122533 if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
122534 if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
122535 if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
122536 method.kind = "constructor";
122537 allowsDirectSuper = constructorAllowsSuper;
122538 } else if (method.static && key.type === "Identifier" && key.name === "prototype") {
122539 this.raise(key.start, "Classes may not have a static property named prototype");
122540 }
122541 this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
122542 if (method.kind === "get" && method.value.params.length !== 0)
122543 { this.raiseRecoverable(method.value.start, "getter should have no params"); }
122544 if (method.kind === "set" && method.value.params.length !== 1)
122545 { this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
122546 if (method.kind === "set" && method.value.params[0].type === "RestElement")
122547 { this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
122548 return method
122549 };
122550
122551 pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
122552 method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
122553 return this.finishNode(method, "MethodDefinition")
122554 };
122555
122556 pp$1.parseClassId = function(node, isStatement) {
122557 if (this.type === types.name) {
122558 node.id = this.parseIdent();
122559 if (isStatement)
122560 { this.checkLVal(node.id, BIND_LEXICAL, false); }
122561 } else {
122562 if (isStatement === true)
122563 { this.unexpected(); }
122564 node.id = null;
122565 }
122566 };
122567
122568 pp$1.parseClassSuper = function(node) {
122569 node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
122570 };
122571
122572 // Parses module export declaration.
122573
122574 pp$1.parseExport = function(node, exports) {
122575 this.next();
122576 // export * from '...'
122577 if (this.eat(types.star)) {
122578 this.expectContextual("from");
122579 if (this.type !== types.string) { this.unexpected(); }
122580 node.source = this.parseExprAtom();
122581 this.semicolon();
122582 return this.finishNode(node, "ExportAllDeclaration")
122583 }
122584 if (this.eat(types._default)) { // export default ...
122585 this.checkExport(exports, "default", this.lastTokStart);
122586 var isAsync;
122587 if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
122588 var fNode = this.startNode();
122589 this.next();
122590 if (isAsync) { this.next(); }
122591 node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
122592 } else if (this.type === types._class) {
122593 var cNode = this.startNode();
122594 node.declaration = this.parseClass(cNode, "nullableID");
122595 } else {
122596 node.declaration = this.parseMaybeAssign();
122597 this.semicolon();
122598 }
122599 return this.finishNode(node, "ExportDefaultDeclaration")
122600 }
122601 // export var|const|let|function|class ...
122602 if (this.shouldParseExportStatement()) {
122603 node.declaration = this.parseStatement(null);
122604 if (node.declaration.type === "VariableDeclaration")
122605 { this.checkVariableExport(exports, node.declaration.declarations); }
122606 else
122607 { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }
122608 node.specifiers = [];
122609 node.source = null;
122610 } else { // export { x, y as z } [from '...']
122611 node.declaration = null;
122612 node.specifiers = this.parseExportSpecifiers(exports);
122613 if (this.eatContextual("from")) {
122614 if (this.type !== types.string) { this.unexpected(); }
122615 node.source = this.parseExprAtom();
122616 } else {
122617 for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
122618 // check for keywords used as local names
122619 var spec = list[i];
122620
122621 this.checkUnreserved(spec.local);
122622 // check if export is defined
122623 this.checkLocalExport(spec.local);
122624 }
122625
122626 node.source = null;
122627 }
122628 this.semicolon();
122629 }
122630 return this.finishNode(node, "ExportNamedDeclaration")
122631 };
122632
122633 pp$1.checkExport = function(exports, name, pos) {
122634 if (!exports) { return }
122635 if (has(exports, name))
122636 { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
122637 exports[name] = true;
122638 };
122639
122640 pp$1.checkPatternExport = function(exports, pat) {
122641 var type = pat.type;
122642 if (type === "Identifier")
122643 { this.checkExport(exports, pat.name, pat.start); }
122644 else if (type === "ObjectPattern")
122645 { for (var i = 0, list = pat.properties; i < list.length; i += 1)
122646 {
122647 var prop = list[i];
122648
122649 this.checkPatternExport(exports, prop);
122650 } }
122651 else if (type === "ArrayPattern")
122652 { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
122653 var elt = list$1[i$1];
122654
122655 if (elt) { this.checkPatternExport(exports, elt); }
122656 } }
122657 else if (type === "Property")
122658 { this.checkPatternExport(exports, pat.value); }
122659 else if (type === "AssignmentPattern")
122660 { this.checkPatternExport(exports, pat.left); }
122661 else if (type === "RestElement")
122662 { this.checkPatternExport(exports, pat.argument); }
122663 else if (type === "ParenthesizedExpression")
122664 { this.checkPatternExport(exports, pat.expression); }
122665 };
122666
122667 pp$1.checkVariableExport = function(exports, decls) {
122668 if (!exports) { return }
122669 for (var i = 0, list = decls; i < list.length; i += 1)
122670 {
122671 var decl = list[i];
122672
122673 this.checkPatternExport(exports, decl.id);
122674 }
122675 };
122676
122677 pp$1.shouldParseExportStatement = function() {
122678 return this.type.keyword === "var" ||
122679 this.type.keyword === "const" ||
122680 this.type.keyword === "class" ||
122681 this.type.keyword === "function" ||
122682 this.isLet() ||
122683 this.isAsyncFunction()
122684 };
122685
122686 // Parses a comma-separated list of module exports.
122687
122688 pp$1.parseExportSpecifiers = function(exports) {
122689 var nodes = [], first = true;
122690 // export { x, y as z } [from '...']
122691 this.expect(types.braceL);
122692 while (!this.eat(types.braceR)) {
122693 if (!first) {
122694 this.expect(types.comma);
122695 if (this.afterTrailingComma(types.braceR)) { break }
122696 } else { first = false; }
122697
122698 var node = this.startNode();
122699 node.local = this.parseIdent(true);
122700 node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
122701 this.checkExport(exports, node.exported.name, node.exported.start);
122702 nodes.push(this.finishNode(node, "ExportSpecifier"));
122703 }
122704 return nodes
122705 };
122706
122707 // Parses import declaration.
122708
122709 pp$1.parseImport = function(node) {
122710 this.next();
122711 // import '...'
122712 if (this.type === types.string) {
122713 node.specifiers = empty;
122714 node.source = this.parseExprAtom();
122715 } else {
122716 node.specifiers = this.parseImportSpecifiers();
122717 this.expectContextual("from");
122718 node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
122719 }
122720 this.semicolon();
122721 return this.finishNode(node, "ImportDeclaration")
122722 };
122723
122724 // Parses a comma-separated list of module imports.
122725
122726 pp$1.parseImportSpecifiers = function() {
122727 var nodes = [], first = true;
122728 if (this.type === types.name) {
122729 // import defaultObj, { x, y as z } from '...'
122730 var node = this.startNode();
122731 node.local = this.parseIdent();
122732 this.checkLVal(node.local, BIND_LEXICAL);
122733 nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
122734 if (!this.eat(types.comma)) { return nodes }
122735 }
122736 if (this.type === types.star) {
122737 var node$1 = this.startNode();
122738 this.next();
122739 this.expectContextual("as");
122740 node$1.local = this.parseIdent();
122741 this.checkLVal(node$1.local, BIND_LEXICAL);
122742 nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
122743 return nodes
122744 }
122745 this.expect(types.braceL);
122746 while (!this.eat(types.braceR)) {
122747 if (!first) {
122748 this.expect(types.comma);
122749 if (this.afterTrailingComma(types.braceR)) { break }
122750 } else { first = false; }
122751
122752 var node$2 = this.startNode();
122753 node$2.imported = this.parseIdent(true);
122754 if (this.eatContextual("as")) {
122755 node$2.local = this.parseIdent();
122756 } else {
122757 this.checkUnreserved(node$2.imported);
122758 node$2.local = node$2.imported;
122759 }
122760 this.checkLVal(node$2.local, BIND_LEXICAL);
122761 nodes.push(this.finishNode(node$2, "ImportSpecifier"));
122762 }
122763 return nodes
122764 };
122765
122766 // Set `ExpressionStatement#directive` property for directive prologues.
122767 pp$1.adaptDirectivePrologue = function(statements) {
122768 for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
122769 statements[i].directive = statements[i].expression.raw.slice(1, -1);
122770 }
122771 };
122772 pp$1.isDirectiveCandidate = function(statement) {
122773 return (
122774 statement.type === "ExpressionStatement" &&
122775 statement.expression.type === "Literal" &&
122776 typeof statement.expression.value === "string" &&
122777 // Reject parenthesized strings.
122778 (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
122779 )
122780 };
122781
122782 var pp$2 = Parser.prototype;
122783
122784 // Convert existing expression atom to assignable pattern
122785 // if possible.
122786
122787 pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
122788 if (this.options.ecmaVersion >= 6 && node) {
122789 switch (node.type) {
122790 case "Identifier":
122791 if (this.inAsync && node.name === "await")
122792 { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
122793 break
122794
122795 case "ObjectPattern":
122796 case "ArrayPattern":
122797 case "RestElement":
122798 break
122799
122800 case "ObjectExpression":
122801 node.type = "ObjectPattern";
122802 if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
122803 for (var i = 0, list = node.properties; i < list.length; i += 1) {
122804 var prop = list[i];
122805
122806 this.toAssignable(prop, isBinding);
122807 // Early error:
122808 // AssignmentRestProperty[Yield, Await] :
122809 // `...` DestructuringAssignmentTarget[Yield, Await]
122810 //
122811 // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
122812 if (
122813 prop.type === "RestElement" &&
122814 (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
122815 ) {
122816 this.raise(prop.argument.start, "Unexpected token");
122817 }
122818 }
122819 break
122820
122821 case "Property":
122822 // AssignmentProperty has type === "Property"
122823 if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
122824 this.toAssignable(node.value, isBinding);
122825 break
122826
122827 case "ArrayExpression":
122828 node.type = "ArrayPattern";
122829 if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
122830 this.toAssignableList(node.elements, isBinding);
122831 break
122832
122833 case "SpreadElement":
122834 node.type = "RestElement";
122835 this.toAssignable(node.argument, isBinding);
122836 if (node.argument.type === "AssignmentPattern")
122837 { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
122838 break
122839
122840 case "AssignmentExpression":
122841 if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
122842 node.type = "AssignmentPattern";
122843 delete node.operator;
122844 this.toAssignable(node.left, isBinding);
122845 // falls through to AssignmentPattern
122846
122847 case "AssignmentPattern":
122848 break
122849
122850 case "ParenthesizedExpression":
122851 this.toAssignable(node.expression, isBinding, refDestructuringErrors);
122852 break
122853
122854 case "MemberExpression":
122855 if (!isBinding) { break }
122856
122857 default:
122858 this.raise(node.start, "Assigning to rvalue");
122859 }
122860 } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
122861 return node
122862 };
122863
122864 // Convert list of expression atoms to binding list.
122865
122866 pp$2.toAssignableList = function(exprList, isBinding) {
122867 var end = exprList.length;
122868 for (var i = 0; i < end; i++) {
122869 var elt = exprList[i];
122870 if (elt) { this.toAssignable(elt, isBinding); }
122871 }
122872 if (end) {
122873 var last = exprList[end - 1];
122874 if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
122875 { this.unexpected(last.argument.start); }
122876 }
122877 return exprList
122878 };
122879
122880 // Parses spread element.
122881
122882 pp$2.parseSpread = function(refDestructuringErrors) {
122883 var node = this.startNode();
122884 this.next();
122885 node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
122886 return this.finishNode(node, "SpreadElement")
122887 };
122888
122889 pp$2.parseRestBinding = function() {
122890 var node = this.startNode();
122891 this.next();
122892
122893 // RestElement inside of a function parameter must be an identifier
122894 if (this.options.ecmaVersion === 6 && this.type !== types.name)
122895 { this.unexpected(); }
122896
122897 node.argument = this.parseBindingAtom();
122898
122899 return this.finishNode(node, "RestElement")
122900 };
122901
122902 // Parses lvalue (assignable) atom.
122903
122904 pp$2.parseBindingAtom = function() {
122905 if (this.options.ecmaVersion >= 6) {
122906 switch (this.type) {
122907 case types.bracketL:
122908 var node = this.startNode();
122909 this.next();
122910 node.elements = this.parseBindingList(types.bracketR, true, true);
122911 return this.finishNode(node, "ArrayPattern")
122912
122913 case types.braceL:
122914 return this.parseObj(true)
122915 }
122916 }
122917 return this.parseIdent()
122918 };
122919
122920 pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
122921 var elts = [], first = true;
122922 while (!this.eat(close)) {
122923 if (first) { first = false; }
122924 else { this.expect(types.comma); }
122925 if (allowEmpty && this.type === types.comma) {
122926 elts.push(null);
122927 } else if (allowTrailingComma && this.afterTrailingComma(close)) {
122928 break
122929 } else if (this.type === types.ellipsis) {
122930 var rest = this.parseRestBinding();
122931 this.parseBindingListItem(rest);
122932 elts.push(rest);
122933 if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
122934 this.expect(close);
122935 break
122936 } else {
122937 var elem = this.parseMaybeDefault(this.start, this.startLoc);
122938 this.parseBindingListItem(elem);
122939 elts.push(elem);
122940 }
122941 }
122942 return elts
122943 };
122944
122945 pp$2.parseBindingListItem = function(param) {
122946 return param
122947 };
122948
122949 // Parses assignment pattern around given atom if possible.
122950
122951 pp$2.parseMaybeDefault = function(startPos, startLoc, left) {
122952 left = left || this.parseBindingAtom();
122953 if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
122954 var node = this.startNodeAt(startPos, startLoc);
122955 node.left = left;
122956 node.right = this.parseMaybeAssign();
122957 return this.finishNode(node, "AssignmentPattern")
122958 };
122959
122960 // Verify that a node is an lval — something that can be assigned
122961 // to.
122962 // bindingType can be either:
122963 // 'var' indicating that the lval creates a 'var' binding
122964 // 'let' indicating that the lval creates a lexical ('let' or 'const') binding
122965 // 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references
122966
122967 pp$2.checkLVal = function(expr, bindingType, checkClashes) {
122968 if ( bindingType === void 0 ) bindingType = BIND_NONE;
122969
122970 switch (expr.type) {
122971 case "Identifier":
122972 if (bindingType === BIND_LEXICAL && expr.name === "let")
122973 { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
122974 if (this.strict && this.reservedWordsStrictBind.test(expr.name))
122975 { this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
122976 if (checkClashes) {
122977 if (has(checkClashes, expr.name))
122978 { this.raiseRecoverable(expr.start, "Argument name clash"); }
122979 checkClashes[expr.name] = true;
122980 }
122981 if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
122982 break
122983
122984 case "MemberExpression":
122985 if (bindingType) { this.raiseRecoverable(expr.start, "Binding member expression"); }
122986 break
122987
122988 case "ObjectPattern":
122989 for (var i = 0, list = expr.properties; i < list.length; i += 1)
122990 {
122991 var prop = list[i];
122992
122993 this.checkLVal(prop, bindingType, checkClashes);
122994 }
122995 break
122996
122997 case "Property":
122998 // AssignmentProperty has type === "Property"
122999 this.checkLVal(expr.value, bindingType, checkClashes);
123000 break
123001
123002 case "ArrayPattern":
123003 for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
123004 var elem = list$1[i$1];
123005
123006 if (elem) { this.checkLVal(elem, bindingType, checkClashes); }
123007 }
123008 break
123009
123010 case "AssignmentPattern":
123011 this.checkLVal(expr.left, bindingType, checkClashes);
123012 break
123013
123014 case "RestElement":
123015 this.checkLVal(expr.argument, bindingType, checkClashes);
123016 break
123017
123018 case "ParenthesizedExpression":
123019 this.checkLVal(expr.expression, bindingType, checkClashes);
123020 break
123021
123022 default:
123023 this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue");
123024 }
123025 };
123026
123027 // A recursive descent parser operates by defining functions for all
123028
123029 var pp$3 = Parser.prototype;
123030
123031 // Check if property name clashes with already added.
123032 // Object/class getters and setters are not allowed to clash —
123033 // either with each other or with an init property — and in
123034 // strict mode, init properties are also not allowed to be repeated.
123035
123036 pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
123037 if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
123038 { return }
123039 if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
123040 { return }
123041 var key = prop.key;
123042 var name;
123043 switch (key.type) {
123044 case "Identifier": name = key.name; break
123045 case "Literal": name = String(key.value); break
123046 default: return
123047 }
123048 var kind = prop.kind;
123049 if (this.options.ecmaVersion >= 6) {
123050 if (name === "__proto__" && kind === "init") {
123051 if (propHash.proto) {
123052 if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; }
123053 // Backwards-compat kludge. Can be removed in version 6.0
123054 else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); }
123055 }
123056 propHash.proto = true;
123057 }
123058 return
123059 }
123060 name = "$" + name;
123061 var other = propHash[name];
123062 if (other) {
123063 var redefinition;
123064 if (kind === "init") {
123065 redefinition = this.strict && other.init || other.get || other.set;
123066 } else {
123067 redefinition = other.init || other[kind];
123068 }
123069 if (redefinition)
123070 { this.raiseRecoverable(key.start, "Redefinition of property"); }
123071 } else {
123072 other = propHash[name] = {
123073 init: false,
123074 get: false,
123075 set: false
123076 };
123077 }
123078 other[kind] = true;
123079 };
123080
123081 // ### Expression parsing
123082
123083 // These nest, from the most general expression type at the top to
123084 // 'atomic', nondivisible expression types at the bottom. Most of
123085 // the functions will simply let the function(s) below them parse,
123086 // and, *if* the syntactic construct they handle is present, wrap
123087 // the AST node that the inner parser gave them in another node.
123088
123089 // Parse a full expression. The optional arguments are used to
123090 // forbid the `in` operator (in for loops initalization expressions)
123091 // and provide reference for storing '=' operator inside shorthand
123092 // property assignment in contexts where both object expression
123093 // and object pattern might appear (so it's possible to raise
123094 // delayed syntax error at correct position).
123095
123096 pp$3.parseExpression = function(noIn, refDestructuringErrors) {
123097 var startPos = this.start, startLoc = this.startLoc;
123098 var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
123099 if (this.type === types.comma) {
123100 var node = this.startNodeAt(startPos, startLoc);
123101 node.expressions = [expr];
123102 while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }
123103 return this.finishNode(node, "SequenceExpression")
123104 }
123105 return expr
123106 };
123107
123108 // Parse an assignment expression. This includes applications of
123109 // operators like `+=`.
123110
123111 pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
123112 if (this.isContextual("yield")) {
123113 if (this.inGenerator) { return this.parseYield(noIn) }
123114 // The tokenizer will assume an expression is allowed after
123115 // `yield`, but this isn't that kind of yield
123116 else { this.exprAllowed = false; }
123117 }
123118
123119 var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1;
123120 if (refDestructuringErrors) {
123121 oldParenAssign = refDestructuringErrors.parenthesizedAssign;
123122 oldTrailingComma = refDestructuringErrors.trailingComma;
123123 oldShorthandAssign = refDestructuringErrors.shorthandAssign;
123124 refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1;
123125 } else {
123126 refDestructuringErrors = new DestructuringErrors;
123127 ownDestructuringErrors = true;
123128 }
123129
123130 var startPos = this.start, startLoc = this.startLoc;
123131 if (this.type === types.parenL || this.type === types.name)
123132 { this.potentialArrowAt = this.start; }
123133 var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
123134 if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
123135 if (this.type.isAssign) {
123136 var node = this.startNodeAt(startPos, startLoc);
123137 node.operator = this.value;
123138 node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left;
123139 if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); }
123140 refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly
123141 this.checkLVal(left);
123142 this.next();
123143 node.right = this.parseMaybeAssign(noIn);
123144 return this.finishNode(node, "AssignmentExpression")
123145 } else {
123146 if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
123147 }
123148 if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
123149 if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
123150 if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; }
123151 return left
123152 };
123153
123154 // Parse a ternary conditional (`?:`) operator.
123155
123156 pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
123157 var startPos = this.start, startLoc = this.startLoc;
123158 var expr = this.parseExprOps(noIn, refDestructuringErrors);
123159 if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
123160 if (this.eat(types.question)) {
123161 var node = this.startNodeAt(startPos, startLoc);
123162 node.test = expr;
123163 node.consequent = this.parseMaybeAssign();
123164 this.expect(types.colon);
123165 node.alternate = this.parseMaybeAssign(noIn);
123166 return this.finishNode(node, "ConditionalExpression")
123167 }
123168 return expr
123169 };
123170
123171 // Start the precedence parser.
123172
123173 pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
123174 var startPos = this.start, startLoc = this.startLoc;
123175 var expr = this.parseMaybeUnary(refDestructuringErrors, false);
123176 if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
123177 return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
123178 };
123179
123180 // Parse binary operators with the operator precedence parsing
123181 // algorithm. `left` is the left-hand side of the operator.
123182 // `minPrec` provides context that allows the function to stop and
123183 // defer further parser to one of its callers when it encounters an
123184 // operator that has a lower precedence than the set it is parsing.
123185
123186 pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
123187 var prec = this.type.binop;
123188 if (prec != null && (!noIn || this.type !== types._in)) {
123189 if (prec > minPrec) {
123190 var logical = this.type === types.logicalOR || this.type === types.logicalAND;
123191 var op = this.value;
123192 this.next();
123193 var startPos = this.start, startLoc = this.startLoc;
123194 var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
123195 var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);
123196 return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
123197 }
123198 }
123199 return left
123200 };
123201
123202 pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
123203 var node = this.startNodeAt(startPos, startLoc);
123204 node.left = left;
123205 node.operator = op;
123206 node.right = right;
123207 return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
123208 };
123209
123210 // Parse unary operators, both prefix and postfix.
123211
123212 pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
123213 var startPos = this.start, startLoc = this.startLoc, expr;
123214 if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
123215 expr = this.parseAwait();
123216 sawUnary = true;
123217 } else if (this.type.prefix) {
123218 var node = this.startNode(), update = this.type === types.incDec;
123219 node.operator = this.value;
123220 node.prefix = true;
123221 this.next();
123222 node.argument = this.parseMaybeUnary(null, true);
123223 this.checkExpressionErrors(refDestructuringErrors, true);
123224 if (update) { this.checkLVal(node.argument); }
123225 else if (this.strict && node.operator === "delete" &&
123226 node.argument.type === "Identifier")
123227 { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
123228 else { sawUnary = true; }
123229 expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
123230 } else {
123231 expr = this.parseExprSubscripts(refDestructuringErrors);
123232 if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
123233 while (this.type.postfix && !this.canInsertSemicolon()) {
123234 var node$1 = this.startNodeAt(startPos, startLoc);
123235 node$1.operator = this.value;
123236 node$1.prefix = false;
123237 node$1.argument = expr;
123238 this.checkLVal(expr);
123239 this.next();
123240 expr = this.finishNode(node$1, "UpdateExpression");
123241 }
123242 }
123243
123244 if (!sawUnary && this.eat(types.starstar))
123245 { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
123246 else
123247 { return expr }
123248 };
123249
123250 // Parse call, dot, and `[]`-subscript expressions.
123251
123252 pp$3.parseExprSubscripts = function(refDestructuringErrors) {
123253 var startPos = this.start, startLoc = this.startLoc;
123254 var expr = this.parseExprAtom(refDestructuringErrors);
123255 var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")";
123256 if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr }
123257 var result = this.parseSubscripts(expr, startPos, startLoc);
123258 if (refDestructuringErrors && result.type === "MemberExpression") {
123259 if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
123260 if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
123261 }
123262 return result
123263 };
123264
123265 pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
123266 var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
123267 this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
123268 while (true) {
123269 var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
123270 if (element === base || element.type === "ArrowFunctionExpression") { return element }
123271 base = element;
123272 }
123273 };
123274
123275 pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
123276 var computed = this.eat(types.bracketL);
123277 if (computed || this.eat(types.dot)) {
123278 var node = this.startNodeAt(startPos, startLoc);
123279 node.object = base;
123280 node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
123281 node.computed = !!computed;
123282 if (computed) { this.expect(types.bracketR); }
123283 base = this.finishNode(node, "MemberExpression");
123284 } else if (!noCalls && this.eat(types.parenL)) {
123285 var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
123286 this.yieldPos = 0;
123287 this.awaitPos = 0;
123288 this.awaitIdentPos = 0;
123289 var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && base.type !== "Import", false, refDestructuringErrors);
123290 if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
123291 this.checkPatternErrors(refDestructuringErrors, false);
123292 this.checkYieldAwaitInDefaultParams();
123293 if (this.awaitIdentPos > 0)
123294 { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
123295 this.yieldPos = oldYieldPos;
123296 this.awaitPos = oldAwaitPos;
123297 this.awaitIdentPos = oldAwaitIdentPos;
123298 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
123299 }
123300 this.checkExpressionErrors(refDestructuringErrors, true);
123301 this.yieldPos = oldYieldPos || this.yieldPos;
123302 this.awaitPos = oldAwaitPos || this.awaitPos;
123303 this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
123304 var node$1 = this.startNodeAt(startPos, startLoc);
123305 node$1.callee = base;
123306 node$1.arguments = exprList;
123307 if (node$1.callee.type === "Import") {
123308 if (node$1.arguments.length !== 1) {
123309 this.raise(node$1.start, "import() requires exactly one argument");
123310 }
123311
123312 var importArg = node$1.arguments[0];
123313 if (importArg && importArg.type === "SpreadElement") {
123314 this.raise(importArg.start, "... is not allowed in import()");
123315 }
123316 }
123317 base = this.finishNode(node$1, "CallExpression");
123318 } else if (this.type === types.backQuote) {
123319 var node$2 = this.startNodeAt(startPos, startLoc);
123320 node$2.tag = base;
123321 node$2.quasi = this.parseTemplate({isTagged: true});
123322 base = this.finishNode(node$2, "TaggedTemplateExpression");
123323 }
123324 return base
123325 };
123326
123327 // Parse an atomic expression — either a single token that is an
123328 // expression, an expression started by a keyword like `function` or
123329 // `new`, or an expression wrapped in punctuation like `()`, `[]`,
123330 // or `{}`.
123331
123332 pp$3.parseExprAtom = function(refDestructuringErrors) {
123333 // If a division operator appears in an expression position, the
123334 // tokenizer got confused, and we force it to read a regexp instead.
123335 if (this.type === types.slash) { this.readRegexp(); }
123336
123337 var node, canBeArrow = this.potentialArrowAt === this.start;
123338 switch (this.type) {
123339 case types._super:
123340 if (!this.allowSuper)
123341 { this.raise(this.start, "'super' keyword outside a method"); }
123342 node = this.startNode();
123343 this.next();
123344 if (this.type === types.parenL && !this.allowDirectSuper)
123345 { this.raise(node.start, "super() call outside constructor of a subclass"); }
123346 // The `super` keyword can appear at below:
123347 // SuperProperty:
123348 // super [ Expression ]
123349 // super . IdentifierName
123350 // SuperCall:
123351 // super Arguments
123352 if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
123353 { this.unexpected(); }
123354 return this.finishNode(node, "Super")
123355
123356 case types._this:
123357 node = this.startNode();
123358 this.next();
123359 return this.finishNode(node, "ThisExpression")
123360
123361 case types.name:
123362 var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
123363 var id = this.parseIdent(false);
123364 if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function))
123365 { return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true) }
123366 if (canBeArrow && !this.canInsertSemicolon()) {
123367 if (this.eat(types.arrow))
123368 { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
123369 if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) {
123370 id = this.parseIdent(false);
123371 if (this.canInsertSemicolon() || !this.eat(types.arrow))
123372 { this.unexpected(); }
123373 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
123374 }
123375 }
123376 return id
123377
123378 case types.regexp:
123379 var value = this.value;
123380 node = this.parseLiteral(value.value);
123381 node.regex = {pattern: value.pattern, flags: value.flags};
123382 return node
123383
123384 case types.num: case types.string:
123385 return this.parseLiteral(this.value)
123386
123387 case types._null: case types._true: case types._false:
123388 node = this.startNode();
123389 node.value = this.type === types._null ? null : this.type === types._true;
123390 node.raw = this.type.keyword;
123391 this.next();
123392 return this.finishNode(node, "Literal")
123393
123394 case types.parenL:
123395 var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);
123396 if (refDestructuringErrors) {
123397 if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
123398 { refDestructuringErrors.parenthesizedAssign = start; }
123399 if (refDestructuringErrors.parenthesizedBind < 0)
123400 { refDestructuringErrors.parenthesizedBind = start; }
123401 }
123402 return expr
123403
123404 case types.bracketL:
123405 node = this.startNode();
123406 this.next();
123407 node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
123408 return this.finishNode(node, "ArrayExpression")
123409
123410 case types.braceL:
123411 return this.parseObj(false, refDestructuringErrors)
123412
123413 case types._function:
123414 node = this.startNode();
123415 this.next();
123416 return this.parseFunction(node, 0)
123417
123418 case types._class:
123419 return this.parseClass(this.startNode(), false)
123420
123421 case types._new:
123422 return this.parseNew()
123423
123424 case types.backQuote:
123425 return this.parseTemplate()
123426
123427 case types._import:
123428 if (this.options.ecmaVersion > 10) {
123429 return this.parseDynamicImport()
123430 } else {
123431 return this.unexpected()
123432 }
123433
123434 default:
123435 this.unexpected();
123436 }
123437 };
123438
123439 pp$3.parseDynamicImport = function() {
123440 var node = this.startNode();
123441 this.next();
123442 if (this.type !== types.parenL) {
123443 this.unexpected();
123444 }
123445 return this.finishNode(node, "Import")
123446 };
123447
123448 pp$3.parseLiteral = function(value) {
123449 var node = this.startNode();
123450 node.value = value;
123451 node.raw = this.input.slice(this.start, this.end);
123452 if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); }
123453 this.next();
123454 return this.finishNode(node, "Literal")
123455 };
123456
123457 pp$3.parseParenExpression = function() {
123458 this.expect(types.parenL);
123459 var val = this.parseExpression();
123460 this.expect(types.parenR);
123461 return val
123462 };
123463
123464 pp$3.parseParenAndDistinguishExpression = function(canBeArrow) {
123465 var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
123466 if (this.options.ecmaVersion >= 6) {
123467 this.next();
123468
123469 var innerStartPos = this.start, innerStartLoc = this.startLoc;
123470 var exprList = [], first = true, lastIsComma = false;
123471 var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
123472 this.yieldPos = 0;
123473 this.awaitPos = 0;
123474 // Do not save awaitIdentPos to allow checking awaits nested in parameters
123475 while (this.type !== types.parenR) {
123476 first ? first = false : this.expect(types.comma);
123477 if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
123478 lastIsComma = true;
123479 break
123480 } else if (this.type === types.ellipsis) {
123481 spreadStart = this.start;
123482 exprList.push(this.parseParenItem(this.parseRestBinding()));
123483 if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
123484 break
123485 } else {
123486 exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
123487 }
123488 }
123489 var innerEndPos = this.start, innerEndLoc = this.startLoc;
123490 this.expect(types.parenR);
123491
123492 if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
123493 this.checkPatternErrors(refDestructuringErrors, false);
123494 this.checkYieldAwaitInDefaultParams();
123495 this.yieldPos = oldYieldPos;
123496 this.awaitPos = oldAwaitPos;
123497 return this.parseParenArrowList(startPos, startLoc, exprList)
123498 }
123499
123500 if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
123501 if (spreadStart) { this.unexpected(spreadStart); }
123502 this.checkExpressionErrors(refDestructuringErrors, true);
123503 this.yieldPos = oldYieldPos || this.yieldPos;
123504 this.awaitPos = oldAwaitPos || this.awaitPos;
123505
123506 if (exprList.length > 1) {
123507 val = this.startNodeAt(innerStartPos, innerStartLoc);
123508 val.expressions = exprList;
123509 this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
123510 } else {
123511 val = exprList[0];
123512 }
123513 } else {
123514 val = this.parseParenExpression();
123515 }
123516
123517 if (this.options.preserveParens) {
123518 var par = this.startNodeAt(startPos, startLoc);
123519 par.expression = val;
123520 return this.finishNode(par, "ParenthesizedExpression")
123521 } else {
123522 return val
123523 }
123524 };
123525
123526 pp$3.parseParenItem = function(item) {
123527 return item
123528 };
123529
123530 pp$3.parseParenArrowList = function(startPos, startLoc, exprList) {
123531 return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
123532 };
123533
123534 // New's precedence is slightly tricky. It must allow its argument to
123535 // be a `[]` or dot subscript expression, but not a call — at least,
123536 // not without wrapping it in parentheses. Thus, it uses the noCalls
123537 // argument to parseSubscripts to prevent it from consuming the
123538 // argument list.
123539
123540 var empty$1 = [];
123541
123542 pp$3.parseNew = function() {
123543 var node = this.startNode();
123544 var meta = this.parseIdent(true);
123545 if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
123546 node.meta = meta;
123547 var containsEsc = this.containsEsc;
123548 node.property = this.parseIdent(true);
123549 if (node.property.name !== "target" || containsEsc)
123550 { this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target"); }
123551 if (!this.inNonArrowFunction())
123552 { this.raiseRecoverable(node.start, "new.target can only be used in functions"); }
123553 return this.finishNode(node, "MetaProperty")
123554 }
123555 var startPos = this.start, startLoc = this.startLoc;
123556 node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
123557 if (this.options.ecmaVersion > 10 && node.callee.type === "Import") {
123558 this.raise(node.callee.start, "Cannot use new with import(...)");
123559 }
123560 if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && node.callee.type !== "Import", false); }
123561 else { node.arguments = empty$1; }
123562 return this.finishNode(node, "NewExpression")
123563 };
123564
123565 // Parse template expression.
123566
123567 pp$3.parseTemplateElement = function(ref) {
123568 var isTagged = ref.isTagged;
123569
123570 var elem = this.startNode();
123571 if (this.type === types.invalidTemplate) {
123572 if (!isTagged) {
123573 this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
123574 }
123575 elem.value = {
123576 raw: this.value,
123577 cooked: null
123578 };
123579 } else {
123580 elem.value = {
123581 raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
123582 cooked: this.value
123583 };
123584 }
123585 this.next();
123586 elem.tail = this.type === types.backQuote;
123587 return this.finishNode(elem, "TemplateElement")
123588 };
123589
123590 pp$3.parseTemplate = function(ref) {
123591 if ( ref === void 0 ) ref = {};
123592 var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
123593
123594 var node = this.startNode();
123595 this.next();
123596 node.expressions = [];
123597 var curElt = this.parseTemplateElement({isTagged: isTagged});
123598 node.quasis = [curElt];
123599 while (!curElt.tail) {
123600 if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
123601 this.expect(types.dollarBraceL);
123602 node.expressions.push(this.parseExpression());
123603 this.expect(types.braceR);
123604 node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
123605 }
123606 this.next();
123607 return this.finishNode(node, "TemplateLiteral")
123608 };
123609
123610 pp$3.isAsyncProp = function(prop) {
123611 return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
123612 (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
123613 !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
123614 };
123615
123616 // Parse an object literal or binding pattern.
123617
123618 pp$3.parseObj = function(isPattern, refDestructuringErrors) {
123619 var node = this.startNode(), first = true, propHash = {};
123620 node.properties = [];
123621 this.next();
123622 while (!this.eat(types.braceR)) {
123623 if (!first) {
123624 this.expect(types.comma);
123625 if (this.afterTrailingComma(types.braceR)) { break }
123626 } else { first = false; }
123627
123628 var prop = this.parseProperty(isPattern, refDestructuringErrors);
123629 if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
123630 node.properties.push(prop);
123631 }
123632 return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
123633 };
123634
123635 pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
123636 var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
123637 if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
123638 if (isPattern) {
123639 prop.argument = this.parseIdent(false);
123640 if (this.type === types.comma) {
123641 this.raise(this.start, "Comma is not permitted after the rest element");
123642 }
123643 return this.finishNode(prop, "RestElement")
123644 }
123645 // To disallow parenthesized identifier via `this.toAssignable()`.
123646 if (this.type === types.parenL && refDestructuringErrors) {
123647 if (refDestructuringErrors.parenthesizedAssign < 0) {
123648 refDestructuringErrors.parenthesizedAssign = this.start;
123649 }
123650 if (refDestructuringErrors.parenthesizedBind < 0) {
123651 refDestructuringErrors.parenthesizedBind = this.start;
123652 }
123653 }
123654 // Parse argument.
123655 prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
123656 // To disallow trailing comma via `this.toAssignable()`.
123657 if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
123658 refDestructuringErrors.trailingComma = this.start;
123659 }
123660 // Finish
123661 return this.finishNode(prop, "SpreadElement")
123662 }
123663 if (this.options.ecmaVersion >= 6) {
123664 prop.method = false;
123665 prop.shorthand = false;
123666 if (isPattern || refDestructuringErrors) {
123667 startPos = this.start;
123668 startLoc = this.startLoc;
123669 }
123670 if (!isPattern)
123671 { isGenerator = this.eat(types.star); }
123672 }
123673 var containsEsc = this.containsEsc;
123674 this.parsePropertyName(prop);
123675 if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
123676 isAsync = true;
123677 isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
123678 this.parsePropertyName(prop, refDestructuringErrors);
123679 } else {
123680 isAsync = false;
123681 }
123682 this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
123683 return this.finishNode(prop, "Property")
123684 };
123685
123686 pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
123687 if ((isGenerator || isAsync) && this.type === types.colon)
123688 { this.unexpected(); }
123689
123690 if (this.eat(types.colon)) {
123691 prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
123692 prop.kind = "init";
123693 } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
123694 if (isPattern) { this.unexpected(); }
123695 prop.kind = "init";
123696 prop.method = true;
123697 prop.value = this.parseMethod(isGenerator, isAsync);
123698 } else if (!isPattern && !containsEsc &&
123699 this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
123700 (prop.key.name === "get" || prop.key.name === "set") &&
123701 (this.type !== types.comma && this.type !== types.braceR)) {
123702 if (isGenerator || isAsync) { this.unexpected(); }
123703 prop.kind = prop.key.name;
123704 this.parsePropertyName(prop);
123705 prop.value = this.parseMethod(false);
123706 var paramCount = prop.kind === "get" ? 0 : 1;
123707 if (prop.value.params.length !== paramCount) {
123708 var start = prop.value.start;
123709 if (prop.kind === "get")
123710 { this.raiseRecoverable(start, "getter should have no params"); }
123711 else
123712 { this.raiseRecoverable(start, "setter should have exactly one param"); }
123713 } else {
123714 if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
123715 { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
123716 }
123717 } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
123718 if (isGenerator || isAsync) { this.unexpected(); }
123719 this.checkUnreserved(prop.key);
123720 if (prop.key.name === "await" && !this.awaitIdentPos)
123721 { this.awaitIdentPos = startPos; }
123722 prop.kind = "init";
123723 if (isPattern) {
123724 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
123725 } else if (this.type === types.eq && refDestructuringErrors) {
123726 if (refDestructuringErrors.shorthandAssign < 0)
123727 { refDestructuringErrors.shorthandAssign = this.start; }
123728 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
123729 } else {
123730 prop.value = prop.key;
123731 }
123732 prop.shorthand = true;
123733 } else { this.unexpected(); }
123734 };
123735
123736 pp$3.parsePropertyName = function(prop) {
123737 if (this.options.ecmaVersion >= 6) {
123738 if (this.eat(types.bracketL)) {
123739 prop.computed = true;
123740 prop.key = this.parseMaybeAssign();
123741 this.expect(types.bracketR);
123742 return prop.key
123743 } else {
123744 prop.computed = false;
123745 }
123746 }
123747 return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
123748 };
123749
123750 // Initialize empty function node.
123751
123752 pp$3.initFunction = function(node) {
123753 node.id = null;
123754 if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
123755 if (this.options.ecmaVersion >= 8) { node.async = false; }
123756 };
123757
123758 // Parse object or class method.
123759
123760 pp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
123761 var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
123762
123763 this.initFunction(node);
123764 if (this.options.ecmaVersion >= 6)
123765 { node.generator = isGenerator; }
123766 if (this.options.ecmaVersion >= 8)
123767 { node.async = !!isAsync; }
123768
123769 this.yieldPos = 0;
123770 this.awaitPos = 0;
123771 this.awaitIdentPos = 0;
123772 this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
123773
123774 this.expect(types.parenL);
123775 node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
123776 this.checkYieldAwaitInDefaultParams();
123777 this.parseFunctionBody(node, false, true);
123778
123779 this.yieldPos = oldYieldPos;
123780 this.awaitPos = oldAwaitPos;
123781 this.awaitIdentPos = oldAwaitIdentPos;
123782 return this.finishNode(node, "FunctionExpression")
123783 };
123784
123785 // Parse arrow function expression with given parameters.
123786
123787 pp$3.parseArrowExpression = function(node, params, isAsync) {
123788 var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
123789
123790 this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
123791 this.initFunction(node);
123792 if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }
123793
123794 this.yieldPos = 0;
123795 this.awaitPos = 0;
123796 this.awaitIdentPos = 0;
123797
123798 node.params = this.toAssignableList(params, true);
123799 this.parseFunctionBody(node, true, false);
123800
123801 this.yieldPos = oldYieldPos;
123802 this.awaitPos = oldAwaitPos;
123803 this.awaitIdentPos = oldAwaitIdentPos;
123804 return this.finishNode(node, "ArrowFunctionExpression")
123805 };
123806
123807 // Parse function body and check parameters.
123808
123809 pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {
123810 var isExpression = isArrowFunction && this.type !== types.braceL;
123811 var oldStrict = this.strict, useStrict = false;
123812
123813 if (isExpression) {
123814 node.body = this.parseMaybeAssign();
123815 node.expression = true;
123816 this.checkParams(node, false);
123817 } else {
123818 var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
123819 if (!oldStrict || nonSimple) {
123820 useStrict = this.strictDirective(this.end);
123821 // If this is a strict mode function, verify that argument names
123822 // are not repeated, and it does not try to bind the words `eval`
123823 // or `arguments`.
123824 if (useStrict && nonSimple)
123825 { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
123826 }
123827 // Start a new scope with regard to labels and the `inFunction`
123828 // flag (restore them to their old value afterwards).
123829 var oldLabels = this.labels;
123830 this.labels = [];
123831 if (useStrict) { this.strict = true; }
123832
123833 // Add the params to varDeclaredNames to ensure that an error is thrown
123834 // if a let/const declaration in the function clashes with one of the params.
123835 this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
123836 node.body = this.parseBlock(false);
123837 node.expression = false;
123838 this.adaptDirectivePrologue(node.body.body);
123839 this.labels = oldLabels;
123840 }
123841 this.exitScope();
123842
123843 // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
123844 if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }
123845 this.strict = oldStrict;
123846 };
123847
123848 pp$3.isSimpleParamList = function(params) {
123849 for (var i = 0, list = params; i < list.length; i += 1)
123850 {
123851 var param = list[i];
123852
123853 if (param.type !== "Identifier") { return false
123854 } }
123855 return true
123856 };
123857
123858 // Checks function params for various disallowed patterns such as using "eval"
123859 // or "arguments" and duplicate parameters.
123860
123861 pp$3.checkParams = function(node, allowDuplicates) {
123862 var nameHash = {};
123863 for (var i = 0, list = node.params; i < list.length; i += 1)
123864 {
123865 var param = list[i];
123866
123867 this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash);
123868 }
123869 };
123870
123871 // Parses a comma-separated list of expressions, and returns them as
123872 // an array. `close` is the token type that ends the list, and
123873 // `allowEmpty` can be turned on to allow subsequent commas with
123874 // nothing in between them to be parsed as `null` (which is needed
123875 // for array literals).
123876
123877 pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
123878 var elts = [], first = true;
123879 while (!this.eat(close)) {
123880 if (!first) {
123881 this.expect(types.comma);
123882 if (allowTrailingComma && this.afterTrailingComma(close)) { break }
123883 } else { first = false; }
123884
123885 var elt = (void 0);
123886 if (allowEmpty && this.type === types.comma)
123887 { elt = null; }
123888 else if (this.type === types.ellipsis) {
123889 elt = this.parseSpread(refDestructuringErrors);
123890 if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
123891 { refDestructuringErrors.trailingComma = this.start; }
123892 } else {
123893 elt = this.parseMaybeAssign(false, refDestructuringErrors);
123894 }
123895 elts.push(elt);
123896 }
123897 return elts
123898 };
123899
123900 pp$3.checkUnreserved = function(ref) {
123901 var start = ref.start;
123902 var end = ref.end;
123903 var name = ref.name;
123904
123905 if (this.inGenerator && name === "yield")
123906 { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
123907 if (this.inAsync && name === "await")
123908 { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
123909 if (this.keywords.test(name))
123910 { this.raise(start, ("Unexpected keyword '" + name + "'")); }
123911 if (this.options.ecmaVersion < 6 &&
123912 this.input.slice(start, end).indexOf("\\") !== -1) { return }
123913 var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
123914 if (re.test(name)) {
123915 if (!this.inAsync && name === "await")
123916 { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
123917 this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
123918 }
123919 };
123920
123921 // Parse the next token as an identifier. If `liberal` is true (used
123922 // when parsing properties), it will also convert keywords into
123923 // identifiers.
123924
123925 pp$3.parseIdent = function(liberal, isBinding) {
123926 var node = this.startNode();
123927 if (this.type === types.name) {
123928 node.name = this.value;
123929 } else if (this.type.keyword) {
123930 node.name = this.type.keyword;
123931
123932 // To fix https://github.com/acornjs/acorn/issues/575
123933 // `class` and `function` keywords push new context into this.context.
123934 // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
123935 // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
123936 if ((node.name === "class" || node.name === "function") &&
123937 (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
123938 this.context.pop();
123939 }
123940 } else {
123941 this.unexpected();
123942 }
123943 this.next();
123944 this.finishNode(node, "Identifier");
123945 if (!liberal) {
123946 this.checkUnreserved(node);
123947 if (node.name === "await" && !this.awaitIdentPos)
123948 { this.awaitIdentPos = node.start; }
123949 }
123950 return node
123951 };
123952
123953 // Parses yield expression inside generator.
123954
123955 pp$3.parseYield = function(noIn) {
123956 if (!this.yieldPos) { this.yieldPos = this.start; }
123957
123958 var node = this.startNode();
123959 this.next();
123960 if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
123961 node.delegate = false;
123962 node.argument = null;
123963 } else {
123964 node.delegate = this.eat(types.star);
123965 node.argument = this.parseMaybeAssign(noIn);
123966 }
123967 return this.finishNode(node, "YieldExpression")
123968 };
123969
123970 pp$3.parseAwait = function() {
123971 if (!this.awaitPos) { this.awaitPos = this.start; }
123972
123973 var node = this.startNode();
123974 this.next();
123975 node.argument = this.parseMaybeUnary(null, true);
123976 return this.finishNode(node, "AwaitExpression")
123977 };
123978
123979 var pp$4 = Parser.prototype;
123980
123981 // This function is used to raise exceptions on parse errors. It
123982 // takes an offset integer (into the current `input`) to indicate
123983 // the location of the error, attaches the position to the end
123984 // of the error message, and then raises a `SyntaxError` with that
123985 // message.
123986
123987 pp$4.raise = function(pos, message) {
123988 var loc = getLineInfo(this.input, pos);
123989 message += " (" + loc.line + ":" + loc.column + ")";
123990 var err = new SyntaxError(message);
123991 err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
123992 throw err
123993 };
123994
123995 pp$4.raiseRecoverable = pp$4.raise;
123996
123997 pp$4.curPosition = function() {
123998 if (this.options.locations) {
123999 return new Position(this.curLine, this.pos - this.lineStart)
124000 }
124001 };
124002
124003 var pp$5 = Parser.prototype;
124004
124005 var Scope = function Scope(flags) {
124006 this.flags = flags;
124007 // A list of var-declared names in the current lexical scope
124008 this.var = [];
124009 // A list of lexically-declared names in the current lexical scope
124010 this.lexical = [];
124011 // A list of lexically-declared FunctionDeclaration names in the current lexical scope
124012 this.functions = [];
124013 };
124014
124015 // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
124016
124017 pp$5.enterScope = function(flags) {
124018 this.scopeStack.push(new Scope(flags));
124019 };
124020
124021 pp$5.exitScope = function() {
124022 this.scopeStack.pop();
124023 };
124024
124025 // The spec says:
124026 // > At the top level of a function, or script, function declarations are
124027 // > treated like var declarations rather than like lexical declarations.
124028 pp$5.treatFunctionsAsVarInScope = function(scope) {
124029 return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
124030 };
124031
124032 pp$5.declareName = function(name, bindingType, pos) {
124033 var redeclared = false;
124034 if (bindingType === BIND_LEXICAL) {
124035 var scope = this.currentScope();
124036 redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
124037 scope.lexical.push(name);
124038 if (this.inModule && (scope.flags & SCOPE_TOP))
124039 { delete this.undefinedExports[name]; }
124040 } else if (bindingType === BIND_SIMPLE_CATCH) {
124041 var scope$1 = this.currentScope();
124042 scope$1.lexical.push(name);
124043 } else if (bindingType === BIND_FUNCTION) {
124044 var scope$2 = this.currentScope();
124045 if (this.treatFunctionsAsVar)
124046 { redeclared = scope$2.lexical.indexOf(name) > -1; }
124047 else
124048 { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
124049 scope$2.functions.push(name);
124050 } else {
124051 for (var i = this.scopeStack.length - 1; i >= 0; --i) {
124052 var scope$3 = this.scopeStack[i];
124053 if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
124054 !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
124055 redeclared = true;
124056 break
124057 }
124058 scope$3.var.push(name);
124059 if (this.inModule && (scope$3.flags & SCOPE_TOP))
124060 { delete this.undefinedExports[name]; }
124061 if (scope$3.flags & SCOPE_VAR) { break }
124062 }
124063 }
124064 if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
124065 };
124066
124067 pp$5.checkLocalExport = function(id) {
124068 // scope.functions must be empty as Module code is always strict.
124069 if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
124070 this.scopeStack[0].var.indexOf(id.name) === -1) {
124071 this.undefinedExports[id.name] = id;
124072 }
124073 };
124074
124075 pp$5.currentScope = function() {
124076 return this.scopeStack[this.scopeStack.length - 1]
124077 };
124078
124079 pp$5.currentVarScope = function() {
124080 for (var i = this.scopeStack.length - 1;; i--) {
124081 var scope = this.scopeStack[i];
124082 if (scope.flags & SCOPE_VAR) { return scope }
124083 }
124084 };
124085
124086 // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
124087 pp$5.currentThisScope = function() {
124088 for (var i = this.scopeStack.length - 1;; i--) {
124089 var scope = this.scopeStack[i];
124090 if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
124091 }
124092 };
124093
124094 var Node = function Node(parser, pos, loc) {
124095 this.type = "";
124096 this.start = pos;
124097 this.end = 0;
124098 if (parser.options.locations)
124099 { this.loc = new SourceLocation(parser, loc); }
124100 if (parser.options.directSourceFile)
124101 { this.sourceFile = parser.options.directSourceFile; }
124102 if (parser.options.ranges)
124103 { this.range = [pos, 0]; }
124104 };
124105
124106 // Start an AST node, attaching a start offset.
124107
124108 var pp$6 = Parser.prototype;
124109
124110 pp$6.startNode = function() {
124111 return new Node(this, this.start, this.startLoc)
124112 };
124113
124114 pp$6.startNodeAt = function(pos, loc) {
124115 return new Node(this, pos, loc)
124116 };
124117
124118 // Finish an AST node, adding `type` and `end` properties.
124119
124120 function finishNodeAt(node, type, pos, loc) {
124121 node.type = type;
124122 node.end = pos;
124123 if (this.options.locations)
124124 { node.loc.end = loc; }
124125 if (this.options.ranges)
124126 { node.range[1] = pos; }
124127 return node
124128 }
124129
124130 pp$6.finishNode = function(node, type) {
124131 return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
124132 };
124133
124134 // Finish node at given position
124135
124136 pp$6.finishNodeAt = function(node, type, pos, loc) {
124137 return finishNodeAt.call(this, node, type, pos, loc)
124138 };
124139
124140 // The algorithm used to determine whether a regexp can appear at a
124141
124142 var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
124143 this.token = token;
124144 this.isExpr = !!isExpr;
124145 this.preserveSpace = !!preserveSpace;
124146 this.override = override;
124147 this.generator = !!generator;
124148 };
124149
124150 var types$1 = {
124151 b_stat: new TokContext("{", false),
124152 b_expr: new TokContext("{", true),
124153 b_tmpl: new TokContext("${", false),
124154 p_stat: new TokContext("(", false),
124155 p_expr: new TokContext("(", true),
124156 q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
124157 f_stat: new TokContext("function", false),
124158 f_expr: new TokContext("function", true),
124159 f_expr_gen: new TokContext("function", true, false, null, true),
124160 f_gen: new TokContext("function", false, false, null, true)
124161 };
124162
124163 var pp$7 = Parser.prototype;
124164
124165 pp$7.initialContext = function() {
124166 return [types$1.b_stat]
124167 };
124168
124169 pp$7.braceIsBlock = function(prevType) {
124170 var parent = this.curContext();
124171 if (parent === types$1.f_expr || parent === types$1.f_stat)
124172 { return true }
124173 if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
124174 { return !parent.isExpr }
124175
124176 // The check for `tt.name && exprAllowed` detects whether we are
124177 // after a `yield` or `of` construct. See the `updateContext` for
124178 // `tt.name`.
124179 if (prevType === types._return || prevType === types.name && this.exprAllowed)
124180 { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
124181 if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
124182 { return true }
124183 if (prevType === types.braceL)
124184 { return parent === types$1.b_stat }
124185 if (prevType === types._var || prevType === types._const || prevType === types.name)
124186 { return false }
124187 return !this.exprAllowed
124188 };
124189
124190 pp$7.inGeneratorContext = function() {
124191 for (var i = this.context.length - 1; i >= 1; i--) {
124192 var context = this.context[i];
124193 if (context.token === "function")
124194 { return context.generator }
124195 }
124196 return false
124197 };
124198
124199 pp$7.updateContext = function(prevType) {
124200 var update, type = this.type;
124201 if (type.keyword && prevType === types.dot)
124202 { this.exprAllowed = false; }
124203 else if (update = type.updateContext)
124204 { update.call(this, prevType); }
124205 else
124206 { this.exprAllowed = type.beforeExpr; }
124207 };
124208
124209 // Token-specific context update code
124210
124211 types.parenR.updateContext = types.braceR.updateContext = function() {
124212 if (this.context.length === 1) {
124213 this.exprAllowed = true;
124214 return
124215 }
124216 var out = this.context.pop();
124217 if (out === types$1.b_stat && this.curContext().token === "function") {
124218 out = this.context.pop();
124219 }
124220 this.exprAllowed = !out.isExpr;
124221 };
124222
124223 types.braceL.updateContext = function(prevType) {
124224 this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
124225 this.exprAllowed = true;
124226 };
124227
124228 types.dollarBraceL.updateContext = function() {
124229 this.context.push(types$1.b_tmpl);
124230 this.exprAllowed = true;
124231 };
124232
124233 types.parenL.updateContext = function(prevType) {
124234 var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
124235 this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
124236 this.exprAllowed = true;
124237 };
124238
124239 types.incDec.updateContext = function() {
124240 // tokExprAllowed stays unchanged
124241 };
124242
124243 types._function.updateContext = types._class.updateContext = function(prevType) {
124244 if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else &&
124245 !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
124246 !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
124247 { this.context.push(types$1.f_expr); }
124248 else
124249 { this.context.push(types$1.f_stat); }
124250 this.exprAllowed = false;
124251 };
124252
124253 types.backQuote.updateContext = function() {
124254 if (this.curContext() === types$1.q_tmpl)
124255 { this.context.pop(); }
124256 else
124257 { this.context.push(types$1.q_tmpl); }
124258 this.exprAllowed = false;
124259 };
124260
124261 types.star.updateContext = function(prevType) {
124262 if (prevType === types._function) {
124263 var index = this.context.length - 1;
124264 if (this.context[index] === types$1.f_expr)
124265 { this.context[index] = types$1.f_expr_gen; }
124266 else
124267 { this.context[index] = types$1.f_gen; }
124268 }
124269 this.exprAllowed = true;
124270 };
124271
124272 types.name.updateContext = function(prevType) {
124273 var allowed = false;
124274 if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
124275 if (this.value === "of" && !this.exprAllowed ||
124276 this.value === "yield" && this.inGeneratorContext())
124277 { allowed = true; }
124278 }
124279 this.exprAllowed = allowed;
124280 };
124281
124282 // This file contains Unicode properties extracted from the ECMAScript
124283 // specification. The lists are extracted like so:
124284 // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
124285
124286 // #table-binary-unicode-properties
124287 var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
124288 var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
124289 var ecma11BinaryProperties = ecma10BinaryProperties;
124290 var unicodeBinaryProperties = {
124291 9: ecma9BinaryProperties,
124292 10: ecma10BinaryProperties,
124293 11: ecma11BinaryProperties
124294 };
124295
124296 // #table-unicode-general-category-values
124297 var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
124298
124299 // #table-unicode-script-values
124300 var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
124301 var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
124302 var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
124303 var unicodeScriptValues = {
124304 9: ecma9ScriptValues,
124305 10: ecma10ScriptValues,
124306 11: ecma11ScriptValues
124307 };
124308
124309 var data = {};
124310 function buildUnicodeData(ecmaVersion) {
124311 var d = data[ecmaVersion] = {
124312 binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
124313 nonBinary: {
124314 General_Category: wordsRegexp(unicodeGeneralCategoryValues),
124315 Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
124316 }
124317 };
124318 d.nonBinary.Script_Extensions = d.nonBinary.Script;
124319
124320 d.nonBinary.gc = d.nonBinary.General_Category;
124321 d.nonBinary.sc = d.nonBinary.Script;
124322 d.nonBinary.scx = d.nonBinary.Script_Extensions;
124323 }
124324 buildUnicodeData(9);
124325 buildUnicodeData(10);
124326 buildUnicodeData(11);
124327
124328 var pp$8 = Parser.prototype;
124329
124330 var RegExpValidationState = function RegExpValidationState(parser) {
124331 this.parser = parser;
124332 this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "");
124333 this.unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion];
124334 this.source = "";
124335 this.flags = "";
124336 this.start = 0;
124337 this.switchU = false;
124338 this.switchN = false;
124339 this.pos = 0;
124340 this.lastIntValue = 0;
124341 this.lastStringValue = "";
124342 this.lastAssertionIsQuantifiable = false;
124343 this.numCapturingParens = 0;
124344 this.maxBackReference = 0;
124345 this.groupNames = [];
124346 this.backReferenceNames = [];
124347 };
124348
124349 RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
124350 var unicode = flags.indexOf("u") !== -1;
124351 this.start = start | 0;
124352 this.source = pattern + "";
124353 this.flags = flags;
124354 this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
124355 this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
124356 };
124357
124358 RegExpValidationState.prototype.raise = function raise (message) {
124359 this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
124360 };
124361
124362 // If u flag is given, this returns the code point at the index (it combines a surrogate pair).
124363 // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
124364 RegExpValidationState.prototype.at = function at (i) {
124365 var s = this.source;
124366 var l = s.length;
124367 if (i >= l) {
124368 return -1
124369 }
124370 var c = s.charCodeAt(i);
124371 if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
124372 return c
124373 }
124374 var next = s.charCodeAt(i + 1);
124375 return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
124376 };
124377
124378 RegExpValidationState.prototype.nextIndex = function nextIndex (i) {
124379 var s = this.source;
124380 var l = s.length;
124381 if (i >= l) {
124382 return l
124383 }
124384 var c = s.charCodeAt(i), next;
124385 if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
124386 (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
124387 return i + 1
124388 }
124389 return i + 2
124390 };
124391
124392 RegExpValidationState.prototype.current = function current () {
124393 return this.at(this.pos)
124394 };
124395
124396 RegExpValidationState.prototype.lookahead = function lookahead () {
124397 return this.at(this.nextIndex(this.pos))
124398 };
124399
124400 RegExpValidationState.prototype.advance = function advance () {
124401 this.pos = this.nextIndex(this.pos);
124402 };
124403
124404 RegExpValidationState.prototype.eat = function eat (ch) {
124405 if (this.current() === ch) {
124406 this.advance();
124407 return true
124408 }
124409 return false
124410 };
124411
124412 function codePointToString(ch) {
124413 if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
124414 ch -= 0x10000;
124415 return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
124416 }
124417
124418 /**
124419 * Validate the flags part of a given RegExpLiteral.
124420 *
124421 * @param {RegExpValidationState} state The state to validate RegExp.
124422 * @returns {void}
124423 */
124424 pp$8.validateRegExpFlags = function(state) {
124425 var validFlags = state.validFlags;
124426 var flags = state.flags;
124427
124428 for (var i = 0; i < flags.length; i++) {
124429 var flag = flags.charAt(i);
124430 if (validFlags.indexOf(flag) === -1) {
124431 this.raise(state.start, "Invalid regular expression flag");
124432 }
124433 if (flags.indexOf(flag, i + 1) > -1) {
124434 this.raise(state.start, "Duplicate regular expression flag");
124435 }
124436 }
124437 };
124438
124439 /**
124440 * Validate the pattern part of a given RegExpLiteral.
124441 *
124442 * @param {RegExpValidationState} state The state to validate RegExp.
124443 * @returns {void}
124444 */
124445 pp$8.validateRegExpPattern = function(state) {
124446 this.regexp_pattern(state);
124447
124448 // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
124449 // parsing contains a |GroupName|, reparse with the goal symbol
124450 // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
124451 // exception if _P_ did not conform to the grammar, if any elements of _P_
124452 // were not matched by the parse, or if any Early Error conditions exist.
124453 if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
124454 state.switchN = true;
124455 this.regexp_pattern(state);
124456 }
124457 };
124458
124459 // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
124460 pp$8.regexp_pattern = function(state) {
124461 state.pos = 0;
124462 state.lastIntValue = 0;
124463 state.lastStringValue = "";
124464 state.lastAssertionIsQuantifiable = false;
124465 state.numCapturingParens = 0;
124466 state.maxBackReference = 0;
124467 state.groupNames.length = 0;
124468 state.backReferenceNames.length = 0;
124469
124470 this.regexp_disjunction(state);
124471
124472 if (state.pos !== state.source.length) {
124473 // Make the same messages as V8.
124474 if (state.eat(0x29 /* ) */)) {
124475 state.raise("Unmatched ')'");
124476 }
124477 if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) {
124478 state.raise("Lone quantifier brackets");
124479 }
124480 }
124481 if (state.maxBackReference > state.numCapturingParens) {
124482 state.raise("Invalid escape");
124483 }
124484 for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
124485 var name = list[i];
124486
124487 if (state.groupNames.indexOf(name) === -1) {
124488 state.raise("Invalid named capture referenced");
124489 }
124490 }
124491 };
124492
124493 // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
124494 pp$8.regexp_disjunction = function(state) {
124495 this.regexp_alternative(state);
124496 while (state.eat(0x7C /* | */)) {
124497 this.regexp_alternative(state);
124498 }
124499
124500 // Make the same message as V8.
124501 if (this.regexp_eatQuantifier(state, true)) {
124502 state.raise("Nothing to repeat");
124503 }
124504 if (state.eat(0x7B /* { */)) {
124505 state.raise("Lone quantifier brackets");
124506 }
124507 };
124508
124509 // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
124510 pp$8.regexp_alternative = function(state) {
124511 while (state.pos < state.source.length && this.regexp_eatTerm(state))
124512 { }
124513 };
124514
124515 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
124516 pp$8.regexp_eatTerm = function(state) {
124517 if (this.regexp_eatAssertion(state)) {
124518 // Handle `QuantifiableAssertion Quantifier` alternative.
124519 // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
124520 // is a QuantifiableAssertion.
124521 if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
124522 // Make the same message as V8.
124523 if (state.switchU) {
124524 state.raise("Invalid quantifier");
124525 }
124526 }
124527 return true
124528 }
124529
124530 if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
124531 this.regexp_eatQuantifier(state);
124532 return true
124533 }
124534
124535 return false
124536 };
124537
124538 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
124539 pp$8.regexp_eatAssertion = function(state) {
124540 var start = state.pos;
124541 state.lastAssertionIsQuantifiable = false;
124542
124543 // ^, $
124544 if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
124545 return true
124546 }
124547
124548 // \b \B
124549 if (state.eat(0x5C /* \ */)) {
124550 if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
124551 return true
124552 }
124553 state.pos = start;
124554 }
124555
124556 // Lookahead / Lookbehind
124557 if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
124558 var lookbehind = false;
124559 if (this.options.ecmaVersion >= 9) {
124560 lookbehind = state.eat(0x3C /* < */);
124561 }
124562 if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
124563 this.regexp_disjunction(state);
124564 if (!state.eat(0x29 /* ) */)) {
124565 state.raise("Unterminated group");
124566 }
124567 state.lastAssertionIsQuantifiable = !lookbehind;
124568 return true
124569 }
124570 }
124571
124572 state.pos = start;
124573 return false
124574 };
124575
124576 // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
124577 pp$8.regexp_eatQuantifier = function(state, noError) {
124578 if ( noError === void 0 ) noError = false;
124579
124580 if (this.regexp_eatQuantifierPrefix(state, noError)) {
124581 state.eat(0x3F /* ? */);
124582 return true
124583 }
124584 return false
124585 };
124586
124587 // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
124588 pp$8.regexp_eatQuantifierPrefix = function(state, noError) {
124589 return (
124590 state.eat(0x2A /* * */) ||
124591 state.eat(0x2B /* + */) ||
124592 state.eat(0x3F /* ? */) ||
124593 this.regexp_eatBracedQuantifier(state, noError)
124594 )
124595 };
124596 pp$8.regexp_eatBracedQuantifier = function(state, noError) {
124597 var start = state.pos;
124598 if (state.eat(0x7B /* { */)) {
124599 var min = 0, max = -1;
124600 if (this.regexp_eatDecimalDigits(state)) {
124601 min = state.lastIntValue;
124602 if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
124603 max = state.lastIntValue;
124604 }
124605 if (state.eat(0x7D /* } */)) {
124606 // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
124607 if (max !== -1 && max < min && !noError) {
124608 state.raise("numbers out of order in {} quantifier");
124609 }
124610 return true
124611 }
124612 }
124613 if (state.switchU && !noError) {
124614 state.raise("Incomplete quantifier");
124615 }
124616 state.pos = start;
124617 }
124618 return false
124619 };
124620
124621 // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
124622 pp$8.regexp_eatAtom = function(state) {
124623 return (
124624 this.regexp_eatPatternCharacters(state) ||
124625 state.eat(0x2E /* . */) ||
124626 this.regexp_eatReverseSolidusAtomEscape(state) ||
124627 this.regexp_eatCharacterClass(state) ||
124628 this.regexp_eatUncapturingGroup(state) ||
124629 this.regexp_eatCapturingGroup(state)
124630 )
124631 };
124632 pp$8.regexp_eatReverseSolidusAtomEscape = function(state) {
124633 var start = state.pos;
124634 if (state.eat(0x5C /* \ */)) {
124635 if (this.regexp_eatAtomEscape(state)) {
124636 return true
124637 }
124638 state.pos = start;
124639 }
124640 return false
124641 };
124642 pp$8.regexp_eatUncapturingGroup = function(state) {
124643 var start = state.pos;
124644 if (state.eat(0x28 /* ( */)) {
124645 if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
124646 this.regexp_disjunction(state);
124647 if (state.eat(0x29 /* ) */)) {
124648 return true
124649 }
124650 state.raise("Unterminated group");
124651 }
124652 state.pos = start;
124653 }
124654 return false
124655 };
124656 pp$8.regexp_eatCapturingGroup = function(state) {
124657 if (state.eat(0x28 /* ( */)) {
124658 if (this.options.ecmaVersion >= 9) {
124659 this.regexp_groupSpecifier(state);
124660 } else if (state.current() === 0x3F /* ? */) {
124661 state.raise("Invalid group");
124662 }
124663 this.regexp_disjunction(state);
124664 if (state.eat(0x29 /* ) */)) {
124665 state.numCapturingParens += 1;
124666 return true
124667 }
124668 state.raise("Unterminated group");
124669 }
124670 return false
124671 };
124672
124673 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
124674 pp$8.regexp_eatExtendedAtom = function(state) {
124675 return (
124676 state.eat(0x2E /* . */) ||
124677 this.regexp_eatReverseSolidusAtomEscape(state) ||
124678 this.regexp_eatCharacterClass(state) ||
124679 this.regexp_eatUncapturingGroup(state) ||
124680 this.regexp_eatCapturingGroup(state) ||
124681 this.regexp_eatInvalidBracedQuantifier(state) ||
124682 this.regexp_eatExtendedPatternCharacter(state)
124683 )
124684 };
124685
124686 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
124687 pp$8.regexp_eatInvalidBracedQuantifier = function(state) {
124688 if (this.regexp_eatBracedQuantifier(state, true)) {
124689 state.raise("Nothing to repeat");
124690 }
124691 return false
124692 };
124693
124694 // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
124695 pp$8.regexp_eatSyntaxCharacter = function(state) {
124696 var ch = state.current();
124697 if (isSyntaxCharacter(ch)) {
124698 state.lastIntValue = ch;
124699 state.advance();
124700 return true
124701 }
124702 return false
124703 };
124704 function isSyntaxCharacter(ch) {
124705 return (
124706 ch === 0x24 /* $ */ ||
124707 ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
124708 ch === 0x2E /* . */ ||
124709 ch === 0x3F /* ? */ ||
124710 ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
124711 ch >= 0x7B /* { */ && ch <= 0x7D /* } */
124712 )
124713 }
124714
124715 // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
124716 // But eat eager.
124717 pp$8.regexp_eatPatternCharacters = function(state) {
124718 var start = state.pos;
124719 var ch = 0;
124720 while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
124721 state.advance();
124722 }
124723 return state.pos !== start
124724 };
124725
124726 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
124727 pp$8.regexp_eatExtendedPatternCharacter = function(state) {
124728 var ch = state.current();
124729 if (
124730 ch !== -1 &&
124731 ch !== 0x24 /* $ */ &&
124732 !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
124733 ch !== 0x2E /* . */ &&
124734 ch !== 0x3F /* ? */ &&
124735 ch !== 0x5B /* [ */ &&
124736 ch !== 0x5E /* ^ */ &&
124737 ch !== 0x7C /* | */
124738 ) {
124739 state.advance();
124740 return true
124741 }
124742 return false
124743 };
124744
124745 // GroupSpecifier[U] ::
124746 // [empty]
124747 // `?` GroupName[?U]
124748 pp$8.regexp_groupSpecifier = function(state) {
124749 if (state.eat(0x3F /* ? */)) {
124750 if (this.regexp_eatGroupName(state)) {
124751 if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
124752 state.raise("Duplicate capture group name");
124753 }
124754 state.groupNames.push(state.lastStringValue);
124755 return
124756 }
124757 state.raise("Invalid group");
124758 }
124759 };
124760
124761 // GroupName[U] ::
124762 // `<` RegExpIdentifierName[?U] `>`
124763 // Note: this updates `state.lastStringValue` property with the eaten name.
124764 pp$8.regexp_eatGroupName = function(state) {
124765 state.lastStringValue = "";
124766 if (state.eat(0x3C /* < */)) {
124767 if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
124768 return true
124769 }
124770 state.raise("Invalid capture group name");
124771 }
124772 return false
124773 };
124774
124775 // RegExpIdentifierName[U] ::
124776 // RegExpIdentifierStart[?U]
124777 // RegExpIdentifierName[?U] RegExpIdentifierPart[?U]
124778 // Note: this updates `state.lastStringValue` property with the eaten name.
124779 pp$8.regexp_eatRegExpIdentifierName = function(state) {
124780 state.lastStringValue = "";
124781 if (this.regexp_eatRegExpIdentifierStart(state)) {
124782 state.lastStringValue += codePointToString(state.lastIntValue);
124783 while (this.regexp_eatRegExpIdentifierPart(state)) {
124784 state.lastStringValue += codePointToString(state.lastIntValue);
124785 }
124786 return true
124787 }
124788 return false
124789 };
124790
124791 // RegExpIdentifierStart[U] ::
124792 // UnicodeIDStart
124793 // `$`
124794 // `_`
124795 // `\` RegExpUnicodeEscapeSequence[?U]
124796 pp$8.regexp_eatRegExpIdentifierStart = function(state) {
124797 var start = state.pos;
124798 var ch = state.current();
124799 state.advance();
124800
124801 if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
124802 ch = state.lastIntValue;
124803 }
124804 if (isRegExpIdentifierStart(ch)) {
124805 state.lastIntValue = ch;
124806 return true
124807 }
124808
124809 state.pos = start;
124810 return false
124811 };
124812 function isRegExpIdentifierStart(ch) {
124813 return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
124814 }
124815
124816 // RegExpIdentifierPart[U] ::
124817 // UnicodeIDContinue
124818 // `$`
124819 // `_`
124820 // `\` RegExpUnicodeEscapeSequence[?U]
124821 // <ZWNJ>
124822 // <ZWJ>
124823 pp$8.regexp_eatRegExpIdentifierPart = function(state) {
124824 var start = state.pos;
124825 var ch = state.current();
124826 state.advance();
124827
124828 if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {
124829 ch = state.lastIntValue;
124830 }
124831 if (isRegExpIdentifierPart(ch)) {
124832 state.lastIntValue = ch;
124833 return true
124834 }
124835
124836 state.pos = start;
124837 return false
124838 };
124839 function isRegExpIdentifierPart(ch) {
124840 return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */
124841 }
124842
124843 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
124844 pp$8.regexp_eatAtomEscape = function(state) {
124845 if (
124846 this.regexp_eatBackReference(state) ||
124847 this.regexp_eatCharacterClassEscape(state) ||
124848 this.regexp_eatCharacterEscape(state) ||
124849 (state.switchN && this.regexp_eatKGroupName(state))
124850 ) {
124851 return true
124852 }
124853 if (state.switchU) {
124854 // Make the same message as V8.
124855 if (state.current() === 0x63 /* c */) {
124856 state.raise("Invalid unicode escape");
124857 }
124858 state.raise("Invalid escape");
124859 }
124860 return false
124861 };
124862 pp$8.regexp_eatBackReference = function(state) {
124863 var start = state.pos;
124864 if (this.regexp_eatDecimalEscape(state)) {
124865 var n = state.lastIntValue;
124866 if (state.switchU) {
124867 // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
124868 if (n > state.maxBackReference) {
124869 state.maxBackReference = n;
124870 }
124871 return true
124872 }
124873 if (n <= state.numCapturingParens) {
124874 return true
124875 }
124876 state.pos = start;
124877 }
124878 return false
124879 };
124880 pp$8.regexp_eatKGroupName = function(state) {
124881 if (state.eat(0x6B /* k */)) {
124882 if (this.regexp_eatGroupName(state)) {
124883 state.backReferenceNames.push(state.lastStringValue);
124884 return true
124885 }
124886 state.raise("Invalid named reference");
124887 }
124888 return false
124889 };
124890
124891 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
124892 pp$8.regexp_eatCharacterEscape = function(state) {
124893 return (
124894 this.regexp_eatControlEscape(state) ||
124895 this.regexp_eatCControlLetter(state) ||
124896 this.regexp_eatZero(state) ||
124897 this.regexp_eatHexEscapeSequence(state) ||
124898 this.regexp_eatRegExpUnicodeEscapeSequence(state) ||
124899 (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
124900 this.regexp_eatIdentityEscape(state)
124901 )
124902 };
124903 pp$8.regexp_eatCControlLetter = function(state) {
124904 var start = state.pos;
124905 if (state.eat(0x63 /* c */)) {
124906 if (this.regexp_eatControlLetter(state)) {
124907 return true
124908 }
124909 state.pos = start;
124910 }
124911 return false
124912 };
124913 pp$8.regexp_eatZero = function(state) {
124914 if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
124915 state.lastIntValue = 0;
124916 state.advance();
124917 return true
124918 }
124919 return false
124920 };
124921
124922 // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
124923 pp$8.regexp_eatControlEscape = function(state) {
124924 var ch = state.current();
124925 if (ch === 0x74 /* t */) {
124926 state.lastIntValue = 0x09; /* \t */
124927 state.advance();
124928 return true
124929 }
124930 if (ch === 0x6E /* n */) {
124931 state.lastIntValue = 0x0A; /* \n */
124932 state.advance();
124933 return true
124934 }
124935 if (ch === 0x76 /* v */) {
124936 state.lastIntValue = 0x0B; /* \v */
124937 state.advance();
124938 return true
124939 }
124940 if (ch === 0x66 /* f */) {
124941 state.lastIntValue = 0x0C; /* \f */
124942 state.advance();
124943 return true
124944 }
124945 if (ch === 0x72 /* r */) {
124946 state.lastIntValue = 0x0D; /* \r */
124947 state.advance();
124948 return true
124949 }
124950 return false
124951 };
124952
124953 // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
124954 pp$8.regexp_eatControlLetter = function(state) {
124955 var ch = state.current();
124956 if (isControlLetter(ch)) {
124957 state.lastIntValue = ch % 0x20;
124958 state.advance();
124959 return true
124960 }
124961 return false
124962 };
124963 function isControlLetter(ch) {
124964 return (
124965 (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
124966 (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
124967 )
124968 }
124969
124970 // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
124971 pp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {
124972 var start = state.pos;
124973
124974 if (state.eat(0x75 /* u */)) {
124975 if (this.regexp_eatFixedHexDigits(state, 4)) {
124976 var lead = state.lastIntValue;
124977 if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {
124978 var leadSurrogateEnd = state.pos;
124979 if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
124980 var trail = state.lastIntValue;
124981 if (trail >= 0xDC00 && trail <= 0xDFFF) {
124982 state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
124983 return true
124984 }
124985 }
124986 state.pos = leadSurrogateEnd;
124987 state.lastIntValue = lead;
124988 }
124989 return true
124990 }
124991 if (
124992 state.switchU &&
124993 state.eat(0x7B /* { */) &&
124994 this.regexp_eatHexDigits(state) &&
124995 state.eat(0x7D /* } */) &&
124996 isValidUnicode(state.lastIntValue)
124997 ) {
124998 return true
124999 }
125000 if (state.switchU) {
125001 state.raise("Invalid unicode escape");
125002 }
125003 state.pos = start;
125004 }
125005
125006 return false
125007 };
125008 function isValidUnicode(ch) {
125009 return ch >= 0 && ch <= 0x10FFFF
125010 }
125011
125012 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
125013 pp$8.regexp_eatIdentityEscape = function(state) {
125014 if (state.switchU) {
125015 if (this.regexp_eatSyntaxCharacter(state)) {
125016 return true
125017 }
125018 if (state.eat(0x2F /* / */)) {
125019 state.lastIntValue = 0x2F; /* / */
125020 return true
125021 }
125022 return false
125023 }
125024
125025 var ch = state.current();
125026 if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
125027 state.lastIntValue = ch;
125028 state.advance();
125029 return true
125030 }
125031
125032 return false
125033 };
125034
125035 // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
125036 pp$8.regexp_eatDecimalEscape = function(state) {
125037 state.lastIntValue = 0;
125038 var ch = state.current();
125039 if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
125040 do {
125041 state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
125042 state.advance();
125043 } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
125044 return true
125045 }
125046 return false
125047 };
125048
125049 // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
125050 pp$8.regexp_eatCharacterClassEscape = function(state) {
125051 var ch = state.current();
125052
125053 if (isCharacterClassEscape(ch)) {
125054 state.lastIntValue = -1;
125055 state.advance();
125056 return true
125057 }
125058
125059 if (
125060 state.switchU &&
125061 this.options.ecmaVersion >= 9 &&
125062 (ch === 0x50 /* P */ || ch === 0x70 /* p */)
125063 ) {
125064 state.lastIntValue = -1;
125065 state.advance();
125066 if (
125067 state.eat(0x7B /* { */) &&
125068 this.regexp_eatUnicodePropertyValueExpression(state) &&
125069 state.eat(0x7D /* } */)
125070 ) {
125071 return true
125072 }
125073 state.raise("Invalid property name");
125074 }
125075
125076 return false
125077 };
125078 function isCharacterClassEscape(ch) {
125079 return (
125080 ch === 0x64 /* d */ ||
125081 ch === 0x44 /* D */ ||
125082 ch === 0x73 /* s */ ||
125083 ch === 0x53 /* S */ ||
125084 ch === 0x77 /* w */ ||
125085 ch === 0x57 /* W */
125086 )
125087 }
125088
125089 // UnicodePropertyValueExpression ::
125090 // UnicodePropertyName `=` UnicodePropertyValue
125091 // LoneUnicodePropertyNameOrValue
125092 pp$8.regexp_eatUnicodePropertyValueExpression = function(state) {
125093 var start = state.pos;
125094
125095 // UnicodePropertyName `=` UnicodePropertyValue
125096 if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
125097 var name = state.lastStringValue;
125098 if (this.regexp_eatUnicodePropertyValue(state)) {
125099 var value = state.lastStringValue;
125100 this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
125101 return true
125102 }
125103 }
125104 state.pos = start;
125105
125106 // LoneUnicodePropertyNameOrValue
125107 if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
125108 var nameOrValue = state.lastStringValue;
125109 this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
125110 return true
125111 }
125112 return false
125113 };
125114 pp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
125115 if (!has(state.unicodeProperties.nonBinary, name))
125116 { state.raise("Invalid property name"); }
125117 if (!state.unicodeProperties.nonBinary[name].test(value))
125118 { state.raise("Invalid property value"); }
125119 };
125120 pp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
125121 if (!state.unicodeProperties.binary.test(nameOrValue))
125122 { state.raise("Invalid property name"); }
125123 };
125124
125125 // UnicodePropertyName ::
125126 // UnicodePropertyNameCharacters
125127 pp$8.regexp_eatUnicodePropertyName = function(state) {
125128 var ch = 0;
125129 state.lastStringValue = "";
125130 while (isUnicodePropertyNameCharacter(ch = state.current())) {
125131 state.lastStringValue += codePointToString(ch);
125132 state.advance();
125133 }
125134 return state.lastStringValue !== ""
125135 };
125136 function isUnicodePropertyNameCharacter(ch) {
125137 return isControlLetter(ch) || ch === 0x5F /* _ */
125138 }
125139
125140 // UnicodePropertyValue ::
125141 // UnicodePropertyValueCharacters
125142 pp$8.regexp_eatUnicodePropertyValue = function(state) {
125143 var ch = 0;
125144 state.lastStringValue = "";
125145 while (isUnicodePropertyValueCharacter(ch = state.current())) {
125146 state.lastStringValue += codePointToString(ch);
125147 state.advance();
125148 }
125149 return state.lastStringValue !== ""
125150 };
125151 function isUnicodePropertyValueCharacter(ch) {
125152 return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
125153 }
125154
125155 // LoneUnicodePropertyNameOrValue ::
125156 // UnicodePropertyValueCharacters
125157 pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
125158 return this.regexp_eatUnicodePropertyValue(state)
125159 };
125160
125161 // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
125162 pp$8.regexp_eatCharacterClass = function(state) {
125163 if (state.eat(0x5B /* [ */)) {
125164 state.eat(0x5E /* ^ */);
125165 this.regexp_classRanges(state);
125166 if (state.eat(0x5D /* [ */)) {
125167 return true
125168 }
125169 // Unreachable since it threw "unterminated regular expression" error before.
125170 state.raise("Unterminated character class");
125171 }
125172 return false
125173 };
125174
125175 // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
125176 // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
125177 // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
125178 pp$8.regexp_classRanges = function(state) {
125179 while (this.regexp_eatClassAtom(state)) {
125180 var left = state.lastIntValue;
125181 if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
125182 var right = state.lastIntValue;
125183 if (state.switchU && (left === -1 || right === -1)) {
125184 state.raise("Invalid character class");
125185 }
125186 if (left !== -1 && right !== -1 && left > right) {
125187 state.raise("Range out of order in character class");
125188 }
125189 }
125190 }
125191 };
125192
125193 // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
125194 // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
125195 pp$8.regexp_eatClassAtom = function(state) {
125196 var start = state.pos;
125197
125198 if (state.eat(0x5C /* \ */)) {
125199 if (this.regexp_eatClassEscape(state)) {
125200 return true
125201 }
125202 if (state.switchU) {
125203 // Make the same message as V8.
125204 var ch$1 = state.current();
125205 if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
125206 state.raise("Invalid class escape");
125207 }
125208 state.raise("Invalid escape");
125209 }
125210 state.pos = start;
125211 }
125212
125213 var ch = state.current();
125214 if (ch !== 0x5D /* [ */) {
125215 state.lastIntValue = ch;
125216 state.advance();
125217 return true
125218 }
125219
125220 return false
125221 };
125222
125223 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
125224 pp$8.regexp_eatClassEscape = function(state) {
125225 var start = state.pos;
125226
125227 if (state.eat(0x62 /* b */)) {
125228 state.lastIntValue = 0x08; /* <BS> */
125229 return true
125230 }
125231
125232 if (state.switchU && state.eat(0x2D /* - */)) {
125233 state.lastIntValue = 0x2D; /* - */
125234 return true
125235 }
125236
125237 if (!state.switchU && state.eat(0x63 /* c */)) {
125238 if (this.regexp_eatClassControlLetter(state)) {
125239 return true
125240 }
125241 state.pos = start;
125242 }
125243
125244 return (
125245 this.regexp_eatCharacterClassEscape(state) ||
125246 this.regexp_eatCharacterEscape(state)
125247 )
125248 };
125249
125250 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
125251 pp$8.regexp_eatClassControlLetter = function(state) {
125252 var ch = state.current();
125253 if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
125254 state.lastIntValue = ch % 0x20;
125255 state.advance();
125256 return true
125257 }
125258 return false
125259 };
125260
125261 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
125262 pp$8.regexp_eatHexEscapeSequence = function(state) {
125263 var start = state.pos;
125264 if (state.eat(0x78 /* x */)) {
125265 if (this.regexp_eatFixedHexDigits(state, 2)) {
125266 return true
125267 }
125268 if (state.switchU) {
125269 state.raise("Invalid escape");
125270 }
125271 state.pos = start;
125272 }
125273 return false
125274 };
125275
125276 // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
125277 pp$8.regexp_eatDecimalDigits = function(state) {
125278 var start = state.pos;
125279 var ch = 0;
125280 state.lastIntValue = 0;
125281 while (isDecimalDigit(ch = state.current())) {
125282 state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
125283 state.advance();
125284 }
125285 return state.pos !== start
125286 };
125287 function isDecimalDigit(ch) {
125288 return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
125289 }
125290
125291 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
125292 pp$8.regexp_eatHexDigits = function(state) {
125293 var start = state.pos;
125294 var ch = 0;
125295 state.lastIntValue = 0;
125296 while (isHexDigit(ch = state.current())) {
125297 state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
125298 state.advance();
125299 }
125300 return state.pos !== start
125301 };
125302 function isHexDigit(ch) {
125303 return (
125304 (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
125305 (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
125306 (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
125307 )
125308 }
125309 function hexToInt(ch) {
125310 if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
125311 return 10 + (ch - 0x41 /* A */)
125312 }
125313 if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
125314 return 10 + (ch - 0x61 /* a */)
125315 }
125316 return ch - 0x30 /* 0 */
125317 }
125318
125319 // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
125320 // Allows only 0-377(octal) i.e. 0-255(decimal).
125321 pp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {
125322 if (this.regexp_eatOctalDigit(state)) {
125323 var n1 = state.lastIntValue;
125324 if (this.regexp_eatOctalDigit(state)) {
125325 var n2 = state.lastIntValue;
125326 if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
125327 state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
125328 } else {
125329 state.lastIntValue = n1 * 8 + n2;
125330 }
125331 } else {
125332 state.lastIntValue = n1;
125333 }
125334 return true
125335 }
125336 return false
125337 };
125338
125339 // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
125340 pp$8.regexp_eatOctalDigit = function(state) {
125341 var ch = state.current();
125342 if (isOctalDigit(ch)) {
125343 state.lastIntValue = ch - 0x30; /* 0 */
125344 state.advance();
125345 return true
125346 }
125347 state.lastIntValue = 0;
125348 return false
125349 };
125350 function isOctalDigit(ch) {
125351 return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
125352 }
125353
125354 // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
125355 // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
125356 // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
125357 pp$8.regexp_eatFixedHexDigits = function(state, length) {
125358 var start = state.pos;
125359 state.lastIntValue = 0;
125360 for (var i = 0; i < length; ++i) {
125361 var ch = state.current();
125362 if (!isHexDigit(ch)) {
125363 state.pos = start;
125364 return false
125365 }
125366 state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
125367 state.advance();
125368 }
125369 return true
125370 };
125371
125372 // Object type used to represent tokens. Note that normally, tokens
125373 // simply exist as properties on the parser object. This is only
125374 // used for the onToken callback and the external tokenizer.
125375
125376 var Token = function Token(p) {
125377 this.type = p.type;
125378 this.value = p.value;
125379 this.start = p.start;
125380 this.end = p.end;
125381 if (p.options.locations)
125382 { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
125383 if (p.options.ranges)
125384 { this.range = [p.start, p.end]; }
125385 };
125386
125387 // ## Tokenizer
125388
125389 var pp$9 = Parser.prototype;
125390
125391 // Move to the next token
125392
125393 pp$9.next = function() {
125394 if (this.options.onToken)
125395 { this.options.onToken(new Token(this)); }
125396
125397 this.lastTokEnd = this.end;
125398 this.lastTokStart = this.start;
125399 this.lastTokEndLoc = this.endLoc;
125400 this.lastTokStartLoc = this.startLoc;
125401 this.nextToken();
125402 };
125403
125404 pp$9.getToken = function() {
125405 this.next();
125406 return new Token(this)
125407 };
125408
125409 // If we're in an ES6 environment, make parsers iterable
125410 if (typeof Symbol !== "undefined")
125411 { pp$9[Symbol.iterator] = function() {
125412 var this$1 = this;
125413
125414 return {
125415 next: function () {
125416 var token = this$1.getToken();
125417 return {
125418 done: token.type === types.eof,
125419 value: token
125420 }
125421 }
125422 }
125423 }; }
125424
125425 // Toggle strict mode. Re-reads the next number or string to please
125426 // pedantic tests (`"use strict"; 010;` should fail).
125427
125428 pp$9.curContext = function() {
125429 return this.context[this.context.length - 1]
125430 };
125431
125432 // Read a single token, updating the parser object's token-related
125433 // properties.
125434
125435 pp$9.nextToken = function() {
125436 var curContext = this.curContext();
125437 if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
125438
125439 this.start = this.pos;
125440 if (this.options.locations) { this.startLoc = this.curPosition(); }
125441 if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
125442
125443 if (curContext.override) { return curContext.override(this) }
125444 else { this.readToken(this.fullCharCodeAtPos()); }
125445 };
125446
125447 pp$9.readToken = function(code) {
125448 // Identifier or keyword. '\uXXXX' sequences are allowed in
125449 // identifiers, so '\' also dispatches to that.
125450 if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
125451 { return this.readWord() }
125452
125453 return this.getTokenFromCode(code)
125454 };
125455
125456 pp$9.fullCharCodeAtPos = function() {
125457 var code = this.input.charCodeAt(this.pos);
125458 if (code <= 0xd7ff || code >= 0xe000) { return code }
125459 var next = this.input.charCodeAt(this.pos + 1);
125460 return (code << 10) + next - 0x35fdc00
125461 };
125462
125463 pp$9.skipBlockComment = function() {
125464 var startLoc = this.options.onComment && this.curPosition();
125465 var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
125466 if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
125467 this.pos = end + 2;
125468 if (this.options.locations) {
125469 lineBreakG.lastIndex = start;
125470 var match;
125471 while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
125472 ++this.curLine;
125473 this.lineStart = match.index + match[0].length;
125474 }
125475 }
125476 if (this.options.onComment)
125477 { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
125478 startLoc, this.curPosition()); }
125479 };
125480
125481 pp$9.skipLineComment = function(startSkip) {
125482 var start = this.pos;
125483 var startLoc = this.options.onComment && this.curPosition();
125484 var ch = this.input.charCodeAt(this.pos += startSkip);
125485 while (this.pos < this.input.length && !isNewLine(ch)) {
125486 ch = this.input.charCodeAt(++this.pos);
125487 }
125488 if (this.options.onComment)
125489 { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
125490 startLoc, this.curPosition()); }
125491 };
125492
125493 // Called at the start of the parse and after every token. Skips
125494 // whitespace and comments, and.
125495
125496 pp$9.skipSpace = function() {
125497 loop: while (this.pos < this.input.length) {
125498 var ch = this.input.charCodeAt(this.pos);
125499 switch (ch) {
125500 case 32: case 160: // ' '
125501 ++this.pos;
125502 break
125503 case 13:
125504 if (this.input.charCodeAt(this.pos + 1) === 10) {
125505 ++this.pos;
125506 }
125507 case 10: case 8232: case 8233:
125508 ++this.pos;
125509 if (this.options.locations) {
125510 ++this.curLine;
125511 this.lineStart = this.pos;
125512 }
125513 break
125514 case 47: // '/'
125515 switch (this.input.charCodeAt(this.pos + 1)) {
125516 case 42: // '*'
125517 this.skipBlockComment();
125518 break
125519 case 47:
125520 this.skipLineComment(2);
125521 break
125522 default:
125523 break loop
125524 }
125525 break
125526 default:
125527 if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
125528 ++this.pos;
125529 } else {
125530 break loop
125531 }
125532 }
125533 }
125534 };
125535
125536 // Called at the end of every token. Sets `end`, `val`, and
125537 // maintains `context` and `exprAllowed`, and skips the space after
125538 // the token, so that the next one's `start` will point at the
125539 // right position.
125540
125541 pp$9.finishToken = function(type, val) {
125542 this.end = this.pos;
125543 if (this.options.locations) { this.endLoc = this.curPosition(); }
125544 var prevType = this.type;
125545 this.type = type;
125546 this.value = val;
125547
125548 this.updateContext(prevType);
125549 };
125550
125551 // ### Token reading
125552
125553 // This is the function that is called to fetch the next token. It
125554 // is somewhat obscure, because it works in character codes rather
125555 // than characters, and because operator parsing has been inlined
125556 // into it.
125557 //
125558 // All in the name of speed.
125559 //
125560 pp$9.readToken_dot = function() {
125561 var next = this.input.charCodeAt(this.pos + 1);
125562 if (next >= 48 && next <= 57) { return this.readNumber(true) }
125563 var next2 = this.input.charCodeAt(this.pos + 2);
125564 if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
125565 this.pos += 3;
125566 return this.finishToken(types.ellipsis)
125567 } else {
125568 ++this.pos;
125569 return this.finishToken(types.dot)
125570 }
125571 };
125572
125573 pp$9.readToken_slash = function() { // '/'
125574 var next = this.input.charCodeAt(this.pos + 1);
125575 if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
125576 if (next === 61) { return this.finishOp(types.assign, 2) }
125577 return this.finishOp(types.slash, 1)
125578 };
125579
125580 pp$9.readToken_mult_modulo_exp = function(code) { // '%*'
125581 var next = this.input.charCodeAt(this.pos + 1);
125582 var size = 1;
125583 var tokentype = code === 42 ? types.star : types.modulo;
125584
125585 // exponentiation operator ** and **=
125586 if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
125587 ++size;
125588 tokentype = types.starstar;
125589 next = this.input.charCodeAt(this.pos + 2);
125590 }
125591
125592 if (next === 61) { return this.finishOp(types.assign, size + 1) }
125593 return this.finishOp(tokentype, size)
125594 };
125595
125596 pp$9.readToken_pipe_amp = function(code) { // '|&'
125597 var next = this.input.charCodeAt(this.pos + 1);
125598 if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }
125599 if (next === 61) { return this.finishOp(types.assign, 2) }
125600 return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
125601 };
125602
125603 pp$9.readToken_caret = function() { // '^'
125604 var next = this.input.charCodeAt(this.pos + 1);
125605 if (next === 61) { return this.finishOp(types.assign, 2) }
125606 return this.finishOp(types.bitwiseXOR, 1)
125607 };
125608
125609 pp$9.readToken_plus_min = function(code) { // '+-'
125610 var next = this.input.charCodeAt(this.pos + 1);
125611 if (next === code) {
125612 if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
125613 (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
125614 // A `-->` line comment
125615 this.skipLineComment(3);
125616 this.skipSpace();
125617 return this.nextToken()
125618 }
125619 return this.finishOp(types.incDec, 2)
125620 }
125621 if (next === 61) { return this.finishOp(types.assign, 2) }
125622 return this.finishOp(types.plusMin, 1)
125623 };
125624
125625 pp$9.readToken_lt_gt = function(code) { // '<>'
125626 var next = this.input.charCodeAt(this.pos + 1);
125627 var size = 1;
125628 if (next === code) {
125629 size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
125630 if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
125631 return this.finishOp(types.bitShift, size)
125632 }
125633 if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
125634 this.input.charCodeAt(this.pos + 3) === 45) {
125635 // `<!--`, an XML-style comment that should be interpreted as a line comment
125636 this.skipLineComment(4);
125637 this.skipSpace();
125638 return this.nextToken()
125639 }
125640 if (next === 61) { size = 2; }
125641 return this.finishOp(types.relational, size)
125642 };
125643
125644 pp$9.readToken_eq_excl = function(code) { // '=!'
125645 var next = this.input.charCodeAt(this.pos + 1);
125646 if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
125647 if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
125648 this.pos += 2;
125649 return this.finishToken(types.arrow)
125650 }
125651 return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
125652 };
125653
125654 pp$9.getTokenFromCode = function(code) {
125655 switch (code) {
125656 // The interpretation of a dot depends on whether it is followed
125657 // by a digit or another two dots.
125658 case 46: // '.'
125659 return this.readToken_dot()
125660
125661 // Punctuation tokens.
125662 case 40: ++this.pos; return this.finishToken(types.parenL)
125663 case 41: ++this.pos; return this.finishToken(types.parenR)
125664 case 59: ++this.pos; return this.finishToken(types.semi)
125665 case 44: ++this.pos; return this.finishToken(types.comma)
125666 case 91: ++this.pos; return this.finishToken(types.bracketL)
125667 case 93: ++this.pos; return this.finishToken(types.bracketR)
125668 case 123: ++this.pos; return this.finishToken(types.braceL)
125669 case 125: ++this.pos; return this.finishToken(types.braceR)
125670 case 58: ++this.pos; return this.finishToken(types.colon)
125671 case 63: ++this.pos; return this.finishToken(types.question)
125672
125673 case 96: // '`'
125674 if (this.options.ecmaVersion < 6) { break }
125675 ++this.pos;
125676 return this.finishToken(types.backQuote)
125677
125678 case 48: // '0'
125679 var next = this.input.charCodeAt(this.pos + 1);
125680 if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number
125681 if (this.options.ecmaVersion >= 6) {
125682 if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number
125683 if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number
125684 }
125685
125686 // Anything else beginning with a digit is an integer, octal
125687 // number, or float.
125688 case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
125689 return this.readNumber(false)
125690
125691 // Quotes produce strings.
125692 case 34: case 39: // '"', "'"
125693 return this.readString(code)
125694
125695 // Operators are parsed inline in tiny state machines. '=' (61) is
125696 // often referred to. `finishOp` simply skips the amount of
125697 // characters it is given as second argument, and returns a token
125698 // of the type given by its first argument.
125699
125700 case 47: // '/'
125701 return this.readToken_slash()
125702
125703 case 37: case 42: // '%*'
125704 return this.readToken_mult_modulo_exp(code)
125705
125706 case 124: case 38: // '|&'
125707 return this.readToken_pipe_amp(code)
125708
125709 case 94: // '^'
125710 return this.readToken_caret()
125711
125712 case 43: case 45: // '+-'
125713 return this.readToken_plus_min(code)
125714
125715 case 60: case 62: // '<>'
125716 return this.readToken_lt_gt(code)
125717
125718 case 61: case 33: // '=!'
125719 return this.readToken_eq_excl(code)
125720
125721 case 126: // '~'
125722 return this.finishOp(types.prefix, 1)
125723 }
125724
125725 this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
125726 };
125727
125728 pp$9.finishOp = function(type, size) {
125729 var str = this.input.slice(this.pos, this.pos + size);
125730 this.pos += size;
125731 return this.finishToken(type, str)
125732 };
125733
125734 pp$9.readRegexp = function() {
125735 var escaped, inClass, start = this.pos;
125736 for (;;) {
125737 if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
125738 var ch = this.input.charAt(this.pos);
125739 if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); }
125740 if (!escaped) {
125741 if (ch === "[") { inClass = true; }
125742 else if (ch === "]" && inClass) { inClass = false; }
125743 else if (ch === "/" && !inClass) { break }
125744 escaped = ch === "\\";
125745 } else { escaped = false; }
125746 ++this.pos;
125747 }
125748 var pattern = this.input.slice(start, this.pos);
125749 ++this.pos;
125750 var flagsStart = this.pos;
125751 var flags = this.readWord1();
125752 if (this.containsEsc) { this.unexpected(flagsStart); }
125753
125754 // Validate pattern
125755 var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
125756 state.reset(start, pattern, flags);
125757 this.validateRegExpFlags(state);
125758 this.validateRegExpPattern(state);
125759
125760 // Create Literal#value property value.
125761 var value = null;
125762 try {
125763 value = new RegExp(pattern, flags);
125764 } catch (e) {
125765 // ESTree requires null if it failed to instantiate RegExp object.
125766 // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
125767 }
125768
125769 return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
125770 };
125771
125772 // Read an integer in the given radix. Return null if zero digits
125773 // were read, the integer value otherwise. When `len` is given, this
125774 // will return `null` unless the integer has exactly `len` digits.
125775
125776 pp$9.readInt = function(radix, len) {
125777 var start = this.pos, total = 0;
125778 for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
125779 var code = this.input.charCodeAt(this.pos), val = (void 0);
125780 if (code >= 97) { val = code - 97 + 10; } // a
125781 else if (code >= 65) { val = code - 65 + 10; } // A
125782 else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9
125783 else { val = Infinity; }
125784 if (val >= radix) { break }
125785 ++this.pos;
125786 total = total * radix + val;
125787 }
125788 if (this.pos === start || len != null && this.pos - start !== len) { return null }
125789
125790 return total
125791 };
125792
125793 pp$9.readRadixNumber = function(radix) {
125794 var start = this.pos;
125795 this.pos += 2; // 0x
125796 var val = this.readInt(radix);
125797 if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); }
125798 if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
125799 val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null;
125800 ++this.pos;
125801 } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
125802 return this.finishToken(types.num, val)
125803 };
125804
125805 // Read an integer, octal integer, or floating-point number.
125806
125807 pp$9.readNumber = function(startsWithDot) {
125808 var start = this.pos;
125809 if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); }
125810 var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
125811 if (octal && this.strict) { this.raise(start, "Invalid number"); }
125812 if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
125813 var next = this.input.charCodeAt(this.pos);
125814 if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
125815 var str$1 = this.input.slice(start, this.pos);
125816 var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null;
125817 ++this.pos;
125818 if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
125819 return this.finishToken(types.num, val$1)
125820 }
125821 if (next === 46 && !octal) { // '.'
125822 ++this.pos;
125823 this.readInt(10);
125824 next = this.input.charCodeAt(this.pos);
125825 }
125826 if ((next === 69 || next === 101) && !octal) { // 'eE'
125827 next = this.input.charCodeAt(++this.pos);
125828 if (next === 43 || next === 45) { ++this.pos; } // '+-'
125829 if (this.readInt(10) === null) { this.raise(start, "Invalid number"); }
125830 }
125831 if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
125832
125833 var str = this.input.slice(start, this.pos);
125834 var val = octal ? parseInt(str, 8) : parseFloat(str);
125835 return this.finishToken(types.num, val)
125836 };
125837
125838 // Read a string value, interpreting backslash-escapes.
125839
125840 pp$9.readCodePoint = function() {
125841 var ch = this.input.charCodeAt(this.pos), code;
125842
125843 if (ch === 123) { // '{'
125844 if (this.options.ecmaVersion < 6) { this.unexpected(); }
125845 var codePos = ++this.pos;
125846 code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
125847 ++this.pos;
125848 if (code > 0x10FFFF) { this.invalidStringToken(codePos, "Code point out of bounds"); }
125849 } else {
125850 code = this.readHexChar(4);
125851 }
125852 return code
125853 };
125854
125855 function codePointToString$1(code) {
125856 // UTF-16 Decoding
125857 if (code <= 0xFFFF) { return String.fromCharCode(code) }
125858 code -= 0x10000;
125859 return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
125860 }
125861
125862 pp$9.readString = function(quote) {
125863 var out = "", chunkStart = ++this.pos;
125864 for (;;) {
125865 if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
125866 var ch = this.input.charCodeAt(this.pos);
125867 if (ch === quote) { break }
125868 if (ch === 92) { // '\'
125869 out += this.input.slice(chunkStart, this.pos);
125870 out += this.readEscapedChar(false);
125871 chunkStart = this.pos;
125872 } else {
125873 if (isNewLine(ch, this.options.ecmaVersion >= 10)) { this.raise(this.start, "Unterminated string constant"); }
125874 ++this.pos;
125875 }
125876 }
125877 out += this.input.slice(chunkStart, this.pos++);
125878 return this.finishToken(types.string, out)
125879 };
125880
125881 // Reads template string tokens.
125882
125883 var INVALID_TEMPLATE_ESCAPE_ERROR = {};
125884
125885 pp$9.tryReadTemplateToken = function() {
125886 this.inTemplateElement = true;
125887 try {
125888 this.readTmplToken();
125889 } catch (err) {
125890 if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
125891 this.readInvalidTemplateToken();
125892 } else {
125893 throw err
125894 }
125895 }
125896
125897 this.inTemplateElement = false;
125898 };
125899
125900 pp$9.invalidStringToken = function(position, message) {
125901 if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
125902 throw INVALID_TEMPLATE_ESCAPE_ERROR
125903 } else {
125904 this.raise(position, message);
125905 }
125906 };
125907
125908 pp$9.readTmplToken = function() {
125909 var out = "", chunkStart = this.pos;
125910 for (;;) {
125911 if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
125912 var ch = this.input.charCodeAt(this.pos);
125913 if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
125914 if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
125915 if (ch === 36) {
125916 this.pos += 2;
125917 return this.finishToken(types.dollarBraceL)
125918 } else {
125919 ++this.pos;
125920 return this.finishToken(types.backQuote)
125921 }
125922 }
125923 out += this.input.slice(chunkStart, this.pos);
125924 return this.finishToken(types.template, out)
125925 }
125926 if (ch === 92) { // '\'
125927 out += this.input.slice(chunkStart, this.pos);
125928 out += this.readEscapedChar(true);
125929 chunkStart = this.pos;
125930 } else if (isNewLine(ch)) {
125931 out += this.input.slice(chunkStart, this.pos);
125932 ++this.pos;
125933 switch (ch) {
125934 case 13:
125935 if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }
125936 case 10:
125937 out += "\n";
125938 break
125939 default:
125940 out += String.fromCharCode(ch);
125941 break
125942 }
125943 if (this.options.locations) {
125944 ++this.curLine;
125945 this.lineStart = this.pos;
125946 }
125947 chunkStart = this.pos;
125948 } else {
125949 ++this.pos;
125950 }
125951 }
125952 };
125953
125954 // Reads a template token to search for the end, without validating any escape sequences
125955 pp$9.readInvalidTemplateToken = function() {
125956 for (; this.pos < this.input.length; this.pos++) {
125957 switch (this.input[this.pos]) {
125958 case "\\":
125959 ++this.pos;
125960 break
125961
125962 case "$":
125963 if (this.input[this.pos + 1] !== "{") {
125964 break
125965 }
125966 // falls through
125967
125968 case "`":
125969 return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
125970
125971 // no default
125972 }
125973 }
125974 this.raise(this.start, "Unterminated template");
125975 };
125976
125977 // Used to read escaped characters
125978
125979 pp$9.readEscapedChar = function(inTemplate) {
125980 var ch = this.input.charCodeAt(++this.pos);
125981 ++this.pos;
125982 switch (ch) {
125983 case 110: return "\n" // 'n' -> '\n'
125984 case 114: return "\r" // 'r' -> '\r'
125985 case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
125986 case 117: return codePointToString$1(this.readCodePoint()) // 'u'
125987 case 116: return "\t" // 't' -> '\t'
125988 case 98: return "\b" // 'b' -> '\b'
125989 case 118: return "\u000b" // 'v' -> '\u000b'
125990 case 102: return "\f" // 'f' -> '\f'
125991 case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\r\n'
125992 case 10: // ' \n'
125993 if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
125994 return ""
125995 default:
125996 if (ch >= 48 && ch <= 55) {
125997 var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
125998 var octal = parseInt(octalStr, 8);
125999 if (octal > 255) {
126000 octalStr = octalStr.slice(0, -1);
126001 octal = parseInt(octalStr, 8);
126002 }
126003 this.pos += octalStr.length - 1;
126004 ch = this.input.charCodeAt(this.pos);
126005 if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
126006 this.invalidStringToken(
126007 this.pos - 1 - octalStr.length,
126008 inTemplate
126009 ? "Octal literal in template string"
126010 : "Octal literal in strict mode"
126011 );
126012 }
126013 return String.fromCharCode(octal)
126014 }
126015 if (isNewLine(ch)) {
126016 // Unicode new line characters after \ get removed from output in both
126017 // template literals and strings
126018 return ""
126019 }
126020 return String.fromCharCode(ch)
126021 }
126022 };
126023
126024 // Used to read character escape sequences ('\x', '\u', '\U').
126025
126026 pp$9.readHexChar = function(len) {
126027 var codePos = this.pos;
126028 var n = this.readInt(16, len);
126029 if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
126030 return n
126031 };
126032
126033 // Read an identifier, and return it as a string. Sets `this.containsEsc`
126034 // to whether the word contained a '\u' escape.
126035 //
126036 // Incrementally adds only escaped chars, adding other chunks as-is
126037 // as a micro-optimization.
126038
126039 pp$9.readWord1 = function() {
126040 this.containsEsc = false;
126041 var word = "", first = true, chunkStart = this.pos;
126042 var astral = this.options.ecmaVersion >= 6;
126043 while (this.pos < this.input.length) {
126044 var ch = this.fullCharCodeAtPos();
126045 if (isIdentifierChar(ch, astral)) {
126046 this.pos += ch <= 0xffff ? 1 : 2;
126047 } else if (ch === 92) { // "\"
126048 this.containsEsc = true;
126049 word += this.input.slice(chunkStart, this.pos);
126050 var escStart = this.pos;
126051 if (this.input.charCodeAt(++this.pos) !== 117) // "u"
126052 { this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); }
126053 ++this.pos;
126054 var esc = this.readCodePoint();
126055 if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
126056 { this.invalidStringToken(escStart, "Invalid Unicode escape"); }
126057 word += codePointToString$1(esc);
126058 chunkStart = this.pos;
126059 } else {
126060 break
126061 }
126062 first = false;
126063 }
126064 return word + this.input.slice(chunkStart, this.pos)
126065 };
126066
126067 // Read an identifier or keyword token. Will check for reserved
126068 // words when necessary.
126069
126070 pp$9.readWord = function() {
126071 var word = this.readWord1();
126072 var type = types.name;
126073 if (this.keywords.test(word)) {
126074 if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + word); }
126075 type = keywords$1[word];
126076 }
126077 return this.finishToken(type, word)
126078 };
126079
126080 // Acorn is a tiny, fast JavaScript parser written in JavaScript.
126081
126082 var version = "6.4.0";
126083
126084 Parser.acorn = {
126085 Parser: Parser,
126086 version: version,
126087 defaultOptions: defaultOptions,
126088 Position: Position,
126089 SourceLocation: SourceLocation,
126090 getLineInfo: getLineInfo,
126091 Node: Node,
126092 TokenType: TokenType,
126093 tokTypes: types,
126094 keywordTypes: keywords$1,
126095 TokContext: TokContext,
126096 tokContexts: types$1,
126097 isIdentifierChar: isIdentifierChar,
126098 isIdentifierStart: isIdentifierStart,
126099 Token: Token,
126100 isNewLine: isNewLine,
126101 lineBreak: lineBreak,
126102 lineBreakG: lineBreakG,
126103 nonASCIIwhitespace: nonASCIIwhitespace
126104 };
126105
126106 // The main exported interface (under `self.acorn` when in the
126107 // browser) is a `parse` function that takes a code string and
126108 // returns an abstract syntax tree as specified by [Mozilla parser
126109 // API][api].
126110 //
126111 // [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
126112
126113 function parse(input, options) {
126114 return Parser.parse(input, options)
126115 }
126116
126117 // This function tries to parse a single expression at a given
126118 // offset in a string. Useful for parsing mixed-language formats
126119 // that embed JavaScript expressions.
126120
126121 function parseExpressionAt(input, pos, options) {
126122 return Parser.parseExpressionAt(input, pos, options)
126123 }
126124
126125 // Acorn is organized as a tokenizer and a recursive-descent parser.
126126 // The `tokenizer` export provides an interface to the tokenizer.
126127
126128 function tokenizer(input, options) {
126129 return Parser.tokenizer(input, options)
126130 }
126131
126132 exports.Node = Node;
126133 exports.Parser = Parser;
126134 exports.Position = Position;
126135 exports.SourceLocation = SourceLocation;
126136 exports.TokContext = TokContext;
126137 exports.Token = Token;
126138 exports.TokenType = TokenType;
126139 exports.defaultOptions = defaultOptions;
126140 exports.getLineInfo = getLineInfo;
126141 exports.isIdentifierChar = isIdentifierChar;
126142 exports.isIdentifierStart = isIdentifierStart;
126143 exports.isNewLine = isNewLine;
126144 exports.keywordTypes = keywords$1;
126145 exports.lineBreak = lineBreak;
126146 exports.lineBreakG = lineBreakG;
126147 exports.nonASCIIwhitespace = nonASCIIwhitespace;
126148 exports.parse = parse;
126149 exports.parseExpressionAt = parseExpressionAt;
126150 exports.tokContexts = types$1;
126151 exports.tokTypes = types;
126152 exports.tokenizer = tokenizer;
126153 exports.version = version;
126154
126155 Object.defineProperty(exports, '__esModule', { value: true });
126156
126157}));
126158
126159
126160/***/ }),
126161
126162/***/ 97865:
126163/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
126164
126165"use strict";
126166/*
126167 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
126168
126169 Redistribution and use in source and binary forms, with or without
126170 modification, are permitted provided that the following conditions are met:
126171
126172 * Redistributions of source code must retain the above copyright
126173 notice, this list of conditions and the following disclaimer.
126174 * Redistributions in binary form must reproduce the above copyright
126175 notice, this list of conditions and the following disclaimer in the
126176 documentation and/or other materials provided with the distribution.
126177
126178 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126179 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126180 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126181 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
126182 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126183 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
126184 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
126185 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126186 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126187 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126188*/
126189
126190
126191const Variable = __webpack_require__(48113);
126192
126193/**
126194 * @class Definition
126195 */
126196class Definition {
126197 constructor(type, name, node, parent, index, kind) {
126198
126199 /**
126200 * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
126201 */
126202 this.type = type;
126203
126204 /**
126205 * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence.
126206 */
126207 this.name = name;
126208
126209 /**
126210 * @member {espree.Node} Definition#node - the enclosing node of the identifier.
126211 */
126212 this.node = node;
126213
126214 /**
126215 * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier.
126216 */
126217 this.parent = parent;
126218
126219 /**
126220 * @member {Number?} Definition#index - the index in the declaration statement.
126221 */
126222 this.index = index;
126223
126224 /**
126225 * @member {String?} Definition#kind - the kind of the declaration statement.
126226 */
126227 this.kind = kind;
126228 }
126229}
126230
126231/**
126232 * @class ParameterDefinition
126233 */
126234class ParameterDefinition extends Definition {
126235 constructor(name, node, index, rest) {
126236 super(Variable.Parameter, name, node, null, index, null);
126237
126238 /**
126239 * Whether the parameter definition is a part of a rest parameter.
126240 * @member {boolean} ParameterDefinition#rest
126241 */
126242 this.rest = rest;
126243 }
126244}
126245
126246module.exports = {
126247 ParameterDefinition,
126248 Definition
126249};
126250
126251/* vim: set sw=4 ts=4 et tw=80 : */
126252
126253
126254/***/ }),
126255
126256/***/ 41632:
126257/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
126258
126259"use strict";
126260/*
126261 Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
126262 Copyright (C) 2013 Alex Seville <hi@alexanderseville.com>
126263 Copyright (C) 2014 Thiago de Arruda <tpadilha84@gmail.com>
126264
126265 Redistribution and use in source and binary forms, with or without
126266 modification, are permitted provided that the following conditions are met:
126267
126268 * Redistributions of source code must retain the above copyright
126269 notice, this list of conditions and the following disclaimer.
126270 * Redistributions in binary form must reproduce the above copyright
126271 notice, this list of conditions and the following disclaimer in the
126272 documentation and/or other materials provided with the distribution.
126273
126274 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126275 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126276 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126277 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
126278 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126279 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
126280 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
126281 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126282 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126283 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126284*/
126285
126286/**
126287 * Escope (<a href="http://github.com/estools/escope">escope</a>) is an <a
126288 * href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript</a>
126289 * scope analyzer extracted from the <a
126290 * href="http://github.com/estools/esmangle">esmangle project</a/>.
126291 * <p>
126292 * <em>escope</em> finds lexical scopes in a source program, i.e. areas of that
126293 * program where different occurrences of the same identifier refer to the same
126294 * variable. With each scope the contained variables are collected, and each
126295 * identifier reference in code is linked to its corresponding variable (if
126296 * possible).
126297 * <p>
126298 * <em>escope</em> works on a syntax tree of the parsed source code which has
126299 * to adhere to the <a
126300 * href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API">
126301 * Mozilla Parser API</a>. E.g. <a href="https://github.com/eslint/espree">espree</a> is a parser
126302 * that produces such syntax trees.
126303 * <p>
126304 * The main interface is the {@link analyze} function.
126305 * @module escope
126306 */
126307
126308
126309/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */
126310
126311const assert = __webpack_require__(42357);
126312
126313const ScopeManager = __webpack_require__(13890);
126314const Referencer = __webpack_require__(89937);
126315const Reference = __webpack_require__(9922);
126316const Variable = __webpack_require__(48113);
126317const Scope = __webpack_require__(7816).Scope;
126318const version = __webpack_require__(11335)/* .version */ .i8;
126319
126320/**
126321 * Set the default options
126322 * @returns {Object} options
126323 */
126324function defaultOptions() {
126325 return {
126326 optimistic: false,
126327 directive: false,
126328 nodejsScope: false,
126329 impliedStrict: false,
126330 sourceType: "script", // one of ['script', 'module']
126331 ecmaVersion: 5,
126332 childVisitorKeys: null,
126333 fallback: "iteration"
126334 };
126335}
126336
126337/**
126338 * Preform deep update on option object
126339 * @param {Object} target - Options
126340 * @param {Object} override - Updates
126341 * @returns {Object} Updated options
126342 */
126343function updateDeeply(target, override) {
126344
126345 /**
126346 * Is hash object
126347 * @param {Object} value - Test value
126348 * @returns {boolean} Result
126349 */
126350 function isHashObject(value) {
126351 return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp);
126352 }
126353
126354 for (const key in override) {
126355 if (override.hasOwnProperty(key)) {
126356 const val = override[key];
126357
126358 if (isHashObject(val)) {
126359 if (isHashObject(target[key])) {
126360 updateDeeply(target[key], val);
126361 } else {
126362 target[key] = updateDeeply({}, val);
126363 }
126364 } else {
126365 target[key] = val;
126366 }
126367 }
126368 }
126369 return target;
126370}
126371
126372/**
126373 * Main interface function. Takes an Espree syntax tree and returns the
126374 * analyzed scopes.
126375 * @function analyze
126376 * @param {espree.Tree} tree - Abstract Syntax Tree
126377 * @param {Object} providedOptions - Options that tailor the scope analysis
126378 * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag
126379 * @param {boolean} [providedOptions.directive=false]- the directive flag
126380 * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls
126381 * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole
126382 * script is executed under node.js environment. When enabled, escope adds
126383 * a function scope immediately following the global scope.
126384 * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode
126385 * (if ecmaVersion >= 5).
126386 * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module'
126387 * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered
126388 * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
126389 * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
126390 * @returns {ScopeManager} ScopeManager
126391 */
126392function analyze(tree, providedOptions) {
126393 const options = updateDeeply(defaultOptions(), providedOptions);
126394 const scopeManager = new ScopeManager(options);
126395 const referencer = new Referencer(options, scopeManager);
126396
126397 referencer.visit(tree);
126398
126399 assert(scopeManager.__currentScope === null, "currentScope should be null.");
126400
126401 return scopeManager;
126402}
126403
126404module.exports = {
126405
126406 /** @name module:escope.version */
126407 version,
126408
126409 /** @name module:escope.Reference */
126410 Reference,
126411
126412 /** @name module:escope.Variable */
126413 Variable,
126414
126415 /** @name module:escope.Scope */
126416 Scope,
126417
126418 /** @name module:escope.ScopeManager */
126419 ScopeManager,
126420 analyze
126421};
126422
126423
126424/* vim: set sw=4 ts=4 et tw=80 : */
126425
126426
126427/***/ }),
126428
126429/***/ 30878:
126430/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
126431
126432"use strict";
126433/*
126434 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
126435
126436 Redistribution and use in source and binary forms, with or without
126437 modification, are permitted provided that the following conditions are met:
126438
126439 * Redistributions of source code must retain the above copyright
126440 notice, this list of conditions and the following disclaimer.
126441 * Redistributions in binary form must reproduce the above copyright
126442 notice, this list of conditions and the following disclaimer in the
126443 documentation and/or other materials provided with the distribution.
126444
126445 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126446 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126447 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126448 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
126449 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126450 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
126451 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
126452 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126453 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126454 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126455*/
126456
126457
126458/* eslint-disable no-undefined */
126459
126460const Syntax = __webpack_require__(40379).Syntax;
126461const esrecurse = __webpack_require__(64352);
126462
126463/**
126464 * Get last array element
126465 * @param {array} xs - array
126466 * @returns {any} Last elment
126467 */
126468function getLast(xs) {
126469 return xs[xs.length - 1] || null;
126470}
126471
126472class PatternVisitor extends esrecurse.Visitor {
126473 static isPattern(node) {
126474 const nodeType = node.type;
126475
126476 return (
126477 nodeType === Syntax.Identifier ||
126478 nodeType === Syntax.ObjectPattern ||
126479 nodeType === Syntax.ArrayPattern ||
126480 nodeType === Syntax.SpreadElement ||
126481 nodeType === Syntax.RestElement ||
126482 nodeType === Syntax.AssignmentPattern
126483 );
126484 }
126485
126486 constructor(options, rootPattern, callback) {
126487 super(null, options);
126488 this.rootPattern = rootPattern;
126489 this.callback = callback;
126490 this.assignments = [];
126491 this.rightHandNodes = [];
126492 this.restElements = [];
126493 }
126494
126495 Identifier(pattern) {
126496 const lastRestElement = getLast(this.restElements);
126497
126498 this.callback(pattern, {
126499 topLevel: pattern === this.rootPattern,
126500 rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern,
126501 assignments: this.assignments
126502 });
126503 }
126504
126505 Property(property) {
126506
126507 // Computed property's key is a right hand node.
126508 if (property.computed) {
126509 this.rightHandNodes.push(property.key);
126510 }
126511
126512 // If it's shorthand, its key is same as its value.
126513 // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern).
126514 // If it's not shorthand, the name of new variable is its value's.
126515 this.visit(property.value);
126516 }
126517
126518 ArrayPattern(pattern) {
126519 for (let i = 0, iz = pattern.elements.length; i < iz; ++i) {
126520 const element = pattern.elements[i];
126521
126522 this.visit(element);
126523 }
126524 }
126525
126526 AssignmentPattern(pattern) {
126527 this.assignments.push(pattern);
126528 this.visit(pattern.left);
126529 this.rightHandNodes.push(pattern.right);
126530 this.assignments.pop();
126531 }
126532
126533 RestElement(pattern) {
126534 this.restElements.push(pattern);
126535 this.visit(pattern.argument);
126536 this.restElements.pop();
126537 }
126538
126539 MemberExpression(node) {
126540
126541 // Computed property's key is a right hand node.
126542 if (node.computed) {
126543 this.rightHandNodes.push(node.property);
126544 }
126545
126546 // the object is only read, write to its property.
126547 this.rightHandNodes.push(node.object);
126548 }
126549
126550 //
126551 // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
126552 // By spec, LeftHandSideExpression is Pattern or MemberExpression.
126553 // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
126554 // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc...
126555 //
126556
126557 SpreadElement(node) {
126558 this.visit(node.argument);
126559 }
126560
126561 ArrayExpression(node) {
126562 node.elements.forEach(this.visit, this);
126563 }
126564
126565 AssignmentExpression(node) {
126566 this.assignments.push(node);
126567 this.visit(node.left);
126568 this.rightHandNodes.push(node.right);
126569 this.assignments.pop();
126570 }
126571
126572 CallExpression(node) {
126573
126574 // arguments are right hand nodes.
126575 node.arguments.forEach(a => {
126576 this.rightHandNodes.push(a);
126577 });
126578 this.visit(node.callee);
126579 }
126580}
126581
126582module.exports = PatternVisitor;
126583
126584/* vim: set sw=4 ts=4 et tw=80 : */
126585
126586
126587/***/ }),
126588
126589/***/ 9922:
126590/***/ (function(module) {
126591
126592"use strict";
126593/*
126594 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
126595
126596 Redistribution and use in source and binary forms, with or without
126597 modification, are permitted provided that the following conditions are met:
126598
126599 * Redistributions of source code must retain the above copyright
126600 notice, this list of conditions and the following disclaimer.
126601 * Redistributions in binary form must reproduce the above copyright
126602 notice, this list of conditions and the following disclaimer in the
126603 documentation and/or other materials provided with the distribution.
126604
126605 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126606 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126607 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126608 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
126609 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126610 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
126611 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
126612 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126613 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126614 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126615*/
126616
126617
126618const READ = 0x1;
126619const WRITE = 0x2;
126620const RW = READ | WRITE;
126621
126622/**
126623 * A Reference represents a single occurrence of an identifier in code.
126624 * @class Reference
126625 */
126626class Reference {
126627 constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) {
126628
126629 /**
126630 * Identifier syntax node.
126631 * @member {espreeIdentifier} Reference#identifier
126632 */
126633 this.identifier = ident;
126634
126635 /**
126636 * Reference to the enclosing Scope.
126637 * @member {Scope} Reference#from
126638 */
126639 this.from = scope;
126640
126641 /**
126642 * Whether the reference comes from a dynamic scope (such as 'eval',
126643 * 'with', etc.), and may be trapped by dynamic scopes.
126644 * @member {boolean} Reference#tainted
126645 */
126646 this.tainted = false;
126647
126648 /**
126649 * The variable this reference is resolved with.
126650 * @member {Variable} Reference#resolved
126651 */
126652 this.resolved = null;
126653
126654 /**
126655 * The read-write mode of the reference. (Value is one of {@link
126656 * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}).
126657 * @member {number} Reference#flag
126658 * @private
126659 */
126660 this.flag = flag;
126661 if (this.isWrite()) {
126662
126663 /**
126664 * If reference is writeable, this is the tree being written to it.
126665 * @member {espreeNode} Reference#writeExpr
126666 */
126667 this.writeExpr = writeExpr;
126668
126669 /**
126670 * Whether the Reference might refer to a partial value of writeExpr.
126671 * @member {boolean} Reference#partial
126672 */
126673 this.partial = partial;
126674
126675 /**
126676 * Whether the Reference is to write of initialization.
126677 * @member {boolean} Reference#init
126678 */
126679 this.init = init;
126680 }
126681 this.__maybeImplicitGlobal = maybeImplicitGlobal;
126682 }
126683
126684 /**
126685 * Whether the reference is static.
126686 * @method Reference#isStatic
126687 * @returns {boolean} static
126688 */
126689 isStatic() {
126690 return !this.tainted && this.resolved && this.resolved.scope.isStatic();
126691 }
126692
126693 /**
126694 * Whether the reference is writeable.
126695 * @method Reference#isWrite
126696 * @returns {boolean} write
126697 */
126698 isWrite() {
126699 return !!(this.flag & Reference.WRITE);
126700 }
126701
126702 /**
126703 * Whether the reference is readable.
126704 * @method Reference#isRead
126705 * @returns {boolean} read
126706 */
126707 isRead() {
126708 return !!(this.flag & Reference.READ);
126709 }
126710
126711 /**
126712 * Whether the reference is read-only.
126713 * @method Reference#isReadOnly
126714 * @returns {boolean} read only
126715 */
126716 isReadOnly() {
126717 return this.flag === Reference.READ;
126718 }
126719
126720 /**
126721 * Whether the reference is write-only.
126722 * @method Reference#isWriteOnly
126723 * @returns {boolean} write only
126724 */
126725 isWriteOnly() {
126726 return this.flag === Reference.WRITE;
126727 }
126728
126729 /**
126730 * Whether the reference is read-write.
126731 * @method Reference#isReadWrite
126732 * @returns {boolean} read write
126733 */
126734 isReadWrite() {
126735 return this.flag === Reference.RW;
126736 }
126737}
126738
126739/**
126740 * @constant Reference.READ
126741 * @private
126742 */
126743Reference.READ = READ;
126744
126745/**
126746 * @constant Reference.WRITE
126747 * @private
126748 */
126749Reference.WRITE = WRITE;
126750
126751/**
126752 * @constant Reference.RW
126753 * @private
126754 */
126755Reference.RW = RW;
126756
126757module.exports = Reference;
126758
126759/* vim: set sw=4 ts=4 et tw=80 : */
126760
126761
126762/***/ }),
126763
126764/***/ 89937:
126765/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
126766
126767"use strict";
126768/*
126769 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
126770
126771 Redistribution and use in source and binary forms, with or without
126772 modification, are permitted provided that the following conditions are met:
126773
126774 * Redistributions of source code must retain the above copyright
126775 notice, this list of conditions and the following disclaimer.
126776 * Redistributions in binary form must reproduce the above copyright
126777 notice, this list of conditions and the following disclaimer in the
126778 documentation and/or other materials provided with the distribution.
126779
126780 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126781 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
126782 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126783 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
126784 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126785 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
126786 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
126787 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126788 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
126789 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126790*/
126791
126792
126793/* eslint-disable no-underscore-dangle */
126794/* eslint-disable no-undefined */
126795
126796const Syntax = __webpack_require__(40379).Syntax;
126797const esrecurse = __webpack_require__(64352);
126798const Reference = __webpack_require__(9922);
126799const Variable = __webpack_require__(48113);
126800const PatternVisitor = __webpack_require__(30878);
126801const definition = __webpack_require__(97865);
126802const assert = __webpack_require__(42357);
126803
126804const ParameterDefinition = definition.ParameterDefinition;
126805const Definition = definition.Definition;
126806
126807/**
126808 * Traverse identifier in pattern
126809 * @param {Object} options - options
126810 * @param {pattern} rootPattern - root pattern
126811 * @param {Refencer} referencer - referencer
126812 * @param {callback} callback - callback
126813 * @returns {void}
126814 */
126815function traverseIdentifierInPattern(options, rootPattern, referencer, callback) {
126816
126817 // Call the callback at left hand identifier nodes, and Collect right hand nodes.
126818 const visitor = new PatternVisitor(options, rootPattern, callback);
126819
126820 visitor.visit(rootPattern);
126821
126822 // Process the right hand nodes recursively.
126823 if (referencer !== null && referencer !== undefined) {
126824 visitor.rightHandNodes.forEach(referencer.visit, referencer);
126825 }
126826}
126827
126828// Importing ImportDeclaration.
126829// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation
126830// https://github.com/estree/estree/blob/master/es6.md#importdeclaration
126831// FIXME: Now, we don't create module environment, because the context is
126832// implementation dependent.
126833
126834class Importer extends esrecurse.Visitor {
126835 constructor(declaration, referencer) {
126836 super(null, referencer.options);
126837 this.declaration = declaration;
126838 this.referencer = referencer;
126839 }
126840
126841 visitImport(id, specifier) {
126842 this.referencer.visitPattern(id, pattern => {
126843 this.referencer.currentScope().__define(pattern,
126844 new Definition(
126845 Variable.ImportBinding,
126846 pattern,
126847 specifier,
126848 this.declaration,
126849 null,
126850 null
126851 ));
126852 });
126853 }
126854
126855 ImportNamespaceSpecifier(node) {
126856 const local = (node.local || node.id);
126857
126858 if (local) {
126859 this.visitImport(local, node);
126860 }
126861 }
126862
126863 ImportDefaultSpecifier(node) {
126864 const local = (node.local || node.id);
126865
126866 this.visitImport(local, node);
126867 }
126868
126869 ImportSpecifier(node) {
126870 const local = (node.local || node.id);
126871
126872 if (node.name) {
126873 this.visitImport(node.name, node);
126874 } else {
126875 this.visitImport(local, node);
126876 }
126877 }
126878}
126879
126880// Referencing variables and creating bindings.
126881class Referencer extends esrecurse.Visitor {
126882 constructor(options, scopeManager) {
126883 super(null, options);
126884 this.options = options;
126885 this.scopeManager = scopeManager;
126886 this.parent = null;
126887 this.isInnerMethodDefinition = false;
126888 }
126889
126890 currentScope() {
126891 return this.scopeManager.__currentScope;
126892 }
126893
126894 close(node) {
126895 while (this.currentScope() && node === this.currentScope().block) {
126896 this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager);
126897 }
126898 }
126899
126900 pushInnerMethodDefinition(isInnerMethodDefinition) {
126901 const previous = this.isInnerMethodDefinition;
126902
126903 this.isInnerMethodDefinition = isInnerMethodDefinition;
126904 return previous;
126905 }
126906
126907 popInnerMethodDefinition(isInnerMethodDefinition) {
126908 this.isInnerMethodDefinition = isInnerMethodDefinition;
126909 }
126910
126911 referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) {
126912 const scope = this.currentScope();
126913
126914 assignments.forEach(assignment => {
126915 scope.__referencing(
126916 pattern,
126917 Reference.WRITE,
126918 assignment.right,
126919 maybeImplicitGlobal,
126920 pattern !== assignment.left,
126921 init);
126922 });
126923 }
126924
126925 visitPattern(node, options, callback) {
126926 if (typeof options === "function") {
126927 callback = options;
126928 options = { processRightHandNodes: false };
126929 }
126930 traverseIdentifierInPattern(
126931 this.options,
126932 node,
126933 options.processRightHandNodes ? this : null,
126934 callback);
126935 }
126936
126937 visitFunction(node) {
126938 let i, iz;
126939
126940 // FunctionDeclaration name is defined in upper scope
126941 // NOTE: Not referring variableScope. It is intended.
126942 // Since
126943 // in ES5, FunctionDeclaration should be in FunctionBody.
126944 // in ES6, FunctionDeclaration should be block scoped.
126945
126946 if (node.type === Syntax.FunctionDeclaration) {
126947
126948 // id is defined in upper scope
126949 this.currentScope().__define(node.id,
126950 new Definition(
126951 Variable.FunctionName,
126952 node.id,
126953 node,
126954 null,
126955 null,
126956 null
126957 ));
126958 }
126959
126960 // FunctionExpression with name creates its special scope;
126961 // FunctionExpressionNameScope.
126962 if (node.type === Syntax.FunctionExpression && node.id) {
126963 this.scopeManager.__nestFunctionExpressionNameScope(node);
126964 }
126965
126966 // Consider this function is in the MethodDefinition.
126967 this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition);
126968
126969 const that = this;
126970
126971 /**
126972 * Visit pattern callback
126973 * @param {pattern} pattern - pattern
126974 * @param {Object} info - info
126975 * @returns {void}
126976 */
126977 function visitPatternCallback(pattern, info) {
126978 that.currentScope().__define(pattern,
126979 new ParameterDefinition(
126980 pattern,
126981 node,
126982 i,
126983 info.rest
126984 ));
126985
126986 that.referencingDefaultValue(pattern, info.assignments, null, true);
126987 }
126988
126989 // Process parameter declarations.
126990 for (i = 0, iz = node.params.length; i < iz; ++i) {
126991 this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback);
126992 }
126993
126994 // if there's a rest argument, add that
126995 if (node.rest) {
126996 this.visitPattern({
126997 type: "RestElement",
126998 argument: node.rest
126999 }, pattern => {
127000 this.currentScope().__define(pattern,
127001 new ParameterDefinition(
127002 pattern,
127003 node,
127004 node.params.length,
127005 true
127006 ));
127007 });
127008 }
127009
127010 // In TypeScript there are a number of function-like constructs which have no body,
127011 // so check it exists before traversing
127012 if (node.body) {
127013
127014 // Skip BlockStatement to prevent creating BlockStatement scope.
127015 if (node.body.type === Syntax.BlockStatement) {
127016 this.visitChildren(node.body);
127017 } else {
127018 this.visit(node.body);
127019 }
127020 }
127021
127022 this.close(node);
127023 }
127024
127025 visitClass(node) {
127026 if (node.type === Syntax.ClassDeclaration) {
127027 this.currentScope().__define(node.id,
127028 new Definition(
127029 Variable.ClassName,
127030 node.id,
127031 node,
127032 null,
127033 null,
127034 null
127035 ));
127036 }
127037
127038 this.visit(node.superClass);
127039
127040 this.scopeManager.__nestClassScope(node);
127041
127042 if (node.id) {
127043 this.currentScope().__define(node.id,
127044 new Definition(
127045 Variable.ClassName,
127046 node.id,
127047 node
127048 ));
127049 }
127050 this.visit(node.body);
127051
127052 this.close(node);
127053 }
127054
127055 visitProperty(node) {
127056 let previous;
127057
127058 if (node.computed) {
127059 this.visit(node.key);
127060 }
127061
127062 const isMethodDefinition = node.type === Syntax.MethodDefinition;
127063
127064 if (isMethodDefinition) {
127065 previous = this.pushInnerMethodDefinition(true);
127066 }
127067 this.visit(node.value);
127068 if (isMethodDefinition) {
127069 this.popInnerMethodDefinition(previous);
127070 }
127071 }
127072
127073 visitForIn(node) {
127074 if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") {
127075 this.scopeManager.__nestForScope(node);
127076 }
127077
127078 if (node.left.type === Syntax.VariableDeclaration) {
127079 this.visit(node.left);
127080 this.visitPattern(node.left.declarations[0].id, pattern => {
127081 this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true);
127082 });
127083 } else {
127084 this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
127085 let maybeImplicitGlobal = null;
127086
127087 if (!this.currentScope().isStrict) {
127088 maybeImplicitGlobal = {
127089 pattern,
127090 node
127091 };
127092 }
127093 this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
127094 this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false);
127095 });
127096 }
127097 this.visit(node.right);
127098 this.visit(node.body);
127099
127100 this.close(node);
127101 }
127102
127103 visitVariableDeclaration(variableTargetScope, type, node, index) {
127104
127105 const decl = node.declarations[index];
127106 const init = decl.init;
127107
127108 this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => {
127109 variableTargetScope.__define(
127110 pattern,
127111 new Definition(
127112 type,
127113 pattern,
127114 decl,
127115 node,
127116 index,
127117 node.kind
127118 )
127119 );
127120
127121 this.referencingDefaultValue(pattern, info.assignments, null, true);
127122 if (init) {
127123 this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true);
127124 }
127125 });
127126 }
127127
127128 AssignmentExpression(node) {
127129 if (PatternVisitor.isPattern(node.left)) {
127130 if (node.operator === "=") {
127131 this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
127132 let maybeImplicitGlobal = null;
127133
127134 if (!this.currentScope().isStrict) {
127135 maybeImplicitGlobal = {
127136 pattern,
127137 node
127138 };
127139 }
127140 this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
127141 this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false);
127142 });
127143 } else {
127144 this.currentScope().__referencing(node.left, Reference.RW, node.right);
127145 }
127146 } else {
127147 this.visit(node.left);
127148 }
127149 this.visit(node.right);
127150 }
127151
127152 CatchClause(node) {
127153 this.scopeManager.__nestCatchScope(node);
127154
127155 this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => {
127156 this.currentScope().__define(pattern,
127157 new Definition(
127158 Variable.CatchClause,
127159 node.param,
127160 node,
127161 null,
127162 null,
127163 null
127164 ));
127165 this.referencingDefaultValue(pattern, info.assignments, null, true);
127166 });
127167 this.visit(node.body);
127168
127169 this.close(node);
127170 }
127171
127172 Program(node) {
127173 this.scopeManager.__nestGlobalScope(node);
127174
127175 if (this.scopeManager.__isNodejsScope()) {
127176
127177 // Force strictness of GlobalScope to false when using node.js scope.
127178 this.currentScope().isStrict = false;
127179 this.scopeManager.__nestFunctionScope(node, false);
127180 }
127181
127182 if (this.scopeManager.__isES6() && this.scopeManager.isModule()) {
127183 this.scopeManager.__nestModuleScope(node);
127184 }
127185
127186 if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) {
127187 this.currentScope().isStrict = true;
127188 }
127189
127190 this.visitChildren(node);
127191 this.close(node);
127192 }
127193
127194 Identifier(node) {
127195 this.currentScope().__referencing(node);
127196 }
127197
127198 UpdateExpression(node) {
127199 if (PatternVisitor.isPattern(node.argument)) {
127200 this.currentScope().__referencing(node.argument, Reference.RW, null);
127201 } else {
127202 this.visitChildren(node);
127203 }
127204 }
127205
127206 MemberExpression(node) {
127207 this.visit(node.object);
127208 if (node.computed) {
127209 this.visit(node.property);
127210 }
127211 }
127212
127213 Property(node) {
127214 this.visitProperty(node);
127215 }
127216
127217 MethodDefinition(node) {
127218 this.visitProperty(node);
127219 }
127220
127221 BreakStatement() {} // eslint-disable-line class-methods-use-this
127222
127223 ContinueStatement() {} // eslint-disable-line class-methods-use-this
127224
127225 LabeledStatement(node) {
127226 this.visit(node.body);
127227 }
127228
127229 ForStatement(node) {
127230
127231 // Create ForStatement declaration.
127232 // NOTE: In ES6, ForStatement dynamically generates
127233 // per iteration environment. However, escope is
127234 // a static analyzer, we only generate one scope for ForStatement.
127235 if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") {
127236 this.scopeManager.__nestForScope(node);
127237 }
127238
127239 this.visitChildren(node);
127240
127241 this.close(node);
127242 }
127243
127244 ClassExpression(node) {
127245 this.visitClass(node);
127246 }
127247
127248 ClassDeclaration(node) {
127249 this.visitClass(node);
127250 }
127251
127252 CallExpression(node) {
127253
127254 // Check this is direct call to eval
127255 if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") {
127256
127257 // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
127258 // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
127259 this.currentScope().variableScope.__detectEval();
127260 }
127261 this.visitChildren(node);
127262 }
127263
127264 BlockStatement(node) {
127265 if (this.scopeManager.__isES6()) {
127266 this.scopeManager.__nestBlockScope(node);
127267 }
127268
127269 this.visitChildren(node);
127270
127271 this.close(node);
127272 }
127273
127274 ThisExpression() {
127275 this.currentScope().variableScope.__detectThis();
127276 }
127277
127278 WithStatement(node) {
127279 this.visit(node.object);
127280
127281 // Then nest scope for WithStatement.
127282 this.scopeManager.__nestWithScope(node);
127283
127284 this.visit(node.body);
127285
127286 this.close(node);
127287 }
127288
127289 VariableDeclaration(node) {
127290 const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope();
127291
127292 for (let i = 0, iz = node.declarations.length; i < iz; ++i) {
127293 const decl = node.declarations[i];
127294
127295 this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i);
127296 if (decl.init) {
127297 this.visit(decl.init);
127298 }
127299 }
127300 }
127301
127302 // sec 13.11.8
127303 SwitchStatement(node) {
127304 this.visit(node.discriminant);
127305
127306 if (this.scopeManager.__isES6()) {
127307 this.scopeManager.__nestSwitchScope(node);
127308 }
127309
127310 for (let i = 0, iz = node.cases.length; i < iz; ++i) {
127311 this.visit(node.cases[i]);
127312 }
127313
127314 this.close(node);
127315 }
127316
127317 FunctionDeclaration(node) {
127318 this.visitFunction(node);
127319 }
127320
127321 FunctionExpression(node) {
127322 this.visitFunction(node);
127323 }
127324
127325 ForOfStatement(node) {
127326 this.visitForIn(node);
127327 }
127328
127329 ForInStatement(node) {
127330 this.visitForIn(node);
127331 }
127332
127333 ArrowFunctionExpression(node) {
127334 this.visitFunction(node);
127335 }
127336
127337 ImportDeclaration(node) {
127338 assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
127339
127340 const importer = new Importer(node, this);
127341
127342 importer.visit(node);
127343 }
127344
127345 visitExportDeclaration(node) {
127346 if (node.source) {
127347 return;
127348 }
127349 if (node.declaration) {
127350 this.visit(node.declaration);
127351 return;
127352 }
127353
127354 this.visitChildren(node);
127355 }
127356
127357 ExportDeclaration(node) {
127358 this.visitExportDeclaration(node);
127359 }
127360
127361 ExportNamedDeclaration(node) {
127362 this.visitExportDeclaration(node);
127363 }
127364
127365 ExportSpecifier(node) {
127366 const local = (node.id || node.local);
127367
127368 this.visit(local);
127369 }
127370
127371 MetaProperty() { // eslint-disable-line class-methods-use-this
127372
127373 // do nothing.
127374 }
127375}
127376
127377module.exports = Referencer;
127378
127379/* vim: set sw=4 ts=4 et tw=80 : */
127380
127381
127382/***/ }),
127383
127384/***/ 13890:
127385/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
127386
127387"use strict";
127388/*
127389 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
127390
127391 Redistribution and use in source and binary forms, with or without
127392 modification, are permitted provided that the following conditions are met:
127393
127394 * Redistributions of source code must retain the above copyright
127395 notice, this list of conditions and the following disclaimer.
127396 * Redistributions in binary form must reproduce the above copyright
127397 notice, this list of conditions and the following disclaimer in the
127398 documentation and/or other materials provided with the distribution.
127399
127400 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
127401 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
127402 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
127403 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
127404 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
127405 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
127406 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
127407 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
127408 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
127409 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127410*/
127411
127412
127413/* eslint-disable no-underscore-dangle */
127414
127415const Scope = __webpack_require__(7816);
127416const assert = __webpack_require__(42357);
127417
127418const GlobalScope = Scope.GlobalScope;
127419const CatchScope = Scope.CatchScope;
127420const WithScope = Scope.WithScope;
127421const ModuleScope = Scope.ModuleScope;
127422const ClassScope = Scope.ClassScope;
127423const SwitchScope = Scope.SwitchScope;
127424const FunctionScope = Scope.FunctionScope;
127425const ForScope = Scope.ForScope;
127426const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope;
127427const BlockScope = Scope.BlockScope;
127428
127429/**
127430 * @class ScopeManager
127431 */
127432class ScopeManager {
127433 constructor(options) {
127434 this.scopes = [];
127435 this.globalScope = null;
127436 this.__nodeToScope = new WeakMap();
127437 this.__currentScope = null;
127438 this.__options = options;
127439 this.__declaredVariables = new WeakMap();
127440 }
127441
127442 __useDirective() {
127443 return this.__options.directive;
127444 }
127445
127446 __isOptimistic() {
127447 return this.__options.optimistic;
127448 }
127449
127450 __ignoreEval() {
127451 return this.__options.ignoreEval;
127452 }
127453
127454 __isNodejsScope() {
127455 return this.__options.nodejsScope;
127456 }
127457
127458 isModule() {
127459 return this.__options.sourceType === "module";
127460 }
127461
127462 isImpliedStrict() {
127463 return this.__options.impliedStrict;
127464 }
127465
127466 isStrictModeSupported() {
127467 return this.__options.ecmaVersion >= 5;
127468 }
127469
127470 // Returns appropriate scope for this node.
127471 __get(node) {
127472 return this.__nodeToScope.get(node);
127473 }
127474
127475 /**
127476 * Get variables that are declared by the node.
127477 *
127478 * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
127479 * If the node declares nothing, this method returns an empty array.
127480 * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
127481 *
127482 * @param {Espree.Node} node - a node to get.
127483 * @returns {Variable[]} variables that declared by the node.
127484 */
127485 getDeclaredVariables(node) {
127486 return this.__declaredVariables.get(node) || [];
127487 }
127488
127489 /**
127490 * acquire scope from node.
127491 * @method ScopeManager#acquire
127492 * @param {Espree.Node} node - node for the acquired scope.
127493 * @param {boolean=} inner - look up the most inner scope, default value is false.
127494 * @returns {Scope?} Scope from node
127495 */
127496 acquire(node, inner) {
127497
127498 /**
127499 * predicate
127500 * @param {Scope} testScope - scope to test
127501 * @returns {boolean} predicate
127502 */
127503 function predicate(testScope) {
127504 if (testScope.type === "function" && testScope.functionExpressionScope) {
127505 return false;
127506 }
127507 return true;
127508 }
127509
127510 const scopes = this.__get(node);
127511
127512 if (!scopes || scopes.length === 0) {
127513 return null;
127514 }
127515
127516 // Heuristic selection from all scopes.
127517 // If you would like to get all scopes, please use ScopeManager#acquireAll.
127518 if (scopes.length === 1) {
127519 return scopes[0];
127520 }
127521
127522 if (inner) {
127523 for (let i = scopes.length - 1; i >= 0; --i) {
127524 const scope = scopes[i];
127525
127526 if (predicate(scope)) {
127527 return scope;
127528 }
127529 }
127530 } else {
127531 for (let i = 0, iz = scopes.length; i < iz; ++i) {
127532 const scope = scopes[i];
127533
127534 if (predicate(scope)) {
127535 return scope;
127536 }
127537 }
127538 }
127539
127540 return null;
127541 }
127542
127543 /**
127544 * acquire all scopes from node.
127545 * @method ScopeManager#acquireAll
127546 * @param {Espree.Node} node - node for the acquired scope.
127547 * @returns {Scopes?} Scope array
127548 */
127549 acquireAll(node) {
127550 return this.__get(node);
127551 }
127552
127553 /**
127554 * release the node.
127555 * @method ScopeManager#release
127556 * @param {Espree.Node} node - releasing node.
127557 * @param {boolean=} inner - look up the most inner scope, default value is false.
127558 * @returns {Scope?} upper scope for the node.
127559 */
127560 release(node, inner) {
127561 const scopes = this.__get(node);
127562
127563 if (scopes && scopes.length) {
127564 const scope = scopes[0].upper;
127565
127566 if (!scope) {
127567 return null;
127568 }
127569 return this.acquire(scope.block, inner);
127570 }
127571 return null;
127572 }
127573
127574 attach() { } // eslint-disable-line class-methods-use-this
127575
127576 detach() { } // eslint-disable-line class-methods-use-this
127577
127578 __nestScope(scope) {
127579 if (scope instanceof GlobalScope) {
127580 assert(this.__currentScope === null);
127581 this.globalScope = scope;
127582 }
127583 this.__currentScope = scope;
127584 return scope;
127585 }
127586
127587 __nestGlobalScope(node) {
127588 return this.__nestScope(new GlobalScope(this, node));
127589 }
127590
127591 __nestBlockScope(node) {
127592 return this.__nestScope(new BlockScope(this, this.__currentScope, node));
127593 }
127594
127595 __nestFunctionScope(node, isMethodDefinition) {
127596 return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition));
127597 }
127598
127599 __nestForScope(node) {
127600 return this.__nestScope(new ForScope(this, this.__currentScope, node));
127601 }
127602
127603 __nestCatchScope(node) {
127604 return this.__nestScope(new CatchScope(this, this.__currentScope, node));
127605 }
127606
127607 __nestWithScope(node) {
127608 return this.__nestScope(new WithScope(this, this.__currentScope, node));
127609 }
127610
127611 __nestClassScope(node) {
127612 return this.__nestScope(new ClassScope(this, this.__currentScope, node));
127613 }
127614
127615 __nestSwitchScope(node) {
127616 return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
127617 }
127618
127619 __nestModuleScope(node) {
127620 return this.__nestScope(new ModuleScope(this, this.__currentScope, node));
127621 }
127622
127623 __nestFunctionExpressionNameScope(node) {
127624 return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node));
127625 }
127626
127627 __isES6() {
127628 return this.__options.ecmaVersion >= 6;
127629 }
127630}
127631
127632module.exports = ScopeManager;
127633
127634/* vim: set sw=4 ts=4 et tw=80 : */
127635
127636
127637/***/ }),
127638
127639/***/ 7816:
127640/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
127641
127642"use strict";
127643/*
127644 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
127645
127646 Redistribution and use in source and binary forms, with or without
127647 modification, are permitted provided that the following conditions are met:
127648
127649 * Redistributions of source code must retain the above copyright
127650 notice, this list of conditions and the following disclaimer.
127651 * Redistributions in binary form must reproduce the above copyright
127652 notice, this list of conditions and the following disclaimer in the
127653 documentation and/or other materials provided with the distribution.
127654
127655 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
127656 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
127657 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
127658 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
127659 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
127660 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
127661 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
127662 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
127663 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
127664 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127665*/
127666
127667
127668/* eslint-disable no-underscore-dangle */
127669/* eslint-disable no-undefined */
127670
127671const Syntax = __webpack_require__(40379).Syntax;
127672
127673const Reference = __webpack_require__(9922);
127674const Variable = __webpack_require__(48113);
127675const Definition = __webpack_require__(97865).Definition;
127676const assert = __webpack_require__(42357);
127677
127678/**
127679 * Test if scope is struct
127680 * @param {Scope} scope - scope
127681 * @param {Block} block - block
127682 * @param {boolean} isMethodDefinition - is method definiton
127683 * @param {boolean} useDirective - use directive
127684 * @returns {boolean} is strict scope
127685 */
127686function isStrictScope(scope, block, isMethodDefinition, useDirective) {
127687 let body;
127688
127689 // When upper scope is exists and strict, inner scope is also strict.
127690 if (scope.upper && scope.upper.isStrict) {
127691 return true;
127692 }
127693
127694 if (isMethodDefinition) {
127695 return true;
127696 }
127697
127698 if (scope.type === "class" || scope.type === "module") {
127699 return true;
127700 }
127701
127702 if (scope.type === "block" || scope.type === "switch") {
127703 return false;
127704 }
127705
127706 if (scope.type === "function") {
127707 if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) {
127708 return false;
127709 }
127710
127711 if (block.type === Syntax.Program) {
127712 body = block;
127713 } else {
127714 body = block.body;
127715 }
127716
127717 if (!body) {
127718 return false;
127719 }
127720 } else if (scope.type === "global") {
127721 body = block;
127722 } else {
127723 return false;
127724 }
127725
127726 // Search 'use strict' directive.
127727 if (useDirective) {
127728 for (let i = 0, iz = body.body.length; i < iz; ++i) {
127729 const stmt = body.body[i];
127730
127731 if (stmt.type !== Syntax.DirectiveStatement) {
127732 break;
127733 }
127734 if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
127735 return true;
127736 }
127737 }
127738 } else {
127739 for (let i = 0, iz = body.body.length; i < iz; ++i) {
127740 const stmt = body.body[i];
127741
127742 if (stmt.type !== Syntax.ExpressionStatement) {
127743 break;
127744 }
127745 const expr = stmt.expression;
127746
127747 if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
127748 break;
127749 }
127750 if (expr.raw !== null && expr.raw !== undefined) {
127751 if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
127752 return true;
127753 }
127754 } else {
127755 if (expr.value === "use strict") {
127756 return true;
127757 }
127758 }
127759 }
127760 }
127761 return false;
127762}
127763
127764/**
127765 * Register scope
127766 * @param {ScopeManager} scopeManager - scope manager
127767 * @param {Scope} scope - scope
127768 * @returns {void}
127769 */
127770function registerScope(scopeManager, scope) {
127771 scopeManager.scopes.push(scope);
127772
127773 const scopes = scopeManager.__nodeToScope.get(scope.block);
127774
127775 if (scopes) {
127776 scopes.push(scope);
127777 } else {
127778 scopeManager.__nodeToScope.set(scope.block, [scope]);
127779 }
127780}
127781
127782/**
127783 * Should be statically
127784 * @param {Object} def - def
127785 * @returns {boolean} should be statically
127786 */
127787function shouldBeStatically(def) {
127788 return (
127789 (def.type === Variable.ClassName) ||
127790 (def.type === Variable.Variable && def.parent.kind !== "var")
127791 );
127792}
127793
127794/**
127795 * @class Scope
127796 */
127797class Scope {
127798 constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
127799
127800 /**
127801 * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
127802 * @member {String} Scope#type
127803 */
127804 this.type = type;
127805
127806 /**
127807 * The scoped {@link Variable}s of this scope, as <code>{ Variable.name
127808 * : Variable }</code>.
127809 * @member {Map} Scope#set
127810 */
127811 this.set = new Map();
127812
127813 /**
127814 * The tainted variables of this scope, as <code>{ Variable.name :
127815 * boolean }</code>.
127816 * @member {Map} Scope#taints */
127817 this.taints = new Map();
127818
127819 /**
127820 * Generally, through the lexical scoping of JS you can always know
127821 * which variable an identifier in the source code refers to. There are
127822 * a few exceptions to this rule. With 'global' and 'with' scopes you
127823 * can only decide at runtime which variable a reference refers to.
127824 * Moreover, if 'eval()' is used in a scope, it might introduce new
127825 * bindings in this or its parent scopes.
127826 * All those scopes are considered 'dynamic'.
127827 * @member {boolean} Scope#dynamic
127828 */
127829 this.dynamic = this.type === "global" || this.type === "with";
127830
127831 /**
127832 * A reference to the scope-defining syntax node.
127833 * @member {espree.Node} Scope#block
127834 */
127835 this.block = block;
127836
127837 /**
127838 * The {@link Reference|references} that are not resolved with this scope.
127839 * @member {Reference[]} Scope#through
127840 */
127841 this.through = [];
127842
127843 /**
127844 * The scoped {@link Variable}s of this scope. In the case of a
127845 * 'function' scope this includes the automatic argument <em>arguments</em> as
127846 * its first element, as well as all further formal arguments.
127847 * @member {Variable[]} Scope#variables
127848 */
127849 this.variables = [];
127850
127851 /**
127852 * Any variable {@link Reference|reference} found in this scope. This
127853 * includes occurrences of local variables as well as variables from
127854 * parent scopes (including the global scope). For local variables
127855 * this also includes defining occurrences (like in a 'var' statement).
127856 * In a 'function' scope this does not include the occurrences of the
127857 * formal parameter in the parameter list.
127858 * @member {Reference[]} Scope#references
127859 */
127860 this.references = [];
127861
127862 /**
127863 * For 'global' and 'function' scopes, this is a self-reference. For
127864 * other scope types this is the <em>variableScope</em> value of the
127865 * parent scope.
127866 * @member {Scope} Scope#variableScope
127867 */
127868 this.variableScope =
127869 (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope;
127870
127871 /**
127872 * Whether this scope is created by a FunctionExpression.
127873 * @member {boolean} Scope#functionExpressionScope
127874 */
127875 this.functionExpressionScope = false;
127876
127877 /**
127878 * Whether this is a scope that contains an 'eval()' invocation.
127879 * @member {boolean} Scope#directCallToEvalScope
127880 */
127881 this.directCallToEvalScope = false;
127882
127883 /**
127884 * @member {boolean} Scope#thisFound
127885 */
127886 this.thisFound = false;
127887
127888 this.__left = [];
127889
127890 /**
127891 * Reference to the parent {@link Scope|scope}.
127892 * @member {Scope} Scope#upper
127893 */
127894 this.upper = upperScope;
127895
127896 /**
127897 * Whether 'use strict' is in effect in this scope.
127898 * @member {boolean} Scope#isStrict
127899 */
127900 this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective());
127901
127902 /**
127903 * List of nested {@link Scope}s.
127904 * @member {Scope[]} Scope#childScopes
127905 */
127906 this.childScopes = [];
127907 if (this.upper) {
127908 this.upper.childScopes.push(this);
127909 }
127910
127911 this.__declaredVariables = scopeManager.__declaredVariables;
127912
127913 registerScope(scopeManager, this);
127914 }
127915
127916 __shouldStaticallyClose(scopeManager) {
127917 return (!this.dynamic || scopeManager.__isOptimistic());
127918 }
127919
127920 __shouldStaticallyCloseForGlobal(ref) {
127921
127922 // On global scope, let/const/class declarations should be resolved statically.
127923 const name = ref.identifier.name;
127924
127925 if (!this.set.has(name)) {
127926 return false;
127927 }
127928
127929 const variable = this.set.get(name);
127930 const defs = variable.defs;
127931
127932 return defs.length > 0 && defs.every(shouldBeStatically);
127933 }
127934
127935 __staticCloseRef(ref) {
127936 if (!this.__resolve(ref)) {
127937 this.__delegateToUpperScope(ref);
127938 }
127939 }
127940
127941 __dynamicCloseRef(ref) {
127942
127943 // notify all names are through to global
127944 let current = this;
127945
127946 do {
127947 current.through.push(ref);
127948 current = current.upper;
127949 } while (current);
127950 }
127951
127952 __globalCloseRef(ref) {
127953
127954 // let/const/class declarations should be resolved statically.
127955 // others should be resolved dynamically.
127956 if (this.__shouldStaticallyCloseForGlobal(ref)) {
127957 this.__staticCloseRef(ref);
127958 } else {
127959 this.__dynamicCloseRef(ref);
127960 }
127961 }
127962
127963 __close(scopeManager) {
127964 let closeRef;
127965
127966 if (this.__shouldStaticallyClose(scopeManager)) {
127967 closeRef = this.__staticCloseRef;
127968 } else if (this.type !== "global") {
127969 closeRef = this.__dynamicCloseRef;
127970 } else {
127971 closeRef = this.__globalCloseRef;
127972 }
127973
127974 // Try Resolving all references in this scope.
127975 for (let i = 0, iz = this.__left.length; i < iz; ++i) {
127976 const ref = this.__left[i];
127977
127978 closeRef.call(this, ref);
127979 }
127980 this.__left = null;
127981
127982 return this.upper;
127983 }
127984
127985 // To override by function scopes.
127986 // References in default parameters isn't resolved to variables which are in their function body.
127987 __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars
127988 return true;
127989 }
127990
127991 __resolve(ref) {
127992 const name = ref.identifier.name;
127993
127994 if (!this.set.has(name)) {
127995 return false;
127996 }
127997 const variable = this.set.get(name);
127998
127999 if (!this.__isValidResolution(ref, variable)) {
128000 return false;
128001 }
128002 variable.references.push(ref);
128003 variable.stack = variable.stack && ref.from.variableScope === this.variableScope;
128004 if (ref.tainted) {
128005 variable.tainted = true;
128006 this.taints.set(variable.name, true);
128007 }
128008 ref.resolved = variable;
128009
128010 return true;
128011 }
128012
128013 __delegateToUpperScope(ref) {
128014 if (this.upper) {
128015 this.upper.__left.push(ref);
128016 }
128017 this.through.push(ref);
128018 }
128019
128020 __addDeclaredVariablesOfNode(variable, node) {
128021 if (node === null || node === undefined) {
128022 return;
128023 }
128024
128025 let variables = this.__declaredVariables.get(node);
128026
128027 if (variables === null || variables === undefined) {
128028 variables = [];
128029 this.__declaredVariables.set(node, variables);
128030 }
128031 if (variables.indexOf(variable) === -1) {
128032 variables.push(variable);
128033 }
128034 }
128035
128036 __defineGeneric(name, set, variables, node, def) {
128037 let variable;
128038
128039 variable = set.get(name);
128040 if (!variable) {
128041 variable = new Variable(name, this);
128042 set.set(name, variable);
128043 variables.push(variable);
128044 }
128045
128046 if (def) {
128047 variable.defs.push(def);
128048 this.__addDeclaredVariablesOfNode(variable, def.node);
128049 this.__addDeclaredVariablesOfNode(variable, def.parent);
128050 }
128051 if (node) {
128052 variable.identifiers.push(node);
128053 }
128054 }
128055
128056 __define(node, def) {
128057 if (node && node.type === Syntax.Identifier) {
128058 this.__defineGeneric(
128059 node.name,
128060 this.set,
128061 this.variables,
128062 node,
128063 def);
128064 }
128065 }
128066
128067 __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) {
128068
128069 // because Array element may be null
128070 if (!node || node.type !== Syntax.Identifier) {
128071 return;
128072 }
128073
128074 // Specially handle like `this`.
128075 if (node.name === "super") {
128076 return;
128077 }
128078
128079 const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init);
128080
128081 this.references.push(ref);
128082 this.__left.push(ref);
128083 }
128084
128085 __detectEval() {
128086 let current = this;
128087
128088 this.directCallToEvalScope = true;
128089 do {
128090 current.dynamic = true;
128091 current = current.upper;
128092 } while (current);
128093 }
128094
128095 __detectThis() {
128096 this.thisFound = true;
128097 }
128098
128099 __isClosed() {
128100 return this.__left === null;
128101 }
128102
128103 /**
128104 * returns resolved {Reference}
128105 * @method Scope#resolve
128106 * @param {Espree.Identifier} ident - identifier to be resolved.
128107 * @returns {Reference} reference
128108 */
128109 resolve(ident) {
128110 let ref, i, iz;
128111
128112 assert(this.__isClosed(), "Scope should be closed.");
128113 assert(ident.type === Syntax.Identifier, "Target should be identifier.");
128114 for (i = 0, iz = this.references.length; i < iz; ++i) {
128115 ref = this.references[i];
128116 if (ref.identifier === ident) {
128117 return ref;
128118 }
128119 }
128120 return null;
128121 }
128122
128123 /**
128124 * returns this scope is static
128125 * @method Scope#isStatic
128126 * @returns {boolean} static
128127 */
128128 isStatic() {
128129 return !this.dynamic;
128130 }
128131
128132 /**
128133 * returns this scope has materialized arguments
128134 * @method Scope#isArgumentsMaterialized
128135 * @returns {boolean} arguemnts materialized
128136 */
128137 isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this
128138 return true;
128139 }
128140
128141 /**
128142 * returns this scope has materialized `this` reference
128143 * @method Scope#isThisMaterialized
128144 * @returns {boolean} this materialized
128145 */
128146 isThisMaterialized() { // eslint-disable-line class-methods-use-this
128147 return true;
128148 }
128149
128150 isUsedName(name) {
128151 if (this.set.has(name)) {
128152 return true;
128153 }
128154 for (let i = 0, iz = this.through.length; i < iz; ++i) {
128155 if (this.through[i].identifier.name === name) {
128156 return true;
128157 }
128158 }
128159 return false;
128160 }
128161}
128162
128163class GlobalScope extends Scope {
128164 constructor(scopeManager, block) {
128165 super(scopeManager, "global", null, block, false);
128166 this.implicit = {
128167 set: new Map(),
128168 variables: [],
128169
128170 /**
128171 * List of {@link Reference}s that are left to be resolved (i.e. which
128172 * need to be linked to the variable they refer to).
128173 * @member {Reference[]} Scope#implicit#left
128174 */
128175 left: []
128176 };
128177 }
128178
128179 __close(scopeManager) {
128180 const implicit = [];
128181
128182 for (let i = 0, iz = this.__left.length; i < iz; ++i) {
128183 const ref = this.__left[i];
128184
128185 if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
128186 implicit.push(ref.__maybeImplicitGlobal);
128187 }
128188 }
128189
128190 // create an implicit global variable from assignment expression
128191 for (let i = 0, iz = implicit.length; i < iz; ++i) {
128192 const info = implicit[i];
128193
128194 this.__defineImplicit(info.pattern,
128195 new Definition(
128196 Variable.ImplicitGlobalVariable,
128197 info.pattern,
128198 info.node,
128199 null,
128200 null,
128201 null
128202 ));
128203
128204 }
128205
128206 this.implicit.left = this.__left;
128207
128208 return super.__close(scopeManager);
128209 }
128210
128211 __defineImplicit(node, def) {
128212 if (node && node.type === Syntax.Identifier) {
128213 this.__defineGeneric(
128214 node.name,
128215 this.implicit.set,
128216 this.implicit.variables,
128217 node,
128218 def);
128219 }
128220 }
128221}
128222
128223class ModuleScope extends Scope {
128224 constructor(scopeManager, upperScope, block) {
128225 super(scopeManager, "module", upperScope, block, false);
128226 }
128227}
128228
128229class FunctionExpressionNameScope extends Scope {
128230 constructor(scopeManager, upperScope, block) {
128231 super(scopeManager, "function-expression-name", upperScope, block, false);
128232 this.__define(block.id,
128233 new Definition(
128234 Variable.FunctionName,
128235 block.id,
128236 block,
128237 null,
128238 null,
128239 null
128240 ));
128241 this.functionExpressionScope = true;
128242 }
128243}
128244
128245class CatchScope extends Scope {
128246 constructor(scopeManager, upperScope, block) {
128247 super(scopeManager, "catch", upperScope, block, false);
128248 }
128249}
128250
128251class WithScope extends Scope {
128252 constructor(scopeManager, upperScope, block) {
128253 super(scopeManager, "with", upperScope, block, false);
128254 }
128255
128256 __close(scopeManager) {
128257 if (this.__shouldStaticallyClose(scopeManager)) {
128258 return super.__close(scopeManager);
128259 }
128260
128261 for (let i = 0, iz = this.__left.length; i < iz; ++i) {
128262 const ref = this.__left[i];
128263
128264 ref.tainted = true;
128265 this.__delegateToUpperScope(ref);
128266 }
128267 this.__left = null;
128268
128269 return this.upper;
128270 }
128271}
128272
128273class BlockScope extends Scope {
128274 constructor(scopeManager, upperScope, block) {
128275 super(scopeManager, "block", upperScope, block, false);
128276 }
128277}
128278
128279class SwitchScope extends Scope {
128280 constructor(scopeManager, upperScope, block) {
128281 super(scopeManager, "switch", upperScope, block, false);
128282 }
128283}
128284
128285class FunctionScope extends Scope {
128286 constructor(scopeManager, upperScope, block, isMethodDefinition) {
128287 super(scopeManager, "function", upperScope, block, isMethodDefinition);
128288
128289 // section 9.2.13, FunctionDeclarationInstantiation.
128290 // NOTE Arrow functions never have an arguments objects.
128291 if (this.block.type !== Syntax.ArrowFunctionExpression) {
128292 this.__defineArguments();
128293 }
128294 }
128295
128296 isArgumentsMaterialized() {
128297
128298 // TODO(Constellation)
128299 // We can more aggressive on this condition like this.
128300 //
128301 // function t() {
128302 // // arguments of t is always hidden.
128303 // function arguments() {
128304 // }
128305 // }
128306 if (this.block.type === Syntax.ArrowFunctionExpression) {
128307 return false;
128308 }
128309
128310 if (!this.isStatic()) {
128311 return true;
128312 }
128313
128314 const variable = this.set.get("arguments");
128315
128316 assert(variable, "Always have arguments variable.");
128317 return variable.tainted || variable.references.length !== 0;
128318 }
128319
128320 isThisMaterialized() {
128321 if (!this.isStatic()) {
128322 return true;
128323 }
128324 return this.thisFound;
128325 }
128326
128327 __defineArguments() {
128328 this.__defineGeneric(
128329 "arguments",
128330 this.set,
128331 this.variables,
128332 null,
128333 null);
128334 this.taints.set("arguments", true);
128335 }
128336
128337 // References in default parameters isn't resolved to variables which are in their function body.
128338 // const x = 1
128339 // function f(a = x) { // This `x` is resolved to the `x` in the outer scope.
128340 // const x = 2
128341 // console.log(a)
128342 // }
128343 __isValidResolution(ref, variable) {
128344
128345 // If `options.nodejsScope` is true, `this.block` becomes a Program node.
128346 if (this.block.type === "Program") {
128347 return true;
128348 }
128349
128350 const bodyStart = this.block.body.range[0];
128351
128352 // It's invalid resolution in the following case:
128353 return !(
128354 variable.scope === this &&
128355 ref.identifier.range[0] < bodyStart && // the reference is in the parameter part.
128356 variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body.
128357 );
128358 }
128359}
128360
128361class ForScope extends Scope {
128362 constructor(scopeManager, upperScope, block) {
128363 super(scopeManager, "for", upperScope, block, false);
128364 }
128365}
128366
128367class ClassScope extends Scope {
128368 constructor(scopeManager, upperScope, block) {
128369 super(scopeManager, "class", upperScope, block, false);
128370 }
128371}
128372
128373module.exports = {
128374 Scope,
128375 GlobalScope,
128376 ModuleScope,
128377 FunctionExpressionNameScope,
128378 CatchScope,
128379 WithScope,
128380 BlockScope,
128381 SwitchScope,
128382 FunctionScope,
128383 ForScope,
128384 ClassScope
128385};
128386
128387/* vim: set sw=4 ts=4 et tw=80 : */
128388
128389
128390/***/ }),
128391
128392/***/ 48113:
128393/***/ (function(module) {
128394
128395"use strict";
128396/*
128397 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
128398
128399 Redistribution and use in source and binary forms, with or without
128400 modification, are permitted provided that the following conditions are met:
128401
128402 * Redistributions of source code must retain the above copyright
128403 notice, this list of conditions and the following disclaimer.
128404 * Redistributions in binary form must reproduce the above copyright
128405 notice, this list of conditions and the following disclaimer in the
128406 documentation and/or other materials provided with the distribution.
128407
128408 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
128409 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
128410 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
128411 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
128412 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
128413 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
128414 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
128415 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
128416 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
128417 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
128418*/
128419
128420
128421/**
128422 * A Variable represents a locally scoped identifier. These include arguments to
128423 * functions.
128424 * @class Variable
128425 */
128426class Variable {
128427 constructor(name, scope) {
128428
128429 /**
128430 * The variable name, as given in the source code.
128431 * @member {String} Variable#name
128432 */
128433 this.name = name;
128434
128435 /**
128436 * List of defining occurrences of this variable (like in 'var ...'
128437 * statements or as parameter), as AST nodes.
128438 * @member {espree.Identifier[]} Variable#identifiers
128439 */
128440 this.identifiers = [];
128441
128442 /**
128443 * List of {@link Reference|references} of this variable (excluding parameter entries)
128444 * in its defining scope and all nested scopes. For defining
128445 * occurrences only see {@link Variable#defs}.
128446 * @member {Reference[]} Variable#references
128447 */
128448 this.references = [];
128449
128450 /**
128451 * List of defining occurrences of this variable (like in 'var ...'
128452 * statements or as parameter), as custom objects.
128453 * @member {Definition[]} Variable#defs
128454 */
128455 this.defs = [];
128456
128457 this.tainted = false;
128458
128459 /**
128460 * Whether this is a stack variable.
128461 * @member {boolean} Variable#stack
128462 */
128463 this.stack = true;
128464
128465 /**
128466 * Reference to the enclosing Scope.
128467 * @member {Scope} Variable#scope
128468 */
128469 this.scope = scope;
128470 }
128471}
128472
128473Variable.CatchClause = "CatchClause";
128474Variable.Parameter = "Parameter";
128475Variable.FunctionName = "FunctionName";
128476Variable.ClassName = "ClassName";
128477Variable.Variable = "Variable";
128478Variable.ImportBinding = "ImportBinding";
128479Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable";
128480
128481module.exports = Variable;
128482
128483/* vim: set sw=4 ts=4 et tw=80 : */
128484
128485
128486/***/ }),
128487
128488/***/ 44670:
128489/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
128490
128491"use strict";
128492/*
128493 MIT License http://www.opensource.org/licenses/mit-license.php
128494 Author Tobias Koppers @sokra
128495*/
128496
128497
128498const Hook = __webpack_require__(88598);
128499const HookCodeFactory = __webpack_require__(66988);
128500
128501class AsyncParallelBailHookCodeFactory extends HookCodeFactory {
128502 content({ onError, onResult, onDone }) {
128503 let code = "";
128504 code += `var _results = new Array(${this.options.taps.length});\n`;
128505 code += "var _checkDone = () => {\n";
128506 code += "for(var i = 0; i < _results.length; i++) {\n";
128507 code += "var item = _results[i];\n";
128508 code += "if(item === undefined) return false;\n";
128509 code += "if(item.result !== undefined) {\n";
128510 code += onResult("item.result");
128511 code += "return true;\n";
128512 code += "}\n";
128513 code += "if(item.error) {\n";
128514 code += onError("item.error");
128515 code += "return true;\n";
128516 code += "}\n";
128517 code += "}\n";
128518 code += "return false;\n";
128519 code += "}\n";
128520 code += this.callTapsParallel({
128521 onError: (i, err, done, doneBreak) => {
128522 let code = "";
128523 code += `if(${i} < _results.length && ((_results.length = ${i +
128524 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`;
128525 code += doneBreak(true);
128526 code += "} else {\n";
128527 code += done();
128528 code += "}\n";
128529 return code;
128530 },
128531 onResult: (i, result, done, doneBreak) => {
128532 let code = "";
128533 code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i +
128534 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`;
128535 code += doneBreak(true);
128536 code += "} else {\n";
128537 code += done();
128538 code += "}\n";
128539 return code;
128540 },
128541 onTap: (i, run, done, doneBreak) => {
128542 let code = "";
128543 if (i > 0) {
128544 code += `if(${i} >= _results.length) {\n`;
128545 code += done();
128546 code += "} else {\n";
128547 }
128548 code += run();
128549 if (i > 0) code += "}\n";
128550 return code;
128551 },
128552 onDone
128553 });
128554 return code;
128555 }
128556}
128557
128558const factory = new AsyncParallelBailHookCodeFactory();
128559
128560class AsyncParallelBailHook extends Hook {
128561 compile(options) {
128562 factory.setup(this, options);
128563 return factory.create(options);
128564 }
128565}
128566
128567Object.defineProperties(AsyncParallelBailHook.prototype, {
128568 _call: { value: undefined, configurable: true, writable: true }
128569});
128570
128571module.exports = AsyncParallelBailHook;
128572
128573
128574/***/ }),
128575
128576/***/ 66079:
128577/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
128578
128579"use strict";
128580/*
128581 MIT License http://www.opensource.org/licenses/mit-license.php
128582 Author Tobias Koppers @sokra
128583*/
128584
128585
128586const Hook = __webpack_require__(88598);
128587const HookCodeFactory = __webpack_require__(66988);
128588
128589class AsyncParallelHookCodeFactory extends HookCodeFactory {
128590 content({ onError, onDone }) {
128591 return this.callTapsParallel({
128592 onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true),
128593 onDone
128594 });
128595 }
128596}
128597
128598const factory = new AsyncParallelHookCodeFactory();
128599
128600class AsyncParallelHook extends Hook {
128601 compile(options) {
128602 factory.setup(this, options);
128603 return factory.create(options);
128604 }
128605}
128606
128607Object.defineProperties(AsyncParallelHook.prototype, {
128608 _call: { value: undefined, configurable: true, writable: true }
128609});
128610
128611module.exports = AsyncParallelHook;
128612
128613
128614/***/ }),
128615
128616/***/ 28575:
128617/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
128618
128619"use strict";
128620/*
128621 MIT License http://www.opensource.org/licenses/mit-license.php
128622 Author Tobias Koppers @sokra
128623*/
128624
128625
128626const Hook = __webpack_require__(88598);
128627const HookCodeFactory = __webpack_require__(66988);
128628
128629class AsyncSeriesBailHookCodeFactory extends HookCodeFactory {
128630 content({ onError, onResult, resultReturns, onDone }) {
128631 return this.callTapsSeries({
128632 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
128633 onResult: (i, result, next) =>
128634 `if(${result} !== undefined) {\n${onResult(
128635 result
128636 )};\n} else {\n${next()}}\n`,
128637 resultReturns,
128638 onDone
128639 });
128640 }
128641}
128642
128643const factory = new AsyncSeriesBailHookCodeFactory();
128644
128645class AsyncSeriesBailHook extends Hook {
128646 compile(options) {
128647 factory.setup(this, options);
128648 return factory.create(options);
128649 }
128650}
128651
128652Object.defineProperties(AsyncSeriesBailHook.prototype, {
128653 _call: { value: undefined, configurable: true, writable: true }
128654});
128655
128656module.exports = AsyncSeriesBailHook;
128657
128658
128659/***/ }),
128660
128661/***/ 52215:
128662/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
128663
128664"use strict";
128665/*
128666 MIT License http://www.opensource.org/licenses/mit-license.php
128667 Author Tobias Koppers @sokra
128668*/
128669
128670
128671const Hook = __webpack_require__(88598);
128672const HookCodeFactory = __webpack_require__(66988);
128673
128674class AsyncSeriesHookCodeFactory extends HookCodeFactory {
128675 content({ onError, onDone }) {
128676 return this.callTapsSeries({
128677 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
128678 onDone
128679 });
128680 }
128681}
128682
128683const factory = new AsyncSeriesHookCodeFactory();
128684
128685class AsyncSeriesHook extends Hook {
128686 compile(options) {
128687 factory.setup(this, options);
128688 return factory.create(options);
128689 }
128690}
128691
128692Object.defineProperties(AsyncSeriesHook.prototype, {
128693 _call: { value: undefined, configurable: true, writable: true }
128694});
128695
128696module.exports = AsyncSeriesHook;
128697
128698
128699/***/ }),
128700
128701/***/ 44065:
128702/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
128703
128704"use strict";
128705/*
128706 MIT License http://www.opensource.org/licenses/mit-license.php
128707 Author Tobias Koppers @sokra
128708*/
128709
128710
128711const Hook = __webpack_require__(88598);
128712const HookCodeFactory = __webpack_require__(66988);
128713
128714class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory {
128715 content({ onError, onResult, onDone }) {
128716 return this.callTapsSeries({
128717 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
128718 onResult: (i, result, next) => {
128719 let code = "";
128720 code += `if(${result} !== undefined) {\n`;
128721 code += `${this._args[0]} = ${result};\n`;
128722 code += `}\n`;
128723 code += next();
128724 return code;
128725 },
128726 onDone: () => onResult(this._args[0])
128727 });
128728 }
128729}
128730
128731const factory = new AsyncSeriesWaterfallHookCodeFactory();
128732
128733class AsyncSeriesWaterfallHook extends Hook {
128734 constructor(args) {
128735 super(args);
128736 if (args.length < 1)
128737 throw new Error("Waterfall hooks must have at least one argument");
128738 }
128739
128740 compile(options) {
128741 factory.setup(this, options);
128742 return factory.create(options);
128743 }
128744}
128745
128746Object.defineProperties(AsyncSeriesWaterfallHook.prototype, {
128747 _call: { value: undefined, configurable: true, writable: true }
128748});
128749
128750module.exports = AsyncSeriesWaterfallHook;
128751
128752
128753/***/ }),
128754
128755/***/ 88598:
128756/***/ (function(module) {
128757
128758"use strict";
128759/*
128760 MIT License http://www.opensource.org/licenses/mit-license.php
128761 Author Tobias Koppers @sokra
128762*/
128763
128764
128765class Hook {
128766 constructor(args) {
128767 if (!Array.isArray(args)) args = [];
128768 this._args = args;
128769 this.taps = [];
128770 this.interceptors = [];
128771 this.call = this._call;
128772 this.promise = this._promise;
128773 this.callAsync = this._callAsync;
128774 this._x = undefined;
128775 }
128776
128777 compile(options) {
128778 throw new Error("Abstract: should be overriden");
128779 }
128780
128781 _createCall(type) {
128782 return this.compile({
128783 taps: this.taps,
128784 interceptors: this.interceptors,
128785 args: this._args,
128786 type: type
128787 });
128788 }
128789
128790 tap(options, fn) {
128791 if (typeof options === "string") options = { name: options };
128792 if (typeof options !== "object" || options === null)
128793 throw new Error(
128794 "Invalid arguments to tap(options: Object, fn: function)"
128795 );
128796 options = Object.assign({ type: "sync", fn: fn }, options);
128797 if (typeof options.name !== "string" || options.name === "")
128798 throw new Error("Missing name for tap");
128799 options = this._runRegisterInterceptors(options);
128800 this._insert(options);
128801 }
128802
128803 tapAsync(options, fn) {
128804 if (typeof options === "string") options = { name: options };
128805 if (typeof options !== "object" || options === null)
128806 throw new Error(
128807 "Invalid arguments to tapAsync(options: Object, fn: function)"
128808 );
128809 options = Object.assign({ type: "async", fn: fn }, options);
128810 if (typeof options.name !== "string" || options.name === "")
128811 throw new Error("Missing name for tapAsync");
128812 options = this._runRegisterInterceptors(options);
128813 this._insert(options);
128814 }
128815
128816 tapPromise(options, fn) {
128817 if (typeof options === "string") options = { name: options };
128818 if (typeof options !== "object" || options === null)
128819 throw new Error(
128820 "Invalid arguments to tapPromise(options: Object, fn: function)"
128821 );
128822 options = Object.assign({ type: "promise", fn: fn }, options);
128823 if (typeof options.name !== "string" || options.name === "")
128824 throw new Error("Missing name for tapPromise");
128825 options = this._runRegisterInterceptors(options);
128826 this._insert(options);
128827 }
128828
128829 _runRegisterInterceptors(options) {
128830 for (const interceptor of this.interceptors) {
128831 if (interceptor.register) {
128832 const newOptions = interceptor.register(options);
128833 if (newOptions !== undefined) options = newOptions;
128834 }
128835 }
128836 return options;
128837 }
128838
128839 withOptions(options) {
128840 const mergeOptions = opt =>
128841 Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt);
128842
128843 // Prevent creating endless prototype chains
128844 options = Object.assign({}, options, this._withOptions);
128845 const base = this._withOptionsBase || this;
128846 const newHook = Object.create(base);
128847
128848 (newHook.tapAsync = (opt, fn) => base.tapAsync(mergeOptions(opt), fn)),
128849 (newHook.tap = (opt, fn) => base.tap(mergeOptions(opt), fn));
128850 newHook.tapPromise = (opt, fn) => base.tapPromise(mergeOptions(opt), fn);
128851 newHook._withOptions = options;
128852 newHook._withOptionsBase = base;
128853 return newHook;
128854 }
128855
128856 isUsed() {
128857 return this.taps.length > 0 || this.interceptors.length > 0;
128858 }
128859
128860 intercept(interceptor) {
128861 this._resetCompilation();
128862 this.interceptors.push(Object.assign({}, interceptor));
128863 if (interceptor.register) {
128864 for (let i = 0; i < this.taps.length; i++)
128865 this.taps[i] = interceptor.register(this.taps[i]);
128866 }
128867 }
128868
128869 _resetCompilation() {
128870 this.call = this._call;
128871 this.callAsync = this._callAsync;
128872 this.promise = this._promise;
128873 }
128874
128875 _insert(item) {
128876 this._resetCompilation();
128877 let before;
128878 if (typeof item.before === "string") before = new Set([item.before]);
128879 else if (Array.isArray(item.before)) {
128880 before = new Set(item.before);
128881 }
128882 let stage = 0;
128883 if (typeof item.stage === "number") stage = item.stage;
128884 let i = this.taps.length;
128885 while (i > 0) {
128886 i--;
128887 const x = this.taps[i];
128888 this.taps[i + 1] = x;
128889 const xStage = x.stage || 0;
128890 if (before) {
128891 if (before.has(x.name)) {
128892 before.delete(x.name);
128893 continue;
128894 }
128895 if (before.size > 0) {
128896 continue;
128897 }
128898 }
128899 if (xStage > stage) {
128900 continue;
128901 }
128902 i++;
128903 break;
128904 }
128905 this.taps[i] = item;
128906 }
128907}
128908
128909function createCompileDelegate(name, type) {
128910 return function lazyCompileHook(...args) {
128911 this[name] = this._createCall(type);
128912 return this[name](...args);
128913 };
128914}
128915
128916Object.defineProperties(Hook.prototype, {
128917 _call: {
128918 value: createCompileDelegate("call", "sync"),
128919 configurable: true,
128920 writable: true
128921 },
128922 _promise: {
128923 value: createCompileDelegate("promise", "promise"),
128924 configurable: true,
128925 writable: true
128926 },
128927 _callAsync: {
128928 value: createCompileDelegate("callAsync", "async"),
128929 configurable: true,
128930 writable: true
128931 }
128932});
128933
128934module.exports = Hook;
128935
128936
128937/***/ }),
128938
128939/***/ 66988:
128940/***/ (function(module) {
128941
128942"use strict";
128943/*
128944 MIT License http://www.opensource.org/licenses/mit-license.php
128945 Author Tobias Koppers @sokra
128946*/
128947
128948
128949class HookCodeFactory {
128950 constructor(config) {
128951 this.config = config;
128952 this.options = undefined;
128953 this._args = undefined;
128954 }
128955
128956 create(options) {
128957 this.init(options);
128958 let fn;
128959 switch (this.options.type) {
128960 case "sync":
128961 fn = new Function(
128962 this.args(),
128963 '"use strict";\n' +
128964 this.header() +
128965 this.content({
128966 onError: err => `throw ${err};\n`,
128967 onResult: result => `return ${result};\n`,
128968 resultReturns: true,
128969 onDone: () => "",
128970 rethrowIfPossible: true
128971 })
128972 );
128973 break;
128974 case "async":
128975 fn = new Function(
128976 this.args({
128977 after: "_callback"
128978 }),
128979 '"use strict";\n' +
128980 this.header() +
128981 this.content({
128982 onError: err => `_callback(${err});\n`,
128983 onResult: result => `_callback(null, ${result});\n`,
128984 onDone: () => "_callback();\n"
128985 })
128986 );
128987 break;
128988 case "promise":
128989 let errorHelperUsed = false;
128990 const content = this.content({
128991 onError: err => {
128992 errorHelperUsed = true;
128993 return `_error(${err});\n`;
128994 },
128995 onResult: result => `_resolve(${result});\n`,
128996 onDone: () => "_resolve();\n"
128997 });
128998 let code = "";
128999 code += '"use strict";\n';
129000 code += "return new Promise((_resolve, _reject) => {\n";
129001 if (errorHelperUsed) {
129002 code += "var _sync = true;\n";
129003 code += "function _error(_err) {\n";
129004 code += "if(_sync)\n";
129005 code += "_resolve(Promise.resolve().then(() => { throw _err; }));\n";
129006 code += "else\n";
129007 code += "_reject(_err);\n";
129008 code += "};\n";
129009 }
129010 code += this.header();
129011 code += content;
129012 if (errorHelperUsed) {
129013 code += "_sync = false;\n";
129014 }
129015 code += "});\n";
129016 fn = new Function(this.args(), code);
129017 break;
129018 }
129019 this.deinit();
129020 return fn;
129021 }
129022
129023 setup(instance, options) {
129024 instance._x = options.taps.map(t => t.fn);
129025 }
129026
129027 /**
129028 * @param {{ type: "sync" | "promise" | "async", taps: Array<Tap>, interceptors: Array<Interceptor> }} options
129029 */
129030 init(options) {
129031 this.options = options;
129032 this._args = options.args.slice();
129033 }
129034
129035 deinit() {
129036 this.options = undefined;
129037 this._args = undefined;
129038 }
129039
129040 header() {
129041 let code = "";
129042 if (this.needContext()) {
129043 code += "var _context = {};\n";
129044 } else {
129045 code += "var _context;\n";
129046 }
129047 code += "var _x = this._x;\n";
129048 if (this.options.interceptors.length > 0) {
129049 code += "var _taps = this.taps;\n";
129050 code += "var _interceptors = this.interceptors;\n";
129051 }
129052 for (let i = 0; i < this.options.interceptors.length; i++) {
129053 const interceptor = this.options.interceptors[i];
129054 if (interceptor.call) {
129055 code += `${this.getInterceptor(i)}.call(${this.args({
129056 before: interceptor.context ? "_context" : undefined
129057 })});\n`;
129058 }
129059 }
129060 return code;
129061 }
129062
129063 needContext() {
129064 for (const tap of this.options.taps) if (tap.context) return true;
129065 return false;
129066 }
129067
129068 callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) {
129069 let code = "";
129070 let hasTapCached = false;
129071 for (let i = 0; i < this.options.interceptors.length; i++) {
129072 const interceptor = this.options.interceptors[i];
129073 if (interceptor.tap) {
129074 if (!hasTapCached) {
129075 code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`;
129076 hasTapCached = true;
129077 }
129078 code += `${this.getInterceptor(i)}.tap(${
129079 interceptor.context ? "_context, " : ""
129080 }_tap${tapIndex});\n`;
129081 }
129082 }
129083 code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`;
129084 const tap = this.options.taps[tapIndex];
129085 switch (tap.type) {
129086 case "sync":
129087 if (!rethrowIfPossible) {
129088 code += `var _hasError${tapIndex} = false;\n`;
129089 code += "try {\n";
129090 }
129091 if (onResult) {
129092 code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({
129093 before: tap.context ? "_context" : undefined
129094 })});\n`;
129095 } else {
129096 code += `_fn${tapIndex}(${this.args({
129097 before: tap.context ? "_context" : undefined
129098 })});\n`;
129099 }
129100 if (!rethrowIfPossible) {
129101 code += "} catch(_err) {\n";
129102 code += `_hasError${tapIndex} = true;\n`;
129103 code += onError("_err");
129104 code += "}\n";
129105 code += `if(!_hasError${tapIndex}) {\n`;
129106 }
129107 if (onResult) {
129108 code += onResult(`_result${tapIndex}`);
129109 }
129110 if (onDone) {
129111 code += onDone();
129112 }
129113 if (!rethrowIfPossible) {
129114 code += "}\n";
129115 }
129116 break;
129117 case "async":
129118 let cbCode = "";
129119 if (onResult) cbCode += `(_err${tapIndex}, _result${tapIndex}) => {\n`;
129120 else cbCode += `_err${tapIndex} => {\n`;
129121 cbCode += `if(_err${tapIndex}) {\n`;
129122 cbCode += onError(`_err${tapIndex}`);
129123 cbCode += "} else {\n";
129124 if (onResult) {
129125 cbCode += onResult(`_result${tapIndex}`);
129126 }
129127 if (onDone) {
129128 cbCode += onDone();
129129 }
129130 cbCode += "}\n";
129131 cbCode += "}";
129132 code += `_fn${tapIndex}(${this.args({
129133 before: tap.context ? "_context" : undefined,
129134 after: cbCode
129135 })});\n`;
129136 break;
129137 case "promise":
129138 code += `var _hasResult${tapIndex} = false;\n`;
129139 code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({
129140 before: tap.context ? "_context" : undefined
129141 })});\n`;
129142 code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`;
129143 code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`;
129144 code += `_promise${tapIndex}.then(_result${tapIndex} => {\n`;
129145 code += `_hasResult${tapIndex} = true;\n`;
129146 if (onResult) {
129147 code += onResult(`_result${tapIndex}`);
129148 }
129149 if (onDone) {
129150 code += onDone();
129151 }
129152 code += `}, _err${tapIndex} => {\n`;
129153 code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`;
129154 code += onError(`_err${tapIndex}`);
129155 code += "});\n";
129156 break;
129157 }
129158 return code;
129159 }
129160
129161 callTapsSeries({
129162 onError,
129163 onResult,
129164 resultReturns,
129165 onDone,
129166 doneReturns,
129167 rethrowIfPossible
129168 }) {
129169 if (this.options.taps.length === 0) return onDone();
129170 const firstAsync = this.options.taps.findIndex(t => t.type !== "sync");
129171 const somethingReturns = resultReturns || doneReturns || false;
129172 let code = "";
129173 let current = onDone;
129174 for (let j = this.options.taps.length - 1; j >= 0; j--) {
129175 const i = j;
129176 const unroll = current !== onDone && this.options.taps[i].type !== "sync";
129177 if (unroll) {
129178 code += `function _next${i}() {\n`;
129179 code += current();
129180 code += `}\n`;
129181 current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`;
129182 }
129183 const done = current;
129184 const doneBreak = skipDone => {
129185 if (skipDone) return "";
129186 return onDone();
129187 };
129188 const content = this.callTap(i, {
129189 onError: error => onError(i, error, done, doneBreak),
129190 onResult:
129191 onResult &&
129192 (result => {
129193 return onResult(i, result, done, doneBreak);
129194 }),
129195 onDone: !onResult && done,
129196 rethrowIfPossible:
129197 rethrowIfPossible && (firstAsync < 0 || i < firstAsync)
129198 });
129199 current = () => content;
129200 }
129201 code += current();
129202 return code;
129203 }
129204
129205 callTapsLooping({ onError, onDone, rethrowIfPossible }) {
129206 if (this.options.taps.length === 0) return onDone();
129207 const syncOnly = this.options.taps.every(t => t.type === "sync");
129208 let code = "";
129209 if (!syncOnly) {
129210 code += "var _looper = () => {\n";
129211 code += "var _loopAsync = false;\n";
129212 }
129213 code += "var _loop;\n";
129214 code += "do {\n";
129215 code += "_loop = false;\n";
129216 for (let i = 0; i < this.options.interceptors.length; i++) {
129217 const interceptor = this.options.interceptors[i];
129218 if (interceptor.loop) {
129219 code += `${this.getInterceptor(i)}.loop(${this.args({
129220 before: interceptor.context ? "_context" : undefined
129221 })});\n`;
129222 }
129223 }
129224 code += this.callTapsSeries({
129225 onError,
129226 onResult: (i, result, next, doneBreak) => {
129227 let code = "";
129228 code += `if(${result} !== undefined) {\n`;
129229 code += "_loop = true;\n";
129230 if (!syncOnly) code += "if(_loopAsync) _looper();\n";
129231 code += doneBreak(true);
129232 code += `} else {\n`;
129233 code += next();
129234 code += `}\n`;
129235 return code;
129236 },
129237 onDone:
129238 onDone &&
129239 (() => {
129240 let code = "";
129241 code += "if(!_loop) {\n";
129242 code += onDone();
129243 code += "}\n";
129244 return code;
129245 }),
129246 rethrowIfPossible: rethrowIfPossible && syncOnly
129247 });
129248 code += "} while(_loop);\n";
129249 if (!syncOnly) {
129250 code += "_loopAsync = true;\n";
129251 code += "};\n";
129252 code += "_looper();\n";
129253 }
129254 return code;
129255 }
129256
129257 callTapsParallel({
129258 onError,
129259 onResult,
129260 onDone,
129261 rethrowIfPossible,
129262 onTap = (i, run) => run()
129263 }) {
129264 if (this.options.taps.length <= 1) {
129265 return this.callTapsSeries({
129266 onError,
129267 onResult,
129268 onDone,
129269 rethrowIfPossible
129270 });
129271 }
129272 let code = "";
129273 code += "do {\n";
129274 code += `var _counter = ${this.options.taps.length};\n`;
129275 if (onDone) {
129276 code += "var _done = () => {\n";
129277 code += onDone();
129278 code += "};\n";
129279 }
129280 for (let i = 0; i < this.options.taps.length; i++) {
129281 const done = () => {
129282 if (onDone) return "if(--_counter === 0) _done();\n";
129283 else return "--_counter;";
129284 };
129285 const doneBreak = skipDone => {
129286 if (skipDone || !onDone) return "_counter = 0;\n";
129287 else return "_counter = 0;\n_done();\n";
129288 };
129289 code += "if(_counter <= 0) break;\n";
129290 code += onTap(
129291 i,
129292 () =>
129293 this.callTap(i, {
129294 onError: error => {
129295 let code = "";
129296 code += "if(_counter > 0) {\n";
129297 code += onError(i, error, done, doneBreak);
129298 code += "}\n";
129299 return code;
129300 },
129301 onResult:
129302 onResult &&
129303 (result => {
129304 let code = "";
129305 code += "if(_counter > 0) {\n";
129306 code += onResult(i, result, done, doneBreak);
129307 code += "}\n";
129308 return code;
129309 }),
129310 onDone:
129311 !onResult &&
129312 (() => {
129313 return done();
129314 }),
129315 rethrowIfPossible
129316 }),
129317 done,
129318 doneBreak
129319 );
129320 }
129321 code += "} while(false);\n";
129322 return code;
129323 }
129324
129325 args({ before, after } = {}) {
129326 let allArgs = this._args;
129327 if (before) allArgs = [before].concat(allArgs);
129328 if (after) allArgs = allArgs.concat(after);
129329 if (allArgs.length === 0) {
129330 return "";
129331 } else {
129332 return allArgs.join(", ");
129333 }
129334 }
129335
129336 getTapFn(idx) {
129337 return `_x[${idx}]`;
129338 }
129339
129340 getTap(idx) {
129341 return `_taps[${idx}]`;
129342 }
129343
129344 getInterceptor(idx) {
129345 return `_interceptors[${idx}]`;
129346 }
129347}
129348
129349module.exports = HookCodeFactory;
129350
129351
129352/***/ }),
129353
129354/***/ 25154:
129355/***/ (function(module) {
129356
129357"use strict";
129358/*
129359 MIT License http://www.opensource.org/licenses/mit-license.php
129360 Author Tobias Koppers @sokra
129361*/
129362
129363
129364class HookMap {
129365 constructor(factory) {
129366 this._map = new Map();
129367 this._factory = factory;
129368 this._interceptors = [];
129369 }
129370
129371 get(key) {
129372 return this._map.get(key);
129373 }
129374
129375 for(key) {
129376 const hook = this.get(key);
129377 if (hook !== undefined) {
129378 return hook;
129379 }
129380 let newHook = this._factory(key);
129381 const interceptors = this._interceptors;
129382 for (let i = 0; i < interceptors.length; i++) {
129383 newHook = interceptors[i].factory(key, newHook);
129384 }
129385 this._map.set(key, newHook);
129386 return newHook;
129387 }
129388
129389 intercept(interceptor) {
129390 this._interceptors.push(
129391 Object.assign(
129392 {
129393 factory: (key, hook) => hook
129394 },
129395 interceptor
129396 )
129397 );
129398 }
129399
129400 tap(key, options, fn) {
129401 return this.for(key).tap(options, fn);
129402 }
129403
129404 tapAsync(key, options, fn) {
129405 return this.for(key).tapAsync(options, fn);
129406 }
129407
129408 tapPromise(key, options, fn) {
129409 return this.for(key).tapPromise(options, fn);
129410 }
129411}
129412
129413module.exports = HookMap;
129414
129415
129416/***/ }),
129417
129418/***/ 69724:
129419/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129420
129421"use strict";
129422/*
129423 MIT License http://www.opensource.org/licenses/mit-license.php
129424 Author Tobias Koppers @sokra
129425*/
129426
129427
129428const Hook = __webpack_require__(88598);
129429
129430class MultiHook {
129431 constructor(hooks) {
129432 this.hooks = hooks;
129433 }
129434
129435 tap(options, fn) {
129436 for (const hook of this.hooks) {
129437 hook.tap(options, fn);
129438 }
129439 }
129440
129441 tapAsync(options, fn) {
129442 for (const hook of this.hooks) {
129443 hook.tapAsync(options, fn);
129444 }
129445 }
129446
129447 tapPromise(options, fn) {
129448 for (const hook of this.hooks) {
129449 hook.tapPromise(options, fn);
129450 }
129451 }
129452
129453 isUsed() {
129454 for (const hook of this.hooks) {
129455 if (hook.isUsed()) return true;
129456 }
129457 return false;
129458 }
129459
129460 intercept(interceptor) {
129461 for (const hook of this.hooks) {
129462 hook.intercept(interceptor);
129463 }
129464 }
129465
129466 withOptions(options) {
129467 return new MultiHook(this.hooks.map(h => h.withOptions(options)));
129468 }
129469}
129470
129471module.exports = MultiHook;
129472
129473
129474/***/ }),
129475
129476/***/ 89035:
129477/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129478
129479"use strict";
129480/*
129481 MIT License http://www.opensource.org/licenses/mit-license.php
129482 Author Tobias Koppers @sokra
129483*/
129484
129485
129486const Hook = __webpack_require__(88598);
129487const HookCodeFactory = __webpack_require__(66988);
129488
129489class SyncBailHookCodeFactory extends HookCodeFactory {
129490 content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) {
129491 return this.callTapsSeries({
129492 onError: (i, err) => onError(err),
129493 onResult: (i, result, next) =>
129494 `if(${result} !== undefined) {\n${onResult(
129495 result
129496 )};\n} else {\n${next()}}\n`,
129497 resultReturns,
129498 onDone,
129499 rethrowIfPossible
129500 });
129501 }
129502}
129503
129504const factory = new SyncBailHookCodeFactory();
129505
129506class SyncBailHook extends Hook {
129507 tapAsync() {
129508 throw new Error("tapAsync is not supported on a SyncBailHook");
129509 }
129510
129511 tapPromise() {
129512 throw new Error("tapPromise is not supported on a SyncBailHook");
129513 }
129514
129515 compile(options) {
129516 factory.setup(this, options);
129517 return factory.create(options);
129518 }
129519}
129520
129521module.exports = SyncBailHook;
129522
129523
129524/***/ }),
129525
129526/***/ 68652:
129527/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129528
129529"use strict";
129530/*
129531 MIT License http://www.opensource.org/licenses/mit-license.php
129532 Author Tobias Koppers @sokra
129533*/
129534
129535
129536const Hook = __webpack_require__(88598);
129537const HookCodeFactory = __webpack_require__(66988);
129538
129539class SyncHookCodeFactory extends HookCodeFactory {
129540 content({ onError, onDone, rethrowIfPossible }) {
129541 return this.callTapsSeries({
129542 onError: (i, err) => onError(err),
129543 onDone,
129544 rethrowIfPossible
129545 });
129546 }
129547}
129548
129549const factory = new SyncHookCodeFactory();
129550
129551class SyncHook extends Hook {
129552 tapAsync() {
129553 throw new Error("tapAsync is not supported on a SyncHook");
129554 }
129555
129556 tapPromise() {
129557 throw new Error("tapPromise is not supported on a SyncHook");
129558 }
129559
129560 compile(options) {
129561 factory.setup(this, options);
129562 return factory.create(options);
129563 }
129564}
129565
129566module.exports = SyncHook;
129567
129568
129569/***/ }),
129570
129571/***/ 26020:
129572/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129573
129574"use strict";
129575/*
129576 MIT License http://www.opensource.org/licenses/mit-license.php
129577 Author Tobias Koppers @sokra
129578*/
129579
129580
129581const Hook = __webpack_require__(88598);
129582const HookCodeFactory = __webpack_require__(66988);
129583
129584class SyncLoopHookCodeFactory extends HookCodeFactory {
129585 content({ onError, onDone, rethrowIfPossible }) {
129586 return this.callTapsLooping({
129587 onError: (i, err) => onError(err),
129588 onDone,
129589 rethrowIfPossible
129590 });
129591 }
129592}
129593
129594const factory = new SyncLoopHookCodeFactory();
129595
129596class SyncLoopHook extends Hook {
129597 tapAsync() {
129598 throw new Error("tapAsync is not supported on a SyncLoopHook");
129599 }
129600
129601 tapPromise() {
129602 throw new Error("tapPromise is not supported on a SyncLoopHook");
129603 }
129604
129605 compile(options) {
129606 factory.setup(this, options);
129607 return factory.create(options);
129608 }
129609}
129610
129611module.exports = SyncLoopHook;
129612
129613
129614/***/ }),
129615
129616/***/ 68726:
129617/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129618
129619"use strict";
129620/*
129621 MIT License http://www.opensource.org/licenses/mit-license.php
129622 Author Tobias Koppers @sokra
129623*/
129624
129625
129626const Hook = __webpack_require__(88598);
129627const HookCodeFactory = __webpack_require__(66988);
129628
129629class SyncWaterfallHookCodeFactory extends HookCodeFactory {
129630 content({ onError, onResult, resultReturns, rethrowIfPossible }) {
129631 return this.callTapsSeries({
129632 onError: (i, err) => onError(err),
129633 onResult: (i, result, next) => {
129634 let code = "";
129635 code += `if(${result} !== undefined) {\n`;
129636 code += `${this._args[0]} = ${result};\n`;
129637 code += `}\n`;
129638 code += next();
129639 return code;
129640 },
129641 onDone: () => onResult(this._args[0]),
129642 doneReturns: resultReturns,
129643 rethrowIfPossible
129644 });
129645 }
129646}
129647
129648const factory = new SyncWaterfallHookCodeFactory();
129649
129650class SyncWaterfallHook extends Hook {
129651 constructor(args) {
129652 super(args);
129653 if (args.length < 1)
129654 throw new Error("Waterfall hooks must have at least one argument");
129655 }
129656
129657 tapAsync() {
129658 throw new Error("tapAsync is not supported on a SyncWaterfallHook");
129659 }
129660
129661 tapPromise() {
129662 throw new Error("tapPromise is not supported on a SyncWaterfallHook");
129663 }
129664
129665 compile(options) {
129666 factory.setup(this, options);
129667 return factory.create(options);
129668 }
129669}
129670
129671module.exports = SyncWaterfallHook;
129672
129673
129674/***/ }),
129675
129676/***/ 21960:
129677/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129678
129679"use strict";
129680/*
129681 MIT License http://www.opensource.org/licenses/mit-license.php
129682 Author Tobias Koppers @sokra
129683*/
129684
129685
129686const util = __webpack_require__(31669);
129687const SyncBailHook = __webpack_require__(89035);
129688
129689function Tapable() {
129690 this._pluginCompat = new SyncBailHook(["options"]);
129691 this._pluginCompat.tap(
129692 {
129693 name: "Tapable camelCase",
129694 stage: 100
129695 },
129696 options => {
129697 options.names.add(
129698 options.name.replace(/[- ]([a-z])/g, (str, ch) => ch.toUpperCase())
129699 );
129700 }
129701 );
129702 this._pluginCompat.tap(
129703 {
129704 name: "Tapable this.hooks",
129705 stage: 200
129706 },
129707 options => {
129708 let hook;
129709 for (const name of options.names) {
129710 hook = this.hooks[name];
129711 if (hook !== undefined) {
129712 break;
129713 }
129714 }
129715 if (hook !== undefined) {
129716 const tapOpt = {
129717 name: options.fn.name || "unnamed compat plugin",
129718 stage: options.stage || 0
129719 };
129720 if (options.async) hook.tapAsync(tapOpt, options.fn);
129721 else hook.tap(tapOpt, options.fn);
129722 return true;
129723 }
129724 }
129725 );
129726}
129727module.exports = Tapable;
129728
129729Tapable.addCompatLayer = function addCompatLayer(instance) {
129730 Tapable.call(instance);
129731 instance.plugin = Tapable.prototype.plugin;
129732 instance.apply = Tapable.prototype.apply;
129733};
129734
129735Tapable.prototype.plugin = util.deprecate(function plugin(name, fn) {
129736 if (Array.isArray(name)) {
129737 name.forEach(function(name) {
129738 this.plugin(name, fn);
129739 }, this);
129740 return;
129741 }
129742 const result = this._pluginCompat.call({
129743 name: name,
129744 fn: fn,
129745 names: new Set([name])
129746 });
129747 if (!result) {
129748 throw new Error(
129749 `Plugin could not be registered at '${name}'. Hook was not found.\n` +
129750 "BREAKING CHANGE: There need to exist a hook at 'this.hooks'. " +
129751 "To create a compatibility layer for this hook, hook into 'this._pluginCompat'."
129752 );
129753 }
129754}, "Tapable.plugin is deprecated. Use new API on `.hooks` instead");
129755
129756Tapable.prototype.apply = util.deprecate(function apply() {
129757 for (var i = 0; i < arguments.length; i++) {
129758 arguments[i].apply(this);
129759 }
129760}, "Tapable.apply is deprecated. Call apply on the plugin directly instead");
129761
129762
129763/***/ }),
129764
129765/***/ 56758:
129766/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
129767
129768"use strict";
129769/*
129770 MIT License http://www.opensource.org/licenses/mit-license.php
129771 Author Tobias Koppers @sokra
129772*/
129773
129774
129775exports.__esModule = true;
129776exports.Tapable = __webpack_require__(21960);
129777exports.SyncHook = __webpack_require__(68652);
129778exports.SyncBailHook = __webpack_require__(89035);
129779exports.SyncWaterfallHook = __webpack_require__(68726);
129780exports.SyncLoopHook = __webpack_require__(26020);
129781exports.AsyncParallelHook = __webpack_require__(66079);
129782exports.AsyncParallelBailHook = __webpack_require__(44670);
129783exports.AsyncSeriesHook = __webpack_require__(52215);
129784exports.AsyncSeriesBailHook = __webpack_require__(28575);
129785exports.AsyncSeriesWaterfallHook = __webpack_require__(44065);
129786exports.HookMap = __webpack_require__(25154);
129787exports.MultiHook = __webpack_require__(69724);
129788
129789
129790/***/ }),
129791
129792/***/ 62856:
129793/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
129794
129795"use strict";
129796/*
129797 MIT License http://www.opensource.org/licenses/mit-license.php
129798 Author Tobias Koppers @sokra
129799*/
129800
129801
129802var EventEmitter = __webpack_require__(28614).EventEmitter;
129803var async = __webpack_require__(36386);
129804var chokidar = __webpack_require__(93253);
129805var fs = __webpack_require__(82161);
129806var path = __webpack_require__(85622);
129807
129808var watcherManager = __webpack_require__(35093);
129809
129810var FS_ACCURACY = 1000;
129811
129812
129813function withoutCase(str) {
129814 return str.toLowerCase();
129815}
129816
129817
129818function Watcher(directoryWatcher, filePath, startTime) {
129819 EventEmitter.call(this);
129820 this.directoryWatcher = directoryWatcher;
129821 this.path = filePath;
129822 this.startTime = startTime && +startTime;
129823 // TODO this.data seem to be only read, weird
129824 this.data = 0;
129825}
129826
129827Watcher.prototype = Object.create(EventEmitter.prototype);
129828Watcher.prototype.constructor = Watcher;
129829
129830Watcher.prototype.checkStartTime = function checkStartTime(mtime, initial) {
129831 if(typeof this.startTime !== "number") return !initial;
129832 var startTime = this.startTime;
129833 return startTime <= mtime;
129834};
129835
129836Watcher.prototype.close = function close() {
129837 this.emit("closed");
129838};
129839
129840
129841function DirectoryWatcher(directoryPath, options) {
129842 EventEmitter.call(this);
129843 this.options = options;
129844 this.path = directoryPath;
129845 this.files = Object.create(null);
129846 this.directories = Object.create(null);
129847 var interval = typeof options.poll === "number" ? options.poll : undefined;
129848 this.watcher = chokidar.watch(directoryPath, {
129849 ignoreInitial: true,
129850 persistent: true,
129851 followSymlinks: false,
129852 depth: 0,
129853 atomic: false,
129854 alwaysStat: true,
129855 ignorePermissionErrors: true,
129856 ignored: options.ignored,
129857 usePolling: options.poll ? true : undefined,
129858 interval: interval,
129859 binaryInterval: interval,
129860 disableGlobbing: true
129861 });
129862 this.watcher.on("add", this.onFileAdded.bind(this));
129863 this.watcher.on("addDir", this.onDirectoryAdded.bind(this));
129864 this.watcher.on("change", this.onChange.bind(this));
129865 this.watcher.on("unlink", this.onFileUnlinked.bind(this));
129866 this.watcher.on("unlinkDir", this.onDirectoryUnlinked.bind(this));
129867 this.watcher.on("error", this.onWatcherError.bind(this));
129868 this.initialScan = true;
129869 this.nestedWatching = false;
129870 this.initialScanRemoved = [];
129871 this.doInitialScan();
129872 this.watchers = Object.create(null);
129873 this.parentWatcher = null;
129874 this.refs = 0;
129875}
129876module.exports = DirectoryWatcher;
129877
129878DirectoryWatcher.prototype = Object.create(EventEmitter.prototype);
129879DirectoryWatcher.prototype.constructor = DirectoryWatcher;
129880
129881DirectoryWatcher.prototype.setFileTime = function setFileTime(filePath, mtime, initial, type) {
129882 var now = Date.now();
129883 var old = this.files[filePath];
129884
129885 this.files[filePath] = [initial ? Math.min(now, mtime) : now, mtime];
129886
129887 // we add the fs accuracy to reach the maximum possible mtime
129888 if(mtime)
129889 mtime = mtime + FS_ACCURACY;
129890
129891 if(!old) {
129892 if(mtime) {
129893 if(this.watchers[withoutCase(filePath)]) {
129894 this.watchers[withoutCase(filePath)].forEach(function(w) {
129895 if(!initial || w.checkStartTime(mtime, initial)) {
129896 w.emit("change", mtime, initial ? "initial" : type);
129897 }
129898 });
129899 }
129900 }
129901 } else if(!initial && mtime) {
129902 if(this.watchers[withoutCase(filePath)]) {
129903 this.watchers[withoutCase(filePath)].forEach(function(w) {
129904 w.emit("change", mtime, type);
129905 });
129906 }
129907 } else if(!initial && !mtime) {
129908 if(this.watchers[withoutCase(filePath)]) {
129909 this.watchers[withoutCase(filePath)].forEach(function(w) {
129910 w.emit("remove", type);
129911 });
129912 }
129913 }
129914 if(this.watchers[withoutCase(this.path)]) {
129915 this.watchers[withoutCase(this.path)].forEach(function(w) {
129916 if(!initial || w.checkStartTime(mtime, initial)) {
129917 w.emit("change", filePath, mtime, initial ? "initial" : type);
129918 }
129919 });
129920 }
129921};
129922
129923DirectoryWatcher.prototype.setDirectory = function setDirectory(directoryPath, exist, initial, type) {
129924 if(directoryPath === this.path) {
129925 if(!initial && this.watchers[withoutCase(this.path)]) {
129926 this.watchers[withoutCase(this.path)].forEach(function(w) {
129927 w.emit("change", directoryPath, w.data, initial ? "initial" : type);
129928 });
129929 }
129930 } else {
129931 var old = this.directories[directoryPath];
129932 if(!old) {
129933 if(exist) {
129934 if(this.nestedWatching) {
129935 this.createNestedWatcher(directoryPath);
129936 } else {
129937 this.directories[directoryPath] = true;
129938 }
129939 if(!initial && this.watchers[withoutCase(this.path)]) {
129940 this.watchers[withoutCase(this.path)].forEach(function(w) {
129941 w.emit("change", directoryPath, w.data, initial ? "initial" : type);
129942 });
129943 }
129944 if(this.watchers[withoutCase(directoryPath) + "#directory"]) {
129945 this.watchers[withoutCase(directoryPath) + "#directory"].forEach(function(w) {
129946 w.emit("change", w.data, initial ? "initial" : type);
129947 });
129948 }
129949 }
129950 } else {
129951 if(!exist) {
129952 if(this.nestedWatching)
129953 this.directories[directoryPath].close();
129954 delete this.directories[directoryPath];
129955 if(!initial && this.watchers[withoutCase(this.path)]) {
129956 this.watchers[withoutCase(this.path)].forEach(function(w) {
129957 w.emit("change", directoryPath, w.data, initial ? "initial" : type);
129958 });
129959 }
129960 if(this.watchers[withoutCase(directoryPath) + "#directory"]) {
129961 this.watchers[withoutCase(directoryPath) + "#directory"].forEach(function(w) {
129962 w.emit("change", directoryPath, w.data, initial ? "initial" : type);
129963 });
129964 }
129965 }
129966 }
129967 }
129968};
129969
129970DirectoryWatcher.prototype.createNestedWatcher = function(directoryPath) {
129971 this.directories[directoryPath] = watcherManager.watchDirectory(directoryPath, this.options, 1);
129972 this.directories[directoryPath].on("change", function(filePath, mtime, type) {
129973 if(this.watchers[withoutCase(this.path)]) {
129974 this.watchers[withoutCase(this.path)].forEach(function(w) {
129975 if(w.checkStartTime(mtime, false)) {
129976 w.emit("change", filePath, mtime, type);
129977 }
129978 });
129979 }
129980 }.bind(this));
129981};
129982
129983DirectoryWatcher.prototype.setNestedWatching = function(flag) {
129984 if(this.nestedWatching !== !!flag) {
129985 this.nestedWatching = !!flag;
129986 if(this.nestedWatching) {
129987 Object.keys(this.directories).forEach(function(directory) {
129988 this.createNestedWatcher(directory);
129989 }, this);
129990 } else {
129991 Object.keys(this.directories).forEach(function(directory) {
129992 this.directories[directory].close();
129993 this.directories[directory] = true;
129994 }, this);
129995 }
129996 }
129997};
129998
129999DirectoryWatcher.prototype.watch = function watch(filePath, startTime) {
130000 this.watchers[withoutCase(filePath)] = this.watchers[withoutCase(filePath)] || [];
130001 this.refs++;
130002 var watcher = new Watcher(this, filePath, startTime);
130003 watcher.on("closed", function() {
130004 var idx = this.watchers[withoutCase(filePath)].indexOf(watcher);
130005 this.watchers[withoutCase(filePath)].splice(idx, 1);
130006 if(this.watchers[withoutCase(filePath)].length === 0) {
130007 delete this.watchers[withoutCase(filePath)];
130008 if(this.path === filePath)
130009 this.setNestedWatching(false);
130010 }
130011 if(--this.refs <= 0)
130012 this.close();
130013 }.bind(this));
130014 this.watchers[withoutCase(filePath)].push(watcher);
130015 var data;
130016 if(filePath === this.path) {
130017 this.setNestedWatching(true);
130018 data = false;
130019 Object.keys(this.files).forEach(function(file) {
130020 var d = this.files[file];
130021 if(!data)
130022 data = d;
130023 else
130024 data = [Math.max(data[0], d[0]), Math.max(data[1], d[1])];
130025 }, this);
130026 } else {
130027 data = this.files[filePath];
130028 }
130029 process.nextTick(function() {
130030 if(data) {
130031 var ts = data[0] === data[1] ? data[0] + FS_ACCURACY : data[0];
130032 if(ts >= startTime)
130033 watcher.emit("change", data[1]);
130034 } else if(this.initialScan && this.initialScanRemoved.indexOf(filePath) >= 0) {
130035 watcher.emit("remove");
130036 }
130037 }.bind(this));
130038 return watcher;
130039};
130040
130041DirectoryWatcher.prototype.onFileAdded = function onFileAdded(filePath, stat) {
130042 if(filePath.indexOf(this.path) !== 0) return;
130043 if(/[\\\/]/.test(filePath.substr(this.path.length + 1))) return;
130044
130045 this.setFileTime(filePath, +stat.mtime || +stat.ctime || 1, false, "add");
130046};
130047
130048DirectoryWatcher.prototype.onDirectoryAdded = function onDirectoryAdded(directoryPath /*, stat */) {
130049 if(directoryPath.indexOf(this.path) !== 0) return;
130050 if(/[\\\/]/.test(directoryPath.substr(this.path.length + 1))) return;
130051 this.setDirectory(directoryPath, true, false, "add");
130052};
130053
130054DirectoryWatcher.prototype.onChange = function onChange(filePath, stat) {
130055 if(filePath.indexOf(this.path) !== 0) return;
130056 if(/[\\\/]/.test(filePath.substr(this.path.length + 1))) return;
130057 var mtime = +stat.mtime || +stat.ctime || 1;
130058 ensureFsAccuracy(mtime);
130059 this.setFileTime(filePath, mtime, false, "change");
130060};
130061
130062DirectoryWatcher.prototype.onFileUnlinked = function onFileUnlinked(filePath) {
130063 if(filePath.indexOf(this.path) !== 0) return;
130064 if(/[\\\/]/.test(filePath.substr(this.path.length + 1))) return;
130065 this.setFileTime(filePath, null, false, "unlink");
130066 if(this.initialScan) {
130067 this.initialScanRemoved.push(filePath);
130068 }
130069};
130070
130071DirectoryWatcher.prototype.onDirectoryUnlinked = function onDirectoryUnlinked(directoryPath) {
130072 if(directoryPath.indexOf(this.path) !== 0) return;
130073 if(/[\\\/]/.test(directoryPath.substr(this.path.length + 1))) return;
130074 this.setDirectory(directoryPath, false, false, "unlink");
130075 if(this.initialScan) {
130076 this.initialScanRemoved.push(directoryPath);
130077 }
130078};
130079
130080DirectoryWatcher.prototype.onWatcherError = function onWatcherError(err) {
130081 console.warn("Error from chokidar (" + this.path + "): " + err);
130082};
130083
130084DirectoryWatcher.prototype.doInitialScan = function doInitialScan() {
130085 fs.readdir(this.path, function(err, items) {
130086 if(err) {
130087 this.parentWatcher = watcherManager.watchFile(this.path + "#directory", this.options, 1);
130088 this.parentWatcher.on("change", function(mtime, type) {
130089 if(this.watchers[withoutCase(this.path)]) {
130090 this.watchers[withoutCase(this.path)].forEach(function(w) {
130091 w.emit("change", this.path, mtime, type);
130092 }, this);
130093 }
130094 }.bind(this));
130095 this.initialScan = false;
130096 return;
130097 }
130098 async.forEach(items, function(item, callback) {
130099 var itemPath = path.join(this.path, item);
130100 fs.stat(itemPath, function(err2, stat) {
130101 if(!this.initialScan) return;
130102 if(err2) {
130103 callback();
130104 return;
130105 }
130106 if(stat.isFile()) {
130107 if(!this.files[itemPath])
130108 this.setFileTime(itemPath, +stat.mtime || +stat.ctime || 1, true);
130109 } else if(stat.isDirectory()) {
130110 if(!this.directories[itemPath])
130111 this.setDirectory(itemPath, true, true);
130112 }
130113 callback();
130114 }.bind(this));
130115 }.bind(this), function() {
130116 this.initialScan = false;
130117 this.initialScanRemoved = null;
130118 }.bind(this));
130119 }.bind(this));
130120};
130121
130122DirectoryWatcher.prototype.getTimes = function() {
130123 var obj = Object.create(null);
130124 var selfTime = 0;
130125 Object.keys(this.files).forEach(function(file) {
130126 var data = this.files[file];
130127 var time;
130128 if(data[1]) {
130129 time = Math.max(data[0], data[1] + FS_ACCURACY);
130130 } else {
130131 time = data[0];
130132 }
130133 obj[file] = time;
130134 if(time > selfTime)
130135 selfTime = time;
130136 }, this);
130137 if(this.nestedWatching) {
130138 Object.keys(this.directories).forEach(function(dir) {
130139 var w = this.directories[dir];
130140 var times = w.directoryWatcher.getTimes();
130141 Object.keys(times).forEach(function(file) {
130142 var time = times[file];
130143 obj[file] = time;
130144 if(time > selfTime)
130145 selfTime = time;
130146 });
130147 }, this);
130148 obj[this.path] = selfTime;
130149 }
130150 return obj;
130151};
130152
130153DirectoryWatcher.prototype.close = function() {
130154 this.initialScan = false;
130155 var p = this.watcher.close();
130156 if(p && p.catch) p.catch(this.onWatcherError.bind(this));
130157 if(this.nestedWatching) {
130158 Object.keys(this.directories).forEach(function(dir) {
130159 this.directories[dir].close();
130160 }, this);
130161 }
130162 if(this.parentWatcher) this.parentWatcher.close();
130163 this.emit("closed");
130164};
130165
130166function ensureFsAccuracy(mtime) {
130167 if(!mtime) return;
130168 if(FS_ACCURACY > 1 && mtime % 1 !== 0)
130169 FS_ACCURACY = 1;
130170 else if(FS_ACCURACY > 10 && mtime % 10 !== 0)
130171 FS_ACCURACY = 10;
130172 else if(FS_ACCURACY > 100 && mtime % 100 !== 0)
130173 FS_ACCURACY = 100;
130174}
130175
130176
130177/***/ }),
130178
130179/***/ 93253:
130180/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130181
130182var v3Err;
130183try {
130184 module.exports = __webpack_require__(47257);
130185 return;
130186} catch(e) {
130187 v3Err = e;
130188}
130189
130190var v2Err;
130191try {
130192 module.exports = __webpack_require__(24059);
130193 return;
130194} catch(e) {
130195 v2Err = e;
130196}
130197
130198throw new Error(
130199 "No version of chokidar is available. Tried chokidar@2 and chokidar@3.\n" +
130200 "You could try to manually install any chokidar version.\n" +
130201 "chokidar@3: " + v3Err + "\n" +
130202 "chokidar@2: " + v2Err + "\n"
130203)
130204
130205
130206/***/ }),
130207
130208/***/ 35093:
130209/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130210
130211"use strict";
130212/*
130213 MIT License http://www.opensource.org/licenses/mit-license.php
130214 Author Tobias Koppers @sokra
130215*/
130216
130217
130218var path = __webpack_require__(85622);
130219
130220function WatcherManager() {
130221 this.directoryWatchers = {};
130222}
130223
130224WatcherManager.prototype.getDirectoryWatcher = function(directory, options) {
130225 var DirectoryWatcher = __webpack_require__(62856);
130226 options = options || {};
130227 var key = directory + " " + JSON.stringify(options);
130228 if(!this.directoryWatchers[key]) {
130229 this.directoryWatchers[key] = new DirectoryWatcher(directory, options);
130230 this.directoryWatchers[key].on("closed", function() {
130231 delete this.directoryWatchers[key];
130232 }.bind(this));
130233 }
130234 return this.directoryWatchers[key];
130235};
130236
130237WatcherManager.prototype.watchFile = function watchFile(p, options, startTime) {
130238 var directory = path.dirname(p);
130239 return this.getDirectoryWatcher(directory, options).watch(p, startTime);
130240};
130241
130242WatcherManager.prototype.watchDirectory = function watchDirectory(directory, options, startTime) {
130243 return this.getDirectoryWatcher(directory, options).watch(directory, startTime);
130244};
130245
130246module.exports = new WatcherManager();
130247
130248
130249/***/ }),
130250
130251/***/ 77056:
130252/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130253
130254"use strict";
130255/*
130256 MIT License http://www.opensource.org/licenses/mit-license.php
130257 Author Tobias Koppers @sokra
130258*/
130259
130260
130261var watcherManager = __webpack_require__(35093);
130262var EventEmitter = __webpack_require__(28614).EventEmitter;
130263
130264function Watchpack(options) {
130265 EventEmitter.call(this);
130266 if(!options) options = {};
130267 if(!options.aggregateTimeout) options.aggregateTimeout = 200;
130268 this.options = options;
130269 this.watcherOptions = {
130270 ignored: options.ignored,
130271 poll: options.poll
130272 };
130273 this.fileWatchers = [];
130274 this.dirWatchers = [];
130275 this.mtimes = Object.create(null);
130276 this.paused = false;
130277 this.aggregatedChanges = [];
130278 this.aggregatedRemovals = [];
130279 this.aggregateTimeout = 0;
130280 this._onTimeout = this._onTimeout.bind(this);
130281}
130282
130283module.exports = Watchpack;
130284
130285Watchpack.prototype = Object.create(EventEmitter.prototype);
130286
130287Watchpack.prototype.watch = function watch(files, directories, startTime) {
130288 this.paused = false;
130289 var oldFileWatchers = this.fileWatchers;
130290 var oldDirWatchers = this.dirWatchers;
130291 this.fileWatchers = files.map(function(file) {
130292 return this._fileWatcher(file, watcherManager.watchFile(file, this.watcherOptions, startTime));
130293 }, this);
130294 this.dirWatchers = directories.map(function(dir) {
130295 return this._dirWatcher(dir, watcherManager.watchDirectory(dir, this.watcherOptions, startTime));
130296 }, this);
130297 oldFileWatchers.forEach(function(w) {
130298 w.close();
130299 }, this);
130300 oldDirWatchers.forEach(function(w) {
130301 w.close();
130302 }, this);
130303};
130304
130305Watchpack.prototype.close = function resume() {
130306 this.paused = true;
130307 if(this.aggregateTimeout)
130308 clearTimeout(this.aggregateTimeout);
130309 this.fileWatchers.forEach(function(w) {
130310 w.close();
130311 }, this);
130312 this.dirWatchers.forEach(function(w) {
130313 w.close();
130314 }, this);
130315 this.fileWatchers.length = 0;
130316 this.dirWatchers.length = 0;
130317};
130318
130319Watchpack.prototype.pause = function pause() {
130320 this.paused = true;
130321 if(this.aggregateTimeout)
130322 clearTimeout(this.aggregateTimeout);
130323};
130324
130325function addWatchersToArray(watchers, array) {
130326 watchers.forEach(function(w) {
130327 if(array.indexOf(w.directoryWatcher) < 0) {
130328 array.push(w.directoryWatcher);
130329 addWatchersToArray(Object.keys(w.directoryWatcher.directories).reduce(function(a, dir) {
130330 if(w.directoryWatcher.directories[dir] !== true)
130331 a.push(w.directoryWatcher.directories[dir]);
130332 return a;
130333 }, []), array);
130334 }
130335 });
130336}
130337
130338Watchpack.prototype.getTimes = function() {
130339 var directoryWatchers = [];
130340 addWatchersToArray(this.fileWatchers.concat(this.dirWatchers), directoryWatchers);
130341 var obj = Object.create(null);
130342 directoryWatchers.forEach(function(w) {
130343 var times = w.getTimes();
130344 Object.keys(times).forEach(function(file) {
130345 obj[file] = times[file];
130346 });
130347 });
130348 return obj;
130349};
130350
130351Watchpack.prototype._fileWatcher = function _fileWatcher(file, watcher) {
130352 watcher.on("change", function(mtime, type) {
130353 this._onChange(file, mtime, file, type);
130354 }.bind(this));
130355 watcher.on("remove", function(type) {
130356 this._onRemove(file, file, type);
130357 }.bind(this));
130358 return watcher;
130359};
130360
130361Watchpack.prototype._dirWatcher = function _dirWatcher(item, watcher) {
130362 watcher.on("change", function(file, mtime, type) {
130363 this._onChange(item, mtime, file, type);
130364 }.bind(this));
130365 return watcher;
130366};
130367
130368Watchpack.prototype._onChange = function _onChange(item, mtime, file) {
130369 file = file || item;
130370 this.mtimes[file] = mtime;
130371 if(this.paused) return;
130372 this.emit("change", file, mtime);
130373 if(this.aggregateTimeout)
130374 clearTimeout(this.aggregateTimeout);
130375 if(this.aggregatedChanges.indexOf(item) < 0)
130376 this.aggregatedChanges.push(item);
130377 this.aggregateTimeout = setTimeout(this._onTimeout, this.options.aggregateTimeout);
130378};
130379
130380Watchpack.prototype._onRemove = function _onRemove(item, file) {
130381 file = file || item;
130382 delete this.mtimes[item];
130383 if(this.paused) return;
130384 this.emit("remove", item);
130385 if(this.aggregateTimeout)
130386 clearTimeout(this.aggregateTimeout);
130387 if(this.aggregatedRemovals.indexOf(item) < 0)
130388 this.aggregatedRemovals.push(item);
130389 this.aggregateTimeout = setTimeout(this._onTimeout, this.options.aggregateTimeout);
130390};
130391
130392Watchpack.prototype._onTimeout = function _onTimeout() {
130393 this.aggregateTimeout = 0;
130394 var changes = this.aggregatedChanges;
130395 var removals = this.aggregatedRemovals;
130396 this.aggregatedChanges = [];
130397 this.aggregatedRemovals = [];
130398 this.emit("aggregated", changes, removals);
130399};
130400
130401
130402/***/ }),
130403
130404/***/ 51613:
130405/***/ (function(module) {
130406
130407"use strict";
130408
130409
130410const errorMessage = (schema, data, message) => ({
130411 keyword: "absolutePath",
130412 params: { absolutePath: data },
130413 message: message,
130414 parentSchema: schema
130415});
130416
130417const getErrorFor = (shouldBeAbsolute, data, schema) => {
130418 const message = shouldBeAbsolute
130419 ? `The provided value ${JSON.stringify(data)} is not an absolute path!`
130420 : `A relative path is expected. However, the provided value ${JSON.stringify(
130421 data
130422 )} is an absolute path!`;
130423
130424 return errorMessage(schema, data, message);
130425};
130426
130427module.exports = ajv =>
130428 ajv.addKeyword("absolutePath", {
130429 errors: true,
130430 type: "string",
130431 compile(expected, schema) {
130432 function callback(data) {
130433 let passes = true;
130434 const isExclamationMarkPresent = data.includes("!");
130435
130436 if (isExclamationMarkPresent) {
130437 callback.errors = [
130438 errorMessage(
130439 schema,
130440 data,
130441 `The provided value ${JSON.stringify(
130442 data
130443 )} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`
130444 )
130445 ];
130446 passes = false;
130447 }
130448 // ?:[A-Za-z]:\\ - Windows absolute path
130449 // \\\\ - Windows network absolute path
130450 // \/ - Unix-like OS absolute path
130451 const isCorrectAbsolutePath =
130452 expected === /^(?:[A-Za-z]:\\|\\\\|\/)/.test(data);
130453 if (!isCorrectAbsolutePath) {
130454 callback.errors = [getErrorFor(expected, data, schema)];
130455 passes = false;
130456 }
130457
130458 return passes;
130459 }
130460 callback.errors = [];
130461
130462 return callback;
130463 }
130464 });
130465
130466
130467/***/ }),
130468
130469/***/ 69657:
130470/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130471
130472"use strict";
130473
130474
130475const DEFAULT_OPTIONS = {
130476 workerOptions : {}
130477 , maxCallsPerWorker : Infinity
130478 , maxConcurrentWorkers : (__webpack_require__(12087).cpus() || { length: 1 }).length
130479 , maxConcurrentCallsPerWorker : 10
130480 , maxConcurrentCalls : Infinity
130481 , maxCallTime : Infinity // exceed this and the whole worker is terminated
130482 , maxRetries : Infinity
130483 , forcedKillTime : 100
130484 , autoStart : false
130485 , onChild : function() {}
130486 }
130487
130488const fork = __webpack_require__(68079)
130489 , TimeoutError = __webpack_require__(48916).create('TimeoutError')
130490 , ProcessTerminatedError = __webpack_require__(48916).create('ProcessTerminatedError')
130491 , MaxConcurrentCallsError = __webpack_require__(48916).create('MaxConcurrentCallsError')
130492
130493
130494function Farm (options, path) {
130495 this.options = Object.assign({}, DEFAULT_OPTIONS, options)
130496 this.path = path
130497 this.activeCalls = 0
130498}
130499
130500
130501// make a handle to pass back in the form of an external API
130502Farm.prototype.mkhandle = function (method) {
130503 return function () {
130504 let args = Array.prototype.slice.call(arguments)
130505 if (this.activeCalls + this.callQueue.length >= this.options.maxConcurrentCalls) {
130506 let err = new MaxConcurrentCallsError('Too many concurrent calls (active: ' + this.activeCalls + ', queued: ' + this.callQueue.length + ')')
130507 if (typeof args[args.length - 1] == 'function')
130508 return process.nextTick(args[args.length - 1].bind(null, err))
130509 throw err
130510 }
130511 this.addCall({
130512 method : method
130513 , callback : args.pop()
130514 , args : args
130515 , retries : 0
130516 })
130517 }.bind(this)
130518}
130519
130520
130521// a constructor of sorts
130522Farm.prototype.setup = function (methods) {
130523 let iface
130524 if (!methods) { // single-function export
130525 iface = this.mkhandle()
130526 } else { // multiple functions on the export
130527 iface = {}
130528 methods.forEach(function (m) {
130529 iface[m] = this.mkhandle(m)
130530 }.bind(this))
130531 }
130532
130533 this.searchStart = -1
130534 this.childId = -1
130535 this.children = {}
130536 this.activeChildren = 0
130537 this.callQueue = []
130538
130539 if (this.options.autoStart) {
130540 while (this.activeChildren < this.options.maxConcurrentWorkers)
130541 this.startChild()
130542 }
130543
130544 return iface
130545}
130546
130547
130548// when a child exits, check if there are any outstanding jobs and requeue them
130549Farm.prototype.onExit = function (childId) {
130550 // delay this to give any sends a chance to finish
130551 setTimeout(function () {
130552 let doQueue = false
130553 if (this.children[childId] && this.children[childId].activeCalls) {
130554 this.children[childId].calls.forEach(function (call, i) {
130555 if (!call) return
130556 else if (call.retries >= this.options.maxRetries) {
130557 this.receive({
130558 idx : i
130559 , child : childId
130560 , args : [ new ProcessTerminatedError('cancel after ' + call.retries + ' retries!') ]
130561 })
130562 } else {
130563 call.retries++
130564 this.callQueue.unshift(call)
130565 doQueue = true
130566 }
130567 }.bind(this))
130568 }
130569 this.stopChild(childId)
130570 doQueue && this.processQueue()
130571 }.bind(this), 10)
130572}
130573
130574
130575// start a new worker
130576Farm.prototype.startChild = function () {
130577 this.childId++
130578
130579 let forked = fork(this.path, this.options.workerOptions)
130580 , id = this.childId
130581 , c = {
130582 send : forked.send
130583 , child : forked.child
130584 , calls : []
130585 , activeCalls : 0
130586 , exitCode : null
130587 }
130588
130589 this.options.onChild(forked.child);
130590
130591 forked.child.on('message', function(data) {
130592 if (data.owner !== 'farm') {
130593 return;
130594 }
130595 this.receive(data);
130596 }.bind(this))
130597 forked.child.once('exit', function (code) {
130598 c.exitCode = code
130599 this.onExit(id)
130600 }.bind(this))
130601
130602 this.activeChildren++
130603 this.children[id] = c
130604}
130605
130606
130607// stop a worker, identified by id
130608Farm.prototype.stopChild = function (childId) {
130609 let child = this.children[childId]
130610 if (child) {
130611 child.send({owner: 'farm', event: 'die'})
130612 setTimeout(function () {
130613 if (child.exitCode === null)
130614 child.child.kill('SIGKILL')
130615 }, this.options.forcedKillTime).unref()
130616 ;delete this.children[childId]
130617 this.activeChildren--
130618 }
130619}
130620
130621
130622// called from a child process, the data contains information needed to
130623// look up the child and the original call so we can invoke the callback
130624Farm.prototype.receive = function (data) {
130625 let idx = data.idx
130626 , childId = data.child
130627 , args = data.args
130628 , child = this.children[childId]
130629 , call
130630
130631 if (!child) {
130632 return console.error(
130633 'Worker Farm: Received message for unknown child. '
130634 + 'This is likely as a result of premature child death, '
130635 + 'the operation will have been re-queued.'
130636 )
130637 }
130638
130639 call = child.calls[idx]
130640 if (!call) {
130641 return console.error(
130642 'Worker Farm: Received message for unknown index for existing child. '
130643 + 'This should not happen!'
130644 )
130645 }
130646
130647 if (this.options.maxCallTime !== Infinity)
130648 clearTimeout(call.timer)
130649
130650 if (args[0] && args[0].$error == '$error') {
130651 let e = args[0]
130652 switch (e.type) {
130653 case 'TypeError': args[0] = new TypeError(e.message); break
130654 case 'RangeError': args[0] = new RangeError(e.message); break
130655 case 'EvalError': args[0] = new EvalError(e.message); break
130656 case 'ReferenceError': args[0] = new ReferenceError(e.message); break
130657 case 'SyntaxError': args[0] = new SyntaxError(e.message); break
130658 case 'URIError': args[0] = new URIError(e.message); break
130659 default: args[0] = new Error(e.message)
130660 }
130661 args[0].type = e.type
130662 args[0].stack = e.stack
130663
130664 // Copy any custom properties to pass it on.
130665 Object.keys(e).forEach(function(key) {
130666 args[0][key] = e[key];
130667 });
130668 }
130669
130670 process.nextTick(function () {
130671 call.callback.apply(null, args)
130672 })
130673
130674 ;delete child.calls[idx]
130675 child.activeCalls--
130676 this.activeCalls--
130677
130678 if (child.calls.length >= this.options.maxCallsPerWorker
130679 && !Object.keys(child.calls).length) {
130680 // this child has finished its run, kill it
130681 this.stopChild(childId)
130682 }
130683
130684 // allow any outstanding calls to be processed
130685 this.processQueue()
130686}
130687
130688
130689Farm.prototype.childTimeout = function (childId) {
130690 let child = this.children[childId]
130691 , i
130692
130693 if (!child)
130694 return
130695
130696 for (i in child.calls) {
130697 this.receive({
130698 idx : i
130699 , child : childId
130700 , args : [ new TimeoutError('worker call timed out!') ]
130701 })
130702 }
130703 this.stopChild(childId)
130704}
130705
130706
130707// send a call to a worker, identified by id
130708Farm.prototype.send = function (childId, call) {
130709 let child = this.children[childId]
130710 , idx = child.calls.length
130711
130712 child.calls.push(call)
130713 child.activeCalls++
130714 this.activeCalls++
130715
130716 child.send({
130717 owner : 'farm'
130718 , idx : idx
130719 , child : childId
130720 , method : call.method
130721 , args : call.args
130722 })
130723
130724 if (this.options.maxCallTime !== Infinity) {
130725 call.timer =
130726 setTimeout(this.childTimeout.bind(this, childId), this.options.maxCallTime)
130727 }
130728}
130729
130730
130731// a list of active worker ids, in order, but the starting offset is
130732// shifted each time this method is called, so we work our way through
130733// all workers when handing out jobs
130734Farm.prototype.childKeys = function () {
130735 let cka = Object.keys(this.children)
130736 , cks
130737
130738 if (this.searchStart >= cka.length - 1)
130739 this.searchStart = 0
130740 else
130741 this.searchStart++
130742
130743 cks = cka.splice(0, this.searchStart)
130744
130745 return cka.concat(cks)
130746}
130747
130748
130749// Calls are added to a queue, this processes the queue and is called
130750// whenever there might be a chance to send more calls to the workers.
130751// The various options all impact on when we're able to send calls,
130752// they may need to be kept in a queue until a worker is ready.
130753Farm.prototype.processQueue = function () {
130754 let cka, i = 0, childId
130755
130756 if (!this.callQueue.length)
130757 return this.ending && this.end()
130758
130759 if (this.activeChildren < this.options.maxConcurrentWorkers)
130760 this.startChild()
130761
130762 for (cka = this.childKeys(); i < cka.length; i++) {
130763 childId = +cka[i]
130764 if (this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker
130765 && this.children[childId].calls.length < this.options.maxCallsPerWorker) {
130766
130767 this.send(childId, this.callQueue.shift())
130768 if (!this.callQueue.length)
130769 return this.ending && this.end()
130770 } /*else {
130771 console.log(
130772 , this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker
130773 , this.children[childId].calls.length < this.options.maxCallsPerWorker
130774 , this.children[childId].calls.length , this.options.maxCallsPerWorker)
130775 }*/
130776 }
130777
130778 if (this.ending)
130779 this.end()
130780}
130781
130782
130783// add a new call to the call queue, then trigger a process of the queue
130784Farm.prototype.addCall = function (call) {
130785 if (this.ending)
130786 return this.end() // don't add anything new to the queue
130787 this.callQueue.push(call)
130788 this.processQueue()
130789}
130790
130791
130792// kills child workers when they're all done
130793Farm.prototype.end = function (callback) {
130794 let complete = true
130795 if (this.ending === false)
130796 return
130797 if (callback)
130798 this.ending = callback
130799 else if (this.ending == null)
130800 this.ending = true
130801 Object.keys(this.children).forEach(function (child) {
130802 if (!this.children[child])
130803 return
130804 if (!this.children[child].activeCalls)
130805 this.stopChild(child)
130806 else
130807 complete = false
130808 }.bind(this))
130809
130810 if (complete && typeof this.ending == 'function') {
130811 process.nextTick(function () {
130812 this.ending()
130813 this.ending = false
130814 }.bind(this))
130815 }
130816}
130817
130818
130819module.exports = Farm
130820module.exports.TimeoutError = TimeoutError
130821
130822
130823/***/ }),
130824
130825/***/ 68079:
130826/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130827
130828"use strict";
130829
130830
130831const childProcess = __webpack_require__(63129)
130832 , childModule = __webpack_require__.ab + "index.js"
130833
130834
130835function fork (forkModule, workerOptions) {
130836 // suppress --debug / --inspect flags while preserving others (like --harmony)
130837 let filteredArgs = process.execArgv.filter(function (v) {
130838 return !(/^--(debug|inspect)/).test(v)
130839 })
130840 , options = Object.assign({
130841 execArgv : filteredArgs
130842 , env : process.env
130843 , cwd : process.cwd()
130844 }, workerOptions)
130845 , child = childProcess.fork(__webpack_require__.ab + "index.js", process.argv, options)
130846
130847 child.on('error', function() {
130848 // this *should* be picked up by onExit and the operation requeued
130849 })
130850
130851 child.send({ owner: 'farm', module: forkModule })
130852
130853 // return a send() function for this child
130854 return {
130855 send : child.send.bind(child)
130856 , child : child
130857 }
130858}
130859
130860
130861module.exports = fork
130862
130863
130864/***/ }),
130865
130866/***/ 18921:
130867/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130868
130869"use strict";
130870
130871
130872const Farm = __webpack_require__(69657)
130873
130874let farms = [] // keep record of farms so we can end() them if required
130875
130876
130877function farm (options, path, methods) {
130878 if (typeof options == 'string') {
130879 methods = path
130880 path = options
130881 options = {}
130882 }
130883
130884 let f = new Farm(options, path)
130885 , api = f.setup(methods)
130886
130887 farms.push({ farm: f, api: api })
130888
130889 // return the public API
130890 return api
130891}
130892
130893
130894function end (api, callback) {
130895 for (let i = 0; i < farms.length; i++)
130896 if (farms[i] && farms[i].api === api)
130897 return farms[i].farm.end(callback)
130898 process.nextTick(callback.bind(null, new Error('Worker farm not found!')))
130899}
130900
130901
130902module.exports = farm
130903module.exports.end = end
130904
130905
130906/***/ }),
130907
130908/***/ 27410:
130909/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
130910
130911/* eslint-disable import/no-extraneous-dependencies */
130912
130913module.exports = function () {
130914 return {
130915 BasicEvaluatedExpression: __webpack_require__(96770),
130916 NodeEnvironmentPlugin: __webpack_require__(52520),
130917 NodeTargetPlugin: __webpack_require__(59743),
130918 ModuleFilenameHelpers: __webpack_require__(71474),
130919 GraphHelpers: __webpack_require__(32973),
130920 Module: __webpack_require__(75993),
130921 NormalModule: __webpack_require__(25963),
130922 Dependency: __webpack_require__(57282),
130923 LibraryTemplatePlugin: __webpack_require__(65237),
130924 SingleEntryPlugin: __webpack_require__(19070),
130925 node: __webpack_require__(92929).node,
130926 util: __webpack_require__(92929).util,
130927 optimize: __webpack_require__(92929).optimize,
130928 sources: __webpack_require__(53665),
130929 webpack: __webpack_require__(92929),
130930 package: {
130931 version: __webpack_require__(71618)/* .version */ .i8,
130932 },
130933 }
130934}
130935
130936
130937/***/ }),
130938
130939/***/ 42357:
130940/***/ (function(module) {
130941
130942"use strict";
130943module.exports = require("assert");;
130944
130945/***/ }),
130946
130947/***/ 64293:
130948/***/ (function(module) {
130949
130950"use strict";
130951module.exports = require("buffer");;
130952
130953/***/ }),
130954
130955/***/ 63129:
130956/***/ (function(module) {
130957
130958"use strict";
130959module.exports = require("child_process");;
130960
130961/***/ }),
130962
130963/***/ 47257:
130964/***/ (function(module) {
130965
130966"use strict";
130967module.exports = require("chokidar");;
130968
130969/***/ }),
130970
130971/***/ 27619:
130972/***/ (function(module) {
130973
130974"use strict";
130975module.exports = require("constants");;
130976
130977/***/ }),
130978
130979/***/ 76417:
130980/***/ (function(module) {
130981
130982"use strict";
130983module.exports = require("crypto");;
130984
130985/***/ }),
130986
130987/***/ 28614:
130988/***/ (function(module) {
130989
130990"use strict";
130991module.exports = require("events");;
130992
130993/***/ }),
130994
130995/***/ 35747:
130996/***/ (function(module) {
130997
130998"use strict";
130999module.exports = require("fs");;
131000
131001/***/ }),
131002
131003/***/ 57012:
131004/***/ (function(module) {
131005
131006"use strict";
131007module.exports = require("inspector");;
131008
131009/***/ }),
131010
131011/***/ 32282:
131012/***/ (function(module) {
131013
131014"use strict";
131015module.exports = require("module");;
131016
131017/***/ }),
131018
131019/***/ 36801:
131020/***/ (function(module) {
131021
131022"use strict";
131023module.exports = require("next/dist/compiled/cacache");;
131024
131025/***/ }),
131026
131027/***/ 31185:
131028/***/ (function(module) {
131029
131030"use strict";
131031module.exports = require("next/dist/compiled/debug");;
131032
131033/***/ }),
131034
131035/***/ 61844:
131036/***/ (function(module) {
131037
131038"use strict";
131039module.exports = require("next/dist/compiled/find-cache-dir");;
131040
131041/***/ }),
131042
131043/***/ 47543:
131044/***/ (function(module) {
131045
131046"use strict";
131047module.exports = require("next/dist/compiled/is-wsl");;
131048
131049/***/ }),
131050
131051/***/ 36386:
131052/***/ (function(module) {
131053
131054"use strict";
131055module.exports = require("next/dist/compiled/neo-async");;
131056
131057/***/ }),
131058
131059/***/ 33225:
131060/***/ (function(module) {
131061
131062"use strict";
131063module.exports = require("next/dist/compiled/schema-utils");;
131064
131065/***/ }),
131066
131067/***/ 96241:
131068/***/ (function(module) {
131069
131070"use strict";
131071module.exports = require("next/dist/compiled/source-map");;
131072
131073/***/ }),
131074
131075/***/ 54775:
131076/***/ (function(module) {
131077
131078"use strict";
131079module.exports = require("next/dist/compiled/terser");;
131080
131081/***/ }),
131082
131083/***/ 53665:
131084/***/ (function(module) {
131085
131086"use strict";
131087module.exports = require("next/dist/compiled/webpack-sources");;
131088
131089/***/ }),
131090
131091/***/ 27852:
131092/***/ (function(module) {
131093
131094"use strict";
131095module.exports = require("node-libs-browser");;
131096
131097/***/ }),
131098
131099/***/ 12087:
131100/***/ (function(module) {
131101
131102"use strict";
131103module.exports = require("os");;
131104
131105/***/ }),
131106
131107/***/ 85622:
131108/***/ (function(module) {
131109
131110"use strict";
131111module.exports = require("path");;
131112
131113/***/ }),
131114
131115/***/ 92413:
131116/***/ (function(module) {
131117
131118"use strict";
131119module.exports = require("stream");;
131120
131121/***/ }),
131122
131123/***/ 78835:
131124/***/ (function(module) {
131125
131126"use strict";
131127module.exports = require("url");;
131128
131129/***/ }),
131130
131131/***/ 31669:
131132/***/ (function(module) {
131133
131134"use strict";
131135module.exports = require("util");;
131136
131137/***/ }),
131138
131139/***/ 92184:
131140/***/ (function(module) {
131141
131142"use strict";
131143module.exports = require("vm");;
131144
131145/***/ })
131146
131147/******/ });
131148/************************************************************************/
131149/******/ // The module cache
131150/******/ var __webpack_module_cache__ = {};
131151/******/
131152/******/ // The require function
131153/******/ function __webpack_require__(moduleId) {
131154/******/ // Check if module is in cache
131155/******/ if(__webpack_module_cache__[moduleId]) {
131156/******/ return __webpack_module_cache__[moduleId].exports;
131157/******/ }
131158/******/ // Create a new module (and put it into the cache)
131159/******/ var module = __webpack_module_cache__[moduleId] = {
131160/******/ // no module.id needed
131161/******/ // no module.loaded needed
131162/******/ exports: {}
131163/******/ };
131164/******/
131165/******/ // Execute the module function
131166/******/ var threw = true;
131167/******/ try {
131168/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
131169/******/ threw = false;
131170/******/ } finally {
131171/******/ if(threw) delete __webpack_module_cache__[moduleId];
131172/******/ }
131173/******/
131174/******/ // Return the exports of the module
131175/******/ return module.exports;
131176/******/ }
131177/******/
131178/************************************************************************/
131179/******/ /* webpack/runtime/compat */
131180/******/
131181/******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
131182/******/ // module exports must be returned from runtime so entry inlining is disabled
131183/******/ // startup
131184/******/ // Load entry module and return exports
131185/******/ return __webpack_require__(27410);
131186/******/ })()
131187;
\No newline at end of file