From caca3368cecdfeb219715565247f476b66ab89c1 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Wed, 16 Feb 2022 13:53:11 +0100 Subject: [PATCH] handle proxy settings for aws-sdk Signed-off-by: CrazyMax --- dist/bridge.js | 984 + dist/events.js | 1033 + dist/index.js | 58148 +++++++++++++++++++++++++++++++++-- dist/setup-node-sandbox.js | 473 + dist/setup-sandbox.js | 462 + package.json | 3 +- src/aws.ts | 28 +- yarn.lock | 283 +- 8 files changed, 58064 insertions(+), 3350 deletions(-) create mode 100644 dist/bridge.js create mode 100644 dist/events.js create mode 100644 dist/setup-node-sandbox.js create mode 100644 dist/setup-sandbox.js diff --git a/dist/bridge.js b/dist/bridge.js new file mode 100644 index 00000000..66794788 --- /dev/null +++ b/dist/bridge.js @@ -0,0 +1,984 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 989: +/***/ ((__unused_webpack_module, exports) => { + + + +/** + * __ ___ ____ _ _ ___ _ _ ____ + * \ \ / / \ | _ \| \ | |_ _| \ | |/ ___| + * \ \ /\ / / _ \ | |_) | \| || || \| | | _ + * \ V V / ___ \| _ <| |\ || || |\ | |_| | + * \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| + * + * This file is critical for vm2. It implements the bridge between the host and the sandbox. + * If you do not know exactly what you are doing, you should NOT edit this file. + * + * The file is loaded in the host and sandbox to handle objects in both directions. + * This is done to ensure that RangeErrors are from the correct context. + * The boundary between the sandbox and host might throw RangeErrors from both contexts. + * Therefore, thisFromOther and friends can handle objects from both domains. + * + * Method parameters have comments to tell from which context they came. + * + */ + +const globalsList = [ + 'Number', + 'String', + 'Boolean', + 'Date', + 'RegExp', + 'Map', + 'WeakMap', + 'Set', + 'WeakSet', + 'Promise', + 'Function' +]; + +const errorsList = [ + 'RangeError', + 'ReferenceError', + 'SyntaxError', + 'TypeError', + 'EvalError', + 'URIError', + 'Error' +]; + +const OPNA = 'Operation not allowed on contextified object.'; + +const thisGlobalPrototypes = { + __proto__: null, + Object: Object.prototype, + Array: Array.prototype +}; + +for (let i = 0; i < globalsList.length; i++) { + const key = globalsList[i]; + const g = global[key]; + if (g) thisGlobalPrototypes[key] = g.prototype; +} + +for (let i = 0; i < errorsList.length; i++) { + const key = errorsList[i]; + const g = global[key]; + if (g) thisGlobalPrototypes[key] = g.prototype; +} + +const { + getPrototypeOf: thisReflectGetPrototypeOf, + setPrototypeOf: thisReflectSetPrototypeOf, + defineProperty: thisReflectDefineProperty, + deleteProperty: thisReflectDeleteProperty, + getOwnPropertyDescriptor: thisReflectGetOwnPropertyDescriptor, + isExtensible: thisReflectIsExtensible, + preventExtensions: thisReflectPreventExtensions, + apply: thisReflectApply, + construct: thisReflectConstruct, + set: thisReflectSet, + get: thisReflectGet, + has: thisReflectHas, + ownKeys: thisReflectOwnKeys, + enumerate: thisReflectEnumerate, +} = Reflect; + +const thisObject = Object; +const { + freeze: thisObjectFreeze, + prototype: thisObjectPrototype +} = thisObject; +const thisObjectHasOwnProperty = thisObjectPrototype.hasOwnProperty; +const ThisProxy = Proxy; +const ThisWeakMap = WeakMap; +const { + get: thisWeakMapGet, + set: thisWeakMapSet +} = ThisWeakMap.prototype; +const ThisMap = Map; +const thisMapGet = ThisMap.prototype.get; +const thisMapSet = ThisMap.prototype.set; +const thisFunction = Function; +const thisFunctionBind = thisFunction.prototype.bind; +const thisArrayIsArray = Array.isArray; +const thisErrorCaptureStackTrace = Error.captureStackTrace; + +const thisSymbolToString = Symbol.prototype.toString; +const thisSymbolToStringTag = Symbol.toStringTag; + +/** + * VMError. + * + * @public + * @extends {Error} + */ +class VMError extends Error { + + /** + * Create VMError instance. + * + * @public + * @param {string} message - Error message. + * @param {string} code - Error code. + */ + constructor(message, code) { + super(message); + + this.name = 'VMError'; + this.code = code; + + thisErrorCaptureStackTrace(this, this.constructor); + } +} + +thisGlobalPrototypes['VMError'] = VMError.prototype; + +function thisUnexpected() { + return new VMError('Unexpected'); +} + +if (!thisReflectSetPrototypeOf(exports, null)) throw thisUnexpected(); + +function thisSafeGetOwnPropertyDescriptor(obj, key) { + const desc = thisReflectGetOwnPropertyDescriptor(obj, key); + if (!desc) return desc; + if (!thisReflectSetPrototypeOf(desc, null)) throw thisUnexpected(); + return desc; +} + +function thisThrowCallerCalleeArgumentsAccess(key) { + 'use strict'; + thisThrowCallerCalleeArgumentsAccess[key]; + return thisUnexpected(); +} + +function thisIdMapping(factory, other) { + return other; +} + +const thisThrowOnKeyAccessHandler = thisObjectFreeze({ + __proto__: null, + get(target, key, receiver) { + if (typeof key === 'symbol') { + key = thisReflectApply(thisSymbolToString, key, []); + } + throw new VMError(`Unexpected access to key '${key}'`); + } +}); + +const emptyForzenObject = thisObjectFreeze({ + __proto__: null +}); + +const thisThrowOnKeyAccess = new ThisProxy(emptyForzenObject, thisThrowOnKeyAccessHandler); + +function SafeBase() {} + +if (!thisReflectDefineProperty(SafeBase, 'prototype', { + __proto__: null, + value: thisThrowOnKeyAccess +})) throw thisUnexpected(); + +function SHARED_FUNCTION() {} + +const TEST_PROXY_HANDLER = thisObjectFreeze({ + __proto__: thisThrowOnKeyAccess, + construct() { + return this; + } +}); + +function thisIsConstructor(obj) { + // Note: obj@any(unsafe) + const Func = new ThisProxy(obj, TEST_PROXY_HANDLER); + try { + // eslint-disable-next-line no-new + new Func(); + return true; + } catch (e) { + return false; + } +} + +function thisCreateTargetObject(obj, proto) { + // Note: obj@any(unsafe) proto@any(unsafe) returns@this(unsafe) throws@this(unsafe) + let base; + if (typeof obj === 'function') { + if (thisIsConstructor(obj)) { + // Bind the function since bound functions do not have a prototype property. + base = thisReflectApply(thisFunctionBind, SHARED_FUNCTION, [null]); + } else { + base = () => {}; + } + } else if (thisArrayIsArray(obj)) { + base = []; + } else { + return {__proto__: proto}; + } + if (!thisReflectSetPrototypeOf(base, proto)) throw thisUnexpected(); + return base; +} + +function createBridge(otherInit, registerProxy) { + + const mappingOtherToThis = new ThisWeakMap(); + const protoMappings = new ThisMap(); + const protoName = new ThisMap(); + + function thisAddProtoMapping(proto, other, name) { + // Note: proto@this(unsafe) other@other(unsafe) name@this(unsafe) throws@this(unsafe) + thisReflectApply(thisMapSet, protoMappings, [proto, thisIdMapping]); + thisReflectApply(thisMapSet, protoMappings, [other, + (factory, object) => thisProxyOther(factory, object, proto)]); + if (name) thisReflectApply(thisMapSet, protoName, [proto, name]); + } + + function thisAddProtoMappingFactory(protoFactory, other, name) { + // Note: protoFactory@this(unsafe) other@other(unsafe) name@this(unsafe) throws@this(unsafe) + let proto; + thisReflectApply(thisMapSet, protoMappings, [other, + (factory, object) => { + if (!proto) { + proto = protoFactory(); + thisReflectApply(thisMapSet, protoMappings, [proto, thisIdMapping]); + if (name) thisReflectApply(thisMapSet, protoName, [proto, name]); + } + return thisProxyOther(factory, object, proto); + }]); + } + + const result = { + __proto__: null, + globalPrototypes: thisGlobalPrototypes, + safeGetOwnPropertyDescriptor: thisSafeGetOwnPropertyDescriptor, + fromArguments: thisFromOtherArguments, + from: thisFromOther, + fromWithFactory: thisFromOtherWithFactory, + ensureThis: thisEnsureThis, + mapping: mappingOtherToThis, + connect: thisConnect, + reflectSet: thisReflectSet, + reflectGet: thisReflectGet, + reflectDefineProperty: thisReflectDefineProperty, + reflectDeleteProperty: thisReflectDeleteProperty, + reflectApply: thisReflectApply, + reflectConstruct: thisReflectConstruct, + reflectHas: thisReflectHas, + reflectOwnKeys: thisReflectOwnKeys, + reflectEnumerate: thisReflectEnumerate, + reflectGetPrototypeOf: thisReflectGetPrototypeOf, + reflectIsExtensible: thisReflectIsExtensible, + reflectPreventExtensions: thisReflectPreventExtensions, + objectHasOwnProperty: thisObjectHasOwnProperty, + weakMapSet: thisWeakMapSet, + addProtoMapping: thisAddProtoMapping, + addProtoMappingFactory: thisAddProtoMappingFactory, + defaultFactory, + protectedFactory, + readonlyFactory, + VMError + }; + + const isHost = typeof otherInit !== 'object'; + + if (isHost) { + otherInit = otherInit(result, registerProxy); + } + + result.other = otherInit; + + const { + globalPrototypes: otherGlobalPrototypes, + safeGetOwnPropertyDescriptor: otherSafeGetOwnPropertyDescriptor, + fromArguments: otherFromThisArguments, + from: otherFromThis, + mapping: mappingThisToOther, + reflectSet: otherReflectSet, + reflectGet: otherReflectGet, + reflectDefineProperty: otherReflectDefineProperty, + reflectDeleteProperty: otherReflectDeleteProperty, + reflectApply: otherReflectApply, + reflectConstruct: otherReflectConstruct, + reflectHas: otherReflectHas, + reflectOwnKeys: otherReflectOwnKeys, + reflectEnumerate: otherReflectEnumerate, + reflectGetPrototypeOf: otherReflectGetPrototypeOf, + reflectIsExtensible: otherReflectIsExtensible, + reflectPreventExtensions: otherReflectPreventExtensions, + objectHasOwnProperty: otherObjectHasOwnProperty, + weakMapSet: otherWeakMapSet + } = otherInit; + + function thisOtherHasOwnProperty(object, key) { + // Note: object@other(safe) key@prim throws@this(unsafe) + try { + return otherReflectApply(otherObjectHasOwnProperty, object, [key]) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + function thisDefaultGet(handler, object, key, desc) { + // Note: object@other(unsafe) key@prim desc@other(safe) + let ret; // @other(unsafe) + if (desc.get || desc.set) { + const getter = desc.get; + if (!getter) return undefined; + try { + ret = otherReflectApply(getter, object, [key]); + } catch (e) { + throw thisFromOther(e); + } + } else { + ret = desc.value; + } + return handler.fromOtherWithContext(ret); + } + + function otherFromThisIfAvailable(to, from, key) { + // Note: to@other(safe) from@this(safe) key@prim throws@this(unsafe) + if (!thisReflectApply(thisObjectHasOwnProperty, from, [key])) return false; + try { + to[key] = otherFromThis(from[key]); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return true; + } + + class BaseHandler extends SafeBase { + + constructor(object) { + // Note: object@other(unsafe) throws@this(unsafe) + super(); + this.object = object; + } + + getFactory() { + return defaultFactory; + } + + fromOtherWithContext(other) { + // Note: other@other(unsafe) throws@this(unsafe) + return thisFromOtherWithFactory(this.getFactory(), other); + } + + doPreventExtensions(target, object, factory) { + // Note: target@this(unsafe) object@other(unsafe) throws@this(unsafe) + let keys; // @other(safe-array-of-prim) + try { + keys = otherReflectOwnKeys(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; // @prim + let desc; + try { + desc = otherSafeGetOwnPropertyDescriptor(object, key); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (!desc) continue; + if (!desc.configurable) { + const current = thisSafeGetOwnPropertyDescriptor(target, key); + if (current && !current.configurable) continue; + if (desc.get || desc.set) { + desc.get = this.fromOtherWithContext(desc.get); + desc.set = this.fromOtherWithContext(desc.set); + } else if (typeof object === 'function' && (key === 'caller' || key === 'callee' || key === 'arguments')) { + desc.value = null; + } else { + desc.value = this.fromOtherWithContext(desc.value); + } + } else { + if (desc.get || desc.set) { + desc = { + __proto__: null, + configurable: true, + enumerable: desc.enumerable, + writable: true, + value: null + }; + } else { + desc.value = null; + } + } + if (!thisReflectDefineProperty(target, key, desc)) throw thisUnexpected(); + } + if (!thisReflectPreventExtensions(target)) throw thisUnexpected(); + } + + get(target, key, receiver) { + // Note: target@this(unsafe) key@prim receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + switch (key) { + case 'constructor': { + const desc = otherSafeGetOwnPropertyDescriptor(object, key); + if (desc) return thisDefaultGet(this, object, key, desc); + const proto = thisReflectGetPrototypeOf(target); + return proto === null ? undefined : proto.constructor; + } + case '__proto__': { + const desc = otherSafeGetOwnPropertyDescriptor(object, key); + if (desc) return thisDefaultGet(this, object, key, desc); + return thisReflectGetPrototypeOf(target); + } + case thisSymbolToStringTag: + if (!thisOtherHasOwnProperty(object, thisSymbolToStringTag)) { + const proto = thisReflectGetPrototypeOf(target); + const name = thisReflectApply(thisMapGet, protoName, [proto]); + if (name) return name; + } + break; + case 'arguments': + case 'caller': + case 'callee': + if (thisOtherHasOwnProperty(object, key)) throw thisThrowCallerCalleeArgumentsAccess(key); + break; + } + let ret; // @other(unsafe) + try { + ret = otherReflectGet(object, key); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return this.fromOtherWithContext(ret); + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (key === '__proto__' && !thisOtherHasOwnProperty(object, key)) { + return this.setPrototypeOf(target, value); + } + try { + value = otherFromThis(value); + return otherReflectSet(object, key, value) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + getPrototypeOf(target) { + // Note: target@this(unsafe) + return thisReflectGetPrototypeOf(target); + } + + setPrototypeOf(target, value) { + // Note: target@this(unsafe) throws@this(unsafe) + throw new VMError(OPNA); + } + + apply(target, context, args) { + // Note: target@this(unsafe) context@this(unsafe) args@this(safe-array) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let ret; // @other(unsafe) + try { + context = otherFromThis(context); + args = otherFromThisArguments(args); + ret = otherReflectApply(object, context, args); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOther(ret); + } + + construct(target, args, newTarget) { + // Note: target@this(unsafe) args@this(safe-array) newTarget@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let ret; // @other(unsafe) + try { + args = otherFromThisArguments(args); + ret = otherReflectConstruct(object, args); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOtherWithFactory(this.getFactory(), ret, thisFromOther(object)); + } + + getOwnPropertyDescriptorDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@other{safe} throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (desc && typeof object === 'function' && (prop === 'arguments' || prop === 'caller' || prop === 'callee')) desc.value = null; + return desc; + } + + getOwnPropertyDescriptor(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + let desc; // @other(safe) + try { + desc = otherSafeGetOwnPropertyDescriptor(object, prop); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + + desc = this.getOwnPropertyDescriptorDesc(target, prop, desc); + + if (!desc) return undefined; + + let thisDesc; + if (desc.get || desc.set) { + thisDesc = { + __proto__: null, + get: this.fromOtherWithContext(desc.get), + set: this.fromOtherWithContext(desc.set), + enumerable: desc.enumerable === true, + configurable: desc.configurable === true + }; + } else { + thisDesc = { + __proto__: null, + value: this.fromOtherWithContext(desc.value), + writable: desc.writable === true, + enumerable: desc.enumerable === true, + configurable: desc.configurable === true + }; + } + if (!thisDesc.configurable) { + const oldDesc = thisSafeGetOwnPropertyDescriptor(target, prop); + if (!oldDesc || oldDesc.configurable || oldDesc.writable !== thisDesc.writable) { + if (!thisReflectDefineProperty(target, prop, thisDesc)) throw thisUnexpected(); + } + } + return thisDesc; + } + + definePropertyDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(safe) throws@this(unsafe) + return desc; + } + + defineProperty(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (!thisReflectSetPrototypeOf(desc, null)) throw thisUnexpected(); + + desc = this.definePropertyDesc(target, prop, desc); + + if (!desc) return false; + + let otherDesc = {__proto__: null}; + let hasFunc = true; + let hasValue = true; + let hasBasic = true; + hasFunc &= otherFromThisIfAvailable(otherDesc, desc, 'get'); + hasFunc &= otherFromThisIfAvailable(otherDesc, desc, 'set'); + hasValue &= otherFromThisIfAvailable(otherDesc, desc, 'value'); + hasValue &= otherFromThisIfAvailable(otherDesc, desc, 'writable'); + hasBasic &= otherFromThisIfAvailable(otherDesc, desc, 'enumerable'); + hasBasic &= otherFromThisIfAvailable(otherDesc, desc, 'configurable'); + + try { + if (!otherReflectDefineProperty(object, prop, otherDesc)) return false; + if (otherDesc.configurable !== true && (!hasBasic || !(hasFunc || hasValue))) { + otherDesc = otherSafeGetOwnPropertyDescriptor(object, prop); + } + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + + if (!otherDesc.configurable) { + let thisDesc; + if (otherDesc.get || otherDesc.set) { + thisDesc = { + __proto__: null, + get: this.fromOtherWithContext(otherDesc.get), + set: this.fromOtherWithContext(otherDesc.set), + enumerable: otherDesc.enumerable, + configurable: otherDesc.configurable + }; + } else { + thisDesc = { + __proto__: null, + value: this.fromOtherWithContext(otherDesc.value), + writable: otherDesc.writable, + enumerable: otherDesc.enumerable, + configurable: otherDesc.configurable + }; + } + if (!thisReflectDefineProperty(target, prop, thisDesc)) throw thisUnexpected(); + } + return true; + } + + deleteProperty(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + return otherReflectDeleteProperty(object, prop) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + has(target, key) { + // Note: target@this(unsafe) key@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + return otherReflectHas(object, key) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + isExtensible(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + if (otherReflectIsExtensible(object)) return true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (thisReflectIsExtensible(target)) { + this.doPreventExtensions(target, object, this); + } + return false; + } + + ownKeys(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let res; // @other(unsafe) + try { + res = otherReflectOwnKeys(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOther(res); + } + + preventExtensions(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + if (!otherReflectPreventExtensions(object)) return false; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (thisReflectIsExtensible(target)) { + this.doPreventExtensions(target, object, this); + } + return true; + } + + enumerate(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let res; // @other(unsafe) + try { + res = otherReflectEnumerate(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return this.fromOtherWithContext(res); + } + + } + + function defaultFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new BaseHandler(object); + } + + class ProtectedHandler extends BaseHandler { + + getFactory() { + return protectedFactory; + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + if (typeof value === 'function') { + return thisReflectDefineProperty(receiver, key, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }) === true; + } + return super.set(target, key, value, receiver); + } + + definePropertyDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(safe) throws@this(unsafe) + if (desc && (desc.set || desc.get || typeof desc.value === 'function')) return undefined; + return desc; + } + + } + + function protectedFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new ProtectedHandler(object); + } + + class ReadOnlyHandler extends BaseHandler { + + getFactory() { + return readonlyFactory; + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + return thisReflectDefineProperty(receiver, key, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }); + } + + setPrototypeOf(target, value) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + defineProperty(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(unsafe) throws@this(unsafe) + return false; + } + + deleteProperty(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + return false; + } + + isExtensible(target) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + preventExtensions(target) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + } + + function readonlyFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new ReadOnlyHandler(object); + } + + class ReadOnlyMockHandler extends ReadOnlyHandler { + + constructor(object, mock) { + // Note: object@other(unsafe) mock:this(unsafe) throws@this(unsafe) + super(object); + this.mock = mock; + } + + get(target, key, receiver) { + // Note: target@this(unsafe) key@prim receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + const mock = this.mock; + if (thisReflectApply(thisObjectHasOwnProperty, mock, key) && !thisOtherHasOwnProperty(object, key)) { + return mock[key]; + } + return super.get(target, key, receiver); + } + + } + + function thisFromOther(other) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return thisFromOtherWithFactory(defaultFactory, other); + } + + function thisProxyOther(factory, other, proto) { + const target = thisCreateTargetObject(other, proto); + const handler = factory(other); + const proxy = new ThisProxy(target, handler); + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [proxy, other]); + registerProxy(proxy, handler); + } catch (e) { + throw new VMError('Unexpected error'); + } + if (!isHost) { + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, proxy]); + return proxy; + } + const proxy2 = new ThisProxy(proxy, emptyForzenObject); + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [proxy2, other]); + registerProxy(proxy2, handler); + } catch (e) { + throw new VMError('Unexpected error'); + } + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, proxy2]); + return proxy2; + } + + function thisEnsureThis(other) { + const type = typeof other; + switch (type) { + case 'object': + case 'function': + if (other === null) { + return null; + } else { + let proto = thisReflectGetPrototypeOf(other); + if (!proto) { + return other; + } + while (proto) { + const mapping = thisReflectApply(thisMapGet, protoMappings, [proto]); + if (mapping) { + const mapped = thisReflectApply(thisWeakMapGet, mappingOtherToThis, [other]); + if (mapped) return mapped; + return mapping(defaultFactory, other); + } + proto = thisReflectGetPrototypeOf(proto); + } + return other; + } + + case 'undefined': + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': + return other; + + default: // new, unknown types can be dangerous + throw new VMError(`Unknown type '${type}'`); + } + } + + function thisFromOtherWithFactory(factory, other, proto) { + for (let loop = 0; loop < 10; loop++) { + const type = typeof other; + switch (type) { + case 'object': + case 'function': + if (other === null) { + return null; + } else { + const mapped = thisReflectApply(thisWeakMapGet, mappingOtherToThis, [other]); + if (mapped) return mapped; + if (proto) { + return thisProxyOther(factory, other, proto); + } + try { + proto = otherReflectGetPrototypeOf(other); + } catch (e) { // @other(unsafe) + other = e; + break; + } + if (!proto) { + return thisProxyOther(factory, other, null); + } + while (proto) { + const mapping = thisReflectApply(thisMapGet, protoMappings, [proto]); + if (mapping) return mapping(factory, other); + try { + proto = otherReflectGetPrototypeOf(proto); + } catch (e) { // @other(unsafe) + other = e; + break; + } + } + return thisProxyOther(factory, other, thisObjectPrototype); + } + + case 'undefined': + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': + return other; + + default: // new, unknown types can be dangerous + throw new VMError(`Unknown type '${type}'`); + } + factory = defaultFactory; + proto = undefined; + } + throw new VMError('Exception recursion depth'); + } + + function thisFromOtherArguments(args) { + // Note: args@other(safe-array) returns@this(safe-array) throws@this(unsafe) + const arr = []; + for (let i = 0; i < args.length; i++) { + const value = thisFromOther(args[i]); + thisReflectDefineProperty(arr, i, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }); + } + return arr; + } + + function thisConnect(obj, other) { + // Note: obj@this(unsafe) other@other(unsafe) throws@this(unsafe) + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [obj, other]); + } catch (e) { + throw new VMError('Unexpected error'); + } + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, obj]); + } + + thisAddProtoMapping(thisGlobalPrototypes.Object, otherGlobalPrototypes.Object); + thisAddProtoMapping(thisGlobalPrototypes.Array, otherGlobalPrototypes.Array); + + for (let i = 0; i < globalsList.length; i++) { + const key = globalsList[i]; + const tp = thisGlobalPrototypes[key]; + const op = otherGlobalPrototypes[key]; + if (tp && op) thisAddProtoMapping(tp, op, key); + } + + for (let i = 0; i < errorsList.length; i++) { + const key = errorsList[i]; + const tp = thisGlobalPrototypes[key]; + const op = otherGlobalPrototypes[key]; + if (tp && op) thisAddProtoMapping(tp, op, 'Error'); + } + + thisAddProtoMapping(thisGlobalPrototypes.VMError, otherGlobalPrototypes.VMError, 'Error'); + + result.BaseHandler = BaseHandler; + result.ProtectedHandler = ProtectedHandler; + result.ReadOnlyHandler = ReadOnlyHandler; + result.ReadOnlyMockHandler = ReadOnlyMockHandler; + + return result; +} + +exports.createBridge = createBridge; +exports.VMError = VMError; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = {}; +/******/ __webpack_modules__[989](0, __webpack_exports__); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/dist/events.js b/dist/events.js new file mode 100644 index 00000000..f91938c7 --- /dev/null +++ b/dist/events.js @@ -0,0 +1,1033 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ 906: +/***/ ((module) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// Modified by the vm2 team to make this a standalone module to be loaded into the sandbox. + + + +const host = fromhost; + +const { + Boolean, + Error, + String, + Symbol +} = globalThis; + +const ReflectApply = Reflect.apply; +const ReflectOwnKeys = Reflect.ownKeys; + +const ErrorCaptureStackTrace = Error.captureStackTrace; + +const NumberIsNaN = Number.isNaN; + +const ObjectCreate = Object.create; +const ObjectDefineProperty = Object.defineProperty; +const ObjectDefineProperties = Object.defineProperties; +const ObjectGetPrototypeOf = Object.getPrototypeOf; + +const SymbolFor = Symbol.for; + +function uncurryThis(func) { + return (thiz, ...args) => ReflectApply(func, thiz, args); +} + +const ArrayPrototypeIndexOf = uncurryThis(Array.prototype.indexOf); +const ArrayPrototypeJoin = uncurryThis(Array.prototype.join); +const ArrayPrototypeSlice = uncurryThis(Array.prototype.slice); +const ArrayPrototypeSplice = uncurryThis(Array.prototype.splice); +const ArrayPrototypeUnshift = uncurryThis(Array.prototype.unshift); + +const kRejection = SymbolFor('nodejs.rejection'); + +function inspect(obj) { + return typeof obj === 'symbol' ? obj.toString() : `${obj}`; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function assert(what, message) { + if (!what) throw new Error(message); +} + +function E(key, msg, Base) { + return function NodeError(...args) { + const error = new Base(); + const message = ReflectApply(msg, error, args); + ObjectDefineProperties(error, { + message: { + value: message, + enumerable: false, + writable: true, + configurable: true, + }, + toString: { + value() { + return `${this.name} [${key}]: ${this.message}`; + }, + enumerable: false, + writable: true, + configurable: true, + }, + }); + error.code = key; + return error; + }; +} + + +const ERR_INVALID_ARG_TYPE = E('ERR_INVALID_ARG_TYPE', + (name, expected, actual) => { + assert(typeof name === 'string', "'name' must be a string"); + if (!ArrayIsArray(expected)) { + expected = [expected]; + } + + let msg = 'The '; + if (StringPrototypeEndsWith(name, ' argument')) { + // For cases like 'first argument' + msg += `${name} `; + } else { + const type = StringPrototypeIncludes(name, '.') ? 'property' : 'argument'; + msg += `"${name}" ${type} `; + } + msg += 'must be '; + + const types = []; + const instances = []; + const other = []; + + for (const value of expected) { + assert(typeof value === 'string', + 'All expected entries have to be of type string'); + if (ArrayPrototypeIncludes(kTypes, value)) { + ArrayPrototypePush(types, StringPrototypeToLowerCase(value)); + } else if (RegExpPrototypeTest(classRegExp, value)) { + ArrayPrototypePush(instances, value); + } else { + assert(value !== 'object', + 'The value "object" should be written as "Object"'); + ArrayPrototypePush(other, value); + } + } + + // Special handle `object` in case other instances are allowed to outline + // the differences between each other. + if (instances.length > 0) { + const pos = ArrayPrototypeIndexOf(types, 'object'); + if (pos !== -1) { + ArrayPrototypeSplice(types, pos, 1); + ArrayPrototypePush(instances, 'Object'); + } + } + + if (types.length > 0) { + if (types.length > 2) { + const last = ArrayPrototypePop(types); + msg += `one of type ${ArrayPrototypeJoin(types, ', ')}, or ${last}`; + } else if (types.length === 2) { + msg += `one of type ${types[0]} or ${types[1]}`; + } else { + msg += `of type ${types[0]}`; + } + if (instances.length > 0 || other.length > 0) + msg += ' or '; + } + + if (instances.length > 0) { + if (instances.length > 2) { + const last = ArrayPrototypePop(instances); + msg += + `an instance of ${ArrayPrototypeJoin(instances, ', ')}, or ${last}`; + } else { + msg += `an instance of ${instances[0]}`; + if (instances.length === 2) { + msg += ` or ${instances[1]}`; + } + } + if (other.length > 0) + msg += ' or '; + } + + if (other.length > 0) { + if (other.length > 2) { + const last = ArrayPrototypePop(other); + msg += `one of ${ArrayPrototypeJoin(other, ', ')}, or ${last}`; + } else if (other.length === 2) { + msg += `one of ${other[0]} or ${other[1]}`; + } else { + if (StringPrototypeToLowerCase(other[0]) !== other[0]) + msg += 'an '; + msg += `${other[0]}`; + } + } + + if (actual == null) { + msg += `. Received ${actual}`; + } else if (typeof actual === 'function' && actual.name) { + msg += `. Received function ${actual.name}`; + } else if (typeof actual === 'object') { + if (actual.constructor && actual.constructor.name) { + msg += `. Received an instance of ${actual.constructor.name}`; + } else { + const inspected = inspect(actual, { depth: -1 }); + msg += `. Received ${inspected}`; + } + } else { + let inspected = inspect(actual, { colors: false }); + if (inspected.length > 25) + inspected = `${StringPrototypeSlice(inspected, 0, 25)}...`; + msg += `. Received type ${typeof actual} (${inspected})`; + } + return msg; + }, TypeError); + +const ERR_INVALID_THIS = E('ERR_INVALID_THIS', s => `Value of "this" must be of type ${s}`, TypeError); + +const ERR_OUT_OF_RANGE = E('ERR_OUT_OF_RANGE', + (str, range, input, replaceDefaultBoolean = false) => { + assert(range, 'Missing "range" argument'); + let msg = replaceDefaultBoolean ? str : + `The value of "${str}" is out of range.`; + const received = inspect(input); + msg += ` It must be ${range}. Received ${received}`; + return msg; + }, RangeError); + +const ERR_UNHANDLED_ERROR = E('ERR_UNHANDLED_ERROR', + err => { + const msg = 'Unhandled error.'; + if (err === undefined) return msg; + return `${msg} (${err})`; + }, Error); + +function validateBoolean(value, name) { + if (typeof value !== 'boolean') + throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value); +} + +function validateFunction(value, name) { + if (typeof value !== 'function') + throw new ERR_INVALID_ARG_TYPE(name, 'Function', value); +} + +function validateString(value, name) { + if (typeof value !== 'string') + throw new ERR_INVALID_ARG_TYPE(name, 'string', value); +} + +function nc(cond, e) { + return cond === undefined || cond === null ? e : cond; +} + +function oc(base, key) { + return base === undefined || base === null ? undefined : base[key]; +} + +const kCapture = Symbol('kCapture'); +const kErrorMonitor = host.kErrorMonitor || Symbol('events.errorMonitor'); +const kMaxEventTargetListeners = Symbol('events.maxEventTargetListeners'); +const kMaxEventTargetListenersWarned = + Symbol('events.maxEventTargetListenersWarned'); + +const kIsEventTarget = SymbolFor('nodejs.event_target'); + +function isEventTarget(obj) { + return oc(oc(obj, 'constructor'), kIsEventTarget); +} + +/** + * Creates a new `EventEmitter` instance. + * @param {{ captureRejections?: boolean; }} [opts] + * @constructs {EventEmitter} + */ +function EventEmitter(opts) { + EventEmitter.init.call(this, opts); +} +module.exports = EventEmitter; +if (host.once) module.exports.once = host.once; +if (host.on) module.exports.on = host.on; +if (host.getEventListeners) module.exports.getEventListeners = host.getEventListeners; +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.usingDomains = false; + +EventEmitter.captureRejectionSymbol = kRejection; +ObjectDefineProperty(EventEmitter, 'captureRejections', { + get() { + return EventEmitter.prototype[kCapture]; + }, + set(value) { + validateBoolean(value, 'EventEmitter.captureRejections'); + + EventEmitter.prototype[kCapture] = value; + }, + enumerable: true +}); + +if (host.EventEmitterReferencingAsyncResource) { + const kAsyncResource = Symbol('kAsyncResource'); + const EventEmitterReferencingAsyncResource = host.EventEmitterReferencingAsyncResource; + + class EventEmitterAsyncResource extends EventEmitter { + /** + * @param {{ + * name?: string, + * triggerAsyncId?: number, + * requireManualDestroy?: boolean, + * }} [options] + */ + constructor(options = undefined) { + let name; + if (typeof options === 'string') { + name = options; + options = undefined; + } else { + if (new.target === EventEmitterAsyncResource) { + validateString(oc(options, 'name'), 'options.name'); + } + name = oc(options, 'name') || new.target.name; + } + super(options); + + this[kAsyncResource] = + new EventEmitterReferencingAsyncResource(this, name, options); + } + + /** + * @param {symbol,string} event + * @param {...any} args + * @returns {boolean} + */ + emit(event, ...args) { + if (this[kAsyncResource] === undefined) + throw new ERR_INVALID_THIS('EventEmitterAsyncResource'); + const { asyncResource } = this; + ArrayPrototypeUnshift(args, super.emit, this, event); + return ReflectApply(asyncResource.runInAsyncScope, asyncResource, + args); + } + + /** + * @returns {void} + */ + emitDestroy() { + if (this[kAsyncResource] === undefined) + throw new ERR_INVALID_THIS('EventEmitterAsyncResource'); + this.asyncResource.emitDestroy(); + } + + /** + * @type {number} + */ + get asyncId() { + if (this[kAsyncResource] === undefined) + throw new ERR_INVALID_THIS('EventEmitterAsyncResource'); + return this.asyncResource.asyncId(); + } + + /** + * @type {number} + */ + get triggerAsyncId() { + if (this[kAsyncResource] === undefined) + throw new ERR_INVALID_THIS('EventEmitterAsyncResource'); + return this.asyncResource.triggerAsyncId(); + } + + /** + * @type {EventEmitterReferencingAsyncResource} + */ + get asyncResource() { + if (this[kAsyncResource] === undefined) + throw new ERR_INVALID_THIS('EventEmitterAsyncResource'); + return this[kAsyncResource]; + } + } + EventEmitter.EventEmitterAsyncResource = EventEmitterAsyncResource; +} + +EventEmitter.errorMonitor = kErrorMonitor; + +// The default for captureRejections is false +ObjectDefineProperty(EventEmitter.prototype, kCapture, { + value: false, + writable: true, + enumerable: false +}); + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +let defaultMaxListeners = 10; + +function checkListener(listener) { + validateFunction(listener, 'listener'); +} + +ObjectDefineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new ERR_OUT_OF_RANGE('defaultMaxListeners', + 'a non-negative number', + arg); + } + defaultMaxListeners = arg; + } +}); + +ObjectDefineProperties(EventEmitter, { + kMaxEventTargetListeners: { + value: kMaxEventTargetListeners, + enumerable: false, + configurable: false, + writable: false, + }, + kMaxEventTargetListenersWarned: { + value: kMaxEventTargetListenersWarned, + enumerable: false, + configurable: false, + writable: false, + } +}); + +/** + * Sets the max listeners. + * @param {number} n + * @param {EventTarget[] | EventEmitter[]} [eventTargets] + * @returns {void} + */ +EventEmitter.setMaxListeners = + function(n = defaultMaxListeners, ...eventTargets) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) + throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n); + if (eventTargets.length === 0) { + defaultMaxListeners = n; + } else { + for (let i = 0; i < eventTargets.length; i++) { + const target = eventTargets[i]; + if (isEventTarget(target)) { + target[kMaxEventTargetListeners] = n; + target[kMaxEventTargetListenersWarned] = false; + } else if (typeof target.setMaxListeners === 'function') { + target.setMaxListeners(n); + } else { + throw new ERR_INVALID_ARG_TYPE( + 'eventTargets', + ['EventEmitter', 'EventTarget'], + target); + } + } + } + }; + +// If you're updating this function definition, please also update any +// re-definitions, such as the one in the Domain module (lib/domain.js). +EventEmitter.init = function(opts) { + + if (this._events === undefined || + this._events === ObjectGetPrototypeOf(this)._events) { + this._events = ObjectCreate(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; + + + if (oc(opts, 'captureRejections')) { + validateBoolean(opts.captureRejections, 'options.captureRejections'); + this[kCapture] = Boolean(opts.captureRejections); + } else { + // Assigning the kCapture property directly saves an expensive + // prototype lookup in a very sensitive hot path. + this[kCapture] = EventEmitter.prototype[kCapture]; + } +}; + +function addCatch(that, promise, type, args) { + if (!that[kCapture]) { + return; + } + + // Handle Promises/A+ spec, then could be a getter + // that throws on second use. + try { + const then = promise.then; + + if (typeof then === 'function') { + then.call(promise, undefined, function(err) { + // The callback is called with nextTick to avoid a follow-up + // rejection from this promise. + process.nextTick(emitUnhandledRejectionOrErr, that, err, type, args); + }); + } + } catch (err) { + that.emit('error', err); + } +} + +function emitUnhandledRejectionOrErr(ee, err, type, args) { + if (typeof ee[kRejection] === 'function') { + ee[kRejection](err, type, ...args); + } else { + // We have to disable the capture rejections mechanism, otherwise + // we might end up in an infinite loop. + const prev = ee[kCapture]; + + // If the error handler throws, it is not catchable and it + // will end up in 'uncaughtException'. We restore the previous + // value of kCapture in case the uncaughtException is present + // and the exception is handled. + try { + ee[kCapture] = false; + ee.emit('error', err); + } finally { + ee[kCapture] = prev; + } + } +} + +/** + * Increases the max listeners of the event emitter. + * @param {number} n + * @returns {EventEmitter} + */ +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +/** + * Returns the current max listener value for the event emitter. + * @returns {number} + */ +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +/** + * Synchronously calls each of the listeners registered + * for the event. + * @param {string | symbol} type + * @param {...any} [args] + * @returns {boolean} + */ +EventEmitter.prototype.emit = function emit(type, ...args) { + let doError = (type === 'error'); + + const events = this._events; + if (events !== undefined) { + if (doError && events[kErrorMonitor] !== undefined) + this.emit(kErrorMonitor, ...args); + doError = (doError && events.error === undefined); + } else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + let er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + try { + const capture = {}; + ErrorCaptureStackTrace(capture, EventEmitter.prototype.emit); + } catch (e) {} + + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + + let stringifiedEr; + try { + stringifiedEr = inspect(er); + } catch (e) { + stringifiedEr = er; + } + + // At least give some kind of context to the user + const err = new ERR_UNHANDLED_ERROR(stringifiedEr); + err.context = er; + throw err; // Unhandled 'error' event + } + + const handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + const result = handler.apply(this, args); + + // We check if result is undefined first because that + // is the most common case so we do not pay any perf + // penalty + if (result !== undefined && result !== null) { + addCatch(this, result, type, args); + } + } else { + const len = handler.length; + const listeners = arrayClone(handler); + for (let i = 0; i < len; ++i) { + const result = listeners[i].apply(this, args); + + // We check if result is undefined first because that + // is the most common case so we do not pay any perf + // penalty. + // This code is duplicated because extracting it away + // would make it non-inlineable. + if (result !== undefined && result !== null) { + addCatch(this, result, type, args); + } + } + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + let m; + let events; + let existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = ObjectCreate(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + nc(listener.listener, listener)); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + const w = new Error('Possible EventEmitter memory leak detected. ' + + `${existing.length} ${String(type)} listeners ` + + `added to ${inspect(target, { depth: -1 })}. Use ` + + 'emitter.setMaxListeners() to increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + process.emitWarning(w); + } + } + + return target; +} + +/** + * Adds a listener to the event emitter. + * @param {string | symbol} type + * @param {Function} listener + * @returns {EventEmitter} + */ +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +/** + * Adds the `listener` function to the beginning of + * the listeners array. + * @param {string | symbol} type + * @param {Function} listener + * @returns {EventEmitter} + */ +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + const state = { fired: false, wrapFn: undefined, target, type, listener }; + const wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +/** + * Adds a one-time `listener` function to the event emitter. + * @param {string | symbol} type + * @param {Function} listener + * @returns {EventEmitter} + */ +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +/** + * Adds a one-time `listener` function to the beginning of + * the listeners array. + * @param {string | symbol} type + * @param {Function} listener + * @returns {EventEmitter} + */ +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + + +/** + * Removes the specified `listener` from the listeners array. + * @param {string | symbol} type + * @param {Function} listener + * @returns {EventEmitter} + */ +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + checkListener(listener); + + const events = this._events; + if (events === undefined) + return this; + + const list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = ObjectCreate(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + let position = -1; + + for (let i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +/** + * Removes all listeners from the event emitter. (Only + * removes listeners for a specific event name if specified + * as `type`). + * @param {string | symbol} [type] + * @returns {EventEmitter} + */ +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + const events = this._events; + if (events === undefined) + return this; + + // Not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = ObjectCreate(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = ObjectCreate(null); + else + delete events[type]; + } + return this; + } + + // Emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (const key of ReflectOwnKeys(events)) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = ObjectCreate(null); + this._eventsCount = 0; + return this; + } + + const listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (let i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + const events = target._events; + + if (events === undefined) + return []; + + const evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener); +} + +/** + * Returns a copy of the array of listeners for the event name + * specified as `type`. + * @param {string | symbol} type + * @returns {Function[]} + */ +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +/** + * Returns a copy of the array of listeners and wrappers for + * the event name specified as `type`. + * @param {string | symbol} type + * @returns {Function[]} + */ +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +/** + * Returns the number of listeners listening to the event name + * specified as `type`. + * @deprecated since v3.2.0 + * @param {EventEmitter} emitter + * @param {string | symbol} type + * @returns {number} + */ +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } + return emitter.listenerCount(type); +}; + +EventEmitter.prototype.listenerCount = listenerCount; + +/** + * Returns the number of listeners listening to event name + * specified as `type`. + * @param {string | symbol} type + * @returns {number} + */ +function listenerCount(type) { + const events = this._events; + + if (events !== undefined) { + const evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +/** + * Returns an array listing the events for which + * the emitter has registered listeners. + * @returns {any[]} + */ +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr) { + // At least since V8 8.3, this implementation is faster than the previous + // which always used a simple for-loop + switch (arr.length) { + case 2: return [arr[0], arr[1]]; + case 3: return [arr[0], arr[1], arr[2]]; + case 4: return [arr[0], arr[1], arr[2], arr[3]]; + case 5: return [arr[0], arr[1], arr[2], arr[3], arr[4]]; + case 6: return [arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]]; + } + return ArrayPrototypeSlice(arr); +} + +function unwrapListeners(arr) { + const ret = arrayClone(arr); + for (let i = 0; i < ret.length; ++i) { + const orig = ret[i].listener; + if (typeof orig === 'function') + ret[i] = orig; + } + return ret; +} + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __nccwpck_require__(906); +/******/ module.exports = __webpack_exports__; +/******/ +/******/ })() +; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 4fe88a8b..34c21855 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 6748: +/***/ 46748: /***/ ((module) => { "use strict"; @@ -9,7 +9,7 @@ module.exports = JSON.parse('{"name":"@aws-sdk/client-ecr-public","description": /***/ }), -/***/ 6879: +/***/ 16879: /***/ ((module) => { "use strict"; @@ -17,7 +17,7 @@ module.exports = JSON.parse('{"name":"@aws-sdk/client-ecr","description":"AWS SD /***/ }), -/***/ 3966: +/***/ 63966: /***/ ((module) => { "use strict"; @@ -33,7 +33,7 @@ module.exports = JSON.parse('{"name":"@aws-sdk/client-sts","description":"AWS SD /***/ }), -/***/ 5981: +/***/ 35981: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -66,11 +66,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRegistriesData = exports.getAccountIDs = exports.getRegion = exports.isPubECR = exports.isECR = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); const client_ecr_1 = __nccwpck_require__(8923); -const client_ecr_public_1 = __nccwpck_require__(2308); +const client_ecr_public_1 = __nccwpck_require__(42308); +const node_http_handler_1 = __nccwpck_require__(68805); +const proxy_agent_1 = __importDefault(__nccwpck_require__(67367)); const ecrRegistryRegex = /^(([0-9]{12})\.dkr\.ecr\.(.+)\.amazonaws\.com(.cn)?)(\/([^:]+)(:.+)?)?$/; exports.isECR = (registry) => { return ecrRegistryRegex.test(registry) || exports.isPubECR(registry); @@ -110,6 +115,18 @@ exports.getRegistriesData = (registry, username, password) => __awaiter(void 0, core.debug(`Requesting AWS ECR auth token for ${accountIDs.join(', ')}`); authTokenRequest['registryIds'] = accountIDs; } + let httpProxyAgent = null; + const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY || ''; + if (httpProxy) { + core.debug(`Using http proxy ${httpProxy}`); + httpProxyAgent = new proxy_agent_1.default(httpProxy); + } + let httpsProxyAgent = null; + const httpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY || ''; + if (httpsProxy) { + core.debug(`Using https proxy ${httpsProxy}`); + httpsProxyAgent = new proxy_agent_1.default(httpsProxy); + } const credentials = username && password ? { accessKeyId: username, @@ -121,7 +138,11 @@ exports.getRegistriesData = (registry, username, password) => __awaiter(void 0, const ecrPublic = new client_ecr_public_1.ECRPUBLIC({ customUserAgent: 'docker-login-action', credentials, - region: region + region: region, + requestHandler: new node_http_handler_1.NodeHttpHandler({ + httpAgent: httpProxyAgent, + httpsAgent: httpsProxyAgent + }) }); const authTokenResponse = yield ecrPublic.getAuthorizationToken(authTokenRequest); if (!authTokenResponse.authorizationData || !authTokenResponse.authorizationData.authorizationToken) { @@ -142,7 +163,11 @@ exports.getRegistriesData = (registry, username, password) => __awaiter(void 0, const ecr = new client_ecr_1.ECR({ customUserAgent: 'docker-login-action', credentials, - region: region + region: region, + requestHandler: new node_http_handler_1.NodeHttpHandler({ + httpAgent: httpProxyAgent, + httpsAgent: httpsProxyAgent + }) }); const authTokenResponse = yield ecr.getAuthorizationToken(authTokenRequest); if (!Array.isArray(authTokenResponse.authorizationData) || !authTokenResponse.authorizationData.length) { @@ -165,7 +190,7 @@ exports.getRegistriesData = (registry, username, password) => __awaiter(void 0, /***/ }), -/***/ 3842: +/***/ 13842: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -191,7 +216,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getInputs = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); function getInputs() { return { registry: core.getInput('registry'), @@ -241,9 +266,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.loginECR = exports.loginStandard = exports.logout = exports.login = void 0; -const aws = __importStar(__nccwpck_require__(5981)); -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const aws = __importStar(__nccwpck_require__(35981)); +const core = __importStar(__nccwpck_require__(42186)); +const exec = __importStar(__nccwpck_require__(71514)); function login(registry, username, password, ecr) { return __awaiter(this, void 0, void 0, function* () { if (/true/i.test(ecr) || (ecr == 'auto' && aws.isECR(registry))) { @@ -359,10 +384,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.run = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const context = __importStar(__nccwpck_require__(3842)); +const core = __importStar(__nccwpck_require__(42186)); +const context = __importStar(__nccwpck_require__(13842)); const docker = __importStar(__nccwpck_require__(3758)); -const stateHelper = __importStar(__nccwpck_require__(8647)); +const stateHelper = __importStar(__nccwpck_require__(88647)); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -395,7 +420,7 @@ else { /***/ }), -/***/ 8647: +/***/ 88647: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -421,7 +446,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.setLogout = exports.setRegistry = exports.logout = exports.registry = exports.IsPost = void 0; -const core = __importStar(__nccwpck_require__(2186)); +const core = __importStar(__nccwpck_require__(42186)); exports.IsPost = !!process.env['STATE_isPost']; exports.registry = process.env['STATE_registry'] || ''; exports.logout = /true/i.test(process.env['STATE_logout'] || ''); @@ -440,7 +465,7 @@ if (!exports.IsPost) { /***/ }), -/***/ 7351: +/***/ 87351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -466,7 +491,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; -const os = __importStar(__nccwpck_require__(2087)); +const os = __importStar(__nccwpck_require__(12087)); const utils_1 = __nccwpck_require__(5278); /** * Commands @@ -539,7 +564,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2186: +/***/ 42186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -574,12 +599,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(7351); +const command_1 = __nccwpck_require__(87351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(5278); -const os = __importStar(__nccwpck_require__(2087)); -const path = __importStar(__nccwpck_require__(5622)); -const oidc_utils_1 = __nccwpck_require__(8041); +const os = __importStar(__nccwpck_require__(12087)); +const path = __importStar(__nccwpck_require__(85622)); +const oidc_utils_1 = __nccwpck_require__(98041); /** * The code to exit an action */ @@ -887,8 +912,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issueCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__nccwpck_require__(5747)); -const os = __importStar(__nccwpck_require__(2087)); +const fs = __importStar(__nccwpck_require__(35747)); +const os = __importStar(__nccwpck_require__(12087)); const utils_1 = __nccwpck_require__(5278); function issueCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; @@ -907,7 +932,7 @@ exports.issueCommand = issueCommand; /***/ }), -/***/ 8041: +/***/ 98041: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -923,9 +948,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(9925); -const auth_1 = __nccwpck_require__(3702); -const core_1 = __nccwpck_require__(2186); +const http_client_1 = __nccwpck_require__(39925); +const auth_1 = __nccwpck_require__(23702); +const core_1 = __nccwpck_require__(42186); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -1038,7 +1063,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 1514: +/***/ 71514: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1073,8 +1098,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; -const string_decoder_1 = __nccwpck_require__(4304); -const tr = __importStar(__nccwpck_require__(8159)); +const string_decoder_1 = __nccwpck_require__(24304); +const tr = __importStar(__nccwpck_require__(88159)); /** * Exec a command. * Output will be streamed to the live console. @@ -1148,7 +1173,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 8159: +/***/ 88159: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1183,13 +1208,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.argStringToArray = exports.ToolRunner = void 0; -const os = __importStar(__nccwpck_require__(2087)); -const events = __importStar(__nccwpck_require__(8614)); -const child = __importStar(__nccwpck_require__(3129)); -const path = __importStar(__nccwpck_require__(5622)); -const io = __importStar(__nccwpck_require__(7436)); -const ioUtil = __importStar(__nccwpck_require__(1962)); -const timers_1 = __nccwpck_require__(8213); +const os = __importStar(__nccwpck_require__(12087)); +const events = __importStar(__nccwpck_require__(28614)); +const child = __importStar(__nccwpck_require__(63129)); +const path = __importStar(__nccwpck_require__(85622)); +const io = __importStar(__nccwpck_require__(47351)); +const ioUtil = __importStar(__nccwpck_require__(81962)); +const timers_1 = __nccwpck_require__(78213); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -1773,7 +1798,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 3702: +/***/ 23702: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1839,15 +1864,15 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 9925: +/***/ 39925: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const http = __nccwpck_require__(8605); -const https = __nccwpck_require__(7211); -const pm = __nccwpck_require__(6443); +const http = __nccwpck_require__(98605); +const https = __nccwpck_require__(57211); +const pm = __nccwpck_require__(16443); let tunnel; var HttpCodes; (function (HttpCodes) { @@ -2266,7 +2291,7 @@ class HttpClient { if (useProxy) { // If using proxy, need tunnel if (!tunnel) { - tunnel = __nccwpck_require__(4294); + tunnel = __nccwpck_require__(74294); } const agentOptions = { maxSockets: maxSockets, @@ -2384,7 +2409,7 @@ exports.HttpClient = HttpClient; /***/ }), -/***/ 6443: +/***/ 16443: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -2449,7 +2474,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 1962: +/***/ 81962: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2485,8 +2510,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; -const fs = __importStar(__nccwpck_require__(5747)); -const path = __importStar(__nccwpck_require__(5622)); +const fs = __importStar(__nccwpck_require__(35747)); +const path = __importStar(__nccwpck_require__(85622)); _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; exports.IS_WINDOWS = process.platform === 'win32'; function exists(fsPath) { @@ -2633,7 +2658,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 7436: +/***/ 47351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2668,11 +2693,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; -const assert_1 = __nccwpck_require__(2357); -const childProcess = __importStar(__nccwpck_require__(3129)); -const path = __importStar(__nccwpck_require__(5622)); -const util_1 = __nccwpck_require__(1669); -const ioUtil = __importStar(__nccwpck_require__(1962)); +const assert_1 = __nccwpck_require__(42357); +const childProcess = __importStar(__nccwpck_require__(63129)); +const path = __importStar(__nccwpck_require__(85622)); +const util_1 = __nccwpck_require__(31669); +const ioUtil = __importStar(__nccwpck_require__(81962)); const exec = util_1.promisify(childProcess.exec); const execFile = util_1.promisify(childProcess.execFile); /** @@ -2981,37 +3006,37 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 6087: +/***/ 86087: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ECRPUBLIC = void 0; -const BatchCheckLayerAvailabilityCommand_1 = __nccwpck_require__(9464); -const BatchDeleteImageCommand_1 = __nccwpck_require__(6517); -const CompleteLayerUploadCommand_1 = __nccwpck_require__(5490); -const CreateRepositoryCommand_1 = __nccwpck_require__(9633); -const DeleteRepositoryCommand_1 = __nccwpck_require__(467); -const DeleteRepositoryPolicyCommand_1 = __nccwpck_require__(2528); -const DescribeImagesCommand_1 = __nccwpck_require__(2776); -const DescribeImageTagsCommand_1 = __nccwpck_require__(7670); -const DescribeRegistriesCommand_1 = __nccwpck_require__(8696); -const DescribeRepositoriesCommand_1 = __nccwpck_require__(2218); -const GetAuthorizationTokenCommand_1 = __nccwpck_require__(2674); -const GetRegistryCatalogDataCommand_1 = __nccwpck_require__(6518); -const GetRepositoryCatalogDataCommand_1 = __nccwpck_require__(3189); +const BatchCheckLayerAvailabilityCommand_1 = __nccwpck_require__(25356); +const BatchDeleteImageCommand_1 = __nccwpck_require__(56517); +const CompleteLayerUploadCommand_1 = __nccwpck_require__(55490); +const CreateRepositoryCommand_1 = __nccwpck_require__(39633); +const DeleteRepositoryCommand_1 = __nccwpck_require__(60467); +const DeleteRepositoryPolicyCommand_1 = __nccwpck_require__(62528); +const DescribeImagesCommand_1 = __nccwpck_require__(22776); +const DescribeImageTagsCommand_1 = __nccwpck_require__(47670); +const DescribeRegistriesCommand_1 = __nccwpck_require__(78696); +const DescribeRepositoriesCommand_1 = __nccwpck_require__(82218); +const GetAuthorizationTokenCommand_1 = __nccwpck_require__(92674); +const GetRegistryCatalogDataCommand_1 = __nccwpck_require__(26518); +const GetRepositoryCatalogDataCommand_1 = __nccwpck_require__(53189); const GetRepositoryPolicyCommand_1 = __nccwpck_require__(8562); -const InitiateLayerUploadCommand_1 = __nccwpck_require__(3675); -const ListTagsForResourceCommand_1 = __nccwpck_require__(575); -const PutImageCommand_1 = __nccwpck_require__(6486); -const PutRegistryCatalogDataCommand_1 = __nccwpck_require__(6805); -const PutRepositoryCatalogDataCommand_1 = __nccwpck_require__(3753); -const SetRepositoryPolicyCommand_1 = __nccwpck_require__(1796); -const TagResourceCommand_1 = __nccwpck_require__(9869); -const UntagResourceCommand_1 = __nccwpck_require__(6689); -const UploadLayerPartCommand_1 = __nccwpck_require__(7429); -const ECRPUBLICClient_1 = __nccwpck_require__(608); +const InitiateLayerUploadCommand_1 = __nccwpck_require__(83675); +const ListTagsForResourceCommand_1 = __nccwpck_require__(80575); +const PutImageCommand_1 = __nccwpck_require__(86486); +const PutRegistryCatalogDataCommand_1 = __nccwpck_require__(46805); +const PutRepositoryCatalogDataCommand_1 = __nccwpck_require__(83753); +const SetRepositoryPolicyCommand_1 = __nccwpck_require__(79838); +const TagResourceCommand_1 = __nccwpck_require__(39869); +const UntagResourceCommand_1 = __nccwpck_require__(66689); +const UploadLayerPartCommand_1 = __nccwpck_require__(97429); +const ECRPUBLICClient_1 = __nccwpck_require__(30608); class ECRPUBLIC extends ECRPUBLICClient_1.ECRPUBLICClient { batchCheckLayerAvailability(args, optionsOrCb, cb) { const command = new BatchCheckLayerAvailabilityCommand_1.BatchCheckLayerAvailabilityCommand(args); @@ -3341,22 +3366,22 @@ exports.ECRPUBLIC = ECRPUBLIC; /***/ }), -/***/ 608: +/***/ 30608: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ECRPUBLICClient = void 0; -const config_resolver_1 = __nccwpck_require__(6153); -const middleware_content_length_1 = __nccwpck_require__(2245); -const middleware_host_header_1 = __nccwpck_require__(2545); -const middleware_logger_1 = __nccwpck_require__(14); -const middleware_retry_1 = __nccwpck_require__(6064); -const middleware_signing_1 = __nccwpck_require__(4935); -const middleware_user_agent_1 = __nccwpck_require__(4688); +const config_resolver_1 = __nccwpck_require__(56153); +const middleware_content_length_1 = __nccwpck_require__(42245); +const middleware_host_header_1 = __nccwpck_require__(22545); +const middleware_logger_1 = __nccwpck_require__(20014); +const middleware_retry_1 = __nccwpck_require__(96064); +const middleware_signing_1 = __nccwpck_require__(14935); +const middleware_user_agent_1 = __nccwpck_require__(64688); const smithy_client_1 = __nccwpck_require__(4963); -const runtimeConfig_1 = __nccwpck_require__(9324); +const runtimeConfig_1 = __nccwpck_require__(49324); class ECRPUBLICClient extends smithy_client_1.Client { constructor(configuration) { const _config_0 = runtimeConfig_1.getRuntimeConfig(configuration); @@ -3384,17 +3409,17 @@ exports.ECRPUBLICClient = ECRPUBLICClient; /***/ }), -/***/ 9464: +/***/ 25356: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchCheckLayerAvailabilityCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class BatchCheckLayerAvailabilityCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3428,17 +3453,17 @@ exports.BatchCheckLayerAvailabilityCommand = BatchCheckLayerAvailabilityCommand; /***/ }), -/***/ 6517: +/***/ 56517: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchDeleteImageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class BatchDeleteImageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3472,17 +3497,17 @@ exports.BatchDeleteImageCommand = BatchDeleteImageCommand; /***/ }), -/***/ 5490: +/***/ 55490: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CompleteLayerUploadCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class CompleteLayerUploadCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3516,17 +3541,17 @@ exports.CompleteLayerUploadCommand = CompleteLayerUploadCommand; /***/ }), -/***/ 9633: +/***/ 39633: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CreateRepositoryCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class CreateRepositoryCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3560,17 +3585,17 @@ exports.CreateRepositoryCommand = CreateRepositoryCommand; /***/ }), -/***/ 467: +/***/ 60467: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteRepositoryCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DeleteRepositoryCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3604,17 +3629,17 @@ exports.DeleteRepositoryCommand = DeleteRepositoryCommand; /***/ }), -/***/ 2528: +/***/ 62528: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DeleteRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3648,17 +3673,17 @@ exports.DeleteRepositoryPolicyCommand = DeleteRepositoryPolicyCommand; /***/ }), -/***/ 7670: +/***/ 47670: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeImageTagsCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DescribeImageTagsCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3692,17 +3717,17 @@ exports.DescribeImageTagsCommand = DescribeImageTagsCommand; /***/ }), -/***/ 2776: +/***/ 22776: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeImagesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DescribeImagesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3736,17 +3761,17 @@ exports.DescribeImagesCommand = DescribeImagesCommand; /***/ }), -/***/ 8696: +/***/ 78696: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeRegistriesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DescribeRegistriesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3780,17 +3805,17 @@ exports.DescribeRegistriesCommand = DescribeRegistriesCommand; /***/ }), -/***/ 2218: +/***/ 82218: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeRepositoriesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class DescribeRepositoriesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3824,17 +3849,17 @@ exports.DescribeRepositoriesCommand = DescribeRepositoriesCommand; /***/ }), -/***/ 2674: +/***/ 92674: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetAuthorizationTokenCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class GetAuthorizationTokenCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3868,17 +3893,17 @@ exports.GetAuthorizationTokenCommand = GetAuthorizationTokenCommand; /***/ }), -/***/ 6518: +/***/ 26518: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRegistryCatalogDataCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class GetRegistryCatalogDataCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3912,17 +3937,17 @@ exports.GetRegistryCatalogDataCommand = GetRegistryCatalogDataCommand; /***/ }), -/***/ 3189: +/***/ 53189: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRepositoryCatalogDataCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class GetRepositoryCatalogDataCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -3963,10 +3988,10 @@ exports.GetRepositoryCatalogDataCommand = GetRepositoryCatalogDataCommand; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class GetRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4000,17 +4025,17 @@ exports.GetRepositoryPolicyCommand = GetRepositoryPolicyCommand; /***/ }), -/***/ 3675: +/***/ 83675: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.InitiateLayerUploadCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class InitiateLayerUploadCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4044,17 +4069,17 @@ exports.InitiateLayerUploadCommand = InitiateLayerUploadCommand; /***/ }), -/***/ 575: +/***/ 80575: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ListTagsForResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class ListTagsForResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4088,17 +4113,17 @@ exports.ListTagsForResourceCommand = ListTagsForResourceCommand; /***/ }), -/***/ 6486: +/***/ 86486: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutImageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class PutImageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4132,17 +4157,17 @@ exports.PutImageCommand = PutImageCommand; /***/ }), -/***/ 6805: +/***/ 46805: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutRegistryCatalogDataCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class PutRegistryCatalogDataCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4176,17 +4201,17 @@ exports.PutRegistryCatalogDataCommand = PutRegistryCatalogDataCommand; /***/ }), -/***/ 3753: +/***/ 83753: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutRepositoryCatalogDataCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class PutRepositoryCatalogDataCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4220,17 +4245,17 @@ exports.PutRepositoryCatalogDataCommand = PutRepositoryCatalogDataCommand; /***/ }), -/***/ 1796: +/***/ 79838: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SetRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class SetRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4264,17 +4289,17 @@ exports.SetRepositoryPolicyCommand = SetRepositoryPolicyCommand; /***/ }), -/***/ 9869: +/***/ 39869: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TagResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class TagResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4308,17 +4333,17 @@ exports.TagResourceCommand = TagResourceCommand; /***/ }), -/***/ 6689: +/***/ 66689: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UntagResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class UntagResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4352,17 +4377,17 @@ exports.UntagResourceCommand = UntagResourceCommand; /***/ }), -/***/ 7429: +/***/ 97429: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UploadLayerPartCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(8818); -const Aws_json1_1_1 = __nccwpck_require__(4170); +const models_0_1 = __nccwpck_require__(38818); +const Aws_json1_1_1 = __nccwpck_require__(64170); class UploadLayerPartCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -4396,48 +4421,48 @@ exports.UploadLayerPartCommand = UploadLayerPartCommand; /***/ }), -/***/ 5442: +/***/ 65442: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9464), exports); -tslib_1.__exportStar(__nccwpck_require__(6517), exports); -tslib_1.__exportStar(__nccwpck_require__(5490), exports); -tslib_1.__exportStar(__nccwpck_require__(9633), exports); -tslib_1.__exportStar(__nccwpck_require__(467), exports); -tslib_1.__exportStar(__nccwpck_require__(2528), exports); -tslib_1.__exportStar(__nccwpck_require__(7670), exports); -tslib_1.__exportStar(__nccwpck_require__(2776), exports); -tslib_1.__exportStar(__nccwpck_require__(8696), exports); -tslib_1.__exportStar(__nccwpck_require__(2218), exports); -tslib_1.__exportStar(__nccwpck_require__(2674), exports); -tslib_1.__exportStar(__nccwpck_require__(6518), exports); -tslib_1.__exportStar(__nccwpck_require__(3189), exports); +tslib_1.__exportStar(__nccwpck_require__(25356), exports); +tslib_1.__exportStar(__nccwpck_require__(56517), exports); +tslib_1.__exportStar(__nccwpck_require__(55490), exports); +tslib_1.__exportStar(__nccwpck_require__(39633), exports); +tslib_1.__exportStar(__nccwpck_require__(60467), exports); +tslib_1.__exportStar(__nccwpck_require__(62528), exports); +tslib_1.__exportStar(__nccwpck_require__(47670), exports); +tslib_1.__exportStar(__nccwpck_require__(22776), exports); +tslib_1.__exportStar(__nccwpck_require__(78696), exports); +tslib_1.__exportStar(__nccwpck_require__(82218), exports); +tslib_1.__exportStar(__nccwpck_require__(92674), exports); +tslib_1.__exportStar(__nccwpck_require__(26518), exports); +tslib_1.__exportStar(__nccwpck_require__(53189), exports); tslib_1.__exportStar(__nccwpck_require__(8562), exports); -tslib_1.__exportStar(__nccwpck_require__(3675), exports); -tslib_1.__exportStar(__nccwpck_require__(575), exports); -tslib_1.__exportStar(__nccwpck_require__(6486), exports); -tslib_1.__exportStar(__nccwpck_require__(6805), exports); -tslib_1.__exportStar(__nccwpck_require__(3753), exports); -tslib_1.__exportStar(__nccwpck_require__(1796), exports); -tslib_1.__exportStar(__nccwpck_require__(9869), exports); -tslib_1.__exportStar(__nccwpck_require__(6689), exports); -tslib_1.__exportStar(__nccwpck_require__(7429), exports); +tslib_1.__exportStar(__nccwpck_require__(83675), exports); +tslib_1.__exportStar(__nccwpck_require__(80575), exports); +tslib_1.__exportStar(__nccwpck_require__(86486), exports); +tslib_1.__exportStar(__nccwpck_require__(46805), exports); +tslib_1.__exportStar(__nccwpck_require__(83753), exports); +tslib_1.__exportStar(__nccwpck_require__(79838), exports); +tslib_1.__exportStar(__nccwpck_require__(39869), exports); +tslib_1.__exportStar(__nccwpck_require__(66689), exports); +tslib_1.__exportStar(__nccwpck_require__(97429), exports); /***/ }), -/***/ 8593: +/***/ 68593: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRegionInfoProvider = void 0; -const config_resolver_1 = __nccwpck_require__(6153); +const config_resolver_1 = __nccwpck_require__(56153); const regionHash = {}; const partitionHash = { aws: { @@ -4569,35 +4594,35 @@ exports.defaultRegionInfoProvider = defaultRegionInfoProvider; /***/ }), -/***/ 2308: +/***/ 42308: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(6087), exports); -tslib_1.__exportStar(__nccwpck_require__(608), exports); -tslib_1.__exportStar(__nccwpck_require__(5442), exports); -tslib_1.__exportStar(__nccwpck_require__(183), exports); -tslib_1.__exportStar(__nccwpck_require__(5945), exports); +tslib_1.__exportStar(__nccwpck_require__(86087), exports); +tslib_1.__exportStar(__nccwpck_require__(30608), exports); +tslib_1.__exportStar(__nccwpck_require__(65442), exports); +tslib_1.__exportStar(__nccwpck_require__(30183), exports); +tslib_1.__exportStar(__nccwpck_require__(75945), exports); /***/ }), -/***/ 183: +/***/ 30183: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(8818), exports); +tslib_1.__exportStar(__nccwpck_require__(38818), exports); /***/ }), -/***/ 8818: +/***/ 38818: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -5145,16 +5170,16 @@ var UploadLayerPartResponse; /***/ }), -/***/ 9634: +/***/ 99634: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeImageTags = void 0; -const DescribeImageTagsCommand_1 = __nccwpck_require__(7670); -const ECRPUBLIC_1 = __nccwpck_require__(6087); -const ECRPUBLICClient_1 = __nccwpck_require__(608); +const DescribeImageTagsCommand_1 = __nccwpck_require__(47670); +const ECRPUBLIC_1 = __nccwpck_require__(86087); +const ECRPUBLICClient_1 = __nccwpck_require__(30608); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeImageTagsCommand_1.DescribeImageTagsCommand(input), ...args); }; @@ -5188,16 +5213,16 @@ exports.paginateDescribeImageTags = paginateDescribeImageTags; /***/ }), -/***/ 4128: +/***/ 74128: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeImages = void 0; -const DescribeImagesCommand_1 = __nccwpck_require__(2776); -const ECRPUBLIC_1 = __nccwpck_require__(6087); -const ECRPUBLICClient_1 = __nccwpck_require__(608); +const DescribeImagesCommand_1 = __nccwpck_require__(22776); +const ECRPUBLIC_1 = __nccwpck_require__(86087); +const ECRPUBLICClient_1 = __nccwpck_require__(30608); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeImagesCommand_1.DescribeImagesCommand(input), ...args); }; @@ -5231,16 +5256,16 @@ exports.paginateDescribeImages = paginateDescribeImages; /***/ }), -/***/ 1720: +/***/ 11720: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeRegistries = void 0; -const DescribeRegistriesCommand_1 = __nccwpck_require__(8696); -const ECRPUBLIC_1 = __nccwpck_require__(6087); -const ECRPUBLICClient_1 = __nccwpck_require__(608); +const DescribeRegistriesCommand_1 = __nccwpck_require__(78696); +const ECRPUBLIC_1 = __nccwpck_require__(86087); +const ECRPUBLICClient_1 = __nccwpck_require__(30608); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeRegistriesCommand_1.DescribeRegistriesCommand(input), ...args); }; @@ -5274,16 +5299,16 @@ exports.paginateDescribeRegistries = paginateDescribeRegistries; /***/ }), -/***/ 5474: +/***/ 65474: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeRepositories = void 0; -const DescribeRepositoriesCommand_1 = __nccwpck_require__(2218); -const ECRPUBLIC_1 = __nccwpck_require__(6087); -const ECRPUBLICClient_1 = __nccwpck_require__(608); +const DescribeRepositoriesCommand_1 = __nccwpck_require__(82218); +const ECRPUBLIC_1 = __nccwpck_require__(86087); +const ECRPUBLICClient_1 = __nccwpck_require__(30608); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeRepositoriesCommand_1.DescribeRepositoriesCommand(input), ...args); }; @@ -5317,7 +5342,7 @@ exports.paginateDescribeRepositories = paginateDescribeRepositories; /***/ }), -/***/ 3463: +/***/ 93463: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -5327,30 +5352,30 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 5945: +/***/ 75945: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9634), exports); -tslib_1.__exportStar(__nccwpck_require__(4128), exports); -tslib_1.__exportStar(__nccwpck_require__(1720), exports); -tslib_1.__exportStar(__nccwpck_require__(5474), exports); -tslib_1.__exportStar(__nccwpck_require__(3463), exports); +tslib_1.__exportStar(__nccwpck_require__(99634), exports); +tslib_1.__exportStar(__nccwpck_require__(74128), exports); +tslib_1.__exportStar(__nccwpck_require__(11720), exports); +tslib_1.__exportStar(__nccwpck_require__(65474), exports); +tslib_1.__exportStar(__nccwpck_require__(93463), exports); /***/ }), -/***/ 4170: +/***/ 64170: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserializeAws_json1_1UploadLayerPartCommand = exports.deserializeAws_json1_1UntagResourceCommand = exports.deserializeAws_json1_1TagResourceCommand = exports.deserializeAws_json1_1SetRepositoryPolicyCommand = exports.deserializeAws_json1_1PutRepositoryCatalogDataCommand = exports.deserializeAws_json1_1PutRegistryCatalogDataCommand = exports.deserializeAws_json1_1PutImageCommand = exports.deserializeAws_json1_1ListTagsForResourceCommand = exports.deserializeAws_json1_1InitiateLayerUploadCommand = exports.deserializeAws_json1_1GetRepositoryPolicyCommand = exports.deserializeAws_json1_1GetRepositoryCatalogDataCommand = exports.deserializeAws_json1_1GetRegistryCatalogDataCommand = exports.deserializeAws_json1_1GetAuthorizationTokenCommand = exports.deserializeAws_json1_1DescribeRepositoriesCommand = exports.deserializeAws_json1_1DescribeRegistriesCommand = exports.deserializeAws_json1_1DescribeImageTagsCommand = exports.deserializeAws_json1_1DescribeImagesCommand = exports.deserializeAws_json1_1DeleteRepositoryPolicyCommand = exports.deserializeAws_json1_1DeleteRepositoryCommand = exports.deserializeAws_json1_1CreateRepositoryCommand = exports.deserializeAws_json1_1CompleteLayerUploadCommand = exports.deserializeAws_json1_1BatchDeleteImageCommand = exports.deserializeAws_json1_1BatchCheckLayerAvailabilityCommand = exports.serializeAws_json1_1UploadLayerPartCommand = exports.serializeAws_json1_1UntagResourceCommand = exports.serializeAws_json1_1TagResourceCommand = exports.serializeAws_json1_1SetRepositoryPolicyCommand = exports.serializeAws_json1_1PutRepositoryCatalogDataCommand = exports.serializeAws_json1_1PutRegistryCatalogDataCommand = exports.serializeAws_json1_1PutImageCommand = exports.serializeAws_json1_1ListTagsForResourceCommand = exports.serializeAws_json1_1InitiateLayerUploadCommand = exports.serializeAws_json1_1GetRepositoryPolicyCommand = exports.serializeAws_json1_1GetRepositoryCatalogDataCommand = exports.serializeAws_json1_1GetRegistryCatalogDataCommand = exports.serializeAws_json1_1GetAuthorizationTokenCommand = exports.serializeAws_json1_1DescribeRepositoriesCommand = exports.serializeAws_json1_1DescribeRegistriesCommand = exports.serializeAws_json1_1DescribeImageTagsCommand = exports.serializeAws_json1_1DescribeImagesCommand = exports.serializeAws_json1_1DeleteRepositoryPolicyCommand = exports.serializeAws_json1_1DeleteRepositoryCommand = exports.serializeAws_json1_1CreateRepositoryCommand = exports.serializeAws_json1_1CompleteLayerUploadCommand = exports.serializeAws_json1_1BatchDeleteImageCommand = exports.serializeAws_json1_1BatchCheckLayerAvailabilityCommand = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); const smithy_client_1 = __nccwpck_require__(4963); const serializeAws_json1_1BatchCheckLayerAvailabilityCommand = async (input, context) => { const headers = { @@ -8465,7 +8490,7 @@ const loadRestJsonErrorCode = (output, data) => { /***/ }), -/***/ 9324: +/***/ 49324: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -8473,19 +8498,19 @@ const loadRestJsonErrorCode = (output, data) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const tslib_1 = __nccwpck_require__(4351); -const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(6748)); -const client_sts_1 = __nccwpck_require__(2209); -const config_resolver_1 = __nccwpck_require__(6153); -const credential_provider_node_1 = __nccwpck_require__(5531); -const hash_node_1 = __nccwpck_require__(7442); -const middleware_retry_1 = __nccwpck_require__(6064); -const node_config_provider_1 = __nccwpck_require__(7684); -const node_http_handler_1 = __nccwpck_require__(8805); -const util_base64_node_1 = __nccwpck_require__(8588); -const util_body_length_node_1 = __nccwpck_require__(4147); -const util_user_agent_node_1 = __nccwpck_require__(8095); -const util_utf8_node_1 = __nccwpck_require__(6278); -const runtimeConfig_shared_1 = __nccwpck_require__(6746); +const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(46748)); +const client_sts_1 = __nccwpck_require__(52209); +const config_resolver_1 = __nccwpck_require__(56153); +const credential_provider_node_1 = __nccwpck_require__(75531); +const hash_node_1 = __nccwpck_require__(97442); +const middleware_retry_1 = __nccwpck_require__(96064); +const node_config_provider_1 = __nccwpck_require__(87684); +const node_http_handler_1 = __nccwpck_require__(68805); +const util_base64_node_1 = __nccwpck_require__(18588); +const util_body_length_node_1 = __nccwpck_require__(74147); +const util_user_agent_node_1 = __nccwpck_require__(98095); +const util_utf8_node_1 = __nccwpck_require__(66278); +const runtimeConfig_shared_1 = __nccwpck_require__(76746); const smithy_client_1 = __nccwpck_require__(4963); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; @@ -8517,7 +8542,7 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 6746: +/***/ 76746: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -8525,7 +8550,7 @@ exports.getRuntimeConfig = getRuntimeConfig; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const url_parser_1 = __nccwpck_require__(2992); -const endpoints_1 = __nccwpck_require__(8593); +const endpoints_1 = __nccwpck_require__(68593); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e; return ({ @@ -8542,55 +8567,55 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 9167: +/***/ 59167: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ECR = void 0; -const BatchCheckLayerAvailabilityCommand_1 = __nccwpck_require__(3804); -const BatchDeleteImageCommand_1 = __nccwpck_require__(5511); -const BatchGetImageCommand_1 = __nccwpck_require__(8859); -const BatchGetRepositoryScanningConfigurationCommand_1 = __nccwpck_require__(9728); -const CompleteLayerUploadCommand_1 = __nccwpck_require__(9003); -const CreatePullThroughCacheRuleCommand_1 = __nccwpck_require__(1454); +const BatchCheckLayerAvailabilityCommand_1 = __nccwpck_require__(63804); +const BatchDeleteImageCommand_1 = __nccwpck_require__(15511); +const BatchGetImageCommand_1 = __nccwpck_require__(78859); +const BatchGetRepositoryScanningConfigurationCommand_1 = __nccwpck_require__(79728); +const CompleteLayerUploadCommand_1 = __nccwpck_require__(49003); +const CreatePullThroughCacheRuleCommand_1 = __nccwpck_require__(71454); const CreateRepositoryCommand_1 = __nccwpck_require__(5074); -const DeleteLifecyclePolicyCommand_1 = __nccwpck_require__(8981); -const DeletePullThroughCacheRuleCommand_1 = __nccwpck_require__(3793); -const DeleteRegistryPolicyCommand_1 = __nccwpck_require__(1424); -const DeleteRepositoryCommand_1 = __nccwpck_require__(8651); -const DeleteRepositoryPolicyCommand_1 = __nccwpck_require__(6828); -const DescribeImageReplicationStatusCommand_1 = __nccwpck_require__(9694); -const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(2987); -const DescribeImagesCommand_1 = __nccwpck_require__(5353); -const DescribePullThroughCacheRulesCommand_1 = __nccwpck_require__(1484); -const DescribeRegistryCommand_1 = __nccwpck_require__(6166); -const DescribeRepositoriesCommand_1 = __nccwpck_require__(1200); -const GetAuthorizationTokenCommand_1 = __nccwpck_require__(5828); -const GetDownloadUrlForLayerCommand_1 = __nccwpck_require__(1401); -const GetLifecyclePolicyCommand_1 = __nccwpck_require__(8469); -const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(7006); -const GetRegistryPolicyCommand_1 = __nccwpck_require__(3685); -const GetRegistryScanningConfigurationCommand_1 = __nccwpck_require__(2741); -const GetRepositoryPolicyCommand_1 = __nccwpck_require__(6330); +const DeleteLifecyclePolicyCommand_1 = __nccwpck_require__(48981); +const DeletePullThroughCacheRuleCommand_1 = __nccwpck_require__(83793); +const DeleteRegistryPolicyCommand_1 = __nccwpck_require__(31424); +const DeleteRepositoryCommand_1 = __nccwpck_require__(88651); +const DeleteRepositoryPolicyCommand_1 = __nccwpck_require__(36828); +const DescribeImageReplicationStatusCommand_1 = __nccwpck_require__(39694); +const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(72987); +const DescribeImagesCommand_1 = __nccwpck_require__(95353); +const DescribePullThroughCacheRulesCommand_1 = __nccwpck_require__(31484); +const DescribeRegistryCommand_1 = __nccwpck_require__(26166); +const DescribeRepositoriesCommand_1 = __nccwpck_require__(21200); +const GetAuthorizationTokenCommand_1 = __nccwpck_require__(35828); +const GetDownloadUrlForLayerCommand_1 = __nccwpck_require__(51401); +const GetLifecyclePolicyCommand_1 = __nccwpck_require__(48469); +const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(17006); +const GetRegistryPolicyCommand_1 = __nccwpck_require__(33685); +const GetRegistryScanningConfigurationCommand_1 = __nccwpck_require__(82741); +const GetRepositoryPolicyCommand_1 = __nccwpck_require__(46330); const InitiateLayerUploadCommand_1 = __nccwpck_require__(6936); const ListImagesCommand_1 = __nccwpck_require__(3854); -const ListTagsForResourceCommand_1 = __nccwpck_require__(7403); -const PutImageCommand_1 = __nccwpck_require__(6844); -const PutImageScanningConfigurationCommand_1 = __nccwpck_require__(7935); -const PutImageTagMutabilityCommand_1 = __nccwpck_require__(6495); -const PutLifecyclePolicyCommand_1 = __nccwpck_require__(4444); -const PutRegistryPolicyCommand_1 = __nccwpck_require__(7928); -const PutRegistryScanningConfigurationCommand_1 = __nccwpck_require__(9529); -const PutReplicationConfigurationCommand_1 = __nccwpck_require__(3350); -const SetRepositoryPolicyCommand_1 = __nccwpck_require__(8300); -const StartImageScanCommand_1 = __nccwpck_require__(7984); -const StartLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(5905); -const TagResourceCommand_1 = __nccwpck_require__(2665); -const UntagResourceCommand_1 = __nccwpck_require__(7225); -const UploadLayerPartCommand_1 = __nccwpck_require__(5825); -const ECRClient_1 = __nccwpck_require__(3391); +const ListTagsForResourceCommand_1 = __nccwpck_require__(97403); +const PutImageCommand_1 = __nccwpck_require__(66844); +const PutImageScanningConfigurationCommand_1 = __nccwpck_require__(87935); +const PutImageTagMutabilityCommand_1 = __nccwpck_require__(66495); +const PutLifecyclePolicyCommand_1 = __nccwpck_require__(33854); +const PutRegistryPolicyCommand_1 = __nccwpck_require__(97928); +const PutRegistryScanningConfigurationCommand_1 = __nccwpck_require__(29529); +const PutReplicationConfigurationCommand_1 = __nccwpck_require__(13350); +const SetRepositoryPolicyCommand_1 = __nccwpck_require__(78300); +const StartImageScanCommand_1 = __nccwpck_require__(47984); +const StartLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(35905); +const TagResourceCommand_1 = __nccwpck_require__(82665); +const UntagResourceCommand_1 = __nccwpck_require__(37225); +const UploadLayerPartCommand_1 = __nccwpck_require__(55825); +const ECRClient_1 = __nccwpck_require__(83391); class ECR extends ECRClient_1.ECRClient { batchCheckLayerAvailability(args, optionsOrCb, cb) { const command = new BatchCheckLayerAvailabilityCommand_1.BatchCheckLayerAvailabilityCommand(args); @@ -9172,20 +9197,20 @@ exports.ECR = ECR; /***/ }), -/***/ 3391: +/***/ 83391: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ECRClient = void 0; -const config_resolver_1 = __nccwpck_require__(6153); -const middleware_content_length_1 = __nccwpck_require__(2245); -const middleware_host_header_1 = __nccwpck_require__(2545); -const middleware_logger_1 = __nccwpck_require__(14); -const middleware_retry_1 = __nccwpck_require__(6064); -const middleware_signing_1 = __nccwpck_require__(4935); -const middleware_user_agent_1 = __nccwpck_require__(4688); +const config_resolver_1 = __nccwpck_require__(56153); +const middleware_content_length_1 = __nccwpck_require__(42245); +const middleware_host_header_1 = __nccwpck_require__(22545); +const middleware_logger_1 = __nccwpck_require__(20014); +const middleware_retry_1 = __nccwpck_require__(96064); +const middleware_signing_1 = __nccwpck_require__(14935); +const middleware_user_agent_1 = __nccwpck_require__(64688); const smithy_client_1 = __nccwpck_require__(4963); const runtimeConfig_1 = __nccwpck_require__(869); class ECRClient extends smithy_client_1.Client { @@ -9215,17 +9240,17 @@ exports.ECRClient = ECRClient; /***/ }), -/***/ 3804: +/***/ 63804: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchCheckLayerAvailabilityCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class BatchCheckLayerAvailabilityCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9259,17 +9284,17 @@ exports.BatchCheckLayerAvailabilityCommand = BatchCheckLayerAvailabilityCommand; /***/ }), -/***/ 5511: +/***/ 15511: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchDeleteImageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class BatchDeleteImageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9303,17 +9328,17 @@ exports.BatchDeleteImageCommand = BatchDeleteImageCommand; /***/ }), -/***/ 8859: +/***/ 78859: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchGetImageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class BatchGetImageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9347,17 +9372,17 @@ exports.BatchGetImageCommand = BatchGetImageCommand; /***/ }), -/***/ 9728: +/***/ 79728: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.BatchGetRepositoryScanningConfigurationCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class BatchGetRepositoryScanningConfigurationCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9391,17 +9416,17 @@ exports.BatchGetRepositoryScanningConfigurationCommand = BatchGetRepositoryScann /***/ }), -/***/ 9003: +/***/ 49003: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CompleteLayerUploadCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class CompleteLayerUploadCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9435,17 +9460,17 @@ exports.CompleteLayerUploadCommand = CompleteLayerUploadCommand; /***/ }), -/***/ 1454: +/***/ 71454: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CreatePullThroughCacheRuleCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class CreatePullThroughCacheRuleCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9486,10 +9511,10 @@ exports.CreatePullThroughCacheRuleCommand = CreatePullThroughCacheRuleCommand; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CreateRepositoryCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class CreateRepositoryCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9523,17 +9548,17 @@ exports.CreateRepositoryCommand = CreateRepositoryCommand; /***/ }), -/***/ 8981: +/***/ 48981: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteLifecyclePolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DeleteLifecyclePolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9567,17 +9592,17 @@ exports.DeleteLifecyclePolicyCommand = DeleteLifecyclePolicyCommand; /***/ }), -/***/ 3793: +/***/ 83793: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeletePullThroughCacheRuleCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DeletePullThroughCacheRuleCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9611,17 +9636,17 @@ exports.DeletePullThroughCacheRuleCommand = DeletePullThroughCacheRuleCommand; /***/ }), -/***/ 1424: +/***/ 31424: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteRegistryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DeleteRegistryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9655,17 +9680,17 @@ exports.DeleteRegistryPolicyCommand = DeleteRegistryPolicyCommand; /***/ }), -/***/ 8651: +/***/ 88651: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteRepositoryCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DeleteRepositoryCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9699,17 +9724,17 @@ exports.DeleteRepositoryCommand = DeleteRepositoryCommand; /***/ }), -/***/ 6828: +/***/ 36828: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeleteRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DeleteRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9743,17 +9768,17 @@ exports.DeleteRepositoryPolicyCommand = DeleteRepositoryPolicyCommand; /***/ }), -/***/ 9694: +/***/ 39694: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeImageReplicationStatusCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribeImageReplicationStatusCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9787,17 +9812,17 @@ exports.DescribeImageReplicationStatusCommand = DescribeImageReplicationStatusCo /***/ }), -/***/ 2987: +/***/ 72987: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeImageScanFindingsCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribeImageScanFindingsCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9831,17 +9856,17 @@ exports.DescribeImageScanFindingsCommand = DescribeImageScanFindingsCommand; /***/ }), -/***/ 5353: +/***/ 95353: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeImagesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribeImagesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9875,17 +9900,17 @@ exports.DescribeImagesCommand = DescribeImagesCommand; /***/ }), -/***/ 1484: +/***/ 31484: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribePullThroughCacheRulesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribePullThroughCacheRulesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9919,17 +9944,17 @@ exports.DescribePullThroughCacheRulesCommand = DescribePullThroughCacheRulesComm /***/ }), -/***/ 6166: +/***/ 26166: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeRegistryCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribeRegistryCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -9963,17 +9988,17 @@ exports.DescribeRegistryCommand = DescribeRegistryCommand; /***/ }), -/***/ 1200: +/***/ 21200: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DescribeRepositoriesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class DescribeRepositoriesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10007,17 +10032,17 @@ exports.DescribeRepositoriesCommand = DescribeRepositoriesCommand; /***/ }), -/***/ 5828: +/***/ 35828: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetAuthorizationTokenCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetAuthorizationTokenCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10051,17 +10076,17 @@ exports.GetAuthorizationTokenCommand = GetAuthorizationTokenCommand; /***/ }), -/***/ 1401: +/***/ 51401: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetDownloadUrlForLayerCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetDownloadUrlForLayerCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10095,17 +10120,17 @@ exports.GetDownloadUrlForLayerCommand = GetDownloadUrlForLayerCommand; /***/ }), -/***/ 8469: +/***/ 48469: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetLifecyclePolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetLifecyclePolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10139,17 +10164,17 @@ exports.GetLifecyclePolicyCommand = GetLifecyclePolicyCommand; /***/ }), -/***/ 7006: +/***/ 17006: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetLifecyclePolicyPreviewCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetLifecyclePolicyPreviewCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10183,17 +10208,17 @@ exports.GetLifecyclePolicyPreviewCommand = GetLifecyclePolicyPreviewCommand; /***/ }), -/***/ 3685: +/***/ 33685: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRegistryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetRegistryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10227,17 +10252,17 @@ exports.GetRegistryPolicyCommand = GetRegistryPolicyCommand; /***/ }), -/***/ 2741: +/***/ 82741: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRegistryScanningConfigurationCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetRegistryScanningConfigurationCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10271,17 +10296,17 @@ exports.GetRegistryScanningConfigurationCommand = GetRegistryScanningConfigurati /***/ }), -/***/ 6330: +/***/ 46330: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class GetRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10322,10 +10347,10 @@ exports.GetRepositoryPolicyCommand = GetRepositoryPolicyCommand; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.InitiateLayerUploadCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class InitiateLayerUploadCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10366,10 +10391,10 @@ exports.InitiateLayerUploadCommand = InitiateLayerUploadCommand; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ListImagesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class ListImagesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10403,17 +10428,17 @@ exports.ListImagesCommand = ListImagesCommand; /***/ }), -/***/ 7403: +/***/ 97403: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ListTagsForResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class ListTagsForResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10447,17 +10472,17 @@ exports.ListTagsForResourceCommand = ListTagsForResourceCommand; /***/ }), -/***/ 6844: +/***/ 66844: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutImageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutImageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10491,17 +10516,17 @@ exports.PutImageCommand = PutImageCommand; /***/ }), -/***/ 7935: +/***/ 87935: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutImageScanningConfigurationCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutImageScanningConfigurationCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10535,17 +10560,17 @@ exports.PutImageScanningConfigurationCommand = PutImageScanningConfigurationComm /***/ }), -/***/ 6495: +/***/ 66495: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutImageTagMutabilityCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutImageTagMutabilityCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10579,17 +10604,17 @@ exports.PutImageTagMutabilityCommand = PutImageTagMutabilityCommand; /***/ }), -/***/ 4444: +/***/ 33854: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutLifecyclePolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutLifecyclePolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10623,17 +10648,17 @@ exports.PutLifecyclePolicyCommand = PutLifecyclePolicyCommand; /***/ }), -/***/ 7928: +/***/ 97928: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutRegistryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutRegistryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10667,17 +10692,17 @@ exports.PutRegistryPolicyCommand = PutRegistryPolicyCommand; /***/ }), -/***/ 9529: +/***/ 29529: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutRegistryScanningConfigurationCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutRegistryScanningConfigurationCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10711,17 +10736,17 @@ exports.PutRegistryScanningConfigurationCommand = PutRegistryScanningConfigurati /***/ }), -/***/ 3350: +/***/ 13350: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PutReplicationConfigurationCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class PutReplicationConfigurationCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10755,17 +10780,17 @@ exports.PutReplicationConfigurationCommand = PutReplicationConfigurationCommand; /***/ }), -/***/ 8300: +/***/ 78300: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SetRepositoryPolicyCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class SetRepositoryPolicyCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10799,17 +10824,17 @@ exports.SetRepositoryPolicyCommand = SetRepositoryPolicyCommand; /***/ }), -/***/ 7984: +/***/ 47984: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StartImageScanCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class StartImageScanCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10843,17 +10868,17 @@ exports.StartImageScanCommand = StartImageScanCommand; /***/ }), -/***/ 5905: +/***/ 35905: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StartLifecyclePolicyPreviewCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class StartLifecyclePolicyPreviewCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10887,17 +10912,17 @@ exports.StartLifecyclePolicyPreviewCommand = StartLifecyclePolicyPreviewCommand; /***/ }), -/***/ 2665: +/***/ 82665: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TagResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class TagResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10931,17 +10956,17 @@ exports.TagResourceCommand = TagResourceCommand; /***/ }), -/***/ 7225: +/***/ 37225: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UntagResourceCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class UntagResourceCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -10975,17 +11000,17 @@ exports.UntagResourceCommand = UntagResourceCommand; /***/ }), -/***/ 5825: +/***/ 55825: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.UploadLayerPartCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(9088); -const Aws_json1_1_1 = __nccwpck_require__(6704); +const models_0_1 = __nccwpck_require__(79088); +const Aws_json1_1_1 = __nccwpck_require__(56704); class UploadLayerPartCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -11019,66 +11044,66 @@ exports.UploadLayerPartCommand = UploadLayerPartCommand; /***/ }), -/***/ 7407: +/***/ 67407: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(3804), exports); -tslib_1.__exportStar(__nccwpck_require__(5511), exports); -tslib_1.__exportStar(__nccwpck_require__(8859), exports); -tslib_1.__exportStar(__nccwpck_require__(9728), exports); -tslib_1.__exportStar(__nccwpck_require__(9003), exports); -tslib_1.__exportStar(__nccwpck_require__(1454), exports); +tslib_1.__exportStar(__nccwpck_require__(63804), exports); +tslib_1.__exportStar(__nccwpck_require__(15511), exports); +tslib_1.__exportStar(__nccwpck_require__(78859), exports); +tslib_1.__exportStar(__nccwpck_require__(79728), exports); +tslib_1.__exportStar(__nccwpck_require__(49003), exports); +tslib_1.__exportStar(__nccwpck_require__(71454), exports); tslib_1.__exportStar(__nccwpck_require__(5074), exports); -tslib_1.__exportStar(__nccwpck_require__(8981), exports); -tslib_1.__exportStar(__nccwpck_require__(3793), exports); -tslib_1.__exportStar(__nccwpck_require__(1424), exports); -tslib_1.__exportStar(__nccwpck_require__(8651), exports); -tslib_1.__exportStar(__nccwpck_require__(6828), exports); -tslib_1.__exportStar(__nccwpck_require__(9694), exports); -tslib_1.__exportStar(__nccwpck_require__(2987), exports); -tslib_1.__exportStar(__nccwpck_require__(5353), exports); -tslib_1.__exportStar(__nccwpck_require__(1484), exports); -tslib_1.__exportStar(__nccwpck_require__(6166), exports); -tslib_1.__exportStar(__nccwpck_require__(1200), exports); -tslib_1.__exportStar(__nccwpck_require__(5828), exports); -tslib_1.__exportStar(__nccwpck_require__(1401), exports); -tslib_1.__exportStar(__nccwpck_require__(8469), exports); -tslib_1.__exportStar(__nccwpck_require__(7006), exports); -tslib_1.__exportStar(__nccwpck_require__(3685), exports); -tslib_1.__exportStar(__nccwpck_require__(2741), exports); -tslib_1.__exportStar(__nccwpck_require__(6330), exports); +tslib_1.__exportStar(__nccwpck_require__(48981), exports); +tslib_1.__exportStar(__nccwpck_require__(83793), exports); +tslib_1.__exportStar(__nccwpck_require__(31424), exports); +tslib_1.__exportStar(__nccwpck_require__(88651), exports); +tslib_1.__exportStar(__nccwpck_require__(36828), exports); +tslib_1.__exportStar(__nccwpck_require__(39694), exports); +tslib_1.__exportStar(__nccwpck_require__(72987), exports); +tslib_1.__exportStar(__nccwpck_require__(95353), exports); +tslib_1.__exportStar(__nccwpck_require__(31484), exports); +tslib_1.__exportStar(__nccwpck_require__(26166), exports); +tslib_1.__exportStar(__nccwpck_require__(21200), exports); +tslib_1.__exportStar(__nccwpck_require__(35828), exports); +tslib_1.__exportStar(__nccwpck_require__(51401), exports); +tslib_1.__exportStar(__nccwpck_require__(48469), exports); +tslib_1.__exportStar(__nccwpck_require__(17006), exports); +tslib_1.__exportStar(__nccwpck_require__(33685), exports); +tslib_1.__exportStar(__nccwpck_require__(82741), exports); +tslib_1.__exportStar(__nccwpck_require__(46330), exports); tslib_1.__exportStar(__nccwpck_require__(6936), exports); tslib_1.__exportStar(__nccwpck_require__(3854), exports); -tslib_1.__exportStar(__nccwpck_require__(7403), exports); -tslib_1.__exportStar(__nccwpck_require__(6844), exports); -tslib_1.__exportStar(__nccwpck_require__(7935), exports); -tslib_1.__exportStar(__nccwpck_require__(6495), exports); -tslib_1.__exportStar(__nccwpck_require__(4444), exports); -tslib_1.__exportStar(__nccwpck_require__(7928), exports); -tslib_1.__exportStar(__nccwpck_require__(9529), exports); -tslib_1.__exportStar(__nccwpck_require__(3350), exports); -tslib_1.__exportStar(__nccwpck_require__(8300), exports); -tslib_1.__exportStar(__nccwpck_require__(7984), exports); -tslib_1.__exportStar(__nccwpck_require__(5905), exports); -tslib_1.__exportStar(__nccwpck_require__(2665), exports); -tslib_1.__exportStar(__nccwpck_require__(7225), exports); -tslib_1.__exportStar(__nccwpck_require__(5825), exports); +tslib_1.__exportStar(__nccwpck_require__(97403), exports); +tslib_1.__exportStar(__nccwpck_require__(66844), exports); +tslib_1.__exportStar(__nccwpck_require__(87935), exports); +tslib_1.__exportStar(__nccwpck_require__(66495), exports); +tslib_1.__exportStar(__nccwpck_require__(33854), exports); +tslib_1.__exportStar(__nccwpck_require__(97928), exports); +tslib_1.__exportStar(__nccwpck_require__(29529), exports); +tslib_1.__exportStar(__nccwpck_require__(13350), exports); +tslib_1.__exportStar(__nccwpck_require__(78300), exports); +tslib_1.__exportStar(__nccwpck_require__(47984), exports); +tslib_1.__exportStar(__nccwpck_require__(35905), exports); +tslib_1.__exportStar(__nccwpck_require__(82665), exports); +tslib_1.__exportStar(__nccwpck_require__(37225), exports); +tslib_1.__exportStar(__nccwpck_require__(55825), exports); /***/ }), -/***/ 3070: +/***/ 63070: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRegionInfoProvider = void 0; -const config_resolver_1 = __nccwpck_require__(6153); +const config_resolver_1 = __nccwpck_require__(56153); const regionHash = { "af-south-1": { variants: [ @@ -11524,29 +11549,29 @@ exports.defaultRegionInfoProvider = defaultRegionInfoProvider; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9167), exports); -tslib_1.__exportStar(__nccwpck_require__(3391), exports); -tslib_1.__exportStar(__nccwpck_require__(7407), exports); -tslib_1.__exportStar(__nccwpck_require__(4692), exports); -tslib_1.__exportStar(__nccwpck_require__(5356), exports); -tslib_1.__exportStar(__nccwpck_require__(8406), exports); +tslib_1.__exportStar(__nccwpck_require__(59167), exports); +tslib_1.__exportStar(__nccwpck_require__(83391), exports); +tslib_1.__exportStar(__nccwpck_require__(67407), exports); +tslib_1.__exportStar(__nccwpck_require__(57451), exports); +tslib_1.__exportStar(__nccwpck_require__(35356), exports); +tslib_1.__exportStar(__nccwpck_require__(28406), exports); /***/ }), -/***/ 4692: +/***/ 57451: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9088), exports); +tslib_1.__exportStar(__nccwpck_require__(79088), exports); /***/ }), -/***/ 9088: +/***/ 79088: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -12616,16 +12641,16 @@ var UploadLayerPartResponse; /***/ }), -/***/ 862: +/***/ 30862: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeImageScanFindings = void 0; -const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(2987); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(72987); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeImageScanFindingsCommand_1.DescribeImageScanFindingsCommand(input), ...args); }; @@ -12659,16 +12684,16 @@ exports.paginateDescribeImageScanFindings = paginateDescribeImageScanFindings; /***/ }), -/***/ 1351: +/***/ 51351: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeImages = void 0; -const DescribeImagesCommand_1 = __nccwpck_require__(5353); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const DescribeImagesCommand_1 = __nccwpck_require__(95353); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeImagesCommand_1.DescribeImagesCommand(input), ...args); }; @@ -12702,16 +12727,16 @@ exports.paginateDescribeImages = paginateDescribeImages; /***/ }), -/***/ 9589: +/***/ 59589: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribePullThroughCacheRules = void 0; -const DescribePullThroughCacheRulesCommand_1 = __nccwpck_require__(1484); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const DescribePullThroughCacheRulesCommand_1 = __nccwpck_require__(31484); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribePullThroughCacheRulesCommand_1.DescribePullThroughCacheRulesCommand(input), ...args); }; @@ -12745,16 +12770,16 @@ exports.paginateDescribePullThroughCacheRules = paginateDescribePullThroughCache /***/ }), -/***/ 6404: +/***/ 16404: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateDescribeRepositories = void 0; -const DescribeRepositoriesCommand_1 = __nccwpck_require__(1200); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const DescribeRepositoriesCommand_1 = __nccwpck_require__(21200); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new DescribeRepositoriesCommand_1.DescribeRepositoriesCommand(input), ...args); }; @@ -12788,16 +12813,16 @@ exports.paginateDescribeRepositories = paginateDescribeRepositories; /***/ }), -/***/ 987: +/***/ 50987: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateGetLifecyclePolicyPreview = void 0; -const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(7006); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(17006); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new GetLifecyclePolicyPreviewCommand_1.GetLifecyclePolicyPreviewCommand(input), ...args); }; @@ -12849,8 +12874,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateListImages = void 0; const ListImagesCommand_1 = __nccwpck_require__(3854); -const ECR_1 = __nccwpck_require__(9167); -const ECRClient_1 = __nccwpck_require__(3391); +const ECR_1 = __nccwpck_require__(59167); +const ECRClient_1 = __nccwpck_require__(83391); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new ListImagesCommand_1.ListImagesCommand(input), ...args); }; @@ -12884,25 +12909,25 @@ exports.paginateListImages = paginateListImages; /***/ }), -/***/ 5356: +/***/ 35356: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(862), exports); -tslib_1.__exportStar(__nccwpck_require__(1351), exports); -tslib_1.__exportStar(__nccwpck_require__(9589), exports); -tslib_1.__exportStar(__nccwpck_require__(6404), exports); -tslib_1.__exportStar(__nccwpck_require__(987), exports); +tslib_1.__exportStar(__nccwpck_require__(30862), exports); +tslib_1.__exportStar(__nccwpck_require__(51351), exports); +tslib_1.__exportStar(__nccwpck_require__(59589), exports); +tslib_1.__exportStar(__nccwpck_require__(16404), exports); +tslib_1.__exportStar(__nccwpck_require__(50987), exports); tslib_1.__exportStar(__nccwpck_require__(9010), exports); tslib_1.__exportStar(__nccwpck_require__(1066), exports); /***/ }), -/***/ 6704: +/***/ 56704: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -12910,7 +12935,7 @@ tslib_1.__exportStar(__nccwpck_require__(1066), exports); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserializeAws_json1_1DeletePullThroughCacheRuleCommand = exports.deserializeAws_json1_1DeleteLifecyclePolicyCommand = exports.deserializeAws_json1_1CreateRepositoryCommand = exports.deserializeAws_json1_1CreatePullThroughCacheRuleCommand = exports.deserializeAws_json1_1CompleteLayerUploadCommand = exports.deserializeAws_json1_1BatchGetRepositoryScanningConfigurationCommand = exports.deserializeAws_json1_1BatchGetImageCommand = exports.deserializeAws_json1_1BatchDeleteImageCommand = exports.deserializeAws_json1_1BatchCheckLayerAvailabilityCommand = exports.serializeAws_json1_1UploadLayerPartCommand = exports.serializeAws_json1_1UntagResourceCommand = exports.serializeAws_json1_1TagResourceCommand = exports.serializeAws_json1_1StartLifecyclePolicyPreviewCommand = exports.serializeAws_json1_1StartImageScanCommand = exports.serializeAws_json1_1SetRepositoryPolicyCommand = exports.serializeAws_json1_1PutReplicationConfigurationCommand = exports.serializeAws_json1_1PutRegistryScanningConfigurationCommand = exports.serializeAws_json1_1PutRegistryPolicyCommand = exports.serializeAws_json1_1PutLifecyclePolicyCommand = exports.serializeAws_json1_1PutImageTagMutabilityCommand = exports.serializeAws_json1_1PutImageScanningConfigurationCommand = exports.serializeAws_json1_1PutImageCommand = exports.serializeAws_json1_1ListTagsForResourceCommand = exports.serializeAws_json1_1ListImagesCommand = exports.serializeAws_json1_1InitiateLayerUploadCommand = exports.serializeAws_json1_1GetRepositoryPolicyCommand = exports.serializeAws_json1_1GetRegistryScanningConfigurationCommand = exports.serializeAws_json1_1GetRegistryPolicyCommand = exports.serializeAws_json1_1GetLifecyclePolicyPreviewCommand = exports.serializeAws_json1_1GetLifecyclePolicyCommand = exports.serializeAws_json1_1GetDownloadUrlForLayerCommand = exports.serializeAws_json1_1GetAuthorizationTokenCommand = exports.serializeAws_json1_1DescribeRepositoriesCommand = exports.serializeAws_json1_1DescribeRegistryCommand = exports.serializeAws_json1_1DescribePullThroughCacheRulesCommand = exports.serializeAws_json1_1DescribeImageScanFindingsCommand = exports.serializeAws_json1_1DescribeImagesCommand = exports.serializeAws_json1_1DescribeImageReplicationStatusCommand = exports.serializeAws_json1_1DeleteRepositoryPolicyCommand = exports.serializeAws_json1_1DeleteRepositoryCommand = exports.serializeAws_json1_1DeleteRegistryPolicyCommand = exports.serializeAws_json1_1DeletePullThroughCacheRuleCommand = exports.serializeAws_json1_1DeleteLifecyclePolicyCommand = exports.serializeAws_json1_1CreateRepositoryCommand = exports.serializeAws_json1_1CreatePullThroughCacheRuleCommand = exports.serializeAws_json1_1CompleteLayerUploadCommand = exports.serializeAws_json1_1BatchGetRepositoryScanningConfigurationCommand = exports.serializeAws_json1_1BatchGetImageCommand = exports.serializeAws_json1_1BatchDeleteImageCommand = exports.serializeAws_json1_1BatchCheckLayerAvailabilityCommand = void 0; exports.deserializeAws_json1_1UploadLayerPartCommand = exports.deserializeAws_json1_1UntagResourceCommand = exports.deserializeAws_json1_1TagResourceCommand = exports.deserializeAws_json1_1StartLifecyclePolicyPreviewCommand = exports.deserializeAws_json1_1StartImageScanCommand = exports.deserializeAws_json1_1SetRepositoryPolicyCommand = exports.deserializeAws_json1_1PutReplicationConfigurationCommand = exports.deserializeAws_json1_1PutRegistryScanningConfigurationCommand = exports.deserializeAws_json1_1PutRegistryPolicyCommand = exports.deserializeAws_json1_1PutLifecyclePolicyCommand = exports.deserializeAws_json1_1PutImageTagMutabilityCommand = exports.deserializeAws_json1_1PutImageScanningConfigurationCommand = exports.deserializeAws_json1_1PutImageCommand = exports.deserializeAws_json1_1ListTagsForResourceCommand = exports.deserializeAws_json1_1ListImagesCommand = exports.deserializeAws_json1_1InitiateLayerUploadCommand = exports.deserializeAws_json1_1GetRepositoryPolicyCommand = exports.deserializeAws_json1_1GetRegistryScanningConfigurationCommand = exports.deserializeAws_json1_1GetRegistryPolicyCommand = exports.deserializeAws_json1_1GetLifecyclePolicyPreviewCommand = exports.deserializeAws_json1_1GetLifecyclePolicyCommand = exports.deserializeAws_json1_1GetDownloadUrlForLayerCommand = exports.deserializeAws_json1_1GetAuthorizationTokenCommand = exports.deserializeAws_json1_1DescribeRepositoriesCommand = exports.deserializeAws_json1_1DescribeRegistryCommand = exports.deserializeAws_json1_1DescribePullThroughCacheRulesCommand = exports.deserializeAws_json1_1DescribeImageScanFindingsCommand = exports.deserializeAws_json1_1DescribeImagesCommand = exports.deserializeAws_json1_1DescribeImageReplicationStatusCommand = exports.deserializeAws_json1_1DeleteRepositoryPolicyCommand = exports.deserializeAws_json1_1DeleteRepositoryCommand = exports.deserializeAws_json1_1DeleteRegistryPolicyCommand = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); const smithy_client_1 = __nccwpck_require__(4963); const serializeAws_json1_1BatchCheckLayerAvailabilityCommand = async (input, context) => { const headers = { @@ -18623,19 +18648,19 @@ const loadRestJsonErrorCode = (output, data) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const tslib_1 = __nccwpck_require__(4351); -const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(6879)); -const client_sts_1 = __nccwpck_require__(2209); -const config_resolver_1 = __nccwpck_require__(6153); -const credential_provider_node_1 = __nccwpck_require__(5531); -const hash_node_1 = __nccwpck_require__(7442); -const middleware_retry_1 = __nccwpck_require__(6064); -const node_config_provider_1 = __nccwpck_require__(7684); -const node_http_handler_1 = __nccwpck_require__(8805); -const util_base64_node_1 = __nccwpck_require__(8588); -const util_body_length_node_1 = __nccwpck_require__(4147); -const util_user_agent_node_1 = __nccwpck_require__(8095); -const util_utf8_node_1 = __nccwpck_require__(6278); -const runtimeConfig_shared_1 = __nccwpck_require__(542); +const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(16879)); +const client_sts_1 = __nccwpck_require__(52209); +const config_resolver_1 = __nccwpck_require__(56153); +const credential_provider_node_1 = __nccwpck_require__(75531); +const hash_node_1 = __nccwpck_require__(97442); +const middleware_retry_1 = __nccwpck_require__(96064); +const node_config_provider_1 = __nccwpck_require__(87684); +const node_http_handler_1 = __nccwpck_require__(68805); +const util_base64_node_1 = __nccwpck_require__(18588); +const util_body_length_node_1 = __nccwpck_require__(74147); +const util_user_agent_node_1 = __nccwpck_require__(98095); +const util_utf8_node_1 = __nccwpck_require__(66278); +const runtimeConfig_shared_1 = __nccwpck_require__(70542); const smithy_client_1 = __nccwpck_require__(4963); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; @@ -18667,7 +18692,7 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 542: +/***/ 70542: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -18675,7 +18700,7 @@ exports.getRuntimeConfig = getRuntimeConfig; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const url_parser_1 = __nccwpck_require__(2992); -const endpoints_1 = __nccwpck_require__(3070); +const endpoints_1 = __nccwpck_require__(63070); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e; return ({ @@ -18692,28 +18717,28 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 8406: +/***/ 28406: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(8547), exports); -tslib_1.__exportStar(__nccwpck_require__(5723), exports); +tslib_1.__exportStar(__nccwpck_require__(78547), exports); +tslib_1.__exportStar(__nccwpck_require__(45723), exports); /***/ }), -/***/ 8547: +/***/ 78547: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.waitUntilImageScanComplete = exports.waitForImageScanComplete = void 0; -const util_waiter_1 = __nccwpck_require__(1627); -const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(2987); +const util_waiter_1 = __nccwpck_require__(21627); +const DescribeImageScanFindingsCommand_1 = __nccwpck_require__(72987); const checkState = async (client, input) => { let reason; try { @@ -18758,15 +18783,15 @@ exports.waitUntilImageScanComplete = waitUntilImageScanComplete; /***/ }), -/***/ 5723: +/***/ 45723: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.waitUntilLifecyclePolicyPreviewComplete = exports.waitForLifecyclePolicyPreviewComplete = void 0; -const util_waiter_1 = __nccwpck_require__(1627); -const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(7006); +const util_waiter_1 = __nccwpck_require__(21627); +const GetLifecyclePolicyPreviewCommand_1 = __nccwpck_require__(17006); const checkState = async (client, input) => { let reason; try { @@ -18811,18 +18836,18 @@ exports.waitUntilLifecyclePolicyPreviewComplete = waitUntilLifecyclePolicyPrevie /***/ }), -/***/ 9838: +/***/ 69838: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SSO = void 0; -const GetRoleCredentialsCommand_1 = __nccwpck_require__(8972); +const GetRoleCredentialsCommand_1 = __nccwpck_require__(18972); const ListAccountRolesCommand_1 = __nccwpck_require__(1513); -const ListAccountsCommand_1 = __nccwpck_require__(4296); -const LogoutCommand_1 = __nccwpck_require__(2586); -const SSOClient_1 = __nccwpck_require__(1057); +const ListAccountsCommand_1 = __nccwpck_require__(64296); +const LogoutCommand_1 = __nccwpck_require__(12586); +const SSOClient_1 = __nccwpck_require__(71057); class SSO extends SSOClient_1.SSOClient { getRoleCredentials(args, optionsOrCb, cb) { const command = new GetRoleCredentialsCommand_1.GetRoleCredentialsCommand(args); @@ -18886,21 +18911,21 @@ exports.SSO = SSO; /***/ }), -/***/ 1057: +/***/ 71057: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SSOClient = void 0; -const config_resolver_1 = __nccwpck_require__(6153); -const middleware_content_length_1 = __nccwpck_require__(2245); -const middleware_host_header_1 = __nccwpck_require__(2545); -const middleware_logger_1 = __nccwpck_require__(14); -const middleware_retry_1 = __nccwpck_require__(6064); -const middleware_user_agent_1 = __nccwpck_require__(4688); +const config_resolver_1 = __nccwpck_require__(56153); +const middleware_content_length_1 = __nccwpck_require__(42245); +const middleware_host_header_1 = __nccwpck_require__(22545); +const middleware_logger_1 = __nccwpck_require__(20014); +const middleware_retry_1 = __nccwpck_require__(96064); +const middleware_user_agent_1 = __nccwpck_require__(64688); const smithy_client_1 = __nccwpck_require__(4963); -const runtimeConfig_1 = __nccwpck_require__(9756); +const runtimeConfig_1 = __nccwpck_require__(19756); class SSOClient extends smithy_client_1.Client { constructor(configuration) { const _config_0 = runtimeConfig_1.getRuntimeConfig(configuration); @@ -18926,17 +18951,17 @@ exports.SSOClient = SSOClient; /***/ }), -/***/ 8972: +/***/ 18972: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetRoleCredentialsCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(6390); -const Aws_restJson1_1 = __nccwpck_require__(8507); +const models_0_1 = __nccwpck_require__(66390); +const Aws_restJson1_1 = __nccwpck_require__(98507); class GetRoleCredentialsCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -18977,10 +19002,10 @@ exports.GetRoleCredentialsCommand = GetRoleCredentialsCommand; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ListAccountRolesCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(6390); -const Aws_restJson1_1 = __nccwpck_require__(8507); +const models_0_1 = __nccwpck_require__(66390); +const Aws_restJson1_1 = __nccwpck_require__(98507); class ListAccountRolesCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -19014,17 +19039,17 @@ exports.ListAccountRolesCommand = ListAccountRolesCommand; /***/ }), -/***/ 4296: +/***/ 64296: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ListAccountsCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(6390); -const Aws_restJson1_1 = __nccwpck_require__(8507); +const models_0_1 = __nccwpck_require__(66390); +const Aws_restJson1_1 = __nccwpck_require__(98507); class ListAccountsCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -19058,17 +19083,17 @@ exports.ListAccountsCommand = ListAccountsCommand; /***/ }), -/***/ 2586: +/***/ 12586: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LogoutCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(6390); -const Aws_restJson1_1 = __nccwpck_require__(8507); +const models_0_1 = __nccwpck_require__(66390); +const Aws_restJson1_1 = __nccwpck_require__(98507); class LogoutCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -19102,29 +19127,29 @@ exports.LogoutCommand = LogoutCommand; /***/ }), -/***/ 5706: +/***/ 65706: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(8972), exports); +tslib_1.__exportStar(__nccwpck_require__(18972), exports); tslib_1.__exportStar(__nccwpck_require__(1513), exports); -tslib_1.__exportStar(__nccwpck_require__(4296), exports); -tslib_1.__exportStar(__nccwpck_require__(2586), exports); +tslib_1.__exportStar(__nccwpck_require__(64296), exports); +tslib_1.__exportStar(__nccwpck_require__(12586), exports); /***/ }), -/***/ 3546: +/***/ 33546: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRegionInfoProvider = void 0; -const config_resolver_1 = __nccwpck_require__(6153); +const config_resolver_1 = __nccwpck_require__(56153); const regionHash = { "ap-northeast-1": { variants: [ @@ -19401,35 +19426,35 @@ exports.defaultRegionInfoProvider = defaultRegionInfoProvider; /***/ }), -/***/ 2666: +/***/ 82666: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9838), exports); -tslib_1.__exportStar(__nccwpck_require__(1057), exports); -tslib_1.__exportStar(__nccwpck_require__(5706), exports); -tslib_1.__exportStar(__nccwpck_require__(4952), exports); -tslib_1.__exportStar(__nccwpck_require__(6773), exports); +tslib_1.__exportStar(__nccwpck_require__(69838), exports); +tslib_1.__exportStar(__nccwpck_require__(71057), exports); +tslib_1.__exportStar(__nccwpck_require__(65706), exports); +tslib_1.__exportStar(__nccwpck_require__(14952), exports); +tslib_1.__exportStar(__nccwpck_require__(36773), exports); /***/ }), -/***/ 4952: +/***/ 14952: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(6390), exports); +tslib_1.__exportStar(__nccwpck_require__(66390), exports); /***/ }), -/***/ 6390: +/***/ 66390: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19532,7 +19557,7 @@ var LogoutRequest; /***/ }), -/***/ 849: +/***/ 80849: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -19542,7 +19567,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 8460: +/***/ 88460: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -19550,8 +19575,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateListAccountRoles = void 0; const ListAccountRolesCommand_1 = __nccwpck_require__(1513); -const SSO_1 = __nccwpck_require__(9838); -const SSOClient_1 = __nccwpck_require__(1057); +const SSO_1 = __nccwpck_require__(69838); +const SSOClient_1 = __nccwpck_require__(71057); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new ListAccountRolesCommand_1.ListAccountRolesCommand(input), ...args); }; @@ -19585,16 +19610,16 @@ exports.paginateListAccountRoles = paginateListAccountRoles; /***/ }), -/***/ 938: +/***/ 50938: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.paginateListAccounts = void 0; -const ListAccountsCommand_1 = __nccwpck_require__(4296); -const SSO_1 = __nccwpck_require__(9838); -const SSOClient_1 = __nccwpck_require__(1057); +const ListAccountsCommand_1 = __nccwpck_require__(64296); +const SSO_1 = __nccwpck_require__(69838); +const SSOClient_1 = __nccwpck_require__(71057); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new ListAccountsCommand_1.ListAccountsCommand(input), ...args); }; @@ -19628,28 +19653,28 @@ exports.paginateListAccounts = paginateListAccounts; /***/ }), -/***/ 6773: +/***/ 36773: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(849), exports); -tslib_1.__exportStar(__nccwpck_require__(8460), exports); -tslib_1.__exportStar(__nccwpck_require__(938), exports); +tslib_1.__exportStar(__nccwpck_require__(80849), exports); +tslib_1.__exportStar(__nccwpck_require__(88460), exports); +tslib_1.__exportStar(__nccwpck_require__(50938), exports); /***/ }), -/***/ 8507: +/***/ 98507: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserializeAws_restJson1LogoutCommand = exports.deserializeAws_restJson1ListAccountsCommand = exports.deserializeAws_restJson1ListAccountRolesCommand = exports.deserializeAws_restJson1GetRoleCredentialsCommand = exports.serializeAws_restJson1LogoutCommand = exports.serializeAws_restJson1ListAccountsCommand = exports.serializeAws_restJson1ListAccountRolesCommand = exports.serializeAws_restJson1GetRoleCredentialsCommand = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); const smithy_client_1 = __nccwpck_require__(4963); const serializeAws_restJson1GetRoleCredentialsCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); @@ -20171,7 +20196,7 @@ const loadRestJsonErrorCode = (output, data) => { /***/ }), -/***/ 9756: +/***/ 19756: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20179,17 +20204,17 @@ const loadRestJsonErrorCode = (output, data) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const tslib_1 = __nccwpck_require__(4351); -const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(3966)); -const config_resolver_1 = __nccwpck_require__(6153); -const hash_node_1 = __nccwpck_require__(7442); -const middleware_retry_1 = __nccwpck_require__(6064); -const node_config_provider_1 = __nccwpck_require__(7684); -const node_http_handler_1 = __nccwpck_require__(8805); -const util_base64_node_1 = __nccwpck_require__(8588); -const util_body_length_node_1 = __nccwpck_require__(4147); -const util_user_agent_node_1 = __nccwpck_require__(8095); -const util_utf8_node_1 = __nccwpck_require__(6278); -const runtimeConfig_shared_1 = __nccwpck_require__(4355); +const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(63966)); +const config_resolver_1 = __nccwpck_require__(56153); +const hash_node_1 = __nccwpck_require__(97442); +const middleware_retry_1 = __nccwpck_require__(96064); +const node_config_provider_1 = __nccwpck_require__(87684); +const node_http_handler_1 = __nccwpck_require__(68805); +const util_base64_node_1 = __nccwpck_require__(18588); +const util_body_length_node_1 = __nccwpck_require__(74147); +const util_user_agent_node_1 = __nccwpck_require__(98095); +const util_utf8_node_1 = __nccwpck_require__(66278); +const runtimeConfig_shared_1 = __nccwpck_require__(44809); const smithy_client_1 = __nccwpck_require__(4963); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; @@ -20220,7 +20245,7 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 4355: +/***/ 44809: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -20228,7 +20253,7 @@ exports.getRuntimeConfig = getRuntimeConfig; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const url_parser_1 = __nccwpck_require__(2992); -const endpoints_1 = __nccwpck_require__(3546); +const endpoints_1 = __nccwpck_require__(33546); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e; return ({ @@ -20245,22 +20270,22 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 2605: +/***/ 32605: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.STS = void 0; -const AssumeRoleCommand_1 = __nccwpck_require__(9802); -const AssumeRoleWithSAMLCommand_1 = __nccwpck_require__(2865); -const AssumeRoleWithWebIdentityCommand_1 = __nccwpck_require__(7451); -const DecodeAuthorizationMessageCommand_1 = __nccwpck_require__(4150); -const GetAccessKeyInfoCommand_1 = __nccwpck_require__(9804); -const GetCallerIdentityCommand_1 = __nccwpck_require__(4278); -const GetFederationTokenCommand_1 = __nccwpck_require__(7552); -const GetSessionTokenCommand_1 = __nccwpck_require__(3285); -const STSClient_1 = __nccwpck_require__(4195); +const AssumeRoleCommand_1 = __nccwpck_require__(59802); +const AssumeRoleWithSAMLCommand_1 = __nccwpck_require__(72865); +const AssumeRoleWithWebIdentityCommand_1 = __nccwpck_require__(37451); +const DecodeAuthorizationMessageCommand_1 = __nccwpck_require__(74150); +const GetAccessKeyInfoCommand_1 = __nccwpck_require__(49804); +const GetCallerIdentityCommand_1 = __nccwpck_require__(24278); +const GetFederationTokenCommand_1 = __nccwpck_require__(57552); +const GetSessionTokenCommand_1 = __nccwpck_require__(43285); +const STSClient_1 = __nccwpck_require__(64195); class STS extends STSClient_1.STSClient { assumeRole(args, optionsOrCb, cb) { const command = new AssumeRoleCommand_1.AssumeRoleCommand(args); @@ -20380,22 +20405,22 @@ exports.STS = STS; /***/ }), -/***/ 4195: +/***/ 64195: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.STSClient = void 0; -const config_resolver_1 = __nccwpck_require__(6153); -const middleware_content_length_1 = __nccwpck_require__(2245); -const middleware_host_header_1 = __nccwpck_require__(2545); -const middleware_logger_1 = __nccwpck_require__(14); -const middleware_retry_1 = __nccwpck_require__(6064); -const middleware_sdk_sts_1 = __nccwpck_require__(5959); -const middleware_user_agent_1 = __nccwpck_require__(4688); +const config_resolver_1 = __nccwpck_require__(56153); +const middleware_content_length_1 = __nccwpck_require__(42245); +const middleware_host_header_1 = __nccwpck_require__(22545); +const middleware_logger_1 = __nccwpck_require__(20014); +const middleware_retry_1 = __nccwpck_require__(96064); +const middleware_sdk_sts_1 = __nccwpck_require__(55959); +const middleware_user_agent_1 = __nccwpck_require__(64688); const smithy_client_1 = __nccwpck_require__(4963); -const runtimeConfig_1 = __nccwpck_require__(3405); +const runtimeConfig_1 = __nccwpck_require__(83405); class STSClient extends smithy_client_1.Client { constructor(configuration) { const _config_0 = runtimeConfig_1.getRuntimeConfig(configuration); @@ -20422,18 +20447,18 @@ exports.STSClient = STSClient; /***/ }), -/***/ 9802: +/***/ 59802: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AssumeRoleCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class AssumeRoleCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20468,17 +20493,17 @@ exports.AssumeRoleCommand = AssumeRoleCommand; /***/ }), -/***/ 2865: +/***/ 72865: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AssumeRoleWithSAMLCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class AssumeRoleWithSAMLCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20512,17 +20537,17 @@ exports.AssumeRoleWithSAMLCommand = AssumeRoleWithSAMLCommand; /***/ }), -/***/ 7451: +/***/ 37451: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AssumeRoleWithWebIdentityCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); +const middleware_serde_1 = __nccwpck_require__(93631); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class AssumeRoleWithWebIdentityCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20556,18 +20581,18 @@ exports.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand; /***/ }), -/***/ 4150: +/***/ 74150: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DecodeAuthorizationMessageCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class DecodeAuthorizationMessageCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20602,18 +20627,18 @@ exports.DecodeAuthorizationMessageCommand = DecodeAuthorizationMessageCommand; /***/ }), -/***/ 9804: +/***/ 49804: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetAccessKeyInfoCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class GetAccessKeyInfoCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20648,18 +20673,18 @@ exports.GetAccessKeyInfoCommand = GetAccessKeyInfoCommand; /***/ }), -/***/ 4278: +/***/ 24278: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetCallerIdentityCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class GetCallerIdentityCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20694,18 +20719,18 @@ exports.GetCallerIdentityCommand = GetCallerIdentityCommand; /***/ }), -/***/ 7552: +/***/ 57552: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetFederationTokenCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class GetFederationTokenCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20740,18 +20765,18 @@ exports.GetFederationTokenCommand = GetFederationTokenCommand; /***/ }), -/***/ 3285: +/***/ 43285: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GetSessionTokenCommand = void 0; -const middleware_serde_1 = __nccwpck_require__(3631); -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_serde_1 = __nccwpck_require__(93631); +const middleware_signing_1 = __nccwpck_require__(14935); const smithy_client_1 = __nccwpck_require__(4963); -const models_0_1 = __nccwpck_require__(1780); -const Aws_query_1 = __nccwpck_require__(740); +const models_0_1 = __nccwpck_require__(21780); +const Aws_query_1 = __nccwpck_require__(10740); class GetSessionTokenCommand extends smithy_client_1.Command { constructor(input) { super(); @@ -20786,34 +20811,34 @@ exports.GetSessionTokenCommand = GetSessionTokenCommand; /***/ }), -/***/ 5716: +/***/ 55716: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9802), exports); -tslib_1.__exportStar(__nccwpck_require__(2865), exports); -tslib_1.__exportStar(__nccwpck_require__(7451), exports); -tslib_1.__exportStar(__nccwpck_require__(4150), exports); -tslib_1.__exportStar(__nccwpck_require__(9804), exports); -tslib_1.__exportStar(__nccwpck_require__(4278), exports); -tslib_1.__exportStar(__nccwpck_require__(7552), exports); -tslib_1.__exportStar(__nccwpck_require__(3285), exports); +tslib_1.__exportStar(__nccwpck_require__(59802), exports); +tslib_1.__exportStar(__nccwpck_require__(72865), exports); +tslib_1.__exportStar(__nccwpck_require__(37451), exports); +tslib_1.__exportStar(__nccwpck_require__(74150), exports); +tslib_1.__exportStar(__nccwpck_require__(49804), exports); +tslib_1.__exportStar(__nccwpck_require__(24278), exports); +tslib_1.__exportStar(__nccwpck_require__(57552), exports); +tslib_1.__exportStar(__nccwpck_require__(43285), exports); /***/ }), -/***/ 8028: +/***/ 88028: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.decorateDefaultCredentialProvider = exports.getDefaultRoleAssumerWithWebIdentity = exports.getDefaultRoleAssumer = void 0; -const defaultStsRoleAssumers_1 = __nccwpck_require__(48); -const STSClient_1 = __nccwpck_require__(4195); +const defaultStsRoleAssumers_1 = __nccwpck_require__(90048); +const STSClient_1 = __nccwpck_require__(64195); const getDefaultRoleAssumer = (stsOptions = {}) => defaultStsRoleAssumers_1.getDefaultRoleAssumer(stsOptions, STSClient_1.STSClient); exports.getDefaultRoleAssumer = getDefaultRoleAssumer; const getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}) => defaultStsRoleAssumers_1.getDefaultRoleAssumerWithWebIdentity(stsOptions, STSClient_1.STSClient); @@ -20828,15 +20853,15 @@ exports.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; /***/ }), -/***/ 48: +/***/ 90048: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.decorateDefaultCredentialProvider = exports.getDefaultRoleAssumerWithWebIdentity = exports.getDefaultRoleAssumer = void 0; -const AssumeRoleCommand_1 = __nccwpck_require__(9802); -const AssumeRoleWithWebIdentityCommand_1 = __nccwpck_require__(7451); +const AssumeRoleCommand_1 = __nccwpck_require__(59802); +const AssumeRoleWithWebIdentityCommand_1 = __nccwpck_require__(37451); const ASSUME_ROLE_DEFAULT_REGION = "us-east-1"; const decorateDefaultRegion = (region) => { if (typeof region !== "function") { @@ -20919,7 +20944,7 @@ exports.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRegionInfoProvider = void 0; -const config_resolver_1 = __nccwpck_require__(6153); +const config_resolver_1 = __nccwpck_require__(56153); const regionHash = { "aws-global": { variants: [ @@ -21138,35 +21163,35 @@ exports.defaultRegionInfoProvider = defaultRegionInfoProvider; /***/ }), -/***/ 2209: +/***/ 52209: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(2605), exports); -tslib_1.__exportStar(__nccwpck_require__(4195), exports); -tslib_1.__exportStar(__nccwpck_require__(5716), exports); -tslib_1.__exportStar(__nccwpck_require__(8028), exports); -tslib_1.__exportStar(__nccwpck_require__(106), exports); +tslib_1.__exportStar(__nccwpck_require__(32605), exports); +tslib_1.__exportStar(__nccwpck_require__(64195), exports); +tslib_1.__exportStar(__nccwpck_require__(55716), exports); +tslib_1.__exportStar(__nccwpck_require__(88028), exports); +tslib_1.__exportStar(__nccwpck_require__(20106), exports); /***/ }), -/***/ 106: +/***/ 20106: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(1780), exports); +tslib_1.__exportStar(__nccwpck_require__(21780), exports); /***/ }), -/***/ 1780: +/***/ 21780: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -21351,17 +21376,17 @@ var GetSessionTokenResponse; /***/ }), -/***/ 740: +/***/ 10740: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserializeAws_queryGetSessionTokenCommand = exports.deserializeAws_queryGetFederationTokenCommand = exports.deserializeAws_queryGetCallerIdentityCommand = exports.deserializeAws_queryGetAccessKeyInfoCommand = exports.deserializeAws_queryDecodeAuthorizationMessageCommand = exports.deserializeAws_queryAssumeRoleWithWebIdentityCommand = exports.deserializeAws_queryAssumeRoleWithSAMLCommand = exports.deserializeAws_queryAssumeRoleCommand = exports.serializeAws_queryGetSessionTokenCommand = exports.serializeAws_queryGetFederationTokenCommand = exports.serializeAws_queryGetCallerIdentityCommand = exports.serializeAws_queryGetAccessKeyInfoCommand = exports.serializeAws_queryDecodeAuthorizationMessageCommand = exports.serializeAws_queryAssumeRoleWithWebIdentityCommand = exports.serializeAws_queryAssumeRoleWithSAMLCommand = exports.serializeAws_queryAssumeRoleCommand = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); const smithy_client_1 = __nccwpck_require__(4963); const entities_1 = __nccwpck_require__(3000); -const fast_xml_parser_1 = __nccwpck_require__(7448); +const fast_xml_parser_1 = __nccwpck_require__(27448); const serializeAws_queryAssumeRoleCommand = async (input, context) => { const headers = { "content-type": "application/x-www-form-urlencoded", @@ -22608,7 +22633,7 @@ const loadQueryErrorCode = (output, data) => { /***/ }), -/***/ 3405: +/***/ 83405: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -22617,18 +22642,18 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRuntimeConfig = void 0; const tslib_1 = __nccwpck_require__(4351); const package_json_1 = tslib_1.__importDefault(__nccwpck_require__(1121)); -const defaultStsRoleAssumers_1 = __nccwpck_require__(48); -const config_resolver_1 = __nccwpck_require__(6153); -const credential_provider_node_1 = __nccwpck_require__(5531); -const hash_node_1 = __nccwpck_require__(7442); -const middleware_retry_1 = __nccwpck_require__(6064); -const node_config_provider_1 = __nccwpck_require__(7684); -const node_http_handler_1 = __nccwpck_require__(8805); -const util_base64_node_1 = __nccwpck_require__(8588); -const util_body_length_node_1 = __nccwpck_require__(4147); -const util_user_agent_node_1 = __nccwpck_require__(8095); -const util_utf8_node_1 = __nccwpck_require__(6278); -const runtimeConfig_shared_1 = __nccwpck_require__(2642); +const defaultStsRoleAssumers_1 = __nccwpck_require__(90048); +const config_resolver_1 = __nccwpck_require__(56153); +const credential_provider_node_1 = __nccwpck_require__(75531); +const hash_node_1 = __nccwpck_require__(97442); +const middleware_retry_1 = __nccwpck_require__(96064); +const node_config_provider_1 = __nccwpck_require__(87684); +const node_http_handler_1 = __nccwpck_require__(68805); +const util_base64_node_1 = __nccwpck_require__(18588); +const util_body_length_node_1 = __nccwpck_require__(74147); +const util_user_agent_node_1 = __nccwpck_require__(98095); +const util_utf8_node_1 = __nccwpck_require__(66278); +const runtimeConfig_shared_1 = __nccwpck_require__(52642); const smithy_client_1 = __nccwpck_require__(4963); const getRuntimeConfig = (config) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; @@ -22660,7 +22685,7 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 2642: +/***/ 52642: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -22685,7 +22710,7 @@ exports.getRuntimeConfig = getRuntimeConfig; /***/ }), -/***/ 4723: +/***/ 14723: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -22705,7 +22730,7 @@ exports.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { /***/ }), -/***/ 2478: +/***/ 42478: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -22725,29 +22750,29 @@ exports.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { /***/ }), -/***/ 7392: +/***/ 47392: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(4723), exports); -tslib_1.__exportStar(__nccwpck_require__(2478), exports); -tslib_1.__exportStar(__nccwpck_require__(2108), exports); -tslib_1.__exportStar(__nccwpck_require__(2327), exports); +tslib_1.__exportStar(__nccwpck_require__(14723), exports); +tslib_1.__exportStar(__nccwpck_require__(42478), exports); +tslib_1.__exportStar(__nccwpck_require__(92108), exports); +tslib_1.__exportStar(__nccwpck_require__(92327), exports); /***/ }), -/***/ 2108: +/***/ 92108: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.resolveCustomEndpointsConfig = void 0; -const normalizeBoolean_1 = __nccwpck_require__(2164); +const normalizeBoolean_1 = __nccwpck_require__(52164); const normalizeEndpoint_1 = __nccwpck_require__(9815); const resolveCustomEndpointsConfig = (input) => { var _a; @@ -22764,15 +22789,15 @@ exports.resolveCustomEndpointsConfig = resolveCustomEndpointsConfig; /***/ }), -/***/ 2327: +/***/ 92327: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.resolveEndpointsConfig = void 0; -const getEndpointFromRegion_1 = __nccwpck_require__(4159); -const normalizeBoolean_1 = __nccwpck_require__(2164); +const getEndpointFromRegion_1 = __nccwpck_require__(94159); +const normalizeBoolean_1 = __nccwpck_require__(52164); const normalizeEndpoint_1 = __nccwpck_require__(9815); const resolveEndpointsConfig = (input) => { var _a; @@ -22793,7 +22818,7 @@ exports.resolveEndpointsConfig = resolveEndpointsConfig; /***/ }), -/***/ 4159: +/***/ 94159: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -22821,7 +22846,7 @@ exports.getEndpointFromRegion = getEndpointFromRegion; /***/ }), -/***/ 2164: +/***/ 52164: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -22863,21 +22888,21 @@ exports.normalizeEndpoint = normalizeEndpoint; /***/ }), -/***/ 6153: +/***/ 56153: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(7392), exports); -tslib_1.__exportStar(__nccwpck_require__(5441), exports); -tslib_1.__exportStar(__nccwpck_require__(6258), exports); +tslib_1.__exportStar(__nccwpck_require__(47392), exports); +tslib_1.__exportStar(__nccwpck_require__(85441), exports); +tslib_1.__exportStar(__nccwpck_require__(86258), exports); /***/ }), -/***/ 422: +/***/ 70422: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -22900,14 +22925,14 @@ exports.NODE_REGION_CONFIG_FILE_OPTIONS = { /***/ }), -/***/ 2844: +/***/ 52844: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRealRegion = void 0; -const isFipsRegion_1 = __nccwpck_require__(2440); +const isFipsRegion_1 = __nccwpck_require__(82440); const getRealRegion = (region) => isFipsRegion_1.isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" @@ -22918,20 +22943,20 @@ exports.getRealRegion = getRealRegion; /***/ }), -/***/ 5441: +/***/ 85441: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(422), exports); -tslib_1.__exportStar(__nccwpck_require__(1595), exports); +tslib_1.__exportStar(__nccwpck_require__(70422), exports); +tslib_1.__exportStar(__nccwpck_require__(81595), exports); /***/ }), -/***/ 2440: +/***/ 82440: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -22944,15 +22969,15 @@ exports.isFipsRegion = isFipsRegion; /***/ }), -/***/ 1595: +/***/ 81595: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.resolveRegionConfig = void 0; -const getRealRegion_1 = __nccwpck_require__(2844); -const isFipsRegion_1 = __nccwpck_require__(2440); +const getRealRegion_1 = __nccwpck_require__(52844); +const isFipsRegion_1 = __nccwpck_require__(82440); const resolveRegionConfig = (input) => { const { region, useFipsEndpoint } = input; if (!region) { @@ -22991,7 +23016,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 6057: +/***/ 56057: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23001,7 +23026,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 5280: +/***/ 15280: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23017,17 +23042,17 @@ exports.getHostnameFromVariants = getHostnameFromVariants; /***/ }), -/***/ 6167: +/***/ 26167: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRegionInfo = void 0; -const getHostnameFromVariants_1 = __nccwpck_require__(5280); -const getResolvedHostname_1 = __nccwpck_require__(3877); -const getResolvedPartition_1 = __nccwpck_require__(7642); -const getResolvedSigningRegion_1 = __nccwpck_require__(3517); +const getHostnameFromVariants_1 = __nccwpck_require__(15280); +const getResolvedHostname_1 = __nccwpck_require__(63877); +const getResolvedPartition_1 = __nccwpck_require__(37642); +const getResolvedSigningRegion_1 = __nccwpck_require__(53517); const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => { var _a, _b, _c, _d, _e, _f; const partition = getResolvedPartition_1.getResolvedPartition(region, { partitionHash }); @@ -23059,7 +23084,7 @@ exports.getRegionInfo = getRegionInfo; /***/ }), -/***/ 3877: +/***/ 63877: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23076,7 +23101,7 @@ exports.getResolvedHostname = getResolvedHostname; /***/ }), -/***/ 7642: +/***/ 37642: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23089,7 +23114,7 @@ exports.getResolvedPartition = getResolvedPartition; /***/ }), -/***/ 3517: +/***/ 53517: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23113,7 +23138,7 @@ exports.getResolvedSigningRegion = getResolvedSigningRegion; /***/ }), -/***/ 6258: +/***/ 86258: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -23121,20 +23146,20 @@ exports.getResolvedSigningRegion = getResolvedSigningRegion; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); tslib_1.__exportStar(__nccwpck_require__(3566), exports); -tslib_1.__exportStar(__nccwpck_require__(6057), exports); -tslib_1.__exportStar(__nccwpck_require__(6167), exports); +tslib_1.__exportStar(__nccwpck_require__(56057), exports); +tslib_1.__exportStar(__nccwpck_require__(26167), exports); /***/ }), -/***/ 5972: +/***/ 15972: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromEnv = exports.ENV_EXPIRATION = exports.ENV_SESSION = exports.ENV_SECRET = exports.ENV_KEY = void 0; -const property_provider_1 = __nccwpck_require__(4462); +const property_provider_1 = __nccwpck_require__(74462); exports.ENV_KEY = "AWS_ACCESS_KEY_ID"; exports.ENV_SECRET = "AWS_SECRET_ACCESS_KEY"; exports.ENV_SESSION = "AWS_SESSION_TOKEN"; @@ -23176,7 +23201,7 @@ var Endpoint; /***/ }), -/***/ 8438: +/***/ 18438: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23194,7 +23219,7 @@ exports.ENDPOINT_CONFIG_OPTIONS = { /***/ }), -/***/ 1695: +/***/ 21695: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23210,14 +23235,14 @@ var EndpointMode; /***/ }), -/***/ 7824: +/***/ 97824: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ENDPOINT_MODE_CONFIG_OPTIONS = exports.CONFIG_ENDPOINT_MODE_NAME = exports.ENV_ENDPOINT_MODE_NAME = void 0; -const EndpointMode_1 = __nccwpck_require__(1695); +const EndpointMode_1 = __nccwpck_require__(21695); exports.ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; exports.CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; exports.ENDPOINT_MODE_CONFIG_OPTIONS = { @@ -23229,19 +23254,19 @@ exports.ENDPOINT_MODE_CONFIG_OPTIONS = { /***/ }), -/***/ 5232: +/***/ 75232: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromContainerMetadata = exports.ENV_CMDS_AUTH_TOKEN = exports.ENV_CMDS_RELATIVE_URI = exports.ENV_CMDS_FULL_URI = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const url_1 = __nccwpck_require__(8835); -const httpRequest_1 = __nccwpck_require__(1303); -const ImdsCredentials_1 = __nccwpck_require__(1467); -const RemoteProviderInit_1 = __nccwpck_require__(2314); -const retry_1 = __nccwpck_require__(9912); +const property_provider_1 = __nccwpck_require__(74462); +const url_1 = __nccwpck_require__(78835); +const httpRequest_1 = __nccwpck_require__(81303); +const ImdsCredentials_1 = __nccwpck_require__(91467); +const RemoteProviderInit_1 = __nccwpck_require__(72314); +const retry_1 = __nccwpck_require__(49912); exports.ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; exports.ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; exports.ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; @@ -23307,19 +23332,19 @@ const getCmdsUri = async () => { /***/ }), -/***/ 5813: +/***/ 35813: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromInstanceMetadata = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const httpRequest_1 = __nccwpck_require__(1303); -const ImdsCredentials_1 = __nccwpck_require__(1467); -const RemoteProviderInit_1 = __nccwpck_require__(2314); -const retry_1 = __nccwpck_require__(9912); -const getInstanceMetadataEndpoint_1 = __nccwpck_require__(1206); +const property_provider_1 = __nccwpck_require__(74462); +const httpRequest_1 = __nccwpck_require__(81303); +const ImdsCredentials_1 = __nccwpck_require__(91467); +const RemoteProviderInit_1 = __nccwpck_require__(72314); +const retry_1 = __nccwpck_require__(49912); +const getInstanceMetadataEndpoint_1 = __nccwpck_require__(41206); const IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; const IMDS_TOKEN_PATH = "/latest/api/token"; const fromInstanceMetadata = (init = {}) => { @@ -23408,21 +23433,21 @@ const getCredentialsFromProfile = async (profile, options) => { /***/ }), -/***/ 5898: +/***/ 25898: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(5232), exports); -tslib_1.__exportStar(__nccwpck_require__(5813), exports); -tslib_1.__exportStar(__nccwpck_require__(2314), exports); +tslib_1.__exportStar(__nccwpck_require__(75232), exports); +tslib_1.__exportStar(__nccwpck_require__(35813), exports); +tslib_1.__exportStar(__nccwpck_require__(72314), exports); /***/ }), -/***/ 1467: +/***/ 91467: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23447,7 +23472,7 @@ exports.fromImdsCredentials = fromImdsCredentials; /***/ }), -/***/ 2314: +/***/ 72314: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23462,16 +23487,16 @@ exports.providerConfigFromInit = providerConfigFromInit; /***/ }), -/***/ 1303: +/***/ 81303: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.httpRequest = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const buffer_1 = __nccwpck_require__(4293); -const http_1 = __nccwpck_require__(8605); +const property_provider_1 = __nccwpck_require__(74462); +const buffer_1 = __nccwpck_require__(64293); +const http_1 = __nccwpck_require__(98605); function httpRequest(options) { return new Promise((resolve, reject) => { var _a; @@ -23511,7 +23536,7 @@ exports.httpRequest = httpRequest; /***/ }), -/***/ 9912: +/***/ 49912: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -23530,19 +23555,19 @@ exports.retry = retry; /***/ }), -/***/ 1206: +/***/ 41206: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getInstanceMetadataEndpoint = void 0; -const node_config_provider_1 = __nccwpck_require__(7684); +const node_config_provider_1 = __nccwpck_require__(87684); const url_parser_1 = __nccwpck_require__(2992); const Endpoint_1 = __nccwpck_require__(3736); -const EndpointConfigOptions_1 = __nccwpck_require__(8438); -const EndpointMode_1 = __nccwpck_require__(1695); -const EndpointModeConfigOptions_1 = __nccwpck_require__(7824); +const EndpointConfigOptions_1 = __nccwpck_require__(18438); +const EndpointMode_1 = __nccwpck_require__(21695); +const EndpointModeConfigOptions_1 = __nccwpck_require__(97824); const getInstanceMetadataEndpoint = async () => url_parser_1.parseUrl((await getFromEndpointConfig()) || (await getFromEndpointModeConfig())); exports.getInstanceMetadataEndpoint = getInstanceMetadataEndpoint; const getFromEndpointConfig = async () => node_config_provider_1.loadConfig(EndpointConfigOptions_1.ENDPOINT_CONFIG_OPTIONS)(); @@ -23561,19 +23586,19 @@ const getFromEndpointModeConfig = async () => { /***/ }), -/***/ 4203: +/***/ 74203: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromIni = void 0; -const credential_provider_env_1 = __nccwpck_require__(5972); -const credential_provider_imds_1 = __nccwpck_require__(5898); -const credential_provider_sso_1 = __nccwpck_require__(6414); -const credential_provider_web_identity_1 = __nccwpck_require__(5646); -const property_provider_1 = __nccwpck_require__(4462); -const util_credentials_1 = __nccwpck_require__(8598); +const credential_provider_env_1 = __nccwpck_require__(15972); +const credential_provider_imds_1 = __nccwpck_require__(25898); +const credential_provider_sso_1 = __nccwpck_require__(26414); +const credential_provider_web_identity_1 = __nccwpck_require__(15646); +const property_provider_1 = __nccwpck_require__(74462); +const util_credentials_1 = __nccwpck_require__(98598); const isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && @@ -23674,22 +23699,22 @@ const resolveWebIdentityCredentials = async (profile, options) => credential_pro /***/ }), -/***/ 5531: +/***/ 75531: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultProvider = exports.ENV_IMDS_DISABLED = void 0; -const credential_provider_env_1 = __nccwpck_require__(5972); -const credential_provider_imds_1 = __nccwpck_require__(5898); -const credential_provider_ini_1 = __nccwpck_require__(4203); -const credential_provider_process_1 = __nccwpck_require__(9969); -const credential_provider_sso_1 = __nccwpck_require__(6414); -const credential_provider_web_identity_1 = __nccwpck_require__(5646); -const property_provider_1 = __nccwpck_require__(4462); -const shared_ini_file_loader_1 = __nccwpck_require__(7387); -const util_credentials_1 = __nccwpck_require__(8598); +const credential_provider_env_1 = __nccwpck_require__(15972); +const credential_provider_imds_1 = __nccwpck_require__(25898); +const credential_provider_ini_1 = __nccwpck_require__(74203); +const credential_provider_process_1 = __nccwpck_require__(89969); +const credential_provider_sso_1 = __nccwpck_require__(26414); +const credential_provider_web_identity_1 = __nccwpck_require__(15646); +const property_provider_1 = __nccwpck_require__(74462); +const shared_ini_file_loader_1 = __nccwpck_require__(67387); +const util_credentials_1 = __nccwpck_require__(98598); exports.ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; const defaultProvider = (init = {}) => { const options = { profile: process.env[util_credentials_1.ENV_PROFILE], ...init }; @@ -23724,16 +23749,16 @@ const remoteProvider = (init) => { /***/ }), -/***/ 9969: +/***/ 89969: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromProcess = exports.ENV_PROFILE = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const util_credentials_1 = __nccwpck_require__(8598); -const child_process_1 = __nccwpck_require__(3129); +const property_provider_1 = __nccwpck_require__(74462); +const util_credentials_1 = __nccwpck_require__(98598); +const child_process_1 = __nccwpck_require__(63129); exports.ENV_PROFILE = "AWS_PROFILE"; const fromProcess = (init = {}) => async () => { const profiles = await util_credentials_1.parseKnownFiles(init); @@ -23802,20 +23827,20 @@ const execPromise = (command) => new Promise(function (resolve, reject) { /***/ }), -/***/ 6414: +/***/ 26414: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isSsoProfile = exports.validateSsoProfile = exports.fromSSO = exports.EXPIRE_WINDOW_MS = void 0; -const client_sso_1 = __nccwpck_require__(2666); -const property_provider_1 = __nccwpck_require__(4462); -const shared_ini_file_loader_1 = __nccwpck_require__(7387); -const util_credentials_1 = __nccwpck_require__(8598); -const crypto_1 = __nccwpck_require__(6417); -const fs_1 = __nccwpck_require__(5747); -const path_1 = __nccwpck_require__(5622); +const client_sso_1 = __nccwpck_require__(82666); +const property_provider_1 = __nccwpck_require__(74462); +const shared_ini_file_loader_1 = __nccwpck_require__(67387); +const util_credentials_1 = __nccwpck_require__(98598); +const crypto_1 = __nccwpck_require__(76417); +const fs_1 = __nccwpck_require__(35747); +const path_1 = __nccwpck_require__(85622); exports.EXPIRE_WINDOW_MS = 15 * 60 * 1000; const SHOULD_FAIL_CREDENTIAL_CHAIN = false; const fromSSO = (init = {}) => async () => { @@ -23898,16 +23923,16 @@ exports.isSsoProfile = isSsoProfile; /***/ }), -/***/ 5614: +/***/ 35614: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromTokenFile = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const fs_1 = __nccwpck_require__(5747); -const fromWebToken_1 = __nccwpck_require__(7905); +const property_provider_1 = __nccwpck_require__(74462); +const fs_1 = __nccwpck_require__(35747); +const fromWebToken_1 = __nccwpck_require__(47905); const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE"; const ENV_ROLE_ARN = "AWS_ROLE_ARN"; const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME"; @@ -23934,14 +23959,14 @@ const resolveTokenFile = (init) => { /***/ }), -/***/ 7905: +/***/ 47905: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromWebToken = void 0; -const property_provider_1 = __nccwpck_require__(4462); +const property_provider_1 = __nccwpck_require__(74462); const fromWebToken = (init) => () => { const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity, } = init; if (!roleAssumerWithWebIdentity) { @@ -23963,29 +23988,29 @@ exports.fromWebToken = fromWebToken; /***/ }), -/***/ 5646: +/***/ 15646: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(5614), exports); -tslib_1.__exportStar(__nccwpck_require__(7905), exports); +tslib_1.__exportStar(__nccwpck_require__(35614), exports); +tslib_1.__exportStar(__nccwpck_require__(47905), exports); /***/ }), -/***/ 7442: +/***/ 97442: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Hash = void 0; -const util_buffer_from_1 = __nccwpck_require__(6010); -const buffer_1 = __nccwpck_require__(4293); -const crypto_1 = __nccwpck_require__(6417); +const util_buffer_from_1 = __nccwpck_require__(36010); +const buffer_1 = __nccwpck_require__(64293); +const crypto_1 = __nccwpck_require__(76417); class Hash { constructor(algorithmIdentifier, secret) { this.hash = secret ? crypto_1.createHmac(algorithmIdentifier, castSourceData(secret)) : crypto_1.createHash(algorithmIdentifier); @@ -24014,7 +24039,7 @@ function castSourceData(toCast, encoding) { /***/ }), -/***/ 9126: +/***/ 69126: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24028,14 +24053,14 @@ exports.isArrayBuffer = isArrayBuffer; /***/ }), -/***/ 2245: +/***/ 42245: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getContentLengthPlugin = exports.contentLengthMiddlewareOptions = exports.contentLengthMiddleware = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); const CONTENT_LENGTH_HEADER = "content-length"; function contentLengthMiddleware(bodyLengthChecker) { return (next) => async (args) => { @@ -24078,14 +24103,14 @@ exports.getContentLengthPlugin = getContentLengthPlugin; /***/ }), -/***/ 2545: +/***/ 22545: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getHostHeaderPlugin = exports.hostHeaderMiddlewareOptions = exports.hostHeaderMiddleware = exports.resolveHostHeaderConfig = void 0; -const protocol_http_1 = __nccwpck_require__(223); +const protocol_http_1 = __nccwpck_require__(70223); function resolveHostHeaderConfig(input) { return input; } @@ -24122,7 +24147,7 @@ exports.getHostHeaderPlugin = getHostHeaderPlugin; /***/ }), -/***/ 14: +/***/ 20014: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -24176,14 +24201,14 @@ exports.getLoggerPlugin = getLoggerPlugin; /***/ }), -/***/ 7328: +/***/ 47328: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AdaptiveRetryStrategy = void 0; -const config_1 = __nccwpck_require__(5192); +const config_1 = __nccwpck_require__(55192); const DefaultRateLimiter_1 = __nccwpck_require__(6402); const StandardRetryStrategy_1 = __nccwpck_require__(533); class AdaptiveRetryStrategy extends StandardRetryStrategy_1.StandardRetryStrategy { @@ -24216,7 +24241,7 @@ exports.AdaptiveRetryStrategy = AdaptiveRetryStrategy; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultRateLimiter = void 0; -const service_error_classification_1 = __nccwpck_require__(1921); +const service_error_classification_1 = __nccwpck_require__(61921); class DefaultRateLimiter { constructor(options) { var _a, _b, _c, _d, _e; @@ -24328,14 +24353,14 @@ exports.DefaultRateLimiter = DefaultRateLimiter; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StandardRetryStrategy = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const service_error_classification_1 = __nccwpck_require__(1921); -const uuid_1 = __nccwpck_require__(5840); -const config_1 = __nccwpck_require__(5192); -const constants_1 = __nccwpck_require__(41); -const defaultRetryQuota_1 = __nccwpck_require__(2568); -const delayDecider_1 = __nccwpck_require__(5940); -const retryDecider_1 = __nccwpck_require__(9572); +const protocol_http_1 = __nccwpck_require__(70223); +const service_error_classification_1 = __nccwpck_require__(61921); +const uuid_1 = __nccwpck_require__(75840); +const config_1 = __nccwpck_require__(55192); +const constants_1 = __nccwpck_require__(30041); +const defaultRetryQuota_1 = __nccwpck_require__(12568); +const delayDecider_1 = __nccwpck_require__(55940); +const retryDecider_1 = __nccwpck_require__(19572); class StandardRetryStrategy { constructor(maxAttemptsProvider, options) { var _a, _b, _c; @@ -24418,7 +24443,7 @@ const asSdkError = (error) => { /***/ }), -/***/ 5192: +/***/ 55192: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24436,15 +24461,15 @@ exports.DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD; /***/ }), -/***/ 6160: +/***/ 76160: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.NODE_RETRY_MODE_CONFIG_OPTIONS = exports.CONFIG_RETRY_MODE = exports.ENV_RETRY_MODE = exports.resolveRetryConfig = exports.NODE_MAX_ATTEMPT_CONFIG_OPTIONS = exports.CONFIG_MAX_ATTEMPTS = exports.ENV_MAX_ATTEMPTS = void 0; -const AdaptiveRetryStrategy_1 = __nccwpck_require__(7328); -const config_1 = __nccwpck_require__(5192); +const AdaptiveRetryStrategy_1 = __nccwpck_require__(47328); +const config_1 = __nccwpck_require__(55192); const StandardRetryStrategy_1 = __nccwpck_require__(533); exports.ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS"; exports.CONFIG_MAX_ATTEMPTS = "max_attempts"; @@ -24513,7 +24538,7 @@ exports.NODE_RETRY_MODE_CONFIG_OPTIONS = { /***/ }), -/***/ 41: +/***/ 30041: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24533,14 +24558,14 @@ exports.REQUEST_HEADER = "amz-sdk-request"; /***/ }), -/***/ 2568: +/***/ 12568: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getDefaultRetryQuota = void 0; -const constants_1 = __nccwpck_require__(41); +const constants_1 = __nccwpck_require__(30041); const getDefaultRetryQuota = (initialRetryTokens, options) => { var _a, _b, _c; const MAX_CAPACITY = initialRetryTokens; @@ -24573,50 +24598,50 @@ exports.getDefaultRetryQuota = getDefaultRetryQuota; /***/ }), -/***/ 5940: +/***/ 55940: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultDelayDecider = void 0; -const constants_1 = __nccwpck_require__(41); +const constants_1 = __nccwpck_require__(30041); const defaultDelayDecider = (delayBase, attempts) => Math.floor(Math.min(constants_1.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); exports.defaultDelayDecider = defaultDelayDecider; /***/ }), -/***/ 6064: +/***/ 96064: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(7328), exports); +tslib_1.__exportStar(__nccwpck_require__(47328), exports); tslib_1.__exportStar(__nccwpck_require__(6402), exports); tslib_1.__exportStar(__nccwpck_require__(533), exports); -tslib_1.__exportStar(__nccwpck_require__(5192), exports); -tslib_1.__exportStar(__nccwpck_require__(6160), exports); -tslib_1.__exportStar(__nccwpck_require__(5940), exports); -tslib_1.__exportStar(__nccwpck_require__(3521), exports); -tslib_1.__exportStar(__nccwpck_require__(9572), exports); -tslib_1.__exportStar(__nccwpck_require__(1806), exports); -tslib_1.__exportStar(__nccwpck_require__(8580), exports); +tslib_1.__exportStar(__nccwpck_require__(55192), exports); +tslib_1.__exportStar(__nccwpck_require__(76160), exports); +tslib_1.__exportStar(__nccwpck_require__(55940), exports); +tslib_1.__exportStar(__nccwpck_require__(43521), exports); +tslib_1.__exportStar(__nccwpck_require__(19572), exports); +tslib_1.__exportStar(__nccwpck_require__(11806), exports); +tslib_1.__exportStar(__nccwpck_require__(48580), exports); /***/ }), -/***/ 3521: +/***/ 43521: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOmitRetryHeadersPlugin = exports.omitRetryHeadersMiddlewareOptions = exports.omitRetryHeadersMiddleware = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const constants_1 = __nccwpck_require__(41); +const protocol_http_1 = __nccwpck_require__(70223); +const constants_1 = __nccwpck_require__(30041); const omitRetryHeadersMiddleware = () => (next) => async (args) => { const { request } = args; if (protocol_http_1.HttpRequest.isInstance(request)) { @@ -24643,14 +24668,14 @@ exports.getOmitRetryHeadersPlugin = getOmitRetryHeadersPlugin; /***/ }), -/***/ 9572: +/***/ 19572: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRetryDecider = void 0; -const service_error_classification_1 = __nccwpck_require__(1921); +const service_error_classification_1 = __nccwpck_require__(61921); const defaultRetryDecider = (error) => { if (!error) { return false; @@ -24662,7 +24687,7 @@ exports.defaultRetryDecider = defaultRetryDecider; /***/ }), -/***/ 1806: +/***/ 11806: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24693,7 +24718,7 @@ exports.getRetryPlugin = getRetryPlugin; /***/ }), -/***/ 8580: +/***/ 48580: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24703,14 +24728,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 5959: +/***/ 55959: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.resolveStsAuthConfig = void 0; -const middleware_signing_1 = __nccwpck_require__(4935); +const middleware_signing_1 = __nccwpck_require__(14935); const resolveStsAuthConfig = (input, { stsClientCtor }) => middleware_signing_1.resolveAwsAuthConfig({ ...input, stsClientCtor, @@ -24720,7 +24745,7 @@ exports.resolveStsAuthConfig = resolveStsAuthConfig; /***/ }), -/***/ 5648: +/***/ 65648: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24740,29 +24765,29 @@ exports.deserializerMiddleware = deserializerMiddleware; /***/ }), -/***/ 3631: +/***/ 93631: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(5648), exports); -tslib_1.__exportStar(__nccwpck_require__(9328), exports); -tslib_1.__exportStar(__nccwpck_require__(9511), exports); +tslib_1.__exportStar(__nccwpck_require__(65648), exports); +tslib_1.__exportStar(__nccwpck_require__(99328), exports); +tslib_1.__exportStar(__nccwpck_require__(19511), exports); /***/ }), -/***/ 9328: +/***/ 99328: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getSerdePlugin = exports.serializerMiddlewareOption = exports.deserializerMiddlewareOption = void 0; -const deserializerMiddleware_1 = __nccwpck_require__(5648); -const serializerMiddleware_1 = __nccwpck_require__(9511); +const deserializerMiddleware_1 = __nccwpck_require__(65648); +const serializerMiddleware_1 = __nccwpck_require__(19511); exports.deserializerMiddlewareOption = { name: "deserializerMiddleware", step: "deserialize", @@ -24788,7 +24813,7 @@ exports.getSerdePlugin = getSerdePlugin; /***/ }), -/***/ 9511: +/***/ 19511: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24807,15 +24832,15 @@ exports.serializerMiddleware = serializerMiddleware; /***/ }), -/***/ 3061: +/***/ 63061: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.resolveSigV4AuthConfig = exports.resolveAwsAuthConfig = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const signature_v4_1 = __nccwpck_require__(7776); +const property_provider_1 = __nccwpck_require__(74462); +const signature_v4_1 = __nccwpck_require__(37776); const CREDENTIAL_EXPIRE_WINDOW = 300000; const resolveAwsAuthConfig = (input) => { const normalizedCreds = input.credentials @@ -24905,29 +24930,29 @@ const normalizeCredentialProvider = (credentials) => { /***/ }), -/***/ 4935: +/***/ 14935: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(3061), exports); -tslib_1.__exportStar(__nccwpck_require__(2509), exports); +tslib_1.__exportStar(__nccwpck_require__(63061), exports); +tslib_1.__exportStar(__nccwpck_require__(42509), exports); /***/ }), -/***/ 2509: +/***/ 42509: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getSigV4AuthPlugin = exports.getAwsAuthPlugin = exports.awsAuthMiddlewareOptions = exports.awsAuthMiddleware = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const getSkewCorrectedDate_1 = __nccwpck_require__(8253); -const getUpdatedSystemClockOffset_1 = __nccwpck_require__(5863); +const protocol_http_1 = __nccwpck_require__(70223); +const getSkewCorrectedDate_1 = __nccwpck_require__(68253); +const getUpdatedSystemClockOffset_1 = __nccwpck_require__(35863); const awsAuthMiddleware = (options) => (next, context) => async function (args) { if (!protocol_http_1.HttpRequest.isInstance(args.request)) return next(args); @@ -24971,7 +24996,7 @@ exports.getSigV4AuthPlugin = exports.getAwsAuthPlugin; /***/ }), -/***/ 8253: +/***/ 68253: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -24984,14 +25009,14 @@ exports.getSkewCorrectedDate = getSkewCorrectedDate; /***/ }), -/***/ 5863: +/***/ 35863: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getUpdatedSystemClockOffset = void 0; -const isClockSkewed_1 = __nccwpck_require__(5301); +const isClockSkewed_1 = __nccwpck_require__(85301); const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { const clockTimeInMs = Date.parse(clockTime); if (isClockSkewed_1.isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { @@ -25004,21 +25029,21 @@ exports.getUpdatedSystemClockOffset = getUpdatedSystemClockOffset; /***/ }), -/***/ 5301: +/***/ 85301: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isClockSkewed = void 0; -const getSkewCorrectedDate_1 = __nccwpck_require__(8253); +const getSkewCorrectedDate_1 = __nccwpck_require__(68253); const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate_1.getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000; exports.isClockSkewed = isClockSkewed; /***/ }), -/***/ 8399: +/***/ 38399: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25241,19 +25266,19 @@ const priorityWeights = { /***/ }), -/***/ 1461: +/***/ 11461: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(8399), exports); +tslib_1.__exportStar(__nccwpck_require__(38399), exports); /***/ }), -/***/ 6546: +/***/ 36546: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25271,7 +25296,7 @@ exports.resolveUserAgentConfig = resolveUserAgentConfig; /***/ }), -/***/ 8025: +/***/ 28025: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25286,28 +25311,28 @@ exports.UA_ESCAPE_REGEX = /[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; /***/ }), -/***/ 4688: +/***/ 64688: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(6546), exports); -tslib_1.__exportStar(__nccwpck_require__(6236), exports); +tslib_1.__exportStar(__nccwpck_require__(36546), exports); +tslib_1.__exportStar(__nccwpck_require__(76236), exports); /***/ }), -/***/ 6236: +/***/ 76236: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getUserAgentPlugin = exports.getUserAgentMiddlewareOptions = exports.userAgentMiddleware = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const constants_1 = __nccwpck_require__(8025); +const protocol_http_1 = __nccwpck_require__(70223); +const constants_1 = __nccwpck_require__(28025); const userAgentMiddleware = (options) => (next, context) => async (args) => { var _a, _b; const { request } = args; @@ -25368,16 +25393,16 @@ exports.getUserAgentPlugin = getUserAgentPlugin; /***/ }), -/***/ 2175: +/***/ 52175: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.loadConfig = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const fromEnv_1 = __nccwpck_require__(6161); -const fromSharedConfigFiles_1 = __nccwpck_require__(3905); +const property_provider_1 = __nccwpck_require__(74462); +const fromEnv_1 = __nccwpck_require__(46161); +const fromSharedConfigFiles_1 = __nccwpck_require__(63905); const fromStatic_1 = __nccwpck_require__(5881); const loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => property_provider_1.memoize(property_provider_1.chain(fromEnv_1.fromEnv(environmentVariableSelector), fromSharedConfigFiles_1.fromSharedConfigFiles(configFileSelector, configuration), fromStatic_1.fromStatic(defaultValue))); exports.loadConfig = loadConfig; @@ -25385,14 +25410,14 @@ exports.loadConfig = loadConfig; /***/ }), -/***/ 6161: +/***/ 46161: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromEnv = void 0; -const property_provider_1 = __nccwpck_require__(4462); +const property_provider_1 = __nccwpck_require__(74462); const fromEnv = (envVarSelector) => async () => { try { const config = envVarSelector(process.env); @@ -25410,15 +25435,15 @@ exports.fromEnv = fromEnv; /***/ }), -/***/ 3905: +/***/ 63905: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromSharedConfigFiles = exports.ENV_PROFILE = void 0; -const property_provider_1 = __nccwpck_require__(4462); -const shared_ini_file_loader_1 = __nccwpck_require__(7387); +const property_provider_1 = __nccwpck_require__(74462); +const shared_ini_file_loader_1 = __nccwpck_require__(67387); const DEFAULT_PROFILE = "default"; exports.ENV_PROFILE = "AWS_PROFILE"; const fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => { @@ -25453,7 +25478,7 @@ exports.fromSharedConfigFiles = fromSharedConfigFiles; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromStatic = void 0; -const property_provider_1 = __nccwpck_require__(4462); +const property_provider_1 = __nccwpck_require__(74462); const isFunction = (func) => typeof func === "function"; const fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => defaultValue() : property_provider_1.fromStatic(defaultValue); exports.fromStatic = fromStatic; @@ -25461,19 +25486,19 @@ exports.fromStatic = fromStatic; /***/ }), -/***/ 7684: +/***/ 87684: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(2175), exports); +tslib_1.__exportStar(__nccwpck_require__(52175), exports); /***/ }), -/***/ 3647: +/***/ 33647: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25485,7 +25510,7 @@ exports.NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; /***/ }), -/***/ 6225: +/***/ 96225: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25505,7 +25530,7 @@ exports.getTransformedHeaders = getTransformedHeaders; /***/ }), -/***/ 8805: +/***/ 68805: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -25513,8 +25538,8 @@ exports.getTransformedHeaders = getTransformedHeaders; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); tslib_1.__exportStar(__nccwpck_require__(2298), exports); -tslib_1.__exportStar(__nccwpck_require__(2533), exports); -tslib_1.__exportStar(__nccwpck_require__(2198), exports); +tslib_1.__exportStar(__nccwpck_require__(92533), exports); +tslib_1.__exportStar(__nccwpck_require__(72198), exports); /***/ }), @@ -25526,14 +25551,14 @@ tslib_1.__exportStar(__nccwpck_require__(2198), exports); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.NodeHttpHandler = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const querystring_builder_1 = __nccwpck_require__(3402); -const http_1 = __nccwpck_require__(8605); -const https_1 = __nccwpck_require__(7211); -const constants_1 = __nccwpck_require__(3647); -const get_transformed_headers_1 = __nccwpck_require__(6225); -const set_connection_timeout_1 = __nccwpck_require__(3598); -const set_socket_timeout_1 = __nccwpck_require__(4751); +const protocol_http_1 = __nccwpck_require__(70223); +const querystring_builder_1 = __nccwpck_require__(43402); +const http_1 = __nccwpck_require__(98605); +const https_1 = __nccwpck_require__(57211); +const constants_1 = __nccwpck_require__(33647); +const get_transformed_headers_1 = __nccwpck_require__(96225); +const set_connection_timeout_1 = __nccwpck_require__(63598); +const set_socket_timeout_1 = __nccwpck_require__(44751); const write_request_body_1 = __nccwpck_require__(5248); class NodeHttpHandler { constructor({ connectionTimeout, socketTimeout, httpAgent, httpsAgent } = {}) { @@ -25603,17 +25628,17 @@ exports.NodeHttpHandler = NodeHttpHandler; /***/ }), -/***/ 2533: +/***/ 92533: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.NodeHttp2Handler = void 0; -const protocol_http_1 = __nccwpck_require__(223); -const querystring_builder_1 = __nccwpck_require__(3402); -const http2_1 = __nccwpck_require__(7565); -const get_transformed_headers_1 = __nccwpck_require__(6225); +const protocol_http_1 = __nccwpck_require__(70223); +const querystring_builder_1 = __nccwpck_require__(43402); +const http2_1 = __nccwpck_require__(97565); +const get_transformed_headers_1 = __nccwpck_require__(96225); const write_request_body_1 = __nccwpck_require__(5248); class NodeHttp2Handler { constructor({ requestTimeout, sessionTimeout, disableConcurrentStreams } = {}) { @@ -25742,7 +25767,7 @@ exports.NodeHttp2Handler = NodeHttp2Handler; /***/ }), -/***/ 3598: +/***/ 63598: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25772,7 +25797,7 @@ exports.setConnectionTimeout = setConnectionTimeout; /***/ }), -/***/ 4751: +/***/ 44751: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25790,14 +25815,14 @@ exports.setSocketTimeout = setSocketTimeout; /***/ }), -/***/ 4362: +/***/ 84362: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Collector = void 0; -const stream_1 = __nccwpck_require__(2413); +const stream_1 = __nccwpck_require__(92413); class Collector extends stream_1.Writable { constructor() { super(...arguments); @@ -25813,14 +25838,14 @@ exports.Collector = Collector; /***/ }), -/***/ 2198: +/***/ 72198: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.streamCollector = void 0; -const collector_1 = __nccwpck_require__(4362); +const collector_1 = __nccwpck_require__(84362); const streamCollector = (stream) => new Promise((resolve, reject) => { const collector = new collector_1.Collector(); stream.pipe(collector); @@ -25846,7 +25871,7 @@ exports.streamCollector = streamCollector; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.writeRequestBody = void 0; -const stream_1 = __nccwpck_require__(2413); +const stream_1 = __nccwpck_require__(92413); function writeRequestBody(httpRequest, request) { const expect = request.headers["Expect"] || request.headers["expect"]; if (expect === "100-continue") { @@ -25874,7 +25899,7 @@ function writeBody(httpRequest, body) { /***/ }), -/***/ 1786: +/***/ 81786: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25918,14 +25943,14 @@ exports.CredentialsProviderError = CredentialsProviderError; /***/ }), -/***/ 1444: +/***/ 51444: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.chain = void 0; -const ProviderError_1 = __nccwpck_require__(1786); +const ProviderError_1 = __nccwpck_require__(81786); function chain(...providers) { return () => { let promise = Promise.reject(new ProviderError_1.ProviderError("No providers in chain")); @@ -25945,7 +25970,7 @@ exports.chain = chain; /***/ }), -/***/ 529: +/***/ 10529: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -25958,16 +25983,16 @@ exports.fromStatic = fromStatic; /***/ }), -/***/ 4462: +/***/ 74462: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(1786), exports); -tslib_1.__exportStar(__nccwpck_require__(1444), exports); -tslib_1.__exportStar(__nccwpck_require__(529), exports); +tslib_1.__exportStar(__nccwpck_require__(81786), exports); +tslib_1.__exportStar(__nccwpck_require__(51444), exports); +tslib_1.__exportStar(__nccwpck_require__(10529), exports); tslib_1.__exportStar(__nccwpck_require__(714), exports); @@ -26029,7 +26054,7 @@ exports.memoize = memoize; /***/ }), -/***/ 6779: +/***/ 56779: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26039,7 +26064,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 2872: +/***/ 52872: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26096,7 +26121,7 @@ function cloneQuery(query) { /***/ }), -/***/ 2348: +/***/ 92348: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26121,22 +26146,22 @@ exports.HttpResponse = HttpResponse; /***/ }), -/***/ 223: +/***/ 70223: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(6779), exports); -tslib_1.__exportStar(__nccwpck_require__(2872), exports); -tslib_1.__exportStar(__nccwpck_require__(2348), exports); -tslib_1.__exportStar(__nccwpck_require__(5694), exports); +tslib_1.__exportStar(__nccwpck_require__(56779), exports); +tslib_1.__exportStar(__nccwpck_require__(52872), exports); +tslib_1.__exportStar(__nccwpck_require__(92348), exports); +tslib_1.__exportStar(__nccwpck_require__(85694), exports); /***/ }), -/***/ 5694: +/***/ 85694: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26152,14 +26177,14 @@ exports.isValidHostname = isValidHostname; /***/ }), -/***/ 3402: +/***/ 43402: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.buildQueryString = void 0; -const util_uri_escape_1 = __nccwpck_require__(7952); +const util_uri_escape_1 = __nccwpck_require__(57952); function buildQueryString(query) { const parts = []; for (let key of Object.keys(query).sort()) { @@ -26185,7 +26210,7 @@ exports.buildQueryString = buildQueryString; /***/ }), -/***/ 7424: +/***/ 47424: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26257,7 +26282,7 @@ exports.TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; /***/ }), -/***/ 1921: +/***/ 61921: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -26286,16 +26311,16 @@ exports.isTransientError = isTransientError; /***/ }), -/***/ 7387: +/***/ 67387: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getHomeDir = exports.loadSharedConfigFiles = exports.ENV_CONFIG_PATH = exports.ENV_CREDENTIALS_PATH = void 0; -const fs_1 = __nccwpck_require__(5747); -const os_1 = __nccwpck_require__(2087); -const path_1 = __nccwpck_require__(5622); +const fs_1 = __nccwpck_require__(35747); +const os_1 = __nccwpck_require__(12087); +const path_1 = __nccwpck_require__(85622); exports.ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; exports.ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; const swallowError = () => ({}); @@ -26378,7 +26403,7 @@ exports.getHomeDir = getHomeDir; /***/ }), -/***/ 5086: +/***/ 75086: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -26386,16 +26411,16 @@ exports.getHomeDir = getHomeDir; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SignatureV4 = void 0; const util_hex_encoding_1 = __nccwpck_require__(1968); -const constants_1 = __nccwpck_require__(342); -const credentialDerivation_1 = __nccwpck_require__(8023); -const getCanonicalHeaders_1 = __nccwpck_require__(3590); -const getCanonicalQuery_1 = __nccwpck_require__(2019); -const getPayloadHash_1 = __nccwpck_require__(7080); -const headerUtil_1 = __nccwpck_require__(4120); -const moveHeadersToQuery_1 = __nccwpck_require__(8201); -const normalizeProvider_1 = __nccwpck_require__(7027); -const prepareRequest_1 = __nccwpck_require__(5772); -const utilDate_1 = __nccwpck_require__(4799); +const constants_1 = __nccwpck_require__(30342); +const credentialDerivation_1 = __nccwpck_require__(11424); +const getCanonicalHeaders_1 = __nccwpck_require__(93590); +const getCanonicalQuery_1 = __nccwpck_require__(92019); +const getPayloadHash_1 = __nccwpck_require__(47080); +const headerUtil_1 = __nccwpck_require__(34120); +const moveHeadersToQuery_1 = __nccwpck_require__(98201); +const normalizeProvider_1 = __nccwpck_require__(57027); +const prepareRequest_1 = __nccwpck_require__(75772); +const utilDate_1 = __nccwpck_require__(94799); class SignatureV4 { constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true, }) { this.service = service; @@ -26536,7 +26561,7 @@ const getCanonicalHeaderList = (headers) => Object.keys(headers).sort().join(";" /***/ }), -/***/ 3141: +/***/ 53141: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26561,7 +26586,7 @@ exports.cloneQuery = cloneQuery; /***/ }), -/***/ 342: +/***/ 30342: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26615,7 +26640,7 @@ exports.MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; /***/ }), -/***/ 8023: +/***/ 11424: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -26623,7 +26648,7 @@ exports.MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.clearCredentialCache = exports.getSigningKey = exports.createScope = void 0; const util_hex_encoding_1 = __nccwpck_require__(1968); -const constants_1 = __nccwpck_require__(342); +const constants_1 = __nccwpck_require__(30342); const signingKeyCache = {}; const cacheQueue = []; const createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${constants_1.KEY_TYPE_IDENTIFIER}`; @@ -26661,14 +26686,14 @@ const hmac = (ctor, secret, data) => { /***/ }), -/***/ 3590: +/***/ 93590: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getCanonicalHeaders = void 0; -const constants_1 = __nccwpck_require__(342); +const constants_1 = __nccwpck_require__(30342); const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => { const canonical = {}; for (const headerName of Object.keys(headers).sort()) { @@ -26690,15 +26715,15 @@ exports.getCanonicalHeaders = getCanonicalHeaders; /***/ }), -/***/ 2019: +/***/ 92019: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getCanonicalQuery = void 0; -const util_uri_escape_1 = __nccwpck_require__(7952); -const constants_1 = __nccwpck_require__(342); +const util_uri_escape_1 = __nccwpck_require__(57952); +const constants_1 = __nccwpck_require__(30342); const getCanonicalQuery = ({ query = {} }) => { const keys = []; const serialized = {}; @@ -26729,16 +26754,16 @@ exports.getCanonicalQuery = getCanonicalQuery; /***/ }), -/***/ 7080: +/***/ 47080: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getPayloadHash = void 0; -const is_array_buffer_1 = __nccwpck_require__(9126); +const is_array_buffer_1 = __nccwpck_require__(69126); const util_hex_encoding_1 = __nccwpck_require__(1968); -const constants_1 = __nccwpck_require__(342); +const constants_1 = __nccwpck_require__(30342); const getPayloadHash = async ({ headers, body }, hashConstructor) => { for (const headerName of Object.keys(headers)) { if (headerName.toLowerCase() === constants_1.SHA256_HEADER) { @@ -26760,7 +26785,7 @@ exports.getPayloadHash = getPayloadHash; /***/ }), -/***/ 4120: +/***/ 34120: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26800,7 +26825,7 @@ exports.deleteHeader = deleteHeader; /***/ }), -/***/ 7776: +/***/ 37776: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -26808,33 +26833,33 @@ exports.deleteHeader = deleteHeader; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.normalizeRegionProvider = exports.normalizeCredentialsProvider = exports.prepareRequest = exports.moveHeadersToQuery = exports.getPayloadHash = exports.getCanonicalQuery = exports.getCanonicalHeaders = void 0; const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(5086), exports); -var getCanonicalHeaders_1 = __nccwpck_require__(3590); +tslib_1.__exportStar(__nccwpck_require__(75086), exports); +var getCanonicalHeaders_1 = __nccwpck_require__(93590); Object.defineProperty(exports, "getCanonicalHeaders", ({ enumerable: true, get: function () { return getCanonicalHeaders_1.getCanonicalHeaders; } })); -var getCanonicalQuery_1 = __nccwpck_require__(2019); +var getCanonicalQuery_1 = __nccwpck_require__(92019); Object.defineProperty(exports, "getCanonicalQuery", ({ enumerable: true, get: function () { return getCanonicalQuery_1.getCanonicalQuery; } })); -var getPayloadHash_1 = __nccwpck_require__(7080); +var getPayloadHash_1 = __nccwpck_require__(47080); Object.defineProperty(exports, "getPayloadHash", ({ enumerable: true, get: function () { return getPayloadHash_1.getPayloadHash; } })); -var moveHeadersToQuery_1 = __nccwpck_require__(8201); +var moveHeadersToQuery_1 = __nccwpck_require__(98201); Object.defineProperty(exports, "moveHeadersToQuery", ({ enumerable: true, get: function () { return moveHeadersToQuery_1.moveHeadersToQuery; } })); -var prepareRequest_1 = __nccwpck_require__(5772); +var prepareRequest_1 = __nccwpck_require__(75772); Object.defineProperty(exports, "prepareRequest", ({ enumerable: true, get: function () { return prepareRequest_1.prepareRequest; } })); -var normalizeProvider_1 = __nccwpck_require__(7027); +var normalizeProvider_1 = __nccwpck_require__(57027); Object.defineProperty(exports, "normalizeCredentialsProvider", ({ enumerable: true, get: function () { return normalizeProvider_1.normalizeCredentialsProvider; } })); Object.defineProperty(exports, "normalizeRegionProvider", ({ enumerable: true, get: function () { return normalizeProvider_1.normalizeRegionProvider; } })); -tslib_1.__exportStar(__nccwpck_require__(8023), exports); +tslib_1.__exportStar(__nccwpck_require__(11424), exports); /***/ }), -/***/ 8201: +/***/ 98201: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.moveHeadersToQuery = void 0; -const cloneRequest_1 = __nccwpck_require__(3141); +const cloneRequest_1 = __nccwpck_require__(53141); const moveHeadersToQuery = (request, options = {}) => { var _a; const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : cloneRequest_1.cloneRequest(request); @@ -26856,7 +26881,7 @@ exports.moveHeadersToQuery = moveHeadersToQuery; /***/ }), -/***/ 7027: +/***/ 57027: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26887,15 +26912,15 @@ exports.normalizeCredentialsProvider = normalizeCredentialsProvider; /***/ }), -/***/ 5772: +/***/ 75772: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.prepareRequest = void 0; -const cloneRequest_1 = __nccwpck_require__(3141); -const constants_1 = __nccwpck_require__(342); +const cloneRequest_1 = __nccwpck_require__(53141); +const constants_1 = __nccwpck_require__(30342); const prepareRequest = (request) => { request = typeof request.clone === "function" ? request.clone() : cloneRequest_1.cloneRequest(request); for (const headerName of Object.keys(request.headers)) { @@ -26910,7 +26935,7 @@ exports.prepareRequest = prepareRequest; /***/ }), -/***/ 4799: +/***/ 94799: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -26938,14 +26963,14 @@ exports.toDate = toDate; /***/ }), -/***/ 6034: +/***/ 36034: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Client = void 0; -const middleware_stack_1 = __nccwpck_require__(1461); +const middleware_stack_1 = __nccwpck_require__(11461); class Client { constructor(config) { this.middlewareStack = middleware_stack_1.constructStack(); @@ -26981,7 +27006,7 @@ exports.Client = Client; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Command = void 0; -const middleware_stack_1 = __nccwpck_require__(1461); +const middleware_stack_1 = __nccwpck_require__(11461); class Command { constructor() { this.middlewareStack = middleware_stack_1.constructStack(); @@ -26992,7 +27017,7 @@ exports.Command = Command; /***/ }), -/***/ 8392: +/***/ 78392: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27004,14 +27029,14 @@ exports.SENSITIVE_STRING = "***SensitiveInformation***"; /***/ }), -/***/ 4695: +/***/ 24695: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parseEpochTimestamp = exports.parseRfc7231DateTime = exports.parseRfc3339DateTime = exports.dateToUtcString = void 0; -const parse_utils_1 = __nccwpck_require__(4809); +const parse_utils_1 = __nccwpck_require__(34014); const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; function dateToUtcString(date) { @@ -27168,7 +27193,7 @@ const stripLeadingZeroes = (value) => { /***/ }), -/***/ 2363: +/***/ 12363: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27191,7 +27216,7 @@ exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion; /***/ }), -/***/ 1927: +/***/ 91927: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27208,7 +27233,7 @@ exports.extendedEncodeURIComponent = extendedEncodeURIComponent; /***/ }), -/***/ 6457: +/***/ 86457: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27221,7 +27246,7 @@ exports.getArrayIfSingleItem = getArrayIfSingleItem; /***/ }), -/***/ 5830: +/***/ 95830: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27252,23 +27277,23 @@ exports.getValueFromTextNode = getValueFromTextNode; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(6034), exports); +tslib_1.__exportStar(__nccwpck_require__(36034), exports); tslib_1.__exportStar(__nccwpck_require__(4014), exports); -tslib_1.__exportStar(__nccwpck_require__(8392), exports); -tslib_1.__exportStar(__nccwpck_require__(4695), exports); -tslib_1.__exportStar(__nccwpck_require__(2363), exports); -tslib_1.__exportStar(__nccwpck_require__(1927), exports); -tslib_1.__exportStar(__nccwpck_require__(6457), exports); -tslib_1.__exportStar(__nccwpck_require__(5830), exports); -tslib_1.__exportStar(__nccwpck_require__(3613), exports); -tslib_1.__exportStar(__nccwpck_require__(4809), exports); -tslib_1.__exportStar(__nccwpck_require__(8000), exports); -tslib_1.__exportStar(__nccwpck_require__(8730), exports); +tslib_1.__exportStar(__nccwpck_require__(78392), exports); +tslib_1.__exportStar(__nccwpck_require__(24695), exports); +tslib_1.__exportStar(__nccwpck_require__(12363), exports); +tslib_1.__exportStar(__nccwpck_require__(91927), exports); +tslib_1.__exportStar(__nccwpck_require__(86457), exports); +tslib_1.__exportStar(__nccwpck_require__(95830), exports); +tslib_1.__exportStar(__nccwpck_require__(93613), exports); +tslib_1.__exportStar(__nccwpck_require__(34014), exports); +tslib_1.__exportStar(__nccwpck_require__(38000), exports); +tslib_1.__exportStar(__nccwpck_require__(48730), exports); /***/ }), -/***/ 3613: +/***/ 93613: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27314,7 +27339,7 @@ exports.LazyJsonString = LazyJsonString; /***/ }), -/***/ 4809: +/***/ 34014: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27528,7 +27553,7 @@ exports.strictParseByte = strictParseByte; /***/ }), -/***/ 8000: +/***/ 38000: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27553,7 +27578,7 @@ exports.serializeFloat = serializeFloat; /***/ }), -/***/ 8730: +/***/ 48730: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27599,7 +27624,7 @@ exports.splitEvery = splitEvery; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parseUrl = void 0; -const querystring_parser_1 = __nccwpck_require__(7424); +const querystring_parser_1 = __nccwpck_require__(47424); const parseUrl = (url) => { const { hostname, pathname, port, protocol, search } = new URL(url); let query; @@ -27619,14 +27644,14 @@ exports.parseUrl = parseUrl; /***/ }), -/***/ 8588: +/***/ 18588: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toBase64 = exports.fromBase64 = void 0; -const util_buffer_from_1 = __nccwpck_require__(6010); +const util_buffer_from_1 = __nccwpck_require__(36010); const BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/; function fromBase64(input) { if ((input.length * 3) % 4 !== 0) { @@ -27647,14 +27672,14 @@ exports.toBase64 = toBase64; /***/ }), -/***/ 4147: +/***/ 74147: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.calculateBodyLength = void 0; -const fs_1 = __nccwpck_require__(5747); +const fs_1 = __nccwpck_require__(35747); function calculateBodyLength(body) { if (!body) { return 0; @@ -27677,15 +27702,15 @@ exports.calculateBodyLength = calculateBodyLength; /***/ }), -/***/ 6010: +/***/ 36010: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fromString = exports.fromArrayBuffer = void 0; -const is_array_buffer_1 = __nccwpck_require__(9126); -const buffer_1 = __nccwpck_require__(4293); +const is_array_buffer_1 = __nccwpck_require__(69126); +const buffer_1 = __nccwpck_require__(64293); const fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => { if (!is_array_buffer_1.isArrayBuffer(input)) { throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); @@ -27704,7 +27729,7 @@ exports.fromString = fromString; /***/ }), -/***/ 9509: +/***/ 79509: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27737,19 +27762,19 @@ exports.booleanSelector = booleanSelector; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(9509), exports); +tslib_1.__exportStar(__nccwpck_require__(79509), exports); /***/ }), -/***/ 8598: +/***/ 98598: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getMasterProfileName = exports.parseKnownFiles = exports.DEFAULT_PROFILE = exports.ENV_PROFILE = void 0; -const shared_ini_file_loader_1 = __nccwpck_require__(7387); +const shared_ini_file_loader_1 = __nccwpck_require__(67387); exports.ENV_PROFILE = "AWS_PROFILE"; exports.DEFAULT_PROFILE = "default"; const parseKnownFiles = async (init) => { @@ -27813,21 +27838,21 @@ exports.toHex = toHex; /***/ }), -/***/ 5774: +/***/ 15774: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.escapeUriPath = void 0; -const escape_uri_1 = __nccwpck_require__(4652); +const escape_uri_1 = __nccwpck_require__(24652); const escapeUriPath = (uri) => uri.split("/").map(escape_uri_1.escapeUri).join("/"); exports.escapeUriPath = escapeUriPath; /***/ }), -/***/ 4652: +/***/ 24652: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -27841,30 +27866,30 @@ const hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`; /***/ }), -/***/ 7952: +/***/ 57952: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(4652), exports); -tslib_1.__exportStar(__nccwpck_require__(5774), exports); +tslib_1.__exportStar(__nccwpck_require__(24652), exports); +tslib_1.__exportStar(__nccwpck_require__(15774), exports); /***/ }), -/***/ 8095: +/***/ 98095: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultUserAgent = exports.UA_APP_ID_INI_NAME = exports.UA_APP_ID_ENV_NAME = void 0; -const node_config_provider_1 = __nccwpck_require__(7684); -const os_1 = __nccwpck_require__(2087); -const process_1 = __nccwpck_require__(1765); -const is_crt_available_1 = __nccwpck_require__(8390); +const node_config_provider_1 = __nccwpck_require__(87684); +const os_1 = __nccwpck_require__(12087); +const process_1 = __nccwpck_require__(61765); +const is_crt_available_1 = __nccwpck_require__(68390); exports.UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID"; exports.UA_APP_ID_INI_NAME = "sdk-ua-app-id"; const defaultUserAgent = ({ serviceId, clientVersion }) => { @@ -27903,7 +27928,7 @@ exports.defaultUserAgent = defaultUserAgent; /***/ }), -/***/ 8390: +/***/ 68390: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -27912,7 +27937,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isCrtAvailable = void 0; const isCrtAvailable = () => { try { - if ( true && __nccwpck_require__(7578)) { + if ( true && __nccwpck_require__(87578)) { return ["md/crt-avail"]; } return null; @@ -27926,14 +27951,14 @@ exports.isCrtAvailable = isCrtAvailable; /***/ }), -/***/ 6278: +/***/ 66278: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toUtf8 = exports.fromUtf8 = void 0; -const util_buffer_from_1 = __nccwpck_require__(6010); +const util_buffer_from_1 = __nccwpck_require__(36010); const fromUtf8 = (input) => { const buf = util_buffer_from_1.fromString(input, "utf8"); return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); @@ -27945,15 +27970,15 @@ exports.toUtf8 = toUtf8; /***/ }), -/***/ 8880: +/***/ 38880: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createWaiter = void 0; -const poller_1 = __nccwpck_require__(2105); -const utils_1 = __nccwpck_require__(6001); +const poller_1 = __nccwpck_require__(92105); +const utils_1 = __nccwpck_require__(36001); const waiter_1 = __nccwpck_require__(4996); const abortTimeout = async (abortSignal) => { return new Promise((resolve) => { @@ -27980,27 +28005,27 @@ exports.createWaiter = createWaiter; /***/ }), -/***/ 1627: +/***/ 21627: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(8880), exports); +tslib_1.__exportStar(__nccwpck_require__(38880), exports); tslib_1.__exportStar(__nccwpck_require__(4996), exports); /***/ }), -/***/ 2105: +/***/ 92105: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.runPolling = void 0; -const sleep_1 = __nccwpck_require__(7397); +const sleep_1 = __nccwpck_require__(17397); const waiter_1 = __nccwpck_require__(4996); const exponentialBackoffWithJitter = (minDelay, maxDelay, attemptCeiling, attempt) => { if (attempt > attemptCeiling) @@ -28039,20 +28064,20 @@ exports.runPolling = runPolling; /***/ }), -/***/ 6001: +/***/ 36001: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(7397), exports); -tslib_1.__exportStar(__nccwpck_require__(3931), exports); +tslib_1.__exportStar(__nccwpck_require__(17397), exports); +tslib_1.__exportStar(__nccwpck_require__(23931), exports); /***/ }), -/***/ 7397: +/***/ 17397: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -28067,7 +28092,7 @@ exports.sleep = sleep; /***/ }), -/***/ 3931: +/***/ 23931: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -28142,1859 +28167,40271 @@ exports.checkExceptions = checkExceptions; /***/ }), -/***/ 5107: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 81040: +/***/ ((module) => { + +"use strict"; + +function noop() { } +function once(emitter, name) { + const o = once.spread(emitter, name); + const r = o.then((args) => args[0]); + r.cancel = o.cancel; + return r; +} +(function (once) { + function spread(emitter, name) { + let c = null; + const p = new Promise((resolve, reject) => { + function cancel() { + emitter.removeListener(name, onEvent); + emitter.removeListener('error', onError); + p.cancel = noop; + } + function onEvent(...args) { + cancel(); + resolve(args); + } + function onError(err) { + cancel(); + reject(err); + } + c = cancel; + emitter.on(name, onEvent); + emitter.on('error', onError); + }); + if (!c) { + throw new TypeError('Could not get `cancel()` function'); + } + p.cancel = c; + return p; + } + once.spread = spread; +})(once || (once = {})); +module.exports = once; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 49690: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0; -var entities_json_1 = __importDefault(__nccwpck_require__(4007)); -var legacy_json_1 = __importDefault(__nccwpck_require__(7802)); -var xml_json_1 = __importDefault(__nccwpck_require__(2228)); -var decode_codepoint_1 = __importDefault(__nccwpck_require__(1227)); -var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; -exports.decodeXML = getStrictDecoder(xml_json_1.default); -exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); -function getStrictDecoder(map) { - var replace = getReplacer(map); - return function (str) { return String(str).replace(strictEntityRe, replace); }; +const events_1 = __nccwpck_require__(28614); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const promisify_1 = __importDefault(__nccwpck_require__(66570)); +const debug = debug_1.default('agent-base'); +function isAgent(v) { + return Boolean(v) && typeof v.addRequest === 'function'; } -var sorter = function (a, b) { return (a < b ? 1 : -1); }; -exports.decodeHTML = (function () { - var legacy = Object.keys(legacy_json_1.default).sort(sorter); - var keys = Object.keys(entities_json_1.default).sort(sorter); - for (var i = 0, j = 0; i < keys.length; i++) { - if (legacy[j] === keys[i]) { - keys[i] += ";?"; - j++; +function isSecureEndpoint() { + const { stack } = new Error(); + if (typeof stack !== 'string') + return false; + return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1); +} +function createAgent(callback, opts) { + return new createAgent.Agent(callback, opts); +} +(function (createAgent) { + /** + * Base `http.Agent` implementation. + * No pooling/keep-alive is implemented by default. + * + * @param {Function} callback + * @api public + */ + class Agent extends events_1.EventEmitter { + constructor(callback, _opts) { + super(); + let opts = _opts; + if (typeof callback === 'function') { + this.callback = callback; + } + else if (callback) { + opts = callback; + } + // Timeout for the socket to be returned from the callback + this.timeout = null; + if (opts && typeof opts.timeout === 'number') { + this.timeout = opts.timeout; + } + // These aren't actually used by `agent-base`, but are required + // for the TypeScript definition files in `@types/node` :/ + this.maxFreeSockets = 1; + this.maxSockets = 1; + this.maxTotalSockets = Infinity; + this.sockets = {}; + this.freeSockets = {}; + this.requests = {}; + this.options = {}; + } + get defaultPort() { + if (typeof this.explicitDefaultPort === 'number') { + return this.explicitDefaultPort; + } + return isSecureEndpoint() ? 443 : 80; } - else { - keys[i] += ";"; + set defaultPort(v) { + this.explicitDefaultPort = v; } - } - var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); - var replace = getReplacer(entities_json_1.default); - function replacer(str) { - if (str.substr(-1) !== ";") - str += ";"; - return replace(str); - } - // TODO consider creating a merged map - return function (str) { return String(str).replace(re, replacer); }; -})(); -function getReplacer(map) { - return function replace(str) { - if (str.charAt(1) === "#") { - var secondChar = str.charAt(2); - if (secondChar === "X" || secondChar === "x") { - return decode_codepoint_1.default(parseInt(str.substr(3), 16)); + get protocol() { + if (typeof this.explicitProtocol === 'string') { + return this.explicitProtocol; + } + return isSecureEndpoint() ? 'https:' : 'http:'; + } + set protocol(v) { + this.explicitProtocol = v; + } + callback(req, opts, fn) { + throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); + } + /** + * Called by node-core's "_http_client.js" module when creating + * a new HTTP request with this Agent instance. + * + * @api public + */ + addRequest(req, _opts) { + const opts = Object.assign({}, _opts); + if (typeof opts.secureEndpoint !== 'boolean') { + opts.secureEndpoint = isSecureEndpoint(); + } + if (opts.host == null) { + opts.host = 'localhost'; + } + if (opts.port == null) { + opts.port = opts.secureEndpoint ? 443 : 80; + } + if (opts.protocol == null) { + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; + } + if (opts.host && opts.path) { + // If both a `host` and `path` are specified then it's most + // likely the result of a `url.parse()` call... we need to + // remove the `path` portion so that `net.connect()` doesn't + // attempt to open that as a unix socket file. + delete opts.path; + } + delete opts.agent; + delete opts.hostname; + delete opts._defaultAgent; + delete opts.defaultPort; + delete opts.createConnection; + // Hint to use "Connection: close" + // XXX: non-documented `http` module API :( + req._last = true; + req.shouldKeepAlive = false; + let timedOut = false; + let timeoutId = null; + const timeoutMs = opts.timeout || this.timeout; + const onerror = (err) => { + if (req._hadError) + return; + req.emit('error', err); + // For Safety. Some additional errors might fire later on + // and we need to make sure we don't double-fire the error event. + req._hadError = true; + }; + const ontimeout = () => { + timeoutId = null; + timedOut = true; + const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); + err.code = 'ETIMEOUT'; + onerror(err); + }; + const callbackError = (err) => { + if (timedOut) + return; + if (timeoutId !== null) { + clearTimeout(timeoutId); + timeoutId = null; + } + onerror(err); + }; + const onsocket = (socket) => { + if (timedOut) + return; + if (timeoutId != null) { + clearTimeout(timeoutId); + timeoutId = null; + } + if (isAgent(socket)) { + // `socket` is actually an `http.Agent` instance, so + // relinquish responsibility for this `req` to the Agent + // from here on + debug('Callback returned another Agent instance %o', socket.constructor.name); + socket.addRequest(req, opts); + return; + } + if (socket) { + socket.once('free', () => { + this.freeSocket(socket, opts); + }); + req.onSocket(socket); + return; + } + const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); + onerror(err); + }; + if (typeof this.callback !== 'function') { + onerror(new Error('`callback` is not defined')); + return; + } + if (!this.promisifiedCallback) { + if (this.callback.length >= 3) { + debug('Converting legacy callback function to promise'); + this.promisifiedCallback = promisify_1.default(this.callback); + } + else { + this.promisifiedCallback = this.callback; + } + } + if (typeof timeoutMs === 'number' && timeoutMs > 0) { + timeoutId = setTimeout(ontimeout, timeoutMs); + } + if ('port' in opts && typeof opts.port !== 'number') { + opts.port = Number(opts.port); + } + try { + debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); + Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); + } + catch (err) { + Promise.reject(err).catch(callbackError); } - return decode_codepoint_1.default(parseInt(str.substr(2), 10)); } - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return map[str.slice(1, -1)] || str; - }; -} - + freeSocket(socket, opts) { + debug('Freeing socket %o %o', socket.constructor.name, opts); + socket.destroy(); + } + destroy() { + debug('Destroying agent %o', this.constructor.name); + } + } + createAgent.Agent = Agent; + // So that `instanceof` works correctly + createAgent.prototype = createAgent.Agent.prototype; +})(createAgent || (createAgent = {})); +module.exports = createAgent; +//# sourceMappingURL=index.js.map /***/ }), -/***/ 1227: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 66570: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var decode_json_1 = __importDefault(__nccwpck_require__(4589)); -// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 -var fromCodePoint = -// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -String.fromCodePoint || - function (codePoint) { - var output = ""; - if (codePoint > 0xffff) { - codePoint -= 0x10000; - output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); - codePoint = 0xdc00 | (codePoint & 0x3ff); - } - output += String.fromCharCode(codePoint); - return output; +function promisify(fn) { + return function (req, opts) { + return new Promise((resolve, reject) => { + fn.call(this, req, opts, (err, rtn) => { + if (err) { + reject(err); + } + else { + resolve(rtn); + } + }); + }); }; -function decodeCodePoint(codePoint) { - if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { - return "\uFFFD"; - } - if (codePoint in decode_json_1.default) { - codePoint = decode_json_1.default[codePoint]; - } - return fromCodePoint(codePoint); } -exports.default = decodeCodePoint; - +exports.default = promisify; +//# sourceMappingURL=promisify.js.map /***/ }), -/***/ 2006: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 55382: +/***/ ((module, exports, __nccwpck_require__) => { "use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +function default_1(fork) { + fork.use(es7_1.default); + var types = fork.use(types_1.default); + var defaults = fork.use(shared_1.default).defaults; + var def = types.Type.def; + var or = types.Type.or; + def("Noop") + .bases("Statement") + .build(); + def("DoExpression") + .bases("Expression") + .build("body") + .field("body", [def("Statement")]); + def("Super") + .bases("Expression") + .build(); + def("BindExpression") + .bases("Expression") + .build("object", "callee") + .field("object", or(def("Expression"), null)) + .field("callee", def("Expression")); + def("Decorator") + .bases("Node") + .build("expression") + .field("expression", def("Expression")); + def("Property") + .field("decorators", or([def("Decorator")], null), defaults["null"]); + def("MethodDefinition") + .field("decorators", or([def("Decorator")], null), defaults["null"]); + def("MetaProperty") + .bases("Expression") + .build("meta", "property") + .field("meta", def("Identifier")) + .field("property", def("Identifier")); + def("ParenthesizedExpression") + .bases("Expression") + .build("expression") + .field("expression", def("Expression")); + def("ImportSpecifier") + .bases("ModuleSpecifier") + .build("imported", "local") + .field("imported", def("Identifier")); + def("ImportDefaultSpecifier") + .bases("ModuleSpecifier") + .build("local"); + def("ImportNamespaceSpecifier") + .bases("ModuleSpecifier") + .build("local"); + def("ExportDefaultDeclaration") + .bases("Declaration") + .build("declaration") + .field("declaration", or(def("Declaration"), def("Expression"))); + def("ExportNamedDeclaration") + .bases("Declaration") + .build("declaration", "specifiers", "source") + .field("declaration", or(def("Declaration"), null)) + .field("specifiers", [def("ExportSpecifier")], defaults.emptyArray) + .field("source", or(def("Literal"), null), defaults["null"]); + def("ExportSpecifier") + .bases("ModuleSpecifier") + .build("local", "exported") + .field("exported", def("Identifier")); + def("ExportNamespaceSpecifier") + .bases("Specifier") + .build("exported") + .field("exported", def("Identifier")); + def("ExportDefaultSpecifier") + .bases("Specifier") + .build("exported") + .field("exported", def("Identifier")); + def("ExportAllDeclaration") + .bases("Declaration") + .build("exported", "source") + .field("exported", or(def("Identifier"), null)) + .field("source", def("Literal")); + def("CommentBlock") + .bases("Comment") + .build("value", /*optional:*/ "leading", "trailing"); + def("CommentLine") + .bases("Comment") + .build("value", /*optional:*/ "leading", "trailing"); + def("Directive") + .bases("Node") + .build("value") + .field("value", def("DirectiveLiteral")); + def("DirectiveLiteral") + .bases("Node", "Expression") + .build("value") + .field("value", String, defaults["use strict"]); + def("InterpreterDirective") + .bases("Node") + .build("value") + .field("value", String); + def("BlockStatement") + .bases("Statement") + .build("body") + .field("body", [def("Statement")]) + .field("directives", [def("Directive")], defaults.emptyArray); + def("Program") + .bases("Node") + .build("body") + .field("body", [def("Statement")]) + .field("directives", [def("Directive")], defaults.emptyArray) + .field("interpreter", or(def("InterpreterDirective"), null), defaults["null"]); + // Split Literal + def("StringLiteral") + .bases("Literal") + .build("value") + .field("value", String); + def("NumericLiteral") + .bases("Literal") + .build("value") + .field("value", Number) + .field("raw", or(String, null), defaults["null"]) + .field("extra", { + rawValue: Number, + raw: String + }, function getDefault() { + return { + rawValue: this.value, + raw: this.value + "" + }; + }); + def("BigIntLiteral") + .bases("Literal") + .build("value") + // Only String really seems appropriate here, since BigInt values + // often exceed the limits of JS numbers. + .field("value", or(String, Number)) + .field("extra", { + rawValue: String, + raw: String + }, function getDefault() { + return { + rawValue: String(this.value), + raw: this.value + "n" + }; + }); + def("NullLiteral") + .bases("Literal") + .build() + .field("value", null, defaults["null"]); + def("BooleanLiteral") + .bases("Literal") + .build("value") + .field("value", Boolean); + def("RegExpLiteral") + .bases("Literal") + .build("pattern", "flags") + .field("pattern", String) + .field("flags", String) + .field("value", RegExp, function () { + return new RegExp(this.pattern, this.flags); + }); + var ObjectExpressionProperty = or(def("Property"), def("ObjectMethod"), def("ObjectProperty"), def("SpreadProperty"), def("SpreadElement")); + // Split Property -> ObjectProperty and ObjectMethod + def("ObjectExpression") + .bases("Expression") + .build("properties") + .field("properties", [ObjectExpressionProperty]); + // ObjectMethod hoist .value properties to own properties + def("ObjectMethod") + .bases("Node", "Function") + .build("kind", "key", "params", "body", "computed") + .field("kind", or("method", "get", "set")) + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) + .field("params", [def("Pattern")]) + .field("body", def("BlockStatement")) + .field("computed", Boolean, defaults["false"]) + .field("generator", Boolean, defaults["false"]) + .field("async", Boolean, defaults["false"]) + .field("accessibility", // TypeScript + or(def("Literal"), null), defaults["null"]) + .field("decorators", or([def("Decorator")], null), defaults["null"]); + def("ObjectProperty") + .bases("Node") + .build("key", "value") + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) + .field("value", or(def("Expression"), def("Pattern"))) + .field("accessibility", // TypeScript + or(def("Literal"), null), defaults["null"]) + .field("computed", Boolean, defaults["false"]); + var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod")); + // MethodDefinition -> ClassMethod + def("ClassBody") + .bases("Declaration") + .build("body") + .field("body", [ClassBodyElement]); + def("ClassMethod") + .bases("Declaration", "Function") + .build("kind", "key", "params", "body", "computed", "static") + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))); + def("ClassPrivateMethod") + .bases("Declaration", "Function") + .build("key", "params", "body", "kind", "computed", "static") + .field("key", def("PrivateName")); + ["ClassMethod", + "ClassPrivateMethod", + ].forEach(function (typeName) { + def(typeName) + .field("kind", or("get", "set", "method", "constructor"), function () { return "method"; }) + .field("body", def("BlockStatement")) + .field("computed", Boolean, defaults["false"]) + .field("static", or(Boolean, null), defaults["null"]) + .field("abstract", or(Boolean, null), defaults["null"]) + .field("access", or("public", "private", "protected", null), defaults["null"]) + .field("accessibility", or("public", "private", "protected", null), defaults["null"]) + .field("decorators", or([def("Decorator")], null), defaults["null"]) + .field("optional", or(Boolean, null), defaults["null"]); + }); + def("ClassPrivateProperty") + .bases("ClassProperty") + .build("key", "value") + .field("key", def("PrivateName")) + .field("value", or(def("Expression"), null), defaults["null"]); + def("PrivateName") + .bases("Expression", "Pattern") + .build("id") + .field("id", def("Identifier")); + var ObjectPatternProperty = or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty"), // Used by Esprima + def("ObjectProperty"), // Babel 6 + def("RestProperty") // Babel 6 + ); + // Split into RestProperty and SpreadProperty + def("ObjectPattern") + .bases("Pattern") + .build("properties") + .field("properties", [ObjectPatternProperty]) + .field("decorators", or([def("Decorator")], null), defaults["null"]); + def("SpreadProperty") + .bases("Node") + .build("argument") + .field("argument", def("Expression")); + def("RestProperty") + .bases("Node") + .build("argument") + .field("argument", def("Expression")); + def("ForAwaitStatement") + .bases("Statement") + .build("left", "right", "body") + .field("left", or(def("VariableDeclaration"), def("Expression"))) + .field("right", def("Expression")) + .field("body", def("Statement")); + // The callee node of a dynamic import(...) expression. + def("Import") + .bases("Expression") + .build(); +} +exports.default = default_1; +module.exports = exports["default"]; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; + +/***/ }), + +/***/ 92262: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0; -var xml_json_1 = __importDefault(__nccwpck_require__(2228)); -var inverseXML = getInverseObj(xml_json_1.default); -var xmlReplacer = getInverseReplacer(inverseXML); -/** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using XML entities. - * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. - */ -exports.encodeXML = getASCIIEncoder(inverseXML); -var entities_json_1 = __importDefault(__nccwpck_require__(4007)); -var inverseHTML = getInverseObj(entities_json_1.default); -var htmlReplacer = getInverseReplacer(inverseHTML); -/** - * Encodes all entities and non-ASCII characters in the input. - * - * This includes characters that are valid ASCII characters in HTML documents. - * For example `#` will be encoded as `#`. To get a more compact output, - * consider using the `encodeNonAsciiHTML` function. - * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. - */ -exports.encodeHTML = getInverse(inverseHTML, htmlReplacer); -/** - * Encodes all non-ASCII characters, as well as characters not valid in HTML - * documents using HTML entities. - * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. - */ -exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); -function getInverseObj(obj) { - return Object.keys(obj) - .sort() - .reduce(function (inverse, name) { - inverse[obj[name]] = "&" + name + ";"; - return inverse; - }, {}); +var tslib_1 = __nccwpck_require__(4351); +var babel_core_1 = tslib_1.__importDefault(__nccwpck_require__(55382)); +var flow_1 = tslib_1.__importDefault(__nccwpck_require__(60368)); +function default_1(fork) { + fork.use(babel_core_1.default); + fork.use(flow_1.default); } -function getInverseReplacer(inverse) { - var single = []; - var multiple = []; - for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { - var k = _a[_i]; - if (k.length === 1) { - // Add value to single array - single.push("\\" + k); - } - else { - // Add value to multiple array - multiple.push(k); +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 66604: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + var types = fork.use(types_1.default); + var Type = types.Type; + var def = Type.def; + var or = Type.or; + var shared = fork.use(shared_1.default); + var defaults = shared.defaults; + var geq = shared.geq; + // Abstract supertype of all syntactic entities that are allowed to have a + // .loc field. + def("Printable") + .field("loc", or(def("SourceLocation"), null), defaults["null"], true); + def("Node") + .bases("Printable") + .field("type", String) + .field("comments", or([def("Comment")], null), defaults["null"], true); + def("SourceLocation") + .field("start", def("Position")) + .field("end", def("Position")) + .field("source", or(String, null), defaults["null"]); + def("Position") + .field("line", geq(1)) + .field("column", geq(0)); + def("File") + .bases("Node") + .build("program", "name") + .field("program", def("Program")) + .field("name", or(String, null), defaults["null"]); + def("Program") + .bases("Node") + .build("body") + .field("body", [def("Statement")]); + def("Function") + .bases("Node") + .field("id", or(def("Identifier"), null), defaults["null"]) + .field("params", [def("Pattern")]) + .field("body", def("BlockStatement")) + .field("generator", Boolean, defaults["false"]) + .field("async", Boolean, defaults["false"]); + def("Statement").bases("Node"); + // The empty .build() here means that an EmptyStatement can be constructed + // (i.e. it's not abstract) but that it needs no arguments. + def("EmptyStatement").bases("Statement").build(); + def("BlockStatement") + .bases("Statement") + .build("body") + .field("body", [def("Statement")]); + // TODO Figure out how to silently coerce Expressions to + // ExpressionStatements where a Statement was expected. + def("ExpressionStatement") + .bases("Statement") + .build("expression") + .field("expression", def("Expression")); + def("IfStatement") + .bases("Statement") + .build("test", "consequent", "alternate") + .field("test", def("Expression")) + .field("consequent", def("Statement")) + .field("alternate", or(def("Statement"), null), defaults["null"]); + def("LabeledStatement") + .bases("Statement") + .build("label", "body") + .field("label", def("Identifier")) + .field("body", def("Statement")); + def("BreakStatement") + .bases("Statement") + .build("label") + .field("label", or(def("Identifier"), null), defaults["null"]); + def("ContinueStatement") + .bases("Statement") + .build("label") + .field("label", or(def("Identifier"), null), defaults["null"]); + def("WithStatement") + .bases("Statement") + .build("object", "body") + .field("object", def("Expression")) + .field("body", def("Statement")); + def("SwitchStatement") + .bases("Statement") + .build("discriminant", "cases", "lexical") + .field("discriminant", def("Expression")) + .field("cases", [def("SwitchCase")]) + .field("lexical", Boolean, defaults["false"]); + def("ReturnStatement") + .bases("Statement") + .build("argument") + .field("argument", or(def("Expression"), null)); + def("ThrowStatement") + .bases("Statement") + .build("argument") + .field("argument", def("Expression")); + def("TryStatement") + .bases("Statement") + .build("block", "handler", "finalizer") + .field("block", def("BlockStatement")) + .field("handler", or(def("CatchClause"), null), function () { + return this.handlers && this.handlers[0] || null; + }) + .field("handlers", [def("CatchClause")], function () { + return this.handler ? [this.handler] : []; + }, true) // Indicates this field is hidden from eachField iteration. + .field("guardedHandlers", [def("CatchClause")], defaults.emptyArray) + .field("finalizer", or(def("BlockStatement"), null), defaults["null"]); + def("CatchClause") + .bases("Node") + .build("param", "guard", "body") + // https://github.com/tc39/proposal-optional-catch-binding + .field("param", or(def("Pattern"), null), defaults["null"]) + .field("guard", or(def("Expression"), null), defaults["null"]) + .field("body", def("BlockStatement")); + def("WhileStatement") + .bases("Statement") + .build("test", "body") + .field("test", def("Expression")) + .field("body", def("Statement")); + def("DoWhileStatement") + .bases("Statement") + .build("body", "test") + .field("body", def("Statement")) + .field("test", def("Expression")); + def("ForStatement") + .bases("Statement") + .build("init", "test", "update", "body") + .field("init", or(def("VariableDeclaration"), def("Expression"), null)) + .field("test", or(def("Expression"), null)) + .field("update", or(def("Expression"), null)) + .field("body", def("Statement")); + def("ForInStatement") + .bases("Statement") + .build("left", "right", "body") + .field("left", or(def("VariableDeclaration"), def("Expression"))) + .field("right", def("Expression")) + .field("body", def("Statement")); + def("DebuggerStatement").bases("Statement").build(); + def("Declaration").bases("Statement"); + def("FunctionDeclaration") + .bases("Function", "Declaration") + .build("id", "params", "body") + .field("id", def("Identifier")); + def("FunctionExpression") + .bases("Function", "Expression") + .build("id", "params", "body"); + def("VariableDeclaration") + .bases("Declaration") + .build("kind", "declarations") + .field("kind", or("var", "let", "const")) + .field("declarations", [def("VariableDeclarator")]); + def("VariableDeclarator") + .bases("Node") + .build("id", "init") + .field("id", def("Pattern")) + .field("init", or(def("Expression"), null), defaults["null"]); + def("Expression").bases("Node"); + def("ThisExpression").bases("Expression").build(); + def("ArrayExpression") + .bases("Expression") + .build("elements") + .field("elements", [or(def("Expression"), null)]); + def("ObjectExpression") + .bases("Expression") + .build("properties") + .field("properties", [def("Property")]); + // TODO Not in the Mozilla Parser API, but used by Esprima. + def("Property") + .bases("Node") // Want to be able to visit Property Nodes. + .build("kind", "key", "value") + .field("kind", or("init", "get", "set")) + .field("key", or(def("Literal"), def("Identifier"))) + .field("value", def("Expression")); + def("SequenceExpression") + .bases("Expression") + .build("expressions") + .field("expressions", [def("Expression")]); + var UnaryOperator = or("-", "+", "!", "~", "typeof", "void", "delete"); + def("UnaryExpression") + .bases("Expression") + .build("operator", "argument", "prefix") + .field("operator", UnaryOperator) + .field("argument", def("Expression")) + // Esprima doesn't bother with this field, presumably because it's + // always true for unary operators. + .field("prefix", Boolean, defaults["true"]); + var BinaryOperator = or("==", "!=", "===", "!==", "<", "<=", ">", ">=", "<<", ">>", ">>>", "+", "-", "*", "/", "%", "**", "&", // TODO Missing from the Parser API. + "|", "^", "in", "instanceof"); + def("BinaryExpression") + .bases("Expression") + .build("operator", "left", "right") + .field("operator", BinaryOperator) + .field("left", def("Expression")) + .field("right", def("Expression")); + var AssignmentOperator = or("=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&="); + def("AssignmentExpression") + .bases("Expression") + .build("operator", "left", "right") + .field("operator", AssignmentOperator) + .field("left", or(def("Pattern"), def("MemberExpression"))) + .field("right", def("Expression")); + var UpdateOperator = or("++", "--"); + def("UpdateExpression") + .bases("Expression") + .build("operator", "argument", "prefix") + .field("operator", UpdateOperator) + .field("argument", def("Expression")) + .field("prefix", Boolean); + var LogicalOperator = or("||", "&&"); + def("LogicalExpression") + .bases("Expression") + .build("operator", "left", "right") + .field("operator", LogicalOperator) + .field("left", def("Expression")) + .field("right", def("Expression")); + def("ConditionalExpression") + .bases("Expression") + .build("test", "consequent", "alternate") + .field("test", def("Expression")) + .field("consequent", def("Expression")) + .field("alternate", def("Expression")); + def("NewExpression") + .bases("Expression") + .build("callee", "arguments") + .field("callee", def("Expression")) + // The Mozilla Parser API gives this type as [or(def("Expression"), + // null)], but null values don't really make sense at the call site. + // TODO Report this nonsense. + .field("arguments", [def("Expression")]); + def("CallExpression") + .bases("Expression") + .build("callee", "arguments") + .field("callee", def("Expression")) + // See comment for NewExpression above. + .field("arguments", [def("Expression")]); + def("MemberExpression") + .bases("Expression") + .build("object", "property", "computed") + .field("object", def("Expression")) + .field("property", or(def("Identifier"), def("Expression"))) + .field("computed", Boolean, function () { + var type = this.property.type; + if (type === 'Literal' || + type === 'MemberExpression' || + type === 'BinaryExpression') { + return true; } - } - // Add ranges to single characters. - single.sort(); - for (var start = 0; start < single.length - 1; start++) { - // Find the end of a run of characters - var end = start; - while (end < single.length - 1 && - single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { - end += 1; + return false; + }); + def("Pattern").bases("Node"); + def("SwitchCase") + .bases("Node") + .build("test", "consequent") + .field("test", or(def("Expression"), null)) + .field("consequent", [def("Statement")]); + def("Identifier") + .bases("Expression", "Pattern") + .build("name") + .field("name", String) + .field("optional", Boolean, defaults["false"]); + def("Literal") + .bases("Expression") + .build("value") + .field("value", or(String, Boolean, null, Number, RegExp)) + .field("regex", or({ + pattern: String, + flags: String + }, null), function () { + if (this.value instanceof RegExp) { + var flags = ""; + if (this.value.ignoreCase) + flags += "i"; + if (this.value.multiline) + flags += "m"; + if (this.value.global) + flags += "g"; + return { + pattern: this.value.source, + flags: flags + }; } - var count = 1 + end - start; - // We want to replace at least three characters - if (count < 3) - continue; - single.splice(start, count, single[start] + "-" + single[end]); - } - multiple.unshift("[" + single.join("") + "]"); - return new RegExp(multiple.join("|"), "g"); -} -// /[^\0-\x7F]/gu -var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; -var getCodePoint = -// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -String.prototype.codePointAt != null - ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - function (str) { return str.codePointAt(0); } - : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - function (c) { - return (c.charCodeAt(0) - 0xd800) * 0x400 + - c.charCodeAt(1) - - 0xdc00 + - 0x10000; - }; -function singleCharReplacer(c) { - return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)) - .toString(16) - .toUpperCase() + ";"; + return null; + }); + // Abstract (non-buildable) comment supertype. Not a Node. + def("Comment") + .bases("Printable") + .field("value", String) + // A .leading comment comes before the node, whereas a .trailing + // comment comes after it. These two fields should not both be true, + // but they might both be false when the comment falls inside a node + // and the node has no children for the comment to lead or trail, + // e.g. { /*dangling*/ }. + .field("leading", Boolean, defaults["true"]) + .field("trailing", Boolean, defaults["false"]); } -function getInverse(inverse, re) { - return function (data) { - return data - .replace(re, function (name) { return inverse[name]; }) - .replace(reNonASCII, singleCharReplacer); - }; +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 32207: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +var core_1 = tslib_1.__importDefault(__nccwpck_require__(66604)); +function default_1(fork) { + fork.use(core_1.default); + var types = fork.use(types_1.default); + var Type = types.Type; + var def = types.Type.def; + var or = Type.or; + var shared = fork.use(shared_1.default); + var defaults = shared.defaults; + // https://github.com/tc39/proposal-optional-chaining + // `a?.b` as per https://github.com/estree/estree/issues/146 + def("OptionalMemberExpression") + .bases("MemberExpression") + .build("object", "property", "computed", "optional") + .field("optional", Boolean, defaults["true"]); + // a?.b() + def("OptionalCallExpression") + .bases("CallExpression") + .build("callee", "arguments", "optional") + .field("optional", Boolean, defaults["true"]); + // https://github.com/tc39/proposal-nullish-coalescing + // `a ?? b` as per https://github.com/babel/babylon/pull/761/files + var LogicalOperator = or("||", "&&", "??"); + def("LogicalExpression") + .field("operator", LogicalOperator); } -var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); -/** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using numeric hexadecimal reference (eg. `ü`). - * - * Have a look at `escapeUTF8` if you want a more concise output at the expense - * of reduced transportability. - * - * @param data String to escape. - */ -function escape(data) { - return data.replace(reEscapeChars, singleCharReplacer); +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 48975: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +function default_1(fork) { + fork.use(es7_1.default); + var types = fork.use(types_1.default); + var def = types.Type.def; + def("ImportExpression") + .bases("Expression") + .build("source") + .field("source", def("Expression")); } -exports.escape = escape; -/** - * Encodes all characters not valid in XML documents using numeric hexadecimal - * reference (eg. `ü`). - * - * Note that the output will be character-set dependent. - * - * @param data String to escape. - */ -function escapeUTF8(data) { - return data.replace(xmlReplacer, singleCharReplacer); +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 68127: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var core_1 = tslib_1.__importDefault(__nccwpck_require__(66604)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + fork.use(core_1.default); + var types = fork.use(types_1.default); + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + def("Function") + .field("generator", Boolean, defaults["false"]) + .field("expression", Boolean, defaults["false"]) + .field("defaults", [or(def("Expression"), null)], defaults.emptyArray) + // TODO This could be represented as a RestElement in .params. + .field("rest", or(def("Identifier"), null), defaults["null"]); + // The ESTree way of representing a ...rest parameter. + def("RestElement") + .bases("Pattern") + .build("argument") + .field("argument", def("Pattern")) + .field("typeAnnotation", // for Babylon. Flow parser puts it on the identifier + or(def("TypeAnnotation"), def("TSTypeAnnotation"), null), defaults["null"]); + def("SpreadElementPattern") + .bases("Pattern") + .build("argument") + .field("argument", def("Pattern")); + def("FunctionDeclaration") + .build("id", "params", "body", "generator", "expression"); + def("FunctionExpression") + .build("id", "params", "body", "generator", "expression"); + // The Parser API calls this ArrowExpression, but Esprima and all other + // actual parsers use ArrowFunctionExpression. + def("ArrowFunctionExpression") + .bases("Function", "Expression") + .build("params", "body", "expression") + // The forced null value here is compatible with the overridden + // definition of the "id" field in the Function interface. + .field("id", null, defaults["null"]) + // Arrow function bodies are allowed to be expressions. + .field("body", or(def("BlockStatement"), def("Expression"))) + // The current spec forbids arrow generators, so I have taken the + // liberty of enforcing that. TODO Report this. + .field("generator", false, defaults["false"]); + def("ForOfStatement") + .bases("Statement") + .build("left", "right", "body") + .field("left", or(def("VariableDeclaration"), def("Pattern"))) + .field("right", def("Expression")) + .field("body", def("Statement")); + def("YieldExpression") + .bases("Expression") + .build("argument", "delegate") + .field("argument", or(def("Expression"), null)) + .field("delegate", Boolean, defaults["false"]); + def("GeneratorExpression") + .bases("Expression") + .build("body", "blocks", "filter") + .field("body", def("Expression")) + .field("blocks", [def("ComprehensionBlock")]) + .field("filter", or(def("Expression"), null)); + def("ComprehensionExpression") + .bases("Expression") + .build("body", "blocks", "filter") + .field("body", def("Expression")) + .field("blocks", [def("ComprehensionBlock")]) + .field("filter", or(def("Expression"), null)); + def("ComprehensionBlock") + .bases("Node") + .build("left", "right", "each") + .field("left", def("Pattern")) + .field("right", def("Expression")) + .field("each", Boolean); + def("Property") + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) + .field("value", or(def("Expression"), def("Pattern"))) + .field("method", Boolean, defaults["false"]) + .field("shorthand", Boolean, defaults["false"]) + .field("computed", Boolean, defaults["false"]); + def("ObjectProperty") + .field("shorthand", Boolean, defaults["false"]); + def("PropertyPattern") + .bases("Pattern") + .build("key", "pattern") + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) + .field("pattern", def("Pattern")) + .field("computed", Boolean, defaults["false"]); + def("ObjectPattern") + .bases("Pattern") + .build("properties") + .field("properties", [or(def("PropertyPattern"), def("Property"))]); + def("ArrayPattern") + .bases("Pattern") + .build("elements") + .field("elements", [or(def("Pattern"), null)]); + def("MethodDefinition") + .bases("Declaration") + .build("kind", "key", "value", "static") + .field("kind", or("constructor", "method", "get", "set")) + .field("key", def("Expression")) + .field("value", def("Function")) + .field("computed", Boolean, defaults["false"]) + .field("static", Boolean, defaults["false"]); + def("SpreadElement") + .bases("Node") + .build("argument") + .field("argument", def("Expression")); + def("ArrayExpression") + .field("elements", [or(def("Expression"), def("SpreadElement"), def("RestElement"), null)]); + def("NewExpression") + .field("arguments", [or(def("Expression"), def("SpreadElement"))]); + def("CallExpression") + .field("arguments", [or(def("Expression"), def("SpreadElement"))]); + // Note: this node type is *not* an AssignmentExpression with a Pattern on + // the left-hand side! The existing AssignmentExpression type already + // supports destructuring assignments. AssignmentPattern nodes may appear + // wherever a Pattern is allowed, and the right-hand side represents a + // default value to be destructured against the left-hand side, if no + // value is otherwise provided. For example: default parameter values. + def("AssignmentPattern") + .bases("Pattern") + .build("left", "right") + .field("left", def("Pattern")) + .field("right", def("Expression")); + var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty")); + def("ClassProperty") + .bases("Declaration") + .build("key") + .field("key", or(def("Literal"), def("Identifier"), def("Expression"))) + .field("computed", Boolean, defaults["false"]); + def("ClassPropertyDefinition") // static property + .bases("Declaration") + .build("definition") + // Yes, Virginia, circular definitions are permitted. + .field("definition", ClassBodyElement); + def("ClassBody") + .bases("Declaration") + .build("body") + .field("body", [ClassBodyElement]); + def("ClassDeclaration") + .bases("Declaration") + .build("id", "body", "superClass") + .field("id", or(def("Identifier"), null)) + .field("body", def("ClassBody")) + .field("superClass", or(def("Expression"), null), defaults["null"]); + def("ClassExpression") + .bases("Expression") + .build("id", "body", "superClass") + .field("id", or(def("Identifier"), null), defaults["null"]) + .field("body", def("ClassBody")) + .field("superClass", or(def("Expression"), null), defaults["null"]); + // Specifier and ModuleSpecifier are abstract non-standard types + // introduced for definitional convenience. + def("Specifier").bases("Node"); + // This supertype is shared/abused by both def/babel.js and + // def/esprima.js. In the future, it will be possible to load only one set + // of definitions appropriate for a given parser, but until then we must + // rely on default functions to reconcile the conflicting AST formats. + def("ModuleSpecifier") + .bases("Specifier") + // This local field is used by Babel/Acorn. It should not technically + // be optional in the Babel/Acorn AST format, but it must be optional + // in the Esprima AST format. + .field("local", or(def("Identifier"), null), defaults["null"]) + // The id and name fields are used by Esprima. The id field should not + // technically be optional in the Esprima AST format, but it must be + // optional in the Babel/Acorn AST format. + .field("id", or(def("Identifier"), null), defaults["null"]) + .field("name", or(def("Identifier"), null), defaults["null"]); + // Like ModuleSpecifier, except type:"ImportSpecifier" and buildable. + // import {} from ...; + def("ImportSpecifier") + .bases("ModuleSpecifier") + .build("id", "name"); + // import <* as id> from ...; + def("ImportNamespaceSpecifier") + .bases("ModuleSpecifier") + .build("id"); + // import from ...; + def("ImportDefaultSpecifier") + .bases("ModuleSpecifier") + .build("id"); + def("ImportDeclaration") + .bases("Declaration") + .build("specifiers", "source", "importKind") + .field("specifiers", [or(def("ImportSpecifier"), def("ImportNamespaceSpecifier"), def("ImportDefaultSpecifier"))], defaults.emptyArray) + .field("source", def("Literal")) + .field("importKind", or("value", "type"), function () { + return "value"; + }); + def("TaggedTemplateExpression") + .bases("Expression") + .build("tag", "quasi") + .field("tag", def("Expression")) + .field("quasi", def("TemplateLiteral")); + def("TemplateLiteral") + .bases("Expression") + .build("quasis", "expressions") + .field("quasis", [def("TemplateElement")]) + .field("expressions", [def("Expression")]); + def("TemplateElement") + .bases("Node") + .build("value", "tail") + .field("value", { "cooked": String, "raw": String }) + .field("tail", Boolean); } -exports.escapeUTF8 = escapeUTF8; -function getASCIIEncoder(obj) { - return function (data) { - return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); }); - }; +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 75351: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var es6_1 = tslib_1.__importDefault(__nccwpck_require__(68127)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + fork.use(es6_1.default); + var types = fork.use(types_1.default); + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + def("Function") + .field("async", Boolean, defaults["false"]); + def("SpreadProperty") + .bases("Node") + .build("argument") + .field("argument", def("Expression")); + def("ObjectExpression") + .field("properties", [or(def("Property"), def("SpreadProperty"), def("SpreadElement"))]); + def("SpreadPropertyPattern") + .bases("Pattern") + .build("argument") + .field("argument", def("Pattern")); + def("ObjectPattern") + .field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"))]); + def("AwaitExpression") + .bases("Expression") + .build("argument", "all") + .field("argument", or(def("Expression"), null)) + .field("all", Boolean, defaults["false"]); } +exports.default = default_1; +module.exports = exports["default"]; /***/ }), -/***/ 3000: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 96817: +/***/ ((module, exports, __nccwpck_require__) => { "use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + fork.use(es7_1.default); + var types = fork.use(types_1.default); + var defaults = fork.use(shared_1.default).defaults; + var def = types.Type.def; + var or = types.Type.or; + def("VariableDeclaration") + .field("declarations", [or(def("VariableDeclarator"), def("Identifier") // Esprima deviation. + )]); + def("Property") + .field("value", or(def("Expression"), def("Pattern") // Esprima deviation. + )); + def("ArrayPattern") + .field("elements", [or(def("Pattern"), def("SpreadElement"), null)]); + def("ObjectPattern") + .field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty") // Used by Esprima. + )]); + // Like ModuleSpecifier, except type:"ExportSpecifier" and buildable. + // export {} [from ...]; + def("ExportSpecifier") + .bases("ModuleSpecifier") + .build("id", "name"); + // export <*> from ...; + def("ExportBatchSpecifier") + .bases("Specifier") + .build(); + def("ExportDeclaration") + .bases("Declaration") + .build("default", "declaration", "specifiers", "source") + .field("default", Boolean) + .field("declaration", or(def("Declaration"), def("Expression"), // Implies default. + null)) + .field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray) + .field("source", or(def("Literal"), null), defaults["null"]); + def("Block") + .bases("Comment") + .build("value", /*optional:*/ "leading", "trailing"); + def("Line") + .bases("Comment") + .build("value", /*optional:*/ "leading", "trailing"); +} +exports.default = default_1; +module.exports = exports["default"]; + +/***/ }), + +/***/ 60368: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0; -var decode_1 = __nccwpck_require__(5107); -var encode_1 = __nccwpck_require__(2006); -/** - * Decodes a string with entities. - * - * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeXML` or `decodeHTML` directly. - */ -function decode(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); +var tslib_1 = __nccwpck_require__(4351); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +var type_annotations_1 = tslib_1.__importDefault(__nccwpck_require__(86278)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + fork.use(es7_1.default); + fork.use(type_annotations_1.default); + var types = fork.use(types_1.default); + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + // Base types + def("Flow").bases("Node"); + def("FlowType").bases("Flow"); + // Type annotations + def("AnyTypeAnnotation") + .bases("FlowType") + .build(); + def("EmptyTypeAnnotation") + .bases("FlowType") + .build(); + def("MixedTypeAnnotation") + .bases("FlowType") + .build(); + def("VoidTypeAnnotation") + .bases("FlowType") + .build(); + def("NumberTypeAnnotation") + .bases("FlowType") + .build(); + def("NumberLiteralTypeAnnotation") + .bases("FlowType") + .build("value", "raw") + .field("value", Number) + .field("raw", String); + // Babylon 6 differs in AST from Flow + // same as NumberLiteralTypeAnnotation + def("NumericLiteralTypeAnnotation") + .bases("FlowType") + .build("value", "raw") + .field("value", Number) + .field("raw", String); + def("StringTypeAnnotation") + .bases("FlowType") + .build(); + def("StringLiteralTypeAnnotation") + .bases("FlowType") + .build("value", "raw") + .field("value", String) + .field("raw", String); + def("BooleanTypeAnnotation") + .bases("FlowType") + .build(); + def("BooleanLiteralTypeAnnotation") + .bases("FlowType") + .build("value", "raw") + .field("value", Boolean) + .field("raw", String); + def("TypeAnnotation") + .bases("Node") + .build("typeAnnotation") + .field("typeAnnotation", def("FlowType")); + def("NullableTypeAnnotation") + .bases("FlowType") + .build("typeAnnotation") + .field("typeAnnotation", def("FlowType")); + def("NullLiteralTypeAnnotation") + .bases("FlowType") + .build(); + def("NullTypeAnnotation") + .bases("FlowType") + .build(); + def("ThisTypeAnnotation") + .bases("FlowType") + .build(); + def("ExistsTypeAnnotation") + .bases("FlowType") + .build(); + def("ExistentialTypeParam") + .bases("FlowType") + .build(); + def("FunctionTypeAnnotation") + .bases("FlowType") + .build("params", "returnType", "rest", "typeParameters") + .field("params", [def("FunctionTypeParam")]) + .field("returnType", def("FlowType")) + .field("rest", or(def("FunctionTypeParam"), null)) + .field("typeParameters", or(def("TypeParameterDeclaration"), null)); + def("FunctionTypeParam") + .bases("Node") + .build("name", "typeAnnotation", "optional") + .field("name", def("Identifier")) + .field("typeAnnotation", def("FlowType")) + .field("optional", Boolean); + def("ArrayTypeAnnotation") + .bases("FlowType") + .build("elementType") + .field("elementType", def("FlowType")); + def("ObjectTypeAnnotation") + .bases("FlowType") + .build("properties", "indexers", "callProperties") + .field("properties", [ + or(def("ObjectTypeProperty"), def("ObjectTypeSpreadProperty")) + ]) + .field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray) + .field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray) + .field("inexact", or(Boolean, void 0), defaults["undefined"]) + .field("exact", Boolean, defaults["false"]) + .field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray); + def("Variance") + .bases("Node") + .build("kind") + .field("kind", or("plus", "minus")); + var LegacyVariance = or(def("Variance"), "plus", "minus", null); + def("ObjectTypeProperty") + .bases("Node") + .build("key", "value", "optional") + .field("key", or(def("Literal"), def("Identifier"))) + .field("value", def("FlowType")) + .field("optional", Boolean) + .field("variance", LegacyVariance, defaults["null"]); + def("ObjectTypeIndexer") + .bases("Node") + .build("id", "key", "value") + .field("id", def("Identifier")) + .field("key", def("FlowType")) + .field("value", def("FlowType")) + .field("variance", LegacyVariance, defaults["null"]); + def("ObjectTypeCallProperty") + .bases("Node") + .build("value") + .field("value", def("FunctionTypeAnnotation")) + .field("static", Boolean, defaults["false"]); + def("QualifiedTypeIdentifier") + .bases("Node") + .build("qualification", "id") + .field("qualification", or(def("Identifier"), def("QualifiedTypeIdentifier"))) + .field("id", def("Identifier")); + def("GenericTypeAnnotation") + .bases("FlowType") + .build("id", "typeParameters") + .field("id", or(def("Identifier"), def("QualifiedTypeIdentifier"))) + .field("typeParameters", or(def("TypeParameterInstantiation"), null)); + def("MemberTypeAnnotation") + .bases("FlowType") + .build("object", "property") + .field("object", def("Identifier")) + .field("property", or(def("MemberTypeAnnotation"), def("GenericTypeAnnotation"))); + def("UnionTypeAnnotation") + .bases("FlowType") + .build("types") + .field("types", [def("FlowType")]); + def("IntersectionTypeAnnotation") + .bases("FlowType") + .build("types") + .field("types", [def("FlowType")]); + def("TypeofTypeAnnotation") + .bases("FlowType") + .build("argument") + .field("argument", def("FlowType")); + def("ObjectTypeSpreadProperty") + .bases("Node") + .build("argument") + .field("argument", def("FlowType")); + def("ObjectTypeInternalSlot") + .bases("Node") + .build("id", "value", "optional", "static", "method") + .field("id", def("Identifier")) + .field("value", def("FlowType")) + .field("optional", Boolean) + .field("static", Boolean) + .field("method", Boolean); + def("TypeParameterDeclaration") + .bases("Node") + .build("params") + .field("params", [def("TypeParameter")]); + def("TypeParameterInstantiation") + .bases("Node") + .build("params") + .field("params", [def("FlowType")]); + def("TypeParameter") + .bases("FlowType") + .build("name", "variance", "bound") + .field("name", String) + .field("variance", LegacyVariance, defaults["null"]) + .field("bound", or(def("TypeAnnotation"), null), defaults["null"]); + def("ClassProperty") + .field("variance", LegacyVariance, defaults["null"]); + def("ClassImplements") + .bases("Node") + .build("id") + .field("id", def("Identifier")) + .field("superClass", or(def("Expression"), null), defaults["null"]) + .field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]); + def("InterfaceTypeAnnotation") + .bases("FlowType") + .build("body", "extends") + .field("body", def("ObjectTypeAnnotation")) + .field("extends", or([def("InterfaceExtends")], null), defaults["null"]); + def("InterfaceDeclaration") + .bases("Declaration") + .build("id", "body", "extends") + .field("id", def("Identifier")) + .field("typeParameters", or(def("TypeParameterDeclaration"), null), defaults["null"]) + .field("body", def("ObjectTypeAnnotation")) + .field("extends", [def("InterfaceExtends")]); + def("DeclareInterface") + .bases("InterfaceDeclaration") + .build("id", "body", "extends"); + def("InterfaceExtends") + .bases("Node") + .build("id") + .field("id", def("Identifier")) + .field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]); + def("TypeAlias") + .bases("Declaration") + .build("id", "typeParameters", "right") + .field("id", def("Identifier")) + .field("typeParameters", or(def("TypeParameterDeclaration"), null)) + .field("right", def("FlowType")); + def("OpaqueType") + .bases("Declaration") + .build("id", "typeParameters", "impltype", "supertype") + .field("id", def("Identifier")) + .field("typeParameters", or(def("TypeParameterDeclaration"), null)) + .field("impltype", def("FlowType")) + .field("supertype", def("FlowType")); + def("DeclareTypeAlias") + .bases("TypeAlias") + .build("id", "typeParameters", "right"); + def("DeclareOpaqueType") + .bases("TypeAlias") + .build("id", "typeParameters", "supertype"); + def("TypeCastExpression") + .bases("Expression") + .build("expression", "typeAnnotation") + .field("expression", def("Expression")) + .field("typeAnnotation", def("TypeAnnotation")); + def("TupleTypeAnnotation") + .bases("FlowType") + .build("types") + .field("types", [def("FlowType")]); + def("DeclareVariable") + .bases("Statement") + .build("id") + .field("id", def("Identifier")); + def("DeclareFunction") + .bases("Statement") + .build("id") + .field("id", def("Identifier")); + def("DeclareClass") + .bases("InterfaceDeclaration") + .build("id"); + def("DeclareModule") + .bases("Statement") + .build("id", "body") + .field("id", or(def("Identifier"), def("Literal"))) + .field("body", def("BlockStatement")); + def("DeclareModuleExports") + .bases("Statement") + .build("typeAnnotation") + .field("typeAnnotation", def("TypeAnnotation")); + def("DeclareExportDeclaration") + .bases("Declaration") + .build("default", "declaration", "specifiers", "source") + .field("default", Boolean) + .field("declaration", or(def("DeclareVariable"), def("DeclareFunction"), def("DeclareClass"), def("FlowType"), // Implies default. + null)) + .field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray) + .field("source", or(def("Literal"), null), defaults["null"]); + def("DeclareExportAllDeclaration") + .bases("Declaration") + .build("source") + .field("source", or(def("Literal"), null), defaults["null"]); + def("FlowPredicate").bases("Flow"); + def("InferredPredicate") + .bases("FlowPredicate") + .build(); + def("DeclaredPredicate") + .bases("FlowPredicate") + .build("value") + .field("value", def("Expression")); + def("CallExpression") + .field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]); + def("NewExpression") + .field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]); } -exports.decode = decode; -/** - * Decodes a string with entities. Does not allow missing trailing semicolons for entities. - * - * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. - */ -function decodeStrict(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 27572: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + fork.use(es7_1.default); + var types = fork.use(types_1.default); + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + def("JSXAttribute") + .bases("Node") + .build("name", "value") + .field("name", or(def("JSXIdentifier"), def("JSXNamespacedName"))) + .field("value", or(def("Literal"), // attr="value" + def("JSXExpressionContainer"), // attr={value} + null // attr= or just attr + ), defaults["null"]); + def("JSXIdentifier") + .bases("Identifier") + .build("name") + .field("name", String); + def("JSXNamespacedName") + .bases("Node") + .build("namespace", "name") + .field("namespace", def("JSXIdentifier")) + .field("name", def("JSXIdentifier")); + def("JSXMemberExpression") + .bases("MemberExpression") + .build("object", "property") + .field("object", or(def("JSXIdentifier"), def("JSXMemberExpression"))) + .field("property", def("JSXIdentifier")) + .field("computed", Boolean, defaults.false); + var JSXElementName = or(def("JSXIdentifier"), def("JSXNamespacedName"), def("JSXMemberExpression")); + def("JSXSpreadAttribute") + .bases("Node") + .build("argument") + .field("argument", def("Expression")); + var JSXAttributes = [or(def("JSXAttribute"), def("JSXSpreadAttribute"))]; + def("JSXExpressionContainer") + .bases("Expression") + .build("expression") + .field("expression", def("Expression")); + def("JSXElement") + .bases("Expression") + .build("openingElement", "closingElement", "children") + .field("openingElement", def("JSXOpeningElement")) + .field("closingElement", or(def("JSXClosingElement"), null), defaults["null"]) + .field("children", [or(def("JSXElement"), def("JSXExpressionContainer"), def("JSXFragment"), def("JSXText"), def("Literal") // TODO Esprima should return JSXText instead. + )], defaults.emptyArray) + .field("name", JSXElementName, function () { + // Little-known fact: the `this` object inside a default function + // is none other than the partially-built object itself, and any + // fields initialized directly from builder function arguments + // (like openingElement, closingElement, and children) are + // guaranteed to be available. + return this.openingElement.name; + }, true) // hidden from traversal + .field("selfClosing", Boolean, function () { + return this.openingElement.selfClosing; + }, true) // hidden from traversal + .field("attributes", JSXAttributes, function () { + return this.openingElement.attributes; + }, true); // hidden from traversal + def("JSXOpeningElement") + .bases("Node") // TODO Does this make sense? Can't really be an JSXElement. + .build("name", "attributes", "selfClosing") + .field("name", JSXElementName) + .field("attributes", JSXAttributes, defaults.emptyArray) + .field("selfClosing", Boolean, defaults["false"]); + def("JSXClosingElement") + .bases("Node") // TODO Same concern. + .build("name") + .field("name", JSXElementName); + def("JSXFragment") + .bases("Expression") + .build("openingElement", "closingElement", "children") + .field("openingElement", def("JSXOpeningFragment")) + .field("closingElement", def("JSXClosingFragment")) + .field("children", [or(def("JSXElement"), def("JSXExpressionContainer"), def("JSXFragment"), def("JSXText"), def("Literal") // TODO Esprima should return JSXText instead. + )], defaults.emptyArray); + def("JSXOpeningFragment") + .bases("Node") // TODO Same concern. + .build(); + def("JSXClosingFragment") + .bases("Node") // TODO Same concern. + .build(); + def("JSXText") + .bases("Literal") + .build("value") + .field("value", String); + def("JSXEmptyExpression").bases("Expression").build(); + // This PR has caused many people issues, but supporting it seems like a + // good idea anyway: https://github.com/babel/babel/pull/4988 + def("JSXSpreadChild") + .bases("Expression") + .build("expression") + .field("expression", def("Expression")); } -exports.decodeStrict = decodeStrict; +exports.default = default_1; +module.exports = exports["default"]; + + +/***/ }), + +/***/ 86278: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; /** - * Encodes a string with entities. - * - * @param data String to encode. - * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + * Type annotation defs shared between Flow and TypeScript. + * These defs could not be defined in ./flow.ts or ./typescript.ts directly + * because they use the same name. */ -function encode(data, level) { - return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + var types = fork.use(types_1.default); + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null); + var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null); + def("Identifier") + .field("typeAnnotation", TypeAnnotation, defaults["null"]); + def("ObjectPattern") + .field("typeAnnotation", TypeAnnotation, defaults["null"]); + def("Function") + .field("returnType", TypeAnnotation, defaults["null"]) + .field("typeParameters", TypeParamDecl, defaults["null"]); + def("ClassProperty") + .build("key", "value", "typeAnnotation", "static") + .field("value", or(def("Expression"), null)) + .field("static", Boolean, defaults["false"]) + .field("typeAnnotation", TypeAnnotation, defaults["null"]); + ["ClassDeclaration", + "ClassExpression", + ].forEach(function (typeName) { + def(typeName) + .field("typeParameters", TypeParamDecl, defaults["null"]) + .field("superTypeParameters", or(def("TypeParameterInstantiation"), def("TSTypeParameterInstantiation"), null), defaults["null"]) + .field("implements", or([def("ClassImplements")], [def("TSExpressionWithTypeArguments")]), defaults.emptyArray); + }); } -exports.encode = encode; -var encode_2 = __nccwpck_require__(2006); -Object.defineProperty(exports, "encodeXML", ({ enumerable: true, get: function () { return encode_2.encodeXML; } })); -Object.defineProperty(exports, "encodeHTML", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); -Object.defineProperty(exports, "encodeNonAsciiHTML", ({ enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } })); -Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return encode_2.escape; } })); -Object.defineProperty(exports, "escapeUTF8", ({ enumerable: true, get: function () { return encode_2.escapeUTF8; } })); -// Legacy aliases (deprecated) -Object.defineProperty(exports, "encodeHTML4", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); -Object.defineProperty(exports, "encodeHTML5", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); -var decode_2 = __nccwpck_require__(5107); -Object.defineProperty(exports, "decodeXML", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); -Object.defineProperty(exports, "decodeHTML", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); -Object.defineProperty(exports, "decodeHTMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); -// Legacy aliases (deprecated) -Object.defineProperty(exports, "decodeHTML4", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); -Object.defineProperty(exports, "decodeHTML5", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); -Object.defineProperty(exports, "decodeHTML4Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); -Object.defineProperty(exports, "decodeHTML5Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); -Object.defineProperty(exports, "decodeXMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); +exports.default = default_1; +module.exports = exports["default"]; /***/ }), -/***/ 5152: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 16743: +/***/ ((module, exports, __nccwpck_require__) => { "use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var babel_core_1 = tslib_1.__importDefault(__nccwpck_require__(55382)); +var type_annotations_1 = tslib_1.__importDefault(__nccwpck_require__(86278)); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var shared_1 = tslib_1.__importDefault(__nccwpck_require__(34631)); +function default_1(fork) { + // Since TypeScript is parsed by Babylon, include the core Babylon types + // but omit the Flow-related types. + fork.use(babel_core_1.default); + fork.use(type_annotations_1.default); + var types = fork.use(types_1.default); + var n = types.namedTypes; + var def = types.Type.def; + var or = types.Type.or; + var defaults = fork.use(shared_1.default).defaults; + var StringLiteral = types.Type.from(function (value, deep) { + if (n.StringLiteral && + n.StringLiteral.check(value, deep)) { + return true; + } + if (n.Literal && + n.Literal.check(value, deep) && + typeof value.value === "string") { + return true; + } + return false; + }, "StringLiteral"); + def("TSType") + .bases("Node"); + var TSEntityName = or(def("Identifier"), def("TSQualifiedName")); + def("TSTypeReference") + .bases("TSType", "TSHasOptionalTypeParameterInstantiation") + .build("typeName", "typeParameters") + .field("typeName", TSEntityName); + // An abstract (non-buildable) base type that provide a commonly-needed + // optional .typeParameters field. + def("TSHasOptionalTypeParameterInstantiation") + .field("typeParameters", or(def("TSTypeParameterInstantiation"), null), defaults["null"]); + // An abstract (non-buildable) base type that provide a commonly-needed + // optional .typeParameters field. + def("TSHasOptionalTypeParameters") + .field("typeParameters", or(def("TSTypeParameterDeclaration"), null, void 0), defaults["null"]); + // An abstract (non-buildable) base type that provide a commonly-needed + // optional .typeAnnotation field. + def("TSHasOptionalTypeAnnotation") + .field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"]); + def("TSQualifiedName") + .bases("Node") + .build("left", "right") + .field("left", TSEntityName) + .field("right", TSEntityName); + def("TSAsExpression") + .bases("Expression", "Pattern") + .build("expression", "typeAnnotation") + .field("expression", def("Expression")) + .field("typeAnnotation", def("TSType")) + .field("extra", or({ parenthesized: Boolean }, null), defaults["null"]); + def("TSNonNullExpression") + .bases("Expression", "Pattern") + .build("expression") + .field("expression", def("Expression")); + [ + "TSAnyKeyword", + "TSBigIntKeyword", + "TSBooleanKeyword", + "TSNeverKeyword", + "TSNullKeyword", + "TSNumberKeyword", + "TSObjectKeyword", + "TSStringKeyword", + "TSSymbolKeyword", + "TSUndefinedKeyword", + "TSUnknownKeyword", + "TSVoidKeyword", + "TSThisType", + ].forEach(function (keywordType) { + def(keywordType) + .bases("TSType") + .build(); + }); + def("TSArrayType") + .bases("TSType") + .build("elementType") + .field("elementType", def("TSType")); + def("TSLiteralType") + .bases("TSType") + .build("literal") + .field("literal", or(def("NumericLiteral"), def("StringLiteral"), def("BooleanLiteral"), def("TemplateLiteral"), def("UnaryExpression"))); + ["TSUnionType", + "TSIntersectionType", + ].forEach(function (typeName) { + def(typeName) + .bases("TSType") + .build("types") + .field("types", [def("TSType")]); + }); + def("TSConditionalType") + .bases("TSType") + .build("checkType", "extendsType", "trueType", "falseType") + .field("checkType", def("TSType")) + .field("extendsType", def("TSType")) + .field("trueType", def("TSType")) + .field("falseType", def("TSType")); + def("TSInferType") + .bases("TSType") + .build("typeParameter") + .field("typeParameter", def("TSTypeParameter")); + def("TSParenthesizedType") + .bases("TSType") + .build("typeAnnotation") + .field("typeAnnotation", def("TSType")); + var ParametersType = [or(def("Identifier"), def("RestElement"), def("ArrayPattern"), def("ObjectPattern"))]; + ["TSFunctionType", + "TSConstructorType", + ].forEach(function (typeName) { + def(typeName) + .bases("TSType", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation") + .build("parameters") + .field("parameters", ParametersType); + }); + def("TSDeclareFunction") + .bases("Declaration", "TSHasOptionalTypeParameters") + .build("id", "params", "returnType") + .field("declare", Boolean, defaults["false"]) + .field("async", Boolean, defaults["false"]) + .field("generator", Boolean, defaults["false"]) + .field("id", or(def("Identifier"), null), defaults["null"]) + .field("params", [def("Pattern")]) + // tSFunctionTypeAnnotationCommon + .field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used? + null), defaults["null"]); + def("TSDeclareMethod") + .bases("Declaration", "TSHasOptionalTypeParameters") + .build("key", "params", "returnType") + .field("async", Boolean, defaults["false"]) + .field("generator", Boolean, defaults["false"]) + .field("params", [def("Pattern")]) + // classMethodOrPropertyCommon + .field("abstract", Boolean, defaults["false"]) + .field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"]) + .field("static", Boolean, defaults["false"]) + .field("computed", Boolean, defaults["false"]) + .field("optional", Boolean, defaults["false"]) + .field("key", or(def("Identifier"), def("StringLiteral"), def("NumericLiteral"), + // Only allowed if .computed is true. + def("Expression"))) + // classMethodOrDeclareMethodCommon + .field("kind", or("get", "set", "method", "constructor"), function getDefault() { return "method"; }) + .field("access", // Not "accessibility"? + or("public", "private", "protected", void 0), defaults["undefined"]) + .field("decorators", or([def("Decorator")], null), defaults["null"]) + // tSFunctionTypeAnnotationCommon + .field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used? + null), defaults["null"]); + def("TSMappedType") + .bases("TSType") + .build("typeParameter", "typeAnnotation") + .field("readonly", or(Boolean, "+", "-"), defaults["false"]) + .field("typeParameter", def("TSTypeParameter")) + .field("optional", or(Boolean, "+", "-"), defaults["false"]) + .field("typeAnnotation", or(def("TSType"), null), defaults["null"]); + def("TSTupleType") + .bases("TSType") + .build("elementTypes") + .field("elementTypes", [or(def("TSType"), def("TSNamedTupleMember"))]); + def("TSNamedTupleMember") + .bases("TSType") + .build("label", "elementType", "optional") + .field("label", def("Identifier")) + .field("optional", Boolean, defaults["false"]) + .field("elementType", def("TSType")); + def("TSRestType") + .bases("TSType") + .build("typeAnnotation") + .field("typeAnnotation", def("TSType")); + def("TSOptionalType") + .bases("TSType") + .build("typeAnnotation") + .field("typeAnnotation", def("TSType")); + def("TSIndexedAccessType") + .bases("TSType") + .build("objectType", "indexType") + .field("objectType", def("TSType")) + .field("indexType", def("TSType")); + def("TSTypeOperator") + .bases("TSType") + .build("operator") + .field("operator", String) + .field("typeAnnotation", def("TSType")); + def("TSTypeAnnotation") + .bases("Node") + .build("typeAnnotation") + .field("typeAnnotation", or(def("TSType"), def("TSTypeAnnotation"))); + def("TSIndexSignature") + .bases("Declaration", "TSHasOptionalTypeAnnotation") + .build("parameters", "typeAnnotation") + .field("parameters", [def("Identifier")]) // Length === 1 + .field("readonly", Boolean, defaults["false"]); + def("TSPropertySignature") + .bases("Declaration", "TSHasOptionalTypeAnnotation") + .build("key", "typeAnnotation", "optional") + .field("key", def("Expression")) + .field("computed", Boolean, defaults["false"]) + .field("readonly", Boolean, defaults["false"]) + .field("optional", Boolean, defaults["false"]) + .field("initializer", or(def("Expression"), null), defaults["null"]); + def("TSMethodSignature") + .bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation") + .build("key", "parameters", "typeAnnotation") + .field("key", def("Expression")) + .field("computed", Boolean, defaults["false"]) + .field("optional", Boolean, defaults["false"]) + .field("parameters", ParametersType); + def("TSTypePredicate") + .bases("TSTypeAnnotation", "TSType") + .build("parameterName", "typeAnnotation", "asserts") + .field("parameterName", or(def("Identifier"), def("TSThisType"))) + .field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"]) + .field("asserts", Boolean, defaults["false"]); + ["TSCallSignatureDeclaration", + "TSConstructSignatureDeclaration", + ].forEach(function (typeName) { + def(typeName) + .bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation") + .build("parameters", "typeAnnotation") + .field("parameters", ParametersType); + }); + def("TSEnumMember") + .bases("Node") + .build("id", "initializer") + .field("id", or(def("Identifier"), StringLiteral)) + .field("initializer", or(def("Expression"), null), defaults["null"]); + def("TSTypeQuery") + .bases("TSType") + .build("exprName") + .field("exprName", or(TSEntityName, def("TSImportType"))); + // Inferred from Babylon's tsParseTypeMember method. + var TSTypeMember = or(def("TSCallSignatureDeclaration"), def("TSConstructSignatureDeclaration"), def("TSIndexSignature"), def("TSMethodSignature"), def("TSPropertySignature")); + def("TSTypeLiteral") + .bases("TSType") + .build("members") + .field("members", [TSTypeMember]); + def("TSTypeParameter") + .bases("Identifier") + .build("name", "constraint", "default") + .field("name", String) + .field("constraint", or(def("TSType"), void 0), defaults["undefined"]) + .field("default", or(def("TSType"), void 0), defaults["undefined"]); + def("TSTypeAssertion") + .bases("Expression", "Pattern") + .build("typeAnnotation", "expression") + .field("typeAnnotation", def("TSType")) + .field("expression", def("Expression")) + .field("extra", or({ parenthesized: Boolean }, null), defaults["null"]); + def("TSTypeParameterDeclaration") + .bases("Declaration") + .build("params") + .field("params", [def("TSTypeParameter")]); + def("TSTypeParameterInstantiation") + .bases("Node") + .build("params") + .field("params", [def("TSType")]); + def("TSEnumDeclaration") + .bases("Declaration") + .build("id", "members") + .field("id", def("Identifier")) + .field("const", Boolean, defaults["false"]) + .field("declare", Boolean, defaults["false"]) + .field("members", [def("TSEnumMember")]) + .field("initializer", or(def("Expression"), null), defaults["null"]); + def("TSTypeAliasDeclaration") + .bases("Declaration", "TSHasOptionalTypeParameters") + .build("id", "typeAnnotation") + .field("id", def("Identifier")) + .field("declare", Boolean, defaults["false"]) + .field("typeAnnotation", def("TSType")); + def("TSModuleBlock") + .bases("Node") + .build("body") + .field("body", [def("Statement")]); + def("TSModuleDeclaration") + .bases("Declaration") + .build("id", "body") + .field("id", or(StringLiteral, TSEntityName)) + .field("declare", Boolean, defaults["false"]) + .field("global", Boolean, defaults["false"]) + .field("body", or(def("TSModuleBlock"), def("TSModuleDeclaration"), null), defaults["null"]); + def("TSImportType") + .bases("TSType", "TSHasOptionalTypeParameterInstantiation") + .build("argument", "qualifier", "typeParameters") + .field("argument", StringLiteral) + .field("qualifier", or(TSEntityName, void 0), defaults["undefined"]); + def("TSImportEqualsDeclaration") + .bases("Declaration") + .build("id", "moduleReference") + .field("id", def("Identifier")) + .field("isExport", Boolean, defaults["false"]) + .field("moduleReference", or(TSEntityName, def("TSExternalModuleReference"))); + def("TSExternalModuleReference") + .bases("Declaration") + .build("expression") + .field("expression", StringLiteral); + def("TSExportAssignment") + .bases("Statement") + .build("expression") + .field("expression", def("Expression")); + def("TSNamespaceExportDeclaration") + .bases("Declaration") + .build("id") + .field("id", def("Identifier")); + def("TSInterfaceBody") + .bases("Node") + .build("body") + .field("body", [TSTypeMember]); + def("TSExpressionWithTypeArguments") + .bases("TSType", "TSHasOptionalTypeParameterInstantiation") + .build("expression", "typeParameters") + .field("expression", TSEntityName); + def("TSInterfaceDeclaration") + .bases("Declaration", "TSHasOptionalTypeParameters") + .build("id", "body") + .field("id", TSEntityName) + .field("declare", Boolean, defaults["false"]) + .field("extends", or([def("TSExpressionWithTypeArguments")], null), defaults["null"]) + .field("body", def("TSInterfaceBody")); + def("TSParameterProperty") + .bases("Pattern") + .build("parameter") + .field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"]) + .field("readonly", Boolean, defaults["false"]) + .field("parameter", or(def("Identifier"), def("AssignmentPattern"))); + def("ClassProperty") + .field("access", // Not "accessibility"? + or("public", "private", "protected", void 0), defaults["undefined"]); + // Defined already in es6 and babel-core. + def("ClassBody") + .field("body", [or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"), + // Just need to add these types: + def("TSDeclareMethod"), TSTypeMember)]); +} +exports.default = default_1; +module.exports = exports["default"]; -//parse Empty Node as self closing node -const buildOptions = __nccwpck_require__(8280).buildOptions; -const defaultOptions = { - attributeNamePrefix: '@_', - attrNodeName: false, - textNodeName: '#text', - ignoreAttributes: true, - cdataTagName: false, - cdataPositionChar: '\\c', - format: false, - indentBy: ' ', - supressEmptyNode: false, - tagValueProcessor: function(a) { - return a; - }, - attrValueProcessor: function(a) { - return a; - }, -}; +/***/ }), -const props = [ - 'attributeNamePrefix', - 'attrNodeName', - 'textNodeName', - 'ignoreAttributes', - 'cdataTagName', - 'cdataPositionChar', - 'format', - 'indentBy', - 'supressEmptyNode', - 'tagValueProcessor', - 'attrValueProcessor', -]; +/***/ 20253: +/***/ ((module, exports, __nccwpck_require__) => { -function Parser(options) { - this.options = buildOptions(options, defaultOptions, props); - if (this.options.ignoreAttributes || this.options.attrNodeName) { - this.isAttribute = function(/*a*/) { - return false; - }; - } else { - this.attrPrefixLen = this.options.attributeNamePrefix.length; - this.isAttribute = isAttribute; - } - if (this.options.cdataTagName) { - this.isCDATA = isCDATA; - } else { - this.isCDATA = function(/*a*/) { - return false; +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var path_visitor_1 = tslib_1.__importDefault(__nccwpck_require__(56525)); +var equiv_1 = tslib_1.__importDefault(__nccwpck_require__(38636)); +var path_1 = tslib_1.__importDefault(__nccwpck_require__(58770)); +var node_path_1 = tslib_1.__importDefault(__nccwpck_require__(35694)); +function default_1(defs) { + var fork = createFork(); + var types = fork.use(types_1.default); + defs.forEach(fork.use); + types.finalize(); + var PathVisitor = fork.use(path_visitor_1.default); + return { + Type: types.Type, + builtInTypes: types.builtInTypes, + namedTypes: types.namedTypes, + builders: types.builders, + defineMethod: types.defineMethod, + getFieldNames: types.getFieldNames, + getFieldValue: types.getFieldValue, + eachField: types.eachField, + someField: types.someField, + getSupertypeNames: types.getSupertypeNames, + getBuilderName: types.getBuilderName, + astNodesAreEquivalent: fork.use(equiv_1.default), + finalize: types.finalize, + Path: fork.use(path_1.default), + NodePath: fork.use(node_path_1.default), + PathVisitor: PathVisitor, + use: fork.use, + visit: PathVisitor.visit, }; - } - this.replaceCDATAstr = replaceCDATAstr; - this.replaceCDATAarr = replaceCDATAarr; +} +exports.default = default_1; +function createFork() { + var used = []; + var usedResult = []; + function use(plugin) { + var idx = used.indexOf(plugin); + if (idx === -1) { + idx = used.length; + used.push(plugin); + usedResult[idx] = plugin(fork); + } + return usedResult[idx]; + } + var fork = { use: use }; + return fork; +} +module.exports = exports["default"]; - if (this.options.format) { - this.indentate = indentate; - this.tagEndChar = '>\n'; - this.newLine = '\n'; - } else { - this.indentate = function() { - return ''; - }; - this.tagEndChar = '>'; - this.newLine = ''; - } - if (this.options.supressEmptyNode) { - this.buildTextNode = buildEmptyTextNode; - this.buildObjNode = buildEmptyObjNode; - } else { - this.buildTextNode = buildTextValNode; - this.buildObjNode = buildObjectNode; - } +/***/ }), - this.buildTextValNode = buildTextValNode; - this.buildObjectNode = buildObjectNode; -} +/***/ 24143: +/***/ ((__unused_webpack_module, exports) => { -Parser.prototype.parse = function(jObj) { - return this.j2x(jObj, 0).val; -}; +"use strict"; -Parser.prototype.j2x = function(jObj, level) { - let attrStr = ''; - let val = ''; - const keys = Object.keys(jObj); - const len = keys.length; - for (let i = 0; i < len; i++) { - const key = keys[i]; - if (typeof jObj[key] === 'undefined') { - // supress undefined node - } else if (jObj[key] === null) { - val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; - } else if (jObj[key] instanceof Date) { - val += this.buildTextNode(jObj[key], key, '', level); - } else if (typeof jObj[key] !== 'object') { - //premitive type - const attr = this.isAttribute(key); - if (attr) { - attrStr += ' ' + attr + '="' + this.options.attrValueProcessor('' + jObj[key]) + '"'; - } else if (this.isCDATA(key)) { - if (jObj[this.options.textNodeName]) { - val += this.replaceCDATAstr(jObj[this.options.textNodeName], jObj[key]); - } else { - val += this.replaceCDATAstr('', jObj[key]); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.namedTypes = void 0; +var namedTypes; +(function (namedTypes) { +})(namedTypes = exports.namedTypes || (exports.namedTypes = {})); + + +/***/ }), + +/***/ 38636: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +function default_1(fork) { + var types = fork.use(types_1.default); + var getFieldNames = types.getFieldNames; + var getFieldValue = types.getFieldValue; + var isArray = types.builtInTypes.array; + var isObject = types.builtInTypes.object; + var isDate = types.builtInTypes.Date; + var isRegExp = types.builtInTypes.RegExp; + var hasOwn = Object.prototype.hasOwnProperty; + function astNodesAreEquivalent(a, b, problemPath) { + if (isArray.check(problemPath)) { + problemPath.length = 0; } - } else { - //tag value - if (key === this.options.textNodeName) { - if (jObj[this.options.cdataTagName]) { - //value will added while processing cdata - } else { - val += this.options.tagValueProcessor('' + jObj[key]); - } - } else { - val += this.buildTextNode(jObj[key], key, '', level); + else { + problemPath = null; } - } - } else if (Array.isArray(jObj[key])) { - //repeated nodes - if (this.isCDATA(key)) { - val += this.indentate(level); - if (jObj[this.options.textNodeName]) { - val += this.replaceCDATAarr(jObj[this.options.textNodeName], jObj[key]); - } else { - val += this.replaceCDATAarr('', jObj[key]); + return areEquivalent(a, b, problemPath); + } + astNodesAreEquivalent.assert = function (a, b) { + var problemPath = []; + if (!astNodesAreEquivalent(a, b, problemPath)) { + if (problemPath.length === 0) { + if (a !== b) { + throw new Error("Nodes must be equal"); + } + } + else { + throw new Error("Nodes differ in the following path: " + + problemPath.map(subscriptForProperty).join("")); + } } - } else { - //nested nodes - const arrLen = jObj[key].length; - for (let j = 0; j < arrLen; j++) { - const item = jObj[key][j]; - if (typeof item === 'undefined') { - // supress undefined node - } else if (item === null) { - val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; - } else if (typeof item === 'object') { - const result = this.j2x(item, level + 1); - val += this.buildObjNode(result.val, key, result.attrStr, level); - } else { - val += this.buildTextNode(item, key, '', level); - } + }; + function subscriptForProperty(property) { + if (/[_$a-z][_$a-z0-9]*/i.test(property)) { + return "." + property; } - } - } else { - //nested node - if (this.options.attrNodeName && key === this.options.attrNodeName) { - const Ks = Object.keys(jObj[key]); - const L = Ks.length; - for (let j = 0; j < L; j++) { - attrStr += ' ' + Ks[j] + '="' + this.options.attrValueProcessor('' + jObj[key][Ks[j]]) + '"'; + return "[" + JSON.stringify(property) + "]"; + } + function areEquivalent(a, b, problemPath) { + if (a === b) { + return true; } - } else { - const result = this.j2x(jObj[key], level + 1); - val += this.buildObjNode(result.val, key, result.attrStr, level); - } + if (isArray.check(a)) { + return arraysAreEquivalent(a, b, problemPath); + } + if (isObject.check(a)) { + return objectsAreEquivalent(a, b, problemPath); + } + if (isDate.check(a)) { + return isDate.check(b) && (+a === +b); + } + if (isRegExp.check(a)) { + return isRegExp.check(b) && (a.source === b.source && + a.global === b.global && + a.multiline === b.multiline && + a.ignoreCase === b.ignoreCase); + } + return a == b; } - } - return {attrStr: attrStr, val: val}; -}; - -function replaceCDATAstr(str, cdata) { - str = this.options.tagValueProcessor('' + str); - if (this.options.cdataPositionChar === '' || str === '') { - return str + ''); + function arraysAreEquivalent(a, b, problemPath) { + isArray.assert(a); + var aLength = a.length; + if (!isArray.check(b) || b.length !== aLength) { + if (problemPath) { + problemPath.push("length"); + } + return false; + } + for (var i = 0; i < aLength; ++i) { + if (problemPath) { + problemPath.push(i); + } + if (i in a !== i in b) { + return false; + } + if (!areEquivalent(a[i], b[i], problemPath)) { + return false; + } + if (problemPath) { + var problemPathTail = problemPath.pop(); + if (problemPathTail !== i) { + throw new Error("" + problemPathTail); + } + } + } + return true; } - return str + this.newLine; - } -} - -function buildObjectNode(val, key, attrStr, level) { - if (attrStr && !val.includes('<')) { - return ( - this.indentate(level) + - '<' + - key + - attrStr + - '>' + - val + - //+ this.newLine - // + this.indentate(level) - '' + - this.options.tagValueProcessor(val) + - ' { -function isCDATA(name) { - return name === this.options.cdataTagName; +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var path_1 = tslib_1.__importDefault(__nccwpck_require__(58770)); +var scope_1 = tslib_1.__importDefault(__nccwpck_require__(89733)); +function nodePathPlugin(fork) { + var types = fork.use(types_1.default); + var n = types.namedTypes; + var b = types.builders; + var isNumber = types.builtInTypes.number; + var isArray = types.builtInTypes.array; + var Path = fork.use(path_1.default); + var Scope = fork.use(scope_1.default); + var NodePath = function NodePath(value, parentPath, name) { + if (!(this instanceof NodePath)) { + throw new Error("NodePath constructor cannot be invoked without 'new'"); + } + Path.call(this, value, parentPath, name); + }; + var NPp = NodePath.prototype = Object.create(Path.prototype, { + constructor: { + value: NodePath, + enumerable: false, + writable: true, + configurable: true + } + }); + Object.defineProperties(NPp, { + node: { + get: function () { + Object.defineProperty(this, "node", { + configurable: true, + value: this._computeNode() + }); + return this.node; + } + }, + parent: { + get: function () { + Object.defineProperty(this, "parent", { + configurable: true, + value: this._computeParent() + }); + return this.parent; + } + }, + scope: { + get: function () { + Object.defineProperty(this, "scope", { + configurable: true, + value: this._computeScope() + }); + return this.scope; + } + } + }); + NPp.replace = function () { + delete this.node; + delete this.parent; + delete this.scope; + return Path.prototype.replace.apply(this, arguments); + }; + NPp.prune = function () { + var remainingNodePath = this.parent; + this.replace(); + return cleanUpNodesAfterPrune(remainingNodePath); + }; + // The value of the first ancestor Path whose value is a Node. + NPp._computeNode = function () { + var value = this.value; + if (n.Node.check(value)) { + return value; + } + var pp = this.parentPath; + return pp && pp.node || null; + }; + // The first ancestor Path whose value is a Node distinct from this.node. + NPp._computeParent = function () { + var value = this.value; + var pp = this.parentPath; + if (!n.Node.check(value)) { + while (pp && !n.Node.check(pp.value)) { + pp = pp.parentPath; + } + if (pp) { + pp = pp.parentPath; + } + } + while (pp && !n.Node.check(pp.value)) { + pp = pp.parentPath; + } + return pp || null; + }; + // The closest enclosing scope that governs this node. + NPp._computeScope = function () { + var value = this.value; + var pp = this.parentPath; + var scope = pp && pp.scope; + if (n.Node.check(value) && + Scope.isEstablishedBy(value)) { + scope = new Scope(this, scope); + } + return scope || null; + }; + NPp.getValueProperty = function (name) { + return types.getFieldValue(this.value, name); + }; + /** + * Determine whether this.node needs to be wrapped in parentheses in order + * for a parser to reproduce the same local AST structure. + * + * For instance, in the expression `(1 + 2) * 3`, the BinaryExpression + * whose operator is "+" needs parentheses, because `1 + 2 * 3` would + * parse differently. + * + * If assumeExpressionContext === true, we don't worry about edge cases + * like an anonymous FunctionExpression appearing lexically first in its + * enclosing statement and thus needing parentheses to avoid being parsed + * as a FunctionDeclaration with a missing name. + */ + NPp.needsParens = function (assumeExpressionContext) { + var pp = this.parentPath; + if (!pp) { + return false; + } + var node = this.value; + // Only expressions need parentheses. + if (!n.Expression.check(node)) { + return false; + } + // Identifiers never need parentheses. + if (node.type === "Identifier") { + return false; + } + while (!n.Node.check(pp.value)) { + pp = pp.parentPath; + if (!pp) { + return false; + } + } + var parent = pp.value; + switch (node.type) { + case "UnaryExpression": + case "SpreadElement": + case "SpreadProperty": + return parent.type === "MemberExpression" + && this.name === "object" + && parent.object === node; + case "BinaryExpression": + case "LogicalExpression": + switch (parent.type) { + case "CallExpression": + return this.name === "callee" + && parent.callee === node; + case "UnaryExpression": + case "SpreadElement": + case "SpreadProperty": + return true; + case "MemberExpression": + return this.name === "object" + && parent.object === node; + case "BinaryExpression": + case "LogicalExpression": { + var n_1 = node; + var po = parent.operator; + var pp_1 = PRECEDENCE[po]; + var no = n_1.operator; + var np = PRECEDENCE[no]; + if (pp_1 > np) { + return true; + } + if (pp_1 === np && this.name === "right") { + if (parent.right !== n_1) { + throw new Error("Nodes must be equal"); + } + return true; + } + } + default: + return false; + } + case "SequenceExpression": + switch (parent.type) { + case "ForStatement": + // Although parentheses wouldn't hurt around sequence + // expressions in the head of for loops, traditional style + // dictates that e.g. i++, j++ should not be wrapped with + // parentheses. + return false; + case "ExpressionStatement": + return this.name !== "expression"; + default: + // Otherwise err on the side of overparenthesization, adding + // explicit exceptions above if this proves overzealous. + return true; + } + case "YieldExpression": + switch (parent.type) { + case "BinaryExpression": + case "LogicalExpression": + case "UnaryExpression": + case "SpreadElement": + case "SpreadProperty": + case "CallExpression": + case "MemberExpression": + case "NewExpression": + case "ConditionalExpression": + case "YieldExpression": + return true; + default: + return false; + } + case "Literal": + return parent.type === "MemberExpression" + && isNumber.check(node.value) + && this.name === "object" + && parent.object === node; + case "AssignmentExpression": + case "ConditionalExpression": + switch (parent.type) { + case "UnaryExpression": + case "SpreadElement": + case "SpreadProperty": + case "BinaryExpression": + case "LogicalExpression": + return true; + case "CallExpression": + return this.name === "callee" + && parent.callee === node; + case "ConditionalExpression": + return this.name === "test" + && parent.test === node; + case "MemberExpression": + return this.name === "object" + && parent.object === node; + default: + return false; + } + default: + if (parent.type === "NewExpression" && + this.name === "callee" && + parent.callee === node) { + return containsCallExpression(node); + } + } + if (assumeExpressionContext !== true && + !this.canBeFirstInStatement() && + this.firstInStatement()) + return true; + return false; + }; + function isBinary(node) { + return n.BinaryExpression.check(node) + || n.LogicalExpression.check(node); + } + // @ts-ignore 'isUnaryLike' is declared but its value is never read. [6133] + function isUnaryLike(node) { + return n.UnaryExpression.check(node) + // I considered making SpreadElement and SpreadProperty subtypes + // of UnaryExpression, but they're not really Expression nodes. + || (n.SpreadElement && n.SpreadElement.check(node)) + || (n.SpreadProperty && n.SpreadProperty.check(node)); + } + var PRECEDENCE = {}; + [["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!=="], + ["<", ">", "<=", ">=", "in", "instanceof"], + [">>", "<<", ">>>"], + ["+", "-"], + ["*", "/", "%"] + ].forEach(function (tier, i) { + tier.forEach(function (op) { + PRECEDENCE[op] = i; + }); + }); + function containsCallExpression(node) { + if (n.CallExpression.check(node)) { + return true; + } + if (isArray.check(node)) { + return node.some(containsCallExpression); + } + if (n.Node.check(node)) { + return types.someField(node, function (_name, child) { + return containsCallExpression(child); + }); + } + return false; + } + NPp.canBeFirstInStatement = function () { + var node = this.node; + return !n.FunctionExpression.check(node) + && !n.ObjectExpression.check(node); + }; + NPp.firstInStatement = function () { + return firstInStatement(this); + }; + function firstInStatement(path) { + for (var node, parent; path.parent; path = path.parent) { + node = path.node; + parent = path.parent.node; + if (n.BlockStatement.check(parent) && + path.parent.name === "body" && + path.name === 0) { + if (parent.body[0] !== node) { + throw new Error("Nodes must be equal"); + } + return true; + } + if (n.ExpressionStatement.check(parent) && + path.name === "expression") { + if (parent.expression !== node) { + throw new Error("Nodes must be equal"); + } + return true; + } + if (n.SequenceExpression.check(parent) && + path.parent.name === "expressions" && + path.name === 0) { + if (parent.expressions[0] !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + if (n.CallExpression.check(parent) && + path.name === "callee") { + if (parent.callee !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + if (n.MemberExpression.check(parent) && + path.name === "object") { + if (parent.object !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + if (n.ConditionalExpression.check(parent) && + path.name === "test") { + if (parent.test !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + if (isBinary(parent) && + path.name === "left") { + if (parent.left !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + if (n.UnaryExpression.check(parent) && + !parent.prefix && + path.name === "argument") { + if (parent.argument !== node) { + throw new Error("Nodes must be equal"); + } + continue; + } + return false; + } + return true; + } + /** + * Pruning certain nodes will result in empty or incomplete nodes, here we clean those nodes up. + */ + function cleanUpNodesAfterPrune(remainingNodePath) { + if (n.VariableDeclaration.check(remainingNodePath.node)) { + var declarations = remainingNodePath.get('declarations').value; + if (!declarations || declarations.length === 0) { + return remainingNodePath.prune(); + } + } + else if (n.ExpressionStatement.check(remainingNodePath.node)) { + if (!remainingNodePath.get('expression').value) { + return remainingNodePath.prune(); + } + } + else if (n.IfStatement.check(remainingNodePath.node)) { + cleanUpIfStatementAfterPrune(remainingNodePath); + } + return remainingNodePath; + } + function cleanUpIfStatementAfterPrune(ifStatement) { + var testExpression = ifStatement.get('test').value; + var alternate = ifStatement.get('alternate').value; + var consequent = ifStatement.get('consequent').value; + if (!consequent && !alternate) { + var testExpressionStatement = b.expressionStatement(testExpression); + ifStatement.replace(testExpressionStatement); + } + else if (!consequent && alternate) { + var negatedTestExpression = b.unaryExpression('!', testExpression, true); + if (n.UnaryExpression.check(testExpression) && testExpression.operator === '!') { + negatedTestExpression = testExpression.argument; + } + ifStatement.get("test").replace(negatedTestExpression); + ifStatement.get("consequent").replace(alternate); + ifStatement.get("alternate").replace(); + } + } + return NodePath; } - -//formatting -//indentation -//\n after each closing or self closing tag - -module.exports = Parser; +exports.default = nodePathPlugin; +module.exports = exports["default"]; /***/ }), -/***/ 1901: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 56525: +/***/ ((module, exports, __nccwpck_require__) => { "use strict"; - -const char = function(a) { - return String.fromCharCode(a); -}; - -const chars = { - nilChar: char(176), - missingChar: char(201), - nilPremitive: char(175), - missingPremitive: char(200), - - emptyChar: char(178), - emptyValue: char(177), //empty Premitive - - boundryChar: char(179), - - objStart: char(198), - arrStart: char(204), - arrayEnd: char(185), -}; - -const charsArr = [ - chars.nilChar, - chars.nilPremitive, - chars.missingChar, - chars.missingPremitive, - chars.boundryChar, - chars.emptyChar, - chars.emptyValue, - chars.arrayEnd, - chars.objStart, - chars.arrStart, -]; - -const _e = function(node, e_schema, options) { - if (typeof e_schema === 'string') { - //premitive - if (node && node[0] && node[0].val !== undefined) { - return getValue(node[0].val, e_schema); - } else { - return getValue(node, e_schema); +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var node_path_1 = tslib_1.__importDefault(__nccwpck_require__(35694)); +var hasOwn = Object.prototype.hasOwnProperty; +function pathVisitorPlugin(fork) { + var types = fork.use(types_1.default); + var NodePath = fork.use(node_path_1.default); + var isArray = types.builtInTypes.array; + var isObject = types.builtInTypes.object; + var isFunction = types.builtInTypes.function; + var undefined; + var PathVisitor = function PathVisitor() { + if (!(this instanceof PathVisitor)) { + throw new Error("PathVisitor constructor cannot be invoked without 'new'"); + } + // Permanent state. + this._reusableContextStack = []; + this._methodNameTable = computeMethodNameTable(this); + this._shouldVisitComments = + hasOwn.call(this._methodNameTable, "Block") || + hasOwn.call(this._methodNameTable, "Line"); + this.Context = makeContextConstructor(this); + // State reset every time PathVisitor.prototype.visit is called. + this._visiting = false; + this._changeReported = false; + }; + function computeMethodNameTable(visitor) { + var typeNames = Object.create(null); + for (var methodName in visitor) { + if (/^visit[A-Z]/.test(methodName)) { + typeNames[methodName.slice("visit".length)] = true; + } + } + var supertypeTable = types.computeSupertypeLookupTable(typeNames); + var methodNameTable = Object.create(null); + var typeNameKeys = Object.keys(supertypeTable); + var typeNameCount = typeNameKeys.length; + for (var i = 0; i < typeNameCount; ++i) { + var typeName = typeNameKeys[i]; + methodName = "visit" + supertypeTable[typeName]; + if (isFunction.check(visitor[methodName])) { + methodNameTable[typeName] = methodName; + } + } + return methodNameTable; } - } else { - const hasValidData = hasData(node); - if (hasValidData === true) { - let str = ''; - if (Array.isArray(e_schema)) { - //attributes can't be repeated. hence check in children tags only - str += chars.arrStart; - const itemSchema = e_schema[0]; - //var itemSchemaType = itemSchema; - const arr_len = node.length; - - if (typeof itemSchema === 'string') { - for (let arr_i = 0; arr_i < arr_len; arr_i++) { - const r = getValue(node[arr_i].val, itemSchema); - str = processValue(str, r); - } - } else { - for (let arr_i = 0; arr_i < arr_len; arr_i++) { - const r = _e(node[arr_i], itemSchema, options); - str = processValue(str, r); - } + PathVisitor.fromMethodsObject = function fromMethodsObject(methods) { + if (methods instanceof PathVisitor) { + return methods; } - str += chars.arrayEnd; //indicates that next item is not array item - } else { - //object - str += chars.objStart; - const keys = Object.keys(e_schema); - if (Array.isArray(node)) { - node = node[0]; + if (!isObject.check(methods)) { + // An empty visitor? + return new PathVisitor; } - for (let i in keys) { - const key = keys[i]; - //a property defined in schema can be present either in attrsMap or children tags - //options.textNodeName will not present in both maps, take it's value from val - //options.attrNodeName will be present in attrsMap - let r; - if (!options.ignoreAttributes && node.attrsMap && node.attrsMap[key]) { - r = _e(node.attrsMap[key], e_schema[key], options); - } else if (key === options.textNodeName) { - r = _e(node.val, e_schema[key], options); - } else { - r = _e(node.child[key], e_schema[key], options); - } - str = processValue(str, r); + var Visitor = function Visitor() { + if (!(this instanceof Visitor)) { + throw new Error("Visitor constructor cannot be invoked without 'new'"); + } + PathVisitor.call(this); + }; + var Vp = Visitor.prototype = Object.create(PVp); + Vp.constructor = Visitor; + extend(Vp, methods); + extend(Visitor, PathVisitor); + isFunction.assert(Visitor.fromMethodsObject); + isFunction.assert(Visitor.visit); + return new Visitor; + }; + function extend(target, source) { + for (var property in source) { + if (hasOwn.call(source, property)) { + target[property] = source[property]; + } } - } - return str; - } else { - return hasValidData; + return target; } - } -}; - -const getValue = function(a /*, type*/) { - switch (a) { - case undefined: - return chars.missingPremitive; - case null: - return chars.nilPremitive; - case '': - return chars.emptyValue; - default: - return a; - } -}; - -const processValue = function(str, r) { - if (!isAppChar(r[0]) && !isAppChar(str[str.length - 1])) { - str += chars.boundryChar; - } - return str + r; -}; - -const isAppChar = function(ch) { - return charsArr.indexOf(ch) !== -1; -}; - -function hasData(jObj) { - if (jObj === undefined) { - return chars.missingChar; - } else if (jObj === null) { - return chars.nilChar; - } else if ( - jObj.child && - Object.keys(jObj.child).length === 0 && - (!jObj.attrsMap || Object.keys(jObj.attrsMap).length === 0) - ) { - return chars.emptyChar; - } else { - return true; - } + PathVisitor.visit = function visit(node, methods) { + return PathVisitor.fromMethodsObject(methods).visit(node); + }; + var PVp = PathVisitor.prototype; + PVp.visit = function () { + if (this._visiting) { + throw new Error("Recursively calling visitor.visit(path) resets visitor state. " + + "Try this.visit(path) or this.traverse(path) instead."); + } + // Private state that needs to be reset before every traversal. + this._visiting = true; + this._changeReported = false; + this._abortRequested = false; + var argc = arguments.length; + var args = new Array(argc); + for (var i = 0; i < argc; ++i) { + args[i] = arguments[i]; + } + if (!(args[0] instanceof NodePath)) { + args[0] = new NodePath({ root: args[0] }).get("root"); + } + // Called with the same arguments as .visit. + this.reset.apply(this, args); + var didNotThrow; + try { + var root = this.visitWithoutReset(args[0]); + didNotThrow = true; + } + finally { + this._visiting = false; + if (!didNotThrow && this._abortRequested) { + // If this.visitWithoutReset threw an exception and + // this._abortRequested was set to true, return the root of + // the AST instead of letting the exception propagate, so that + // client code does not have to provide a try-catch block to + // intercept the AbortRequest exception. Other kinds of + // exceptions will propagate without being intercepted and + // rethrown by a catch block, so their stacks will accurately + // reflect the original throwing context. + return args[0].value; + } + } + return root; + }; + PVp.AbortRequest = function AbortRequest() { }; + PVp.abort = function () { + var visitor = this; + visitor._abortRequested = true; + var request = new visitor.AbortRequest(); + // If you decide to catch this exception and stop it from propagating, + // make sure to call its cancel method to avoid silencing other + // exceptions that might be thrown later in the traversal. + request.cancel = function () { + visitor._abortRequested = false; + }; + throw request; + }; + PVp.reset = function (_path /*, additional arguments */) { + // Empty stub; may be reassigned or overridden by subclasses. + }; + PVp.visitWithoutReset = function (path) { + if (this instanceof this.Context) { + // Since this.Context.prototype === this, there's a chance we + // might accidentally call context.visitWithoutReset. If that + // happens, re-invoke the method against context.visitor. + return this.visitor.visitWithoutReset(path); + } + if (!(path instanceof NodePath)) { + throw new Error(""); + } + var value = path.value; + var methodName = value && + typeof value === "object" && + typeof value.type === "string" && + this._methodNameTable[value.type]; + if (methodName) { + var context = this.acquireContext(path); + try { + return context.invokeVisitorMethod(methodName); + } + finally { + this.releaseContext(context); + } + } + else { + // If there was no visitor method to call, visit the children of + // this node generically. + return visitChildren(path, this); + } + }; + function visitChildren(path, visitor) { + if (!(path instanceof NodePath)) { + throw new Error(""); + } + if (!(visitor instanceof PathVisitor)) { + throw new Error(""); + } + var value = path.value; + if (isArray.check(value)) { + path.each(visitor.visitWithoutReset, visitor); + } + else if (!isObject.check(value)) { + // No children to visit. + } + else { + var childNames = types.getFieldNames(value); + // The .comments field of the Node type is hidden, so we only + // visit it if the visitor defines visitBlock or visitLine, and + // value.comments is defined. + if (visitor._shouldVisitComments && + value.comments && + childNames.indexOf("comments") < 0) { + childNames.push("comments"); + } + var childCount = childNames.length; + var childPaths = []; + for (var i = 0; i < childCount; ++i) { + var childName = childNames[i]; + if (!hasOwn.call(value, childName)) { + value[childName] = types.getFieldValue(value, childName); + } + childPaths.push(path.get(childName)); + } + for (var i = 0; i < childCount; ++i) { + visitor.visitWithoutReset(childPaths[i]); + } + } + return path.value; + } + PVp.acquireContext = function (path) { + if (this._reusableContextStack.length === 0) { + return new this.Context(path); + } + return this._reusableContextStack.pop().reset(path); + }; + PVp.releaseContext = function (context) { + if (!(context instanceof this.Context)) { + throw new Error(""); + } + this._reusableContextStack.push(context); + context.currentPath = null; + }; + PVp.reportChanged = function () { + this._changeReported = true; + }; + PVp.wasChangeReported = function () { + return this._changeReported; + }; + function makeContextConstructor(visitor) { + function Context(path) { + if (!(this instanceof Context)) { + throw new Error(""); + } + if (!(this instanceof PathVisitor)) { + throw new Error(""); + } + if (!(path instanceof NodePath)) { + throw new Error(""); + } + Object.defineProperty(this, "visitor", { + value: visitor, + writable: false, + enumerable: true, + configurable: false + }); + this.currentPath = path; + this.needToCallTraverse = true; + Object.seal(this); + } + if (!(visitor instanceof PathVisitor)) { + throw new Error(""); + } + // Note that the visitor object is the prototype of Context.prototype, + // so all visitor methods are inherited by context objects. + var Cp = Context.prototype = Object.create(visitor); + Cp.constructor = Context; + extend(Cp, sharedContextProtoMethods); + return Context; + } + // Every PathVisitor has a different this.Context constructor and + // this.Context.prototype object, but those prototypes can all use the + // same reset, invokeVisitorMethod, and traverse function objects. + var sharedContextProtoMethods = Object.create(null); + sharedContextProtoMethods.reset = + function reset(path) { + if (!(this instanceof this.Context)) { + throw new Error(""); + } + if (!(path instanceof NodePath)) { + throw new Error(""); + } + this.currentPath = path; + this.needToCallTraverse = true; + return this; + }; + sharedContextProtoMethods.invokeVisitorMethod = + function invokeVisitorMethod(methodName) { + if (!(this instanceof this.Context)) { + throw new Error(""); + } + if (!(this.currentPath instanceof NodePath)) { + throw new Error(""); + } + var result = this.visitor[methodName].call(this, this.currentPath); + if (result === false) { + // Visitor methods return false to indicate that they have handled + // their own traversal needs, and we should not complain if + // this.needToCallTraverse is still true. + this.needToCallTraverse = false; + } + else if (result !== undefined) { + // Any other non-undefined value returned from the visitor method + // is interpreted as a replacement value. + this.currentPath = this.currentPath.replace(result)[0]; + if (this.needToCallTraverse) { + // If this.traverse still hasn't been called, visit the + // children of the replacement node. + this.traverse(this.currentPath); + } + } + if (this.needToCallTraverse !== false) { + throw new Error("Must either call this.traverse or return false in " + methodName); + } + var path = this.currentPath; + return path && path.value; + }; + sharedContextProtoMethods.traverse = + function traverse(path, newVisitor) { + if (!(this instanceof this.Context)) { + throw new Error(""); + } + if (!(path instanceof NodePath)) { + throw new Error(""); + } + if (!(this.currentPath instanceof NodePath)) { + throw new Error(""); + } + this.needToCallTraverse = false; + return visitChildren(path, PathVisitor.fromMethodsObject(newVisitor || this.visitor)); + }; + sharedContextProtoMethods.visit = + function visit(path, newVisitor) { + if (!(this instanceof this.Context)) { + throw new Error(""); + } + if (!(path instanceof NodePath)) { + throw new Error(""); + } + if (!(this.currentPath instanceof NodePath)) { + throw new Error(""); + } + this.needToCallTraverse = false; + return PathVisitor.fromMethodsObject(newVisitor || this.visitor).visitWithoutReset(path); + }; + sharedContextProtoMethods.reportChanged = function reportChanged() { + this.visitor.reportChanged(); + }; + sharedContextProtoMethods.abort = function abort() { + this.needToCallTraverse = false; + this.visitor.abort(); + }; + return PathVisitor; } +exports.default = pathVisitorPlugin; +module.exports = exports["default"]; -const x2j = __nccwpck_require__(6712); -const buildOptions = __nccwpck_require__(8280).buildOptions; -const convert2nimn = function(node, e_schema, options) { - options = buildOptions(options, x2j.defaultOptions, x2j.props); - return _e(node, e_schema, options); -}; +/***/ }), -exports.convert2nimn = convert2nimn; +/***/ 58770: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var Op = Object.prototype; +var hasOwn = Op.hasOwnProperty; +function pathPlugin(fork) { + var types = fork.use(types_1.default); + var isArray = types.builtInTypes.array; + var isNumber = types.builtInTypes.number; + var Path = function Path(value, parentPath, name) { + if (!(this instanceof Path)) { + throw new Error("Path constructor cannot be invoked without 'new'"); + } + if (parentPath) { + if (!(parentPath instanceof Path)) { + throw new Error(""); + } + } + else { + parentPath = null; + name = null; + } + // The value encapsulated by this Path, generally equal to + // parentPath.value[name] if we have a parentPath. + this.value = value; + // The immediate parent Path of this Path. + this.parentPath = parentPath; + // The name of the property of parentPath.value through which this + // Path's value was reached. + this.name = name; + // Calling path.get("child") multiple times always returns the same + // child Path object, for both performance and consistency reasons. + this.__childCache = null; + }; + var Pp = Path.prototype; + function getChildCache(path) { + // Lazily create the child cache. This also cheapens cache + // invalidation, since you can just reset path.__childCache to null. + return path.__childCache || (path.__childCache = Object.create(null)); + } + function getChildPath(path, name) { + var cache = getChildCache(path); + var actualChildValue = path.getValueProperty(name); + var childPath = cache[name]; + if (!hasOwn.call(cache, name) || + // Ensure consistency between cache and reality. + childPath.value !== actualChildValue) { + childPath = cache[name] = new path.constructor(actualChildValue, path, name); + } + return childPath; + } + // This method is designed to be overridden by subclasses that need to + // handle missing properties, etc. + Pp.getValueProperty = function getValueProperty(name) { + return this.value[name]; + }; + Pp.get = function get() { + var names = []; + for (var _i = 0; _i < arguments.length; _i++) { + names[_i] = arguments[_i]; + } + var path = this; + var count = names.length; + for (var i = 0; i < count; ++i) { + path = getChildPath(path, names[i]); + } + return path; + }; + Pp.each = function each(callback, context) { + var childPaths = []; + var len = this.value.length; + var i = 0; + // Collect all the original child paths before invoking the callback. + for (var i = 0; i < len; ++i) { + if (hasOwn.call(this.value, i)) { + childPaths[i] = this.get(i); + } + } + // Invoke the callback on just the original child paths, regardless of + // any modifications made to the array by the callback. I chose these + // semantics over cleverly invoking the callback on new elements because + // this way is much easier to reason about. + context = context || this; + for (i = 0; i < len; ++i) { + if (hasOwn.call(childPaths, i)) { + callback.call(context, childPaths[i]); + } + } + }; + Pp.map = function map(callback, context) { + var result = []; + this.each(function (childPath) { + result.push(callback.call(this, childPath)); + }, context); + return result; + }; + Pp.filter = function filter(callback, context) { + var result = []; + this.each(function (childPath) { + if (callback.call(this, childPath)) { + result.push(childPath); + } + }, context); + return result; + }; + function emptyMoves() { } + function getMoves(path, offset, start, end) { + isArray.assert(path.value); + if (offset === 0) { + return emptyMoves; + } + var length = path.value.length; + if (length < 1) { + return emptyMoves; + } + var argc = arguments.length; + if (argc === 2) { + start = 0; + end = length; + } + else if (argc === 3) { + start = Math.max(start, 0); + end = length; + } + else { + start = Math.max(start, 0); + end = Math.min(end, length); + } + isNumber.assert(start); + isNumber.assert(end); + var moves = Object.create(null); + var cache = getChildCache(path); + for (var i = start; i < end; ++i) { + if (hasOwn.call(path.value, i)) { + var childPath = path.get(i); + if (childPath.name !== i) { + throw new Error(""); + } + var newIndex = i + offset; + childPath.name = newIndex; + moves[newIndex] = childPath; + delete cache[i]; + } + } + delete cache.length; + return function () { + for (var newIndex in moves) { + var childPath = moves[newIndex]; + if (childPath.name !== +newIndex) { + throw new Error(""); + } + cache[newIndex] = childPath; + path.value[newIndex] = childPath.value; + } + }; + } + Pp.shift = function shift() { + var move = getMoves(this, -1); + var result = this.value.shift(); + move(); + return result; + }; + Pp.unshift = function unshift() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var move = getMoves(this, args.length); + var result = this.value.unshift.apply(this.value, args); + move(); + return result; + }; + Pp.push = function push() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + isArray.assert(this.value); + delete getChildCache(this).length; + return this.value.push.apply(this.value, args); + }; + Pp.pop = function pop() { + isArray.assert(this.value); + var cache = getChildCache(this); + delete cache[this.value.length - 1]; + delete cache.length; + return this.value.pop(); + }; + Pp.insertAt = function insertAt(index) { + var argc = arguments.length; + var move = getMoves(this, argc - 1, index); + if (move === emptyMoves && argc <= 1) { + return this; + } + index = Math.max(index, 0); + for (var i = 1; i < argc; ++i) { + this.value[index + i - 1] = arguments[i]; + } + move(); + return this; + }; + Pp.insertBefore = function insertBefore() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var pp = this.parentPath; + var argc = args.length; + var insertAtArgs = [this.name]; + for (var i = 0; i < argc; ++i) { + insertAtArgs.push(args[i]); + } + return pp.insertAt.apply(pp, insertAtArgs); + }; + Pp.insertAfter = function insertAfter() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var pp = this.parentPath; + var argc = args.length; + var insertAtArgs = [this.name + 1]; + for (var i = 0; i < argc; ++i) { + insertAtArgs.push(args[i]); + } + return pp.insertAt.apply(pp, insertAtArgs); + }; + function repairRelationshipWithParent(path) { + if (!(path instanceof Path)) { + throw new Error(""); + } + var pp = path.parentPath; + if (!pp) { + // Orphan paths have no relationship to repair. + return path; + } + var parentValue = pp.value; + var parentCache = getChildCache(pp); + // Make sure parentCache[path.name] is populated. + if (parentValue[path.name] === path.value) { + parentCache[path.name] = path; + } + else if (isArray.check(parentValue)) { + // Something caused path.name to become out of date, so attempt to + // recover by searching for path.value in parentValue. + var i = parentValue.indexOf(path.value); + if (i >= 0) { + parentCache[path.name = i] = path; + } + } + else { + // If path.value disagrees with parentValue[path.name], and + // path.name is not an array index, let path.value become the new + // parentValue[path.name] and update parentCache accordingly. + parentValue[path.name] = path.value; + parentCache[path.name] = path; + } + if (parentValue[path.name] !== path.value) { + throw new Error(""); + } + if (path.parentPath.get(path.name) !== path) { + throw new Error(""); + } + return path; + } + Pp.replace = function replace(replacement) { + var results = []; + var parentValue = this.parentPath.value; + var parentCache = getChildCache(this.parentPath); + var count = arguments.length; + repairRelationshipWithParent(this); + if (isArray.check(parentValue)) { + var originalLength = parentValue.length; + var move = getMoves(this.parentPath, count - 1, this.name + 1); + var spliceArgs = [this.name, 1]; + for (var i = 0; i < count; ++i) { + spliceArgs.push(arguments[i]); + } + var splicedOut = parentValue.splice.apply(parentValue, spliceArgs); + if (splicedOut[0] !== this.value) { + throw new Error(""); + } + if (parentValue.length !== (originalLength - 1 + count)) { + throw new Error(""); + } + move(); + if (count === 0) { + delete this.value; + delete parentCache[this.name]; + this.__childCache = null; + } + else { + if (parentValue[this.name] !== replacement) { + throw new Error(""); + } + if (this.value !== replacement) { + this.value = replacement; + this.__childCache = null; + } + for (i = 0; i < count; ++i) { + results.push(this.parentPath.get(this.name + i)); + } + if (results[0] !== this) { + throw new Error(""); + } + } + } + else if (count === 1) { + if (this.value !== replacement) { + this.__childCache = null; + } + this.value = parentValue[this.name] = replacement; + results.push(this); + } + else if (count === 0) { + delete parentValue[this.name]; + delete this.value; + this.__childCache = null; + // Leave this path cached as parentCache[this.name], even though + // it no longer has a value defined. + } + else { + throw new Error("Could not replace path"); + } + return results; + }; + return Path; +} +exports.default = pathPlugin; +module.exports = exports["default"]; /***/ }), -/***/ 8270: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 89733: +/***/ ((module, exports, __nccwpck_require__) => { "use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +var hasOwn = Object.prototype.hasOwnProperty; +function scopePlugin(fork) { + var types = fork.use(types_1.default); + var Type = types.Type; + var namedTypes = types.namedTypes; + var Node = namedTypes.Node; + var Expression = namedTypes.Expression; + var isArray = types.builtInTypes.array; + var b = types.builders; + var Scope = function Scope(path, parentScope) { + if (!(this instanceof Scope)) { + throw new Error("Scope constructor cannot be invoked without 'new'"); + } + ScopeType.assert(path.value); + var depth; + if (parentScope) { + if (!(parentScope instanceof Scope)) { + throw new Error(""); + } + depth = parentScope.depth + 1; + } + else { + parentScope = null; + depth = 0; + } + Object.defineProperties(this, { + path: { value: path }, + node: { value: path.value }, + isGlobal: { value: !parentScope, enumerable: true }, + depth: { value: depth }, + parent: { value: parentScope }, + bindings: { value: {} }, + types: { value: {} }, + }); + }; + var scopeTypes = [ + // Program nodes introduce global scopes. + namedTypes.Program, + // Function is the supertype of FunctionExpression, + // FunctionDeclaration, ArrowExpression, etc. + namedTypes.Function, + // In case you didn't know, the caught parameter shadows any variable + // of the same name in an outer scope. + namedTypes.CatchClause + ]; + var ScopeType = Type.or.apply(Type, scopeTypes); + Scope.isEstablishedBy = function (node) { + return ScopeType.check(node); + }; + var Sp = Scope.prototype; + // Will be overridden after an instance lazily calls scanScope. + Sp.didScan = false; + Sp.declares = function (name) { + this.scan(); + return hasOwn.call(this.bindings, name); + }; + Sp.declaresType = function (name) { + this.scan(); + return hasOwn.call(this.types, name); + }; + Sp.declareTemporary = function (prefix) { + if (prefix) { + if (!/^[a-z$_]/i.test(prefix)) { + throw new Error(""); + } + } + else { + prefix = "t$"; + } + // Include this.depth in the name to make sure the name does not + // collide with any variables in nested/enclosing scopes. + prefix += this.depth.toString(36) + "$"; + this.scan(); + var index = 0; + while (this.declares(prefix + index)) { + ++index; + } + var name = prefix + index; + return this.bindings[name] = types.builders.identifier(name); + }; + Sp.injectTemporary = function (identifier, init) { + identifier || (identifier = this.declareTemporary()); + var bodyPath = this.path.get("body"); + if (namedTypes.BlockStatement.check(bodyPath.value)) { + bodyPath = bodyPath.get("body"); + } + bodyPath.unshift(b.variableDeclaration("var", [b.variableDeclarator(identifier, init || null)])); + return identifier; + }; + Sp.scan = function (force) { + if (force || !this.didScan) { + for (var name in this.bindings) { + // Empty out this.bindings, just in cases. + delete this.bindings[name]; + } + scanScope(this.path, this.bindings, this.types); + this.didScan = true; + } + }; + Sp.getBindings = function () { + this.scan(); + return this.bindings; + }; + Sp.getTypes = function () { + this.scan(); + return this.types; + }; + function scanScope(path, bindings, scopeTypes) { + var node = path.value; + ScopeType.assert(node); + if (namedTypes.CatchClause.check(node)) { + // A catch clause establishes a new scope but the only variable + // bound in that scope is the catch parameter. Any other + // declarations create bindings in the outer scope. + var param = path.get("param"); + if (param.value) { + addPattern(param, bindings); + } + } + else { + recursiveScanScope(path, bindings, scopeTypes); + } + } + function recursiveScanScope(path, bindings, scopeTypes) { + var node = path.value; + if (path.parent && + namedTypes.FunctionExpression.check(path.parent.node) && + path.parent.node.id) { + addPattern(path.parent.get("id"), bindings); + } + if (!node) { + // None of the remaining cases matter if node is falsy. + } + else if (isArray.check(node)) { + path.each(function (childPath) { + recursiveScanChild(childPath, bindings, scopeTypes); + }); + } + else if (namedTypes.Function.check(node)) { + path.get("params").each(function (paramPath) { + addPattern(paramPath, bindings); + }); + recursiveScanChild(path.get("body"), bindings, scopeTypes); + } + else if ((namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) || + (namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node)) || + (namedTypes.TSTypeAliasDeclaration && namedTypes.TSTypeAliasDeclaration.check(node)) || + (namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node))) { + addTypePattern(path.get("id"), scopeTypes); + } + else if (namedTypes.VariableDeclarator.check(node)) { + addPattern(path.get("id"), bindings); + recursiveScanChild(path.get("init"), bindings, scopeTypes); + } + else if (node.type === "ImportSpecifier" || + node.type === "ImportNamespaceSpecifier" || + node.type === "ImportDefaultSpecifier") { + addPattern( + // Esprima used to use the .name field to refer to the local + // binding identifier for ImportSpecifier nodes, but .id for + // ImportNamespaceSpecifier and ImportDefaultSpecifier nodes. + // ESTree/Acorn/ESpree use .local for all three node types. + path.get(node.local ? "local" : + node.name ? "name" : "id"), bindings); + } + else if (Node.check(node) && !Expression.check(node)) { + types.eachField(node, function (name, child) { + var childPath = path.get(name); + if (!pathHasValue(childPath, child)) { + throw new Error(""); + } + recursiveScanChild(childPath, bindings, scopeTypes); + }); + } + } + function pathHasValue(path, value) { + if (path.value === value) { + return true; + } + // Empty arrays are probably produced by defaults.emptyArray, in which + // case is makes sense to regard them as equivalent, if not ===. + if (Array.isArray(path.value) && + path.value.length === 0 && + Array.isArray(value) && + value.length === 0) { + return true; + } + return false; + } + function recursiveScanChild(path, bindings, scopeTypes) { + var node = path.value; + if (!node || Expression.check(node)) { + // Ignore falsy values and Expressions. + } + else if (namedTypes.FunctionDeclaration.check(node) && + node.id !== null) { + addPattern(path.get("id"), bindings); + } + else if (namedTypes.ClassDeclaration && + namedTypes.ClassDeclaration.check(node)) { + addPattern(path.get("id"), bindings); + } + else if (ScopeType.check(node)) { + if (namedTypes.CatchClause.check(node) && + // TODO Broaden this to accept any pattern. + namedTypes.Identifier.check(node.param)) { + var catchParamName = node.param.name; + var hadBinding = hasOwn.call(bindings, catchParamName); + // Any declarations that occur inside the catch body that do + // not have the same name as the catch parameter should count + // as bindings in the outer scope. + recursiveScanScope(path.get("body"), bindings, scopeTypes); + // If a new binding matching the catch parameter name was + // created while scanning the catch body, ignore it because it + // actually refers to the catch parameter and not the outer + // scope that we're currently scanning. + if (!hadBinding) { + delete bindings[catchParamName]; + } + } + } + else { + recursiveScanScope(path, bindings, scopeTypes); + } + } + function addPattern(patternPath, bindings) { + var pattern = patternPath.value; + namedTypes.Pattern.assert(pattern); + if (namedTypes.Identifier.check(pattern)) { + if (hasOwn.call(bindings, pattern.name)) { + bindings[pattern.name].push(patternPath); + } + else { + bindings[pattern.name] = [patternPath]; + } + } + else if (namedTypes.AssignmentPattern && + namedTypes.AssignmentPattern.check(pattern)) { + addPattern(patternPath.get('left'), bindings); + } + else if (namedTypes.ObjectPattern && + namedTypes.ObjectPattern.check(pattern)) { + patternPath.get('properties').each(function (propertyPath) { + var property = propertyPath.value; + if (namedTypes.Pattern.check(property)) { + addPattern(propertyPath, bindings); + } + else if (namedTypes.Property.check(property)) { + addPattern(propertyPath.get('value'), bindings); + } + else if (namedTypes.SpreadProperty && + namedTypes.SpreadProperty.check(property)) { + addPattern(propertyPath.get('argument'), bindings); + } + }); + } + else if (namedTypes.ArrayPattern && + namedTypes.ArrayPattern.check(pattern)) { + patternPath.get('elements').each(function (elementPath) { + var element = elementPath.value; + if (namedTypes.Pattern.check(element)) { + addPattern(elementPath, bindings); + } + else if (namedTypes.SpreadElement && + namedTypes.SpreadElement.check(element)) { + addPattern(elementPath.get("argument"), bindings); + } + }); + } + else if (namedTypes.PropertyPattern && + namedTypes.PropertyPattern.check(pattern)) { + addPattern(patternPath.get('pattern'), bindings); + } + else if ((namedTypes.SpreadElementPattern && + namedTypes.SpreadElementPattern.check(pattern)) || + (namedTypes.SpreadPropertyPattern && + namedTypes.SpreadPropertyPattern.check(pattern))) { + addPattern(patternPath.get('argument'), bindings); + } + } + function addTypePattern(patternPath, types) { + var pattern = patternPath.value; + namedTypes.Pattern.assert(pattern); + if (namedTypes.Identifier.check(pattern)) { + if (hasOwn.call(types, pattern.name)) { + types[pattern.name].push(patternPath); + } + else { + types[pattern.name] = [patternPath]; + } + } + } + Sp.lookup = function (name) { + for (var scope = this; scope; scope = scope.parent) + if (scope.declares(name)) + break; + return scope; + }; + Sp.lookupType = function (name) { + for (var scope = this; scope; scope = scope.parent) + if (scope.declaresType(name)) + break; + return scope; + }; + Sp.getGlobalScope = function () { + var scope = this; + while (!scope.isGlobal) + scope = scope.parent; + return scope; + }; + return Scope; +} +exports.default = scopePlugin; +module.exports = exports["default"]; -const util = __nccwpck_require__(8280); +/***/ }), -const convertToJson = function(node, options, parentTagName) { - const jObj = {}; +/***/ 34631: +/***/ ((module, exports, __nccwpck_require__) => { - // when no child node or attr is present - if ((!node.child || util.isEmptyObject(node.child)) && (!node.attrsMap || util.isEmptyObject(node.attrsMap))) { - return util.isExist(node.val) ? node.val : ''; - } +"use strict"; +; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(4351); +var types_1 = tslib_1.__importDefault(__nccwpck_require__(52619)); +function default_1(fork) { + var types = fork.use(types_1.default); + var Type = types.Type; + var builtin = types.builtInTypes; + var isNumber = builtin.number; + // An example of constructing a new type with arbitrary constraints from + // an existing type. + function geq(than) { + return Type.from(function (value) { return isNumber.check(value) && value >= than; }, isNumber + " >= " + than); + } + ; + // Default value-returning functions that may optionally be passed as a + // third argument to Def.prototype.field. + var defaults = { + // Functions were used because (among other reasons) that's the most + // elegant way to allow for the emptyArray one always to give a new + // array instance. + "null": function () { return null; }, + "emptyArray": function () { return []; }, + "false": function () { return false; }, + "true": function () { return true; }, + "undefined": function () { }, + "use strict": function () { return "use strict"; } + }; + var naiveIsPrimitive = Type.or(builtin.string, builtin.number, builtin.boolean, builtin.null, builtin.undefined); + var isPrimitive = Type.from(function (value) { + if (value === null) + return true; + var type = typeof value; + if (type === "object" || + type === "function") { + return false; + } + return true; + }, naiveIsPrimitive.toString()); + return { + geq: geq, + defaults: defaults, + isPrimitive: isPrimitive, + }; +} +exports.default = default_1; +module.exports = exports["default"]; - // otherwise create a textnode if node has some text - if (util.isExist(node.val) && !(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) { - const asArray = util.isTagNameInArrayMode(node.tagname, options.arrayMode, parentTagName) - jObj[options.textNodeName] = asArray ? [node.val] : node.val; - } - util.merge(jObj, node.attrsMap, options.arrayMode); +/***/ }), - const keys = Object.keys(node.child); - for (let index = 0; index < keys.length; index++) { - const tagName = keys[index]; - if (node.child[tagName] && node.child[tagName].length > 1) { - jObj[tagName] = []; - for (let tag in node.child[tagName]) { - if (node.child[tagName].hasOwnProperty(tag)) { - jObj[tagName].push(convertToJson(node.child[tagName][tag], options, tagName)); +/***/ 52619: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Def = void 0; +var tslib_1 = __nccwpck_require__(4351); +var Op = Object.prototype; +var objToStr = Op.toString; +var hasOwn = Op.hasOwnProperty; +var BaseType = /** @class */ (function () { + function BaseType() { + } + BaseType.prototype.assert = function (value, deep) { + if (!this.check(value, deep)) { + var str = shallowStringify(value); + throw new Error(str + " does not match type " + this); } - } - } else { - const result = convertToJson(node.child[tagName][0], options, tagName); - const asArray = (options.arrayMode === true && typeof result === 'object') || util.isTagNameInArrayMode(tagName, options.arrayMode, parentTagName); - jObj[tagName] = asArray ? [result] : result; + return true; + }; + BaseType.prototype.arrayOf = function () { + var elemType = this; + return new ArrayType(elemType); + }; + return BaseType; +}()); +var ArrayType = /** @class */ (function (_super) { + tslib_1.__extends(ArrayType, _super); + function ArrayType(elemType) { + var _this = _super.call(this) || this; + _this.elemType = elemType; + _this.kind = "ArrayType"; + return _this; + } + ArrayType.prototype.toString = function () { + return "[" + this.elemType + "]"; + }; + ArrayType.prototype.check = function (value, deep) { + var _this = this; + return Array.isArray(value) && value.every(function (elem) { return _this.elemType.check(elem, deep); }); + }; + return ArrayType; +}(BaseType)); +var IdentityType = /** @class */ (function (_super) { + tslib_1.__extends(IdentityType, _super); + function IdentityType(value) { + var _this = _super.call(this) || this; + _this.value = value; + _this.kind = "IdentityType"; + return _this; + } + IdentityType.prototype.toString = function () { + return String(this.value); + }; + IdentityType.prototype.check = function (value, deep) { + var result = value === this.value; + if (!result && typeof deep === "function") { + deep(this, value); + } + return result; + }; + return IdentityType; +}(BaseType)); +var ObjectType = /** @class */ (function (_super) { + tslib_1.__extends(ObjectType, _super); + function ObjectType(fields) { + var _this = _super.call(this) || this; + _this.fields = fields; + _this.kind = "ObjectType"; + return _this; + } + ObjectType.prototype.toString = function () { + return "{ " + this.fields.join(", ") + " }"; + }; + ObjectType.prototype.check = function (value, deep) { + return (objToStr.call(value) === objToStr.call({}) && + this.fields.every(function (field) { + return field.type.check(value[field.name], deep); + })); + }; + return ObjectType; +}(BaseType)); +var OrType = /** @class */ (function (_super) { + tslib_1.__extends(OrType, _super); + function OrType(types) { + var _this = _super.call(this) || this; + _this.types = types; + _this.kind = "OrType"; + return _this; + } + OrType.prototype.toString = function () { + return this.types.join(" | "); + }; + OrType.prototype.check = function (value, deep) { + return this.types.some(function (type) { + return type.check(value, deep); + }); + }; + return OrType; +}(BaseType)); +var PredicateType = /** @class */ (function (_super) { + tslib_1.__extends(PredicateType, _super); + function PredicateType(name, predicate) { + var _this = _super.call(this) || this; + _this.name = name; + _this.predicate = predicate; + _this.kind = "PredicateType"; + return _this; + } + PredicateType.prototype.toString = function () { + return this.name; + }; + PredicateType.prototype.check = function (value, deep) { + var result = this.predicate(value, deep); + if (!result && typeof deep === "function") { + deep(this, value); + } + return result; + }; + return PredicateType; +}(BaseType)); +var Def = /** @class */ (function () { + function Def(type, typeName) { + this.type = type; + this.typeName = typeName; + this.baseNames = []; + this.ownFields = Object.create(null); + // Includes own typeName. Populated during finalization. + this.allSupertypes = Object.create(null); + // Linear inheritance hierarchy. Populated during finalization. + this.supertypeList = []; + // Includes inherited fields. + this.allFields = Object.create(null); + // Non-hidden keys of allFields. + this.fieldNames = []; + // This property will be overridden as true by individual Def instances + // when they are finalized. + this.finalized = false; + // False by default until .build(...) is called on an instance. + this.buildable = false; + this.buildParams = []; + } + Def.prototype.isSupertypeOf = function (that) { + if (that instanceof Def) { + if (this.finalized !== true || + that.finalized !== true) { + throw new Error(""); + } + return hasOwn.call(that.allSupertypes, this.typeName); + } + else { + throw new Error(that + " is not a Def"); + } + }; + Def.prototype.checkAllFields = function (value, deep) { + var allFields = this.allFields; + if (this.finalized !== true) { + throw new Error("" + this.typeName); + } + function checkFieldByName(name) { + var field = allFields[name]; + var type = field.type; + var child = field.getValue(value); + return type.check(child, deep); + } + return value !== null && + typeof value === "object" && + Object.keys(allFields).every(checkFieldByName); + }; + Def.prototype.bases = function () { + var supertypeNames = []; + for (var _i = 0; _i < arguments.length; _i++) { + supertypeNames[_i] = arguments[_i]; + } + var bases = this.baseNames; + if (this.finalized) { + if (supertypeNames.length !== bases.length) { + throw new Error(""); + } + for (var i = 0; i < supertypeNames.length; i++) { + if (supertypeNames[i] !== bases[i]) { + throw new Error(""); + } + } + return this; + } + supertypeNames.forEach(function (baseName) { + // This indexOf lookup may be O(n), but the typical number of base + // names is very small, and indexOf is a native Array method. + if (bases.indexOf(baseName) < 0) { + bases.push(baseName); + } + }); + return this; // For chaining. + }; + return Def; +}()); +exports.Def = Def; +var Field = /** @class */ (function () { + function Field(name, type, defaultFn, hidden) { + this.name = name; + this.type = type; + this.defaultFn = defaultFn; + this.hidden = !!hidden; + } + Field.prototype.toString = function () { + return JSON.stringify(this.name) + ": " + this.type; + }; + Field.prototype.getValue = function (obj) { + var value = obj[this.name]; + if (typeof value !== "undefined") { + return value; + } + if (typeof this.defaultFn === "function") { + value = this.defaultFn.call(obj); + } + return value; + }; + return Field; +}()); +function shallowStringify(value) { + if (Array.isArray(value)) { + return "[" + value.map(shallowStringify).join(", ") + "]"; } - } + if (value && typeof value === "object") { + return "{ " + Object.keys(value).map(function (key) { + return key + ": " + value[key]; + }).join(", ") + " }"; + } + return JSON.stringify(value); +} +function typesPlugin(_fork) { + var Type = { + or: function () { + var types = []; + for (var _i = 0; _i < arguments.length; _i++) { + types[_i] = arguments[_i]; + } + return new OrType(types.map(function (type) { return Type.from(type); })); + }, + from: function (value, name) { + if (value instanceof ArrayType || + value instanceof IdentityType || + value instanceof ObjectType || + value instanceof OrType || + value instanceof PredicateType) { + return value; + } + // The Def type is used as a helper for constructing compound + // interface types for AST nodes. + if (value instanceof Def) { + return value.type; + } + // Support [ElemType] syntax. + if (isArray.check(value)) { + if (value.length !== 1) { + throw new Error("only one element type is permitted for typed arrays"); + } + return new ArrayType(Type.from(value[0])); + } + // Support { someField: FieldType, ... } syntax. + if (isObject.check(value)) { + return new ObjectType(Object.keys(value).map(function (name) { + return new Field(name, Type.from(value[name], name)); + })); + } + if (typeof value === "function") { + var bicfIndex = builtInCtorFns.indexOf(value); + if (bicfIndex >= 0) { + return builtInCtorTypes[bicfIndex]; + } + if (typeof name !== "string") { + throw new Error("missing name"); + } + return new PredicateType(name, value); + } + // As a last resort, toType returns a type that matches any value that + // is === from. This is primarily useful for literal values like + // toType(null), but it has the additional advantage of allowing + // toType to be a total function. + return new IdentityType(value); + }, + // Define a type whose name is registered in a namespace (the defCache) so + // that future definitions will return the same type given the same name. + // In particular, this system allows for circular and forward definitions. + // The Def object d returned from Type.def may be used to configure the + // type d.type by calling methods such as d.bases, d.build, and d.field. + def: function (typeName) { + return hasOwn.call(defCache, typeName) + ? defCache[typeName] + : defCache[typeName] = new DefImpl(typeName); + }, + hasDef: function (typeName) { + return hasOwn.call(defCache, typeName); + } + }; + var builtInCtorFns = []; + var builtInCtorTypes = []; + function defBuiltInType(name, example) { + var objStr = objToStr.call(example); + var type = new PredicateType(name, function (value) { return objToStr.call(value) === objStr; }); + if (example && typeof example.constructor === "function") { + builtInCtorFns.push(example.constructor); + builtInCtorTypes.push(type); + } + return type; + } + // These types check the underlying [[Class]] attribute of the given + // value, rather than using the problematic typeof operator. Note however + // that no subtyping is considered; so, for instance, isObject.check + // returns false for [], /./, new Date, and null. + var isString = defBuiltInType("string", "truthy"); + var isFunction = defBuiltInType("function", function () { }); + var isArray = defBuiltInType("array", []); + var isObject = defBuiltInType("object", {}); + var isRegExp = defBuiltInType("RegExp", /./); + var isDate = defBuiltInType("Date", new Date()); + var isNumber = defBuiltInType("number", 3); + var isBoolean = defBuiltInType("boolean", true); + var isNull = defBuiltInType("null", null); + var isUndefined = defBuiltInType("undefined", undefined); + var builtInTypes = { + string: isString, + function: isFunction, + array: isArray, + object: isObject, + RegExp: isRegExp, + Date: isDate, + number: isNumber, + boolean: isBoolean, + null: isNull, + undefined: isUndefined, + }; + // In order to return the same Def instance every time Type.def is called + // with a particular name, those instances need to be stored in a cache. + var defCache = Object.create(null); + function defFromValue(value) { + if (value && typeof value === "object") { + var type = value.type; + if (typeof type === "string" && + hasOwn.call(defCache, type)) { + var d = defCache[type]; + if (d.finalized) { + return d; + } + } + } + return null; + } + var DefImpl = /** @class */ (function (_super) { + tslib_1.__extends(DefImpl, _super); + function DefImpl(typeName) { + var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this; + return _this; + } + DefImpl.prototype.check = function (value, deep) { + if (this.finalized !== true) { + throw new Error("prematurely checking unfinalized type " + this.typeName); + } + // A Def type can only match an object value. + if (value === null || typeof value !== "object") { + return false; + } + var vDef = defFromValue(value); + if (!vDef) { + // If we couldn't infer the Def associated with the given value, + // and we expected it to be a SourceLocation or a Position, it was + // probably just missing a "type" field (because Esprima does not + // assign a type property to such nodes). Be optimistic and let + // this.checkAllFields make the final decision. + if (this.typeName === "SourceLocation" || + this.typeName === "Position") { + return this.checkAllFields(value, deep); + } + // Calling this.checkAllFields for any other type of node is both + // bad for performance and way too forgiving. + return false; + } + // If checking deeply and vDef === this, then we only need to call + // checkAllFields once. Calling checkAllFields is too strict when deep + // is false, because then we only care about this.isSupertypeOf(vDef). + if (deep && vDef === this) { + return this.checkAllFields(value, deep); + } + // In most cases we rely exclusively on isSupertypeOf to make O(1) + // subtyping determinations. This suffices in most situations outside + // of unit tests, since interface conformance is checked whenever new + // instances are created using builder functions. + if (!this.isSupertypeOf(vDef)) { + return false; + } + // The exception is when deep is true; then, we recursively check all + // fields. + if (!deep) { + return true; + } + // Use the more specific Def (vDef) to perform the deep check, but + // shallow-check fields defined by the less specific Def (this). + return vDef.checkAllFields(value, deep) + && this.checkAllFields(value, false); + }; + DefImpl.prototype.build = function () { + var _this = this; + var buildParams = []; + for (var _i = 0; _i < arguments.length; _i++) { + buildParams[_i] = arguments[_i]; + } + // Calling Def.prototype.build multiple times has the effect of merely + // redefining this property. + this.buildParams = buildParams; + if (this.buildable) { + // If this Def is already buildable, update self.buildParams and + // continue using the old builder function. + return this; + } + // Every buildable type will have its "type" field filled in + // automatically. This includes types that are not subtypes of Node, + // like SourceLocation, but that seems harmless (TODO?). + this.field("type", String, function () { return _this.typeName; }); + // Override Dp.buildable for this Def instance. + this.buildable = true; + var addParam = function (built, param, arg, isArgAvailable) { + if (hasOwn.call(built, param)) + return; + var all = _this.allFields; + if (!hasOwn.call(all, param)) { + throw new Error("" + param); + } + var field = all[param]; + var type = field.type; + var value; + if (isArgAvailable) { + value = arg; + } + else if (field.defaultFn) { + // Expose the partially-built object to the default + // function as its `this` object. + value = field.defaultFn.call(built); + } + else { + var message = "no value or default function given for field " + + JSON.stringify(param) + " of " + _this.typeName + "(" + + _this.buildParams.map(function (name) { + return all[name]; + }).join(", ") + ")"; + throw new Error(message); + } + if (!type.check(value)) { + throw new Error(shallowStringify(value) + + " does not match field " + field + + " of type " + _this.typeName); + } + built[param] = value; + }; + // Calling the builder function will construct an instance of the Def, + // with positional arguments mapped to the fields original passed to .build. + // If not enough arguments are provided, the default value for the remaining fields + // will be used. + var builder = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var argc = args.length; + if (!_this.finalized) { + throw new Error("attempting to instantiate unfinalized type " + + _this.typeName); + } + var built = Object.create(nodePrototype); + _this.buildParams.forEach(function (param, i) { + if (i < argc) { + addParam(built, param, args[i], true); + } + else { + addParam(built, param, null, false); + } + }); + Object.keys(_this.allFields).forEach(function (param) { + // Use the default value. + addParam(built, param, null, false); + }); + // Make sure that the "type" field was filled automatically. + if (built.type !== _this.typeName) { + throw new Error(""); + } + return built; + }; + // Calling .from on the builder function will construct an instance of the Def, + // using field values from the passed object. For fields missing from the passed object, + // their default value will be used. + builder.from = function (obj) { + if (!_this.finalized) { + throw new Error("attempting to instantiate unfinalized type " + + _this.typeName); + } + var built = Object.create(nodePrototype); + Object.keys(_this.allFields).forEach(function (param) { + if (hasOwn.call(obj, param)) { + addParam(built, param, obj[param], true); + } + else { + addParam(built, param, null, false); + } + }); + // Make sure that the "type" field was filled automatically. + if (built.type !== _this.typeName) { + throw new Error(""); + } + return built; + }; + Object.defineProperty(builders, getBuilderName(this.typeName), { + enumerable: true, + value: builder + }); + return this; + }; + // The reason fields are specified using .field(...) instead of an object + // literal syntax is somewhat subtle: the object literal syntax would + // support only one key and one value, but with .field(...) we can pass + // any number of arguments to specify the field. + DefImpl.prototype.field = function (name, type, defaultFn, hidden) { + if (this.finalized) { + console.error("Ignoring attempt to redefine field " + + JSON.stringify(name) + " of finalized type " + + JSON.stringify(this.typeName)); + return this; + } + this.ownFields[name] = new Field(name, Type.from(type), defaultFn, hidden); + return this; // For chaining. + }; + DefImpl.prototype.finalize = function () { + var _this = this; + // It's not an error to finalize a type more than once, but only the + // first call to .finalize does anything. + if (!this.finalized) { + var allFields = this.allFields; + var allSupertypes = this.allSupertypes; + this.baseNames.forEach(function (name) { + var def = defCache[name]; + if (def instanceof Def) { + def.finalize(); + extend(allFields, def.allFields); + extend(allSupertypes, def.allSupertypes); + } + else { + var message = "unknown supertype name " + + JSON.stringify(name) + + " for subtype " + + JSON.stringify(_this.typeName); + throw new Error(message); + } + }); + // TODO Warn if fields are overridden with incompatible types. + extend(allFields, this.ownFields); + allSupertypes[this.typeName] = this; + this.fieldNames.length = 0; + for (var fieldName in allFields) { + if (hasOwn.call(allFields, fieldName) && + !allFields[fieldName].hidden) { + this.fieldNames.push(fieldName); + } + } + // Types are exported only once they have been finalized. + Object.defineProperty(namedTypes, this.typeName, { + enumerable: true, + value: this.type + }); + this.finalized = true; + // A linearization of the inheritance hierarchy. + populateSupertypeList(this.typeName, this.supertypeList); + if (this.buildable && + this.supertypeList.lastIndexOf("Expression") >= 0) { + wrapExpressionBuilderWithStatement(this.typeName); + } + } + }; + return DefImpl; + }(Def)); + // Note that the list returned by this function is a copy of the internal + // supertypeList, *without* the typeName itself as the first element. + function getSupertypeNames(typeName) { + if (!hasOwn.call(defCache, typeName)) { + throw new Error(""); + } + var d = defCache[typeName]; + if (d.finalized !== true) { + throw new Error(""); + } + return d.supertypeList.slice(1); + } + // Returns an object mapping from every known type in the defCache to the + // most specific supertype whose name is an own property of the candidates + // object. + function computeSupertypeLookupTable(candidates) { + var table = {}; + var typeNames = Object.keys(defCache); + var typeNameCount = typeNames.length; + for (var i = 0; i < typeNameCount; ++i) { + var typeName = typeNames[i]; + var d = defCache[typeName]; + if (d.finalized !== true) { + throw new Error("" + typeName); + } + for (var j = 0; j < d.supertypeList.length; ++j) { + var superTypeName = d.supertypeList[j]; + if (hasOwn.call(candidates, superTypeName)) { + table[typeName] = superTypeName; + break; + } + } + } + return table; + } + var builders = Object.create(null); + // This object is used as prototype for any node created by a builder. + var nodePrototype = {}; + // Call this function to define a new method to be shared by all AST + // nodes. The replaced method (if any) is returned for easy wrapping. + function defineMethod(name, func) { + var old = nodePrototype[name]; + // Pass undefined as func to delete nodePrototype[name]. + if (isUndefined.check(func)) { + delete nodePrototype[name]; + } + else { + isFunction.assert(func); + Object.defineProperty(nodePrototype, name, { + enumerable: true, + configurable: true, + value: func + }); + } + return old; + } + function getBuilderName(typeName) { + return typeName.replace(/^[A-Z]+/, function (upperCasePrefix) { + var len = upperCasePrefix.length; + switch (len) { + case 0: return ""; + // If there's only one initial capital letter, just lower-case it. + case 1: return upperCasePrefix.toLowerCase(); + default: + // If there's more than one initial capital letter, lower-case + // all but the last one, so that XMLDefaultDeclaration (for + // example) becomes xmlDefaultDeclaration. + return upperCasePrefix.slice(0, len - 1).toLowerCase() + + upperCasePrefix.charAt(len - 1); + } + }); + } + function getStatementBuilderName(typeName) { + typeName = getBuilderName(typeName); + return typeName.replace(/(Expression)?$/, "Statement"); + } + var namedTypes = {}; + // Like Object.keys, but aware of what fields each AST type should have. + function getFieldNames(object) { + var d = defFromValue(object); + if (d) { + return d.fieldNames.slice(0); + } + if ("type" in object) { + throw new Error("did not recognize object of type " + + JSON.stringify(object.type)); + } + return Object.keys(object); + } + // Get the value of an object property, taking object.type and default + // functions into account. + function getFieldValue(object, fieldName) { + var d = defFromValue(object); + if (d) { + var field = d.allFields[fieldName]; + if (field) { + return field.getValue(object); + } + } + return object && object[fieldName]; + } + // Iterate over all defined fields of an object, including those missing + // or undefined, passing each field name and effective value (as returned + // by getFieldValue) to the callback. If the object has no corresponding + // Def, the callback will never be called. + function eachField(object, callback, context) { + getFieldNames(object).forEach(function (name) { + callback.call(this, name, getFieldValue(object, name)); + }, context); + } + // Similar to eachField, except that iteration stops as soon as the + // callback returns a truthy value. Like Array.prototype.some, the final + // result is either true or false to indicates whether the callback + // returned true for any element or not. + function someField(object, callback, context) { + return getFieldNames(object).some(function (name) { + return callback.call(this, name, getFieldValue(object, name)); + }, context); + } + // Adds an additional builder for Expression subtypes + // that wraps the built Expression in an ExpressionStatements. + function wrapExpressionBuilderWithStatement(typeName) { + var wrapperName = getStatementBuilderName(typeName); + // skip if the builder already exists + if (builders[wrapperName]) + return; + // the builder function to wrap with builders.ExpressionStatement + var wrapped = builders[getBuilderName(typeName)]; + // skip if there is nothing to wrap + if (!wrapped) + return; + var builder = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return builders.expressionStatement(wrapped.apply(builders, args)); + }; + builder.from = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return builders.expressionStatement(wrapped.from.apply(builders, args)); + }; + builders[wrapperName] = builder; + } + function populateSupertypeList(typeName, list) { + list.length = 0; + list.push(typeName); + var lastSeen = Object.create(null); + for (var pos = 0; pos < list.length; ++pos) { + typeName = list[pos]; + var d = defCache[typeName]; + if (d.finalized !== true) { + throw new Error(""); + } + // If we saw typeName earlier in the breadth-first traversal, + // delete the last-seen occurrence. + if (hasOwn.call(lastSeen, typeName)) { + delete list[lastSeen[typeName]]; + } + // Record the new index of the last-seen occurrence of typeName. + lastSeen[typeName] = pos; + // Enqueue the base names of this type. + list.push.apply(list, d.baseNames); + } + // Compaction loop to remove array holes. + for (var to = 0, from = to, len = list.length; from < len; ++from) { + if (hasOwn.call(list, from)) { + list[to++] = list[from]; + } + } + list.length = to; + } + function extend(into, from) { + Object.keys(from).forEach(function (name) { + into[name] = from[name]; + }); + return into; + } + function finalize() { + Object.keys(defCache).forEach(function (name) { + defCache[name].finalize(); + }); + } + return { + Type: Type, + builtInTypes: builtInTypes, + getSupertypeNames: getSupertypeNames, + computeSupertypeLookupTable: computeSupertypeLookupTable, + builders: builders, + defineMethod: defineMethod, + getBuilderName: getBuilderName, + getStatementBuilderName: getStatementBuilderName, + namedTypes: namedTypes, + getFieldNames: getFieldNames, + getFieldValue: getFieldValue, + eachField: eachField, + someField: someField, + finalize: finalize, + }; +} +exports.default = typesPlugin; +; - //add value - return jObj; -}; -exports.convertToJson = convertToJson; +/***/ }), + +/***/ 27012: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.visit = exports.use = exports.Type = exports.someField = exports.PathVisitor = exports.Path = exports.NodePath = exports.namedTypes = exports.getSupertypeNames = exports.getFieldValue = exports.getFieldNames = exports.getBuilderName = exports.finalize = exports.eachField = exports.defineMethod = exports.builtInTypes = exports.builders = exports.astNodesAreEquivalent = void 0; +var tslib_1 = __nccwpck_require__(4351); +var fork_1 = tslib_1.__importDefault(__nccwpck_require__(20253)); +var core_1 = tslib_1.__importDefault(__nccwpck_require__(66604)); +var es6_1 = tslib_1.__importDefault(__nccwpck_require__(68127)); +var es7_1 = tslib_1.__importDefault(__nccwpck_require__(75351)); +var es2020_1 = tslib_1.__importDefault(__nccwpck_require__(48975)); +var jsx_1 = tslib_1.__importDefault(__nccwpck_require__(27572)); +var flow_1 = tslib_1.__importDefault(__nccwpck_require__(60368)); +var esprima_1 = tslib_1.__importDefault(__nccwpck_require__(96817)); +var babel_1 = tslib_1.__importDefault(__nccwpck_require__(92262)); +var typescript_1 = tslib_1.__importDefault(__nccwpck_require__(16743)); +var es_proposals_1 = tslib_1.__importDefault(__nccwpck_require__(32207)); +var namedTypes_1 = __nccwpck_require__(24143); +Object.defineProperty(exports, "namedTypes", ({ enumerable: true, get: function () { return namedTypes_1.namedTypes; } })); +var _a = fork_1.default([ + // This core module of AST types captures ES5 as it is parsed today by + // git://github.com/ariya/esprima.git#master. + core_1.default, + // Feel free to add to or remove from this list of extension modules to + // configure the precise type hierarchy that you need. + es6_1.default, + es7_1.default, + es2020_1.default, + jsx_1.default, + flow_1.default, + esprima_1.default, + babel_1.default, + typescript_1.default, + es_proposals_1.default, +]), astNodesAreEquivalent = _a.astNodesAreEquivalent, builders = _a.builders, builtInTypes = _a.builtInTypes, defineMethod = _a.defineMethod, eachField = _a.eachField, finalize = _a.finalize, getBuilderName = _a.getBuilderName, getFieldNames = _a.getFieldNames, getFieldValue = _a.getFieldValue, getSupertypeNames = _a.getSupertypeNames, n = _a.namedTypes, NodePath = _a.NodePath, Path = _a.Path, PathVisitor = _a.PathVisitor, someField = _a.someField, Type = _a.Type, use = _a.use, visit = _a.visit; +exports.astNodesAreEquivalent = astNodesAreEquivalent; +exports.builders = builders; +exports.builtInTypes = builtInTypes; +exports.defineMethod = defineMethod; +exports.eachField = eachField; +exports.finalize = finalize; +exports.getBuilderName = getBuilderName; +exports.getFieldNames = getFieldNames; +exports.getFieldValue = getFieldValue; +exports.getSupertypeNames = getSupertypeNames; +exports.NodePath = NodePath; +exports.Path = Path; +exports.PathVisitor = PathVisitor; +exports.someField = someField; +exports.Type = Type; +exports.use = use; +exports.visit = visit; +// Populate the exported fields of the namedTypes namespace, while still +// retaining its member types. +Object.assign(namedTypes_1.namedTypes, n); /***/ }), -/***/ 6014: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 86966: +/***/ ((module) => { "use strict"; +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ -const util = __nccwpck_require__(8280); -const buildOptions = __nccwpck_require__(8280).buildOptions; -const x2j = __nccwpck_require__(6712); -//TODO: do it later -const convertToJsonString = function(node, options) { - options = buildOptions(options, x2j.defaultOptions, x2j.props); +/** + * Module exports. + * @public + */ - options.indentBy = options.indentBy || ''; - return _cToJsonStr(node, options, 0); +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: Math.pow(1024, 4), + pb: Math.pow(1024, 5), }; -const _cToJsonStr = function(node, options, level) { - let jObj = '{'; +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; - //traver through all the children - const keys = Object.keys(node.child); +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ - for (let index = 0; index < keys.length; index++) { - var tagname = keys[index]; - if (node.child[tagname] && node.child[tagname].length > 1) { - jObj += '"' + tagname + '" : [ '; - for (var tag in node.child[tagname]) { - jObj += _cToJsonStr(node.child[tagname][tag], options) + ' , '; - } - jObj = jObj.substr(0, jObj.length - 1) + ' ] '; //remove extra comma in last +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.pb) { + unit = 'PB'; + } else if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; } else { - jObj += '"' + tagname + '" : ' + _cToJsonStr(node.child[tagname][0], options) + ' ,'; + unit = 'B'; } } - util.merge(jObj, node.attrsMap); - //add attrsMap as new children - if (util.isEmptyObject(jObj)) { - return util.isExist(node.val) ? node.val : ''; - } else { - if (util.isExist(node.val)) { - if (!(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) { - jObj += '"' + options.textNodeName + '" : ' + stringval(node.val); - } - } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); } - //add value - if (jObj[jObj.length - 1] === ',') { - jObj = jObj.substr(0, jObj.length - 2); + + if (thousandsSeparator) { + str = str.split('.').map(function (s, i) { + return i === 0 + ? s.replace(formatThousandsRegExp, thousandsSeparator) + : s + }).join('.'); } - return jObj + '}'; -}; -function stringval(v) { - if (v === true || v === false || !isNaN(v)) { - return v; + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' } else { - return '"' + v + '"'; + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); } -} -function indentate(options, level) { - return options.indentBy.repeat(level); -} + if (isNaN(floatValue)) { + return null; + } -exports.convertToJsonString = convertToJsonString; + return Math.floor(map[unit] * floatValue); +} /***/ }), -/***/ 7448: +/***/ 95898: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; -const nodeToJson = __nccwpck_require__(8270); -const xmlToNodeobj = __nccwpck_require__(6712); -const x2xmlnode = __nccwpck_require__(6712); -const buildOptions = __nccwpck_require__(8280).buildOptions; -const validator = __nccwpck_require__(1739); +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; -exports.parse = function(xmlData, options, validationOption) { - if( validationOption){ - if(validationOption === true) validationOption = {} - - const result = validator.validate(xmlData, validationOption); - if (result !== true) { - throw Error( result.err.msg) - } - } - options = buildOptions(options, x2xmlnode.defaultOptions, x2xmlnode.props); - const traversableObj = xmlToNodeobj.getTraversalObj(xmlData, options) - //print(traversableObj, " "); - return nodeToJson.convertToJson(traversableObj, options); -}; -exports.convertTonimn = __nccwpck_require__(1901).convert2nimn; -exports.getTraversalObj = xmlToNodeobj.getTraversalObj; -exports.convertToJson = nodeToJson.convertToJson; -exports.convertToJsonString = __nccwpck_require__(6014).convertToJsonString; -exports.validate = validator.validate; -exports.j2xParser = __nccwpck_require__(5152); -exports.parseToNimn = function(xmlData, schema, options) { - return exports.convertTonimn(exports.getTraversalObj(xmlData, options), schema, options); -}; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; -function print(xmlNode, indentation){ - if(xmlNode){ - console.log(indentation + "{") - console.log(indentation + " \"tagName\": \"" + xmlNode.tagname + "\", "); - if(xmlNode.parent){ - console.log(indentation + " \"parent\": \"" + xmlNode.parent.tagname + "\", "); - } - console.log(indentation + " \"val\": \"" + xmlNode.val + "\", "); - console.log(indentation + " \"attrs\": " + JSON.stringify(xmlNode.attrsMap,null,4) + ", "); +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - if(xmlNode.child){ - console.log(indentation + "\"child\": {") - const indentation2 = indentation + indentation; - Object.keys(xmlNode.child).forEach( function(key) { - const node = xmlNode.child[key]; +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - if(Array.isArray(node)){ - console.log(indentation + "\""+key+"\" :[") - node.forEach( function(item,index) { - //console.log(indentation + " \""+index+"\" : [") - print(item, indentation2); - }) - console.log(indentation + "],") - }else{ - console.log(indentation + " \""+key+"\" : {") - print(node, indentation2); - console.log(indentation + "},") - } - }); - console.log(indentation + "},") - } - console.log(indentation + "},") - } +function isUndefined(arg) { + return arg === void 0; } +exports.isUndefined = isUndefined; +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; -/***/ }), +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; -/***/ 8280: -/***/ ((__unused_webpack_module, exports) => { +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; -"use strict"; +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; -const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; -const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040'; -const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*' -const regexName = new RegExp('^' + nameRegexp + '$'); +exports.isBuffer = __nccwpck_require__(64293).Buffer.isBuffer; -const getAllMatches = function(string, regex) { - const matches = []; - let match = regex.exec(string); - while (match) { - const allmatches = []; - const len = match.length; - for (let index = 0; index < len; index++) { - allmatches.push(match[index]); - } - matches.push(allmatches); - match = regex.exec(string); - } - return matches; -}; +function objectToString(o) { + return Object.prototype.toString.call(o); +} -const isName = function(string) { - const match = regexName.exec(string); - return !(match === null || typeof match === 'undefined'); -}; -exports.isExist = function(v) { - return typeof v !== 'undefined'; -}; +/***/ }), -exports.isEmptyObject = function(obj) { - return Object.keys(obj).length === 0; -}; +/***/ 92371: +/***/ ((module) => { + +"use strict"; /** - * Copy all the properties of a into b. - * @param {*} target - * @param {*} a + * Returns a `Buffer` instance from the given data URI `uri`. + * + * @param {String} uri Data URI to turn into a Buffer instance + * @return {Buffer} Buffer instance from Data URI + * @api public */ -exports.merge = function(target, a, arrayMode) { - if (a) { - const keys = Object.keys(a); // will return an array of own properties - const len = keys.length; //don't make it inline - for (let i = 0; i < len; i++) { - if (arrayMode === 'strict') { - target[keys[i]] = [ a[keys[i]] ]; - } else { - target[keys[i]] = a[keys[i]]; - } +function dataUriToBuffer(uri) { + if (!/^data:/i.test(uri)) { + throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")'); + } + // strip newlines + uri = uri.replace(/\r?\n/g, ''); + // split the URI up into the "metadata" and the "data" portions + const firstComma = uri.indexOf(','); + if (firstComma === -1 || firstComma <= 4) { + throw new TypeError('malformed data: URI'); + } + // remove the "data:" scheme and parse the metadata + const meta = uri.substring(5, firstComma).split(';'); + let charset = ''; + let base64 = false; + const type = meta[0] || 'text/plain'; + let typeFull = type; + for (let i = 1; i < meta.length; i++) { + if (meta[i] === 'base64') { + base64 = true; + } + else { + typeFull += `;${meta[i]}`; + if (meta[i].indexOf('charset=') === 0) { + charset = meta[i].substring(8); + } + } } - } -}; -/* exports.merge =function (b,a){ - return Object.assign(b,a); -} */ + // defaults to US-ASCII only if type is not provided + if (!meta[0] && !charset.length) { + typeFull += ';charset=US-ASCII'; + charset = 'US-ASCII'; + } + // get the encoded data portion and decode URI-encoded chars + const encoding = base64 ? 'base64' : 'ascii'; + const data = unescape(uri.substring(firstComma + 1)); + const buffer = Buffer.from(data, encoding); + // set `.type` and `.typeFull` properties to MIME type + buffer.type = type; + buffer.typeFull = typeFull; + // set the `.charset` property + buffer.charset = charset; + return buffer; +} +module.exports = dataUriToBuffer; +//# sourceMappingURL=index.js.map -exports.getValue = function(v) { - if (exports.isExist(v)) { - return v; - } else { - return ''; - } -}; +/***/ }), -// const fakeCall = function(a) {return a;}; -// const fakeCallNoReturn = function() {}; +/***/ 28222: +/***/ ((module, exports, __nccwpck_require__) => { -exports.buildOptions = function(options, defaultOptions, props) { - var newOptions = {}; - if (!options) { - return defaultOptions; //if there are not options - } +/* eslint-env browser */ - for (let i = 0; i < props.length; i++) { - if (options[props[i]] !== undefined) { - newOptions[props[i]] = options[props[i]]; - } else { - newOptions[props[i]] = defaultOptions[props[i]]; - } - } - return newOptions; -}; +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); /** - * Check if a tag name should be treated as array + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. * - * @param tagName the node tagname - * @param arrayMode the array mode option - * @param parentTagName the parent tag name - * @returns {boolean} true if node should be parsed as array + * TODO: add a `localStorage` variable to explicitly enable/disable colors */ -exports.isTagNameInArrayMode = function (tagName, arrayMode, parentTagName) { - if (arrayMode === false) { - return false; - } else if (arrayMode instanceof RegExp) { - return arrayMode.test(tagName); - } else if (typeof arrayMode === 'function') { - return !!arrayMode(tagName, parentTagName); - } - return arrayMode === "strict"; +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } -exports.isName = isName; -exports.getAllMatches = getAllMatches; -exports.nameRegexp = nameRegexp; +/** + * Colorize log arguments if enabled. + * + * @api public + */ +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} -/***/ }), +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); -/***/ 1739: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} -"use strict"; +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ -const util = __nccwpck_require__(8280); +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} -const defaultOptions = { - allowBooleanAttributes: false, //A tag can have attributes without any value -}; +module.exports = __nccwpck_require__(46243)(exports); -const props = ['allowBooleanAttributes']; +const {formatters} = module.exports; -//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g"); -exports.validate = function (xmlData, options) { - options = util.buildOptions(options, defaultOptions, props); +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ - //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line - //xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag - //xmlData = xmlData.replace(/()/g,"");//Remove DOCTYPE - const tags = []; - let tagFound = false; +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; - //indicates that the root tag has been closed (aka. depth 0 has been reached) - let reachedRoot = false; - if (xmlData[0] === '\ufeff') { - // check for byte order mark (BOM) - xmlData = xmlData.substr(1); - } +/***/ }), - for (let i = 0; i < xmlData.length; i++) { +/***/ 46243: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (xmlData[i] === '<' && xmlData[i+1] === '?') { - i+=2; - i = readPI(xmlData,i); - if (i.err) return i; - }else if (xmlData[i] === '<') { - //starting of tag - //read until you reach to '>' avoiding any '>' in attribute value - i++; - - if (xmlData[i] === '!') { - i = readCommentAndCDATA(xmlData, i); - continue; - } else { - let closingTag = false; - if (xmlData[i] === '/') { - //closing tag - closingTag = true; - i++; - } - //read tagname - let tagName = ''; - for (; i < xmlData.length && - xmlData[i] !== '>' && - xmlData[i] !== ' ' && - xmlData[i] !== '\t' && - xmlData[i] !== '\n' && - xmlData[i] !== '\r'; i++ - ) { - tagName += xmlData[i]; - } - tagName = tagName.trim(); - //console.log(tagName); +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ - if (tagName[tagName.length - 1] === '/') { - //self closing tag without attributes - tagName = tagName.substring(0, tagName.length - 1); - //continue; - i--; - } - if (!validateTagName(tagName)) { - let msg; - if (tagName.trim().length === 0) { - msg = "There is an unnecessary space between tag name and backward slash ' { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} - const result = readAttributeStr(xmlData, i); - if (result === false) { - return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i)); - } - let attrStr = result.value; - i = result.index; +module.exports = setup; - if (attrStr[attrStr.length - 1] === '/') { - //self closing tag - attrStr = attrStr.substring(0, attrStr.length - 1); - const isValid = validateAttributeString(attrStr, options); - if (isValid === true) { - tagFound = true; - //continue; //text may presents after self closing tag - } else { - //the result from the nested function returns the position of the error within the attribute - //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute - //this gives us the absolute index in the entire xml, which we can use to find the line at last - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); - } - } else if (closingTag) { - if (!result.tagClosed) { - return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); - } else if (attrStr.trim().length > 0) { - return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, i)); - } else { - const otg = tags.pop(); - if (tagName !== otg) { - return getErrorObject('InvalidTag', "Closing tag '"+otg+"' is expected inplace of '"+tagName+"'.", getLineNumberForPosition(xmlData, i)); - } - //when there are no more tags, we reached the root level. - if (tags.length == 0) { - reachedRoot = true; - } - } - } else { - const isValid = validateAttributeString(attrStr, options); - if (isValid !== true) { - //the result from the nested function returns the position of the error within the attribute - //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute - //this gives us the absolute index in the entire xml, which we can use to find the line at last - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); - } +/***/ }), - //if the root level has been reached before ... - if (reachedRoot === true) { - return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i)); - } else { - tags.push(tagName); - } - tagFound = true; - } +/***/ 38237: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - //skip tag text value - //It may include comments and CDATA value - for (i++; i < xmlData.length; i++) { - if (xmlData[i] === '<') { - if (xmlData[i + 1] === '!') { - //comment or CADATA - i++; - i = readCommentAndCDATA(xmlData, i); - continue; - } else if (xmlData[i+1] === '?') { - i = readPI(xmlData, ++i); - if (i.err) return i; - } else{ - break; - } - } else if (xmlData[i] === '&') { - const afterAmp = validateAmpersand(xmlData, i); - if (afterAmp == -1) - return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); - i = afterAmp; - } - } //end of reading tag text value - if (xmlData[i] === '<') { - i--; - } - } - } else { - if (xmlData[i] === ' ' || xmlData[i] === '\t' || xmlData[i] === '\n' || xmlData[i] === '\r') { - continue; - } - return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i)); - } - } +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ - if (!tagFound) { - return getErrorObject('InvalidXml', 'Start tag expected.', 1); - } else if (tags.length > 0) { - return getErrorObject('InvalidXml', "Invalid '"+JSON.stringify(tags, null, 4).replace(/\r?\n/g, '')+"' found.", 1); - } +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __nccwpck_require__(28222); +} else { + module.exports = __nccwpck_require__(35332); +} - return true; -}; + +/***/ }), + +/***/ 35332: +/***/ ((module, exports, __nccwpck_require__) => { /** - * Read Processing insstructions and skip - * @param {*} xmlData - * @param {*} i + * Module dependencies. */ -function readPI(xmlData, i) { - var start = i; - for (; i < xmlData.length; i++) { - if (xmlData[i] == '?' || xmlData[i] == ' ') { - //tagname - var tagname = xmlData.substr(start, i - start); - if (i > 5 && tagname === 'xml') { - return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i)); - } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') { - //check if valid attribut string - i++; - break; - } else { - continue; - } - } - } - return i; -} -function readCommentAndCDATA(xmlData, i) { - if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') { - //comment - for (i += 3; i < xmlData.length; i++) { - if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') { - i += 2; - break; - } - } - } else if ( - xmlData.length > i + 8 && - xmlData[i + 1] === 'D' && - xmlData[i + 2] === 'O' && - xmlData[i + 3] === 'C' && - xmlData[i + 4] === 'T' && - xmlData[i + 5] === 'Y' && - xmlData[i + 6] === 'P' && - xmlData[i + 7] === 'E' - ) { - let angleBracketsCount = 1; - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === '<') { - angleBracketsCount++; - } else if (xmlData[i] === '>') { - angleBracketsCount--; - if (angleBracketsCount === 0) { - break; - } - } - } - } else if ( - xmlData.length > i + 9 && - xmlData[i + 1] === '[' && - xmlData[i + 2] === 'C' && - xmlData[i + 3] === 'D' && - xmlData[i + 4] === 'A' && - xmlData[i + 5] === 'T' && - xmlData[i + 6] === 'A' && - xmlData[i + 7] === '[' - ) { - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') { - i += 2; - break; - } - } - } +const tty = __nccwpck_require__(33867); +const util = __nccwpck_require__(31669); - return i; -} +/** + * This is the Node.js implementation of `debug()`. + */ -var doubleQuote = '"'; -var singleQuote = "'"; +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); /** - * Keep reading xmlData until '<' is found outside the attribute value. - * @param {string} xmlData - * @param {number} i + * Colors. */ -function readAttributeStr(xmlData, i) { - let attrStr = ''; - let startChar = ''; - let tagClosed = false; - for (; i < xmlData.length; i++) { - if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { - if (startChar === '') { - startChar = xmlData[i]; - } else if (startChar !== xmlData[i]) { - //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa - continue; - } else { - startChar = ''; - } - } else if (xmlData[i] === '>') { - if (startChar === '') { - tagClosed = true; - break; - } - } - attrStr += xmlData[i]; - } - if (startChar !== '') { - return false; - } - return { - value: attrStr, - index: i, - tagClosed: tagClosed - }; +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __nccwpck_require__(59318); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. } /** - * Select all the attributes whether valid or invalid. + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js */ -const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g'); -//attr, ="sd", a="amit's", a="sd"b="saf", ab cd="" +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); -function validateAttributeString(attrStr, options) { - //console.log("start:"+attrStr+":end"); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ - //if(attrStr.trim().length === 0) return true; //empty string +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} - const matches = util.getAllMatches(attrStr, validAttrStrRegxp); - const attrNames = {}; +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ - for (let i = 0; i < matches.length; i++) { - if (matches[i][1].length === 0) { - //nospace before attribute name: a="sd"b="saf" - return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(attrStr, matches[i][0])) - } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) { - //independent attribute: ab - return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(attrStr, matches[i][0])); - } - /* else if(matches[i][6] === undefined){//attribute without value: ab= - return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}}; - } */ - const attrName = matches[i][2]; - if (!validateAttrName(attrName)) { - return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(attrStr, matches[i][0])); - } - if (!attrNames.hasOwnProperty(attrName)) { - //check for duplicate attribute. - attrNames[attrName] = 1; - } else { - return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(attrStr, matches[i][0])); - } - } +function formatArgs(args) { + const {namespace: name, useColors} = this; - return true; -} + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; -function validateNumberAmpersand(xmlData, i) { - let re = /\d/; - if (xmlData[i] === 'x') { - i++; - re = /[\da-fA-F]/; - } - for (; i < xmlData.length; i++) { - if (xmlData[i] === ';') - return i; - if (!xmlData[i].match(re)) - break; - } - return -1; + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } } -function validateAmpersand(xmlData, i) { - // https://www.w3.org/TR/xml/#dt-charref - i++; - if (xmlData[i] === ';') - return -1; - if (xmlData[i] === '#') { - i++; - return validateNumberAmpersand(xmlData, i); - } - let count = 0; - for (; i < xmlData.length; i++, count++) { - if (xmlData[i].match(/\w/) && count < 20) - continue; - if (xmlData[i] === ';') - break; - return -1; - } - return i; +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; } -function getErrorObject(code, message, lineNumber) { - return { - err: { - code: code, - msg: message, - line: lineNumber, - }, - }; +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); } -function validateAttrName(attrName) { - return util.isName(attrName); +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } } -// const startsWithXML = /^xml/i; +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ -function validateTagName(tagname) { - return util.isName(tagname) /* && !tagname.match(startsWithXML) */; +function load() { + return process.env.DEBUG; } -//this function returns the line number for the character at the given index -function getLineNumberForPosition(xmlData, index) { - var lines = xmlData.substring(0, index).split(/\r?\n/); - return lines.length; -} +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ -//this function returns the position of the last character of match within attrStr -function getPositionFromMatch(attrStr, match) { - return attrStr.indexOf(match) + match.length; +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } } +module.exports = __nccwpck_require__(46243)(exports); -/***/ }), +const {formatters} = module.exports; -/***/ 9539: -/***/ ((module) => { +/** + * Map %o to `util.inspect()`, all on a single line. + */ -"use strict"; +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ -module.exports = function(tagname, parent, val) { - this.tagname = tagname; - this.parent = parent; - this.child = {}; //child tags - this.attrsMap = {}; //attributes map - this.val = val; //text only - this.addChild = function(child) { - if (Array.isArray(this.child[child.tagname])) { - //already presents - this.child[child.tagname].push(child); - } else { - this.child[child.tagname] = [child]; - } - }; +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); }; /***/ }), -/***/ 6712: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 64033: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const util_1 = __nccwpck_require__(31669); +const escodegen_1 = __nccwpck_require__(7991); +const esprima_1 = __nccwpck_require__(78823); +const ast_types_1 = __nccwpck_require__(27012); +const vm2_1 = __nccwpck_require__(69440); +/** + * Compiles sync JavaScript code into JavaScript with async Functions. + * + * @param {String} code JavaScript string to convert + * @param {Array} names Array of function names to add `await` operators to + * @return {String} Converted JavaScript string with async/await injected + * @api public + */ +function degenerator(code, _names) { + if (!Array.isArray(_names)) { + throw new TypeError('an array of async function "names" is required'); + } + // Duplicate the `names` array since it's rude to augment the user args + const names = _names.slice(0); + const ast = esprima_1.parseScript(code); + // First pass is to find the `function` nodes and turn them into async or + // generator functions only if their body includes `CallExpressions` to + // function in `names`. We also add the names of the functions to the `names` + // array. We'll iterate several time, as every iteration might add new items + // to the `names` array, until no new names were added in the iteration. + let lastNamesLength = 0; + do { + lastNamesLength = names.length; + ast_types_1.visit(ast, { + visitVariableDeclaration(path) { + if (path.node.declarations) { + for (let i = 0; i < path.node.declarations.length; i++) { + const declaration = path.node.declarations[i]; + if (ast_types_1.namedTypes.VariableDeclarator.check(declaration) && + ast_types_1.namedTypes.Identifier.check(declaration.init) && + ast_types_1.namedTypes.Identifier.check(declaration.id) && + checkName(declaration.init.name, names) && + !checkName(declaration.id.name, names)) { + names.push(declaration.id.name); + } + } + } + return false; + }, + visitAssignmentExpression(path) { + if (ast_types_1.namedTypes.Identifier.check(path.node.left) && + ast_types_1.namedTypes.Identifier.check(path.node.right) && + checkName(path.node.right.name, names) && + !checkName(path.node.left.name, names)) { + names.push(path.node.left.name); + } + return false; + }, + visitFunction(path) { + if (path.node.id) { + let shouldDegenerate = false; + ast_types_1.visit(path.node, { + visitCallExpression(path) { + if (checkNames(path.node, names)) { + shouldDegenerate = true; + } + return false; + }, + }); + if (!shouldDegenerate) { + return false; + } + // Got a "function" expression/statement, + // convert it into an async function + path.node.async = true; + // Add function name to `names` array + if (!checkName(path.node.id.name, names)) { + names.push(path.node.id.name); + } + } + this.traverse(path); + }, + }); + } while (lastNamesLength !== names.length); + // Second pass is for adding `await`/`yield` statements to any function + // invocations that match the given `names` array. + ast_types_1.visit(ast, { + visitCallExpression(path) { + if (checkNames(path.node, names)) { + // A "function invocation" expression, + // we need to inject a `AwaitExpression`/`YieldExpression` + const delegate = false; + const { name, parent: { node: pNode }, } = path; + const expr = ast_types_1.builders.awaitExpression(path.node, delegate); + if (ast_types_1.namedTypes.CallExpression.check(pNode)) { + pNode.arguments[name] = expr; + } + else { + pNode[name] = expr; + } + } + this.traverse(path); + }, + }); + return escodegen_1.generate(ast); +} +(function (degenerator) { + function compile(code, returnName, names, options = {}) { + const compiled = degenerator(code, names); + const vm = new vm2_1.VM(options); + const script = new vm2_1.VMScript(`${compiled};${returnName}`, { + filename: options.filename, + }); + const fn = vm.run(script); + if (typeof fn !== 'function') { + throw new Error(`Expected a "function" to be returned for \`${returnName}\`, but got "${typeof fn}"`); + } + const r = function (...args) { + var _a; + try { + const p = fn.apply(this, args); + if (typeof ((_a = p) === null || _a === void 0 ? void 0 : _a.then) === 'function') { + return p; + } + return Promise.resolve(p); + } + catch (err) { + return Promise.reject(err); + } + }; + Object.defineProperty(r, 'toString', { + value: fn.toString.bind(fn), + enumerable: false, + }); + return r; + } + degenerator.compile = compile; +})(degenerator || (degenerator = {})); +/** + * Returns `true` if `node` has a matching name to one of the entries in the + * `names` array. + * + * @param {types.Node} node + * @param {Array} names Array of function names to return true for + * @return {Boolean} + * @api private + */ +function checkNames({ callee }, names) { + let name; + if (ast_types_1.namedTypes.Identifier.check(callee)) { + name = callee.name; + } + else if (ast_types_1.namedTypes.MemberExpression.check(callee)) { + if (ast_types_1.namedTypes.Identifier.check(callee.object) && + ast_types_1.namedTypes.Identifier.check(callee.property)) { + name = `${callee.object.name}.${callee.property.name}`; + } + else { + return false; + } + } + else if (ast_types_1.namedTypes.FunctionExpression.check(callee)) { + if (callee.id) { + name = callee.id.name; + } + else { + return false; + } + } + else { + throw new Error(`Don't know how to get name for: ${callee.type}`); + } + return checkName(name, names); +} +function checkName(name, names) { + // now that we have the `name`, check if any entries match in the `names` array + for (let i = 0; i < names.length; i++) { + const n = names[i]; + if (util_1.isRegExp(n)) { + if (n.test(name)) { + return true; + } + } + else if (name === n) { + return true; + } + } + return false; +} +module.exports = degenerator; +//# sourceMappingURL=index.js.map -const util = __nccwpck_require__(8280); -const buildOptions = __nccwpck_require__(8280).buildOptions; -const xmlNode = __nccwpck_require__(9539); -const regx = - '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)' - .replace(/NAME/g, util.nameRegexp); - -//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g"); -//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g"); +/***/ }), -//polyfill -if (!Number.parseInt && window.parseInt) { - Number.parseInt = window.parseInt; +/***/ 18883: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/*! + * depd + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var callSiteToString = __nccwpck_require__(69829).callSiteToString +var eventListenerCount = __nccwpck_require__(69829).eventListenerCount +var relative = __nccwpck_require__(85622).relative + +/** + * Module exports. + */ + +module.exports = depd + +/** + * Get the path to base files on. + */ + +var basePath = process.cwd() + +/** + * Determine if namespace is contained in the string. + */ + +function containsNamespace (str, namespace) { + var vals = str.split(/[ ,]+/) + var ns = String(namespace).toLowerCase() + + for (var i = 0; i < vals.length; i++) { + var val = vals[i] + + // namespace contained + if (val && (val === '*' || val.toLowerCase() === ns)) { + return true + } + } + + return false } -if (!Number.parseFloat && window.parseFloat) { - Number.parseFloat = window.parseFloat; + +/** + * Convert a data descriptor to accessor descriptor. + */ + +function convertDataDescriptorToAccessor (obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + var value = descriptor.value + + descriptor.get = function getter () { return value } + + if (descriptor.writable) { + descriptor.set = function setter (val) { return (value = val) } + } + + delete descriptor.value + delete descriptor.writable + + Object.defineProperty(obj, prop, descriptor) + + return descriptor } -const defaultOptions = { - attributeNamePrefix: '@_', - attrNodeName: false, - textNodeName: '#text', - ignoreAttributes: true, - ignoreNameSpace: false, - allowBooleanAttributes: false, //a tag can have attributes without any value - //ignoreRootElement : false, - parseNodeValue: true, - parseAttributeValue: false, - arrayMode: false, - trimValues: true, //Trim string values of tag and attributes - cdataTagName: false, - cdataPositionChar: '\\c', - tagValueProcessor: function(a, tagName) { - return a; - }, - attrValueProcessor: function(a, attrName) { - return a; - }, - stopNodes: [] - //decodeStrict: false, -}; +/** + * Create arguments string to keep arity. + */ -exports.defaultOptions = defaultOptions; +function createArgumentsString (arity) { + var str = '' -const props = [ - 'attributeNamePrefix', - 'attrNodeName', - 'textNodeName', - 'ignoreAttributes', - 'ignoreNameSpace', - 'allowBooleanAttributes', - 'parseNodeValue', - 'parseAttributeValue', - 'arrayMode', - 'trimValues', - 'cdataTagName', - 'cdataPositionChar', - 'tagValueProcessor', - 'attrValueProcessor', - 'parseTrueNumberOnly', - 'stopNodes' -]; -exports.props = props; + for (var i = 0; i < arity; i++) { + str += ', arg' + i + } + + return str.substr(2) +} /** - * Trim -> valueProcessor -> parse value - * @param {string} tagName - * @param {string} val - * @param {object} options + * Create stack string from stack. */ -function processTagValue(tagName, val, options) { - if (val) { - if (options.trimValues) { - val = val.trim(); - } - val = options.tagValueProcessor(val, tagName); - val = parseValue(val, options.parseNodeValue, options.parseTrueNumberOnly); + +function createStackString (stack) { + var str = this.name + ': ' + this.namespace + + if (this.message) { + str += ' deprecated ' + this.message } - return val; + for (var i = 0; i < stack.length; i++) { + str += '\n at ' + callSiteToString(stack[i]) + } + + return str } -function resolveNameSpace(tagname, options) { - if (options.ignoreNameSpace) { - const tags = tagname.split(':'); - const prefix = tagname.charAt(0) === '/' ? '/' : ''; - if (tags[0] === 'xmlns') { - return ''; - } - if (tags.length === 2) { - tagname = prefix + tags[1]; - } +/** + * Create deprecate for namespace in caller. + */ + +function depd (namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') } - return tagname; + + var stack = getStack() + var site = callSiteLocation(stack[1]) + var file = site[0] + + function deprecate (message) { + // call to self as log + log.call(deprecate, message) + } + + deprecate._file = file + deprecate._ignored = isignored(namespace) + deprecate._namespace = namespace + deprecate._traced = istraced(namespace) + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate } -function parseValue(val, shouldParse, parseTrueNumberOnly) { - if (shouldParse && typeof val === 'string') { - let parsed; - if (val.trim() === '' || isNaN(val)) { - parsed = val === 'true' ? true : val === 'false' ? false : val; - } else { - if (val.indexOf('0x') !== -1) { - //support hexa decimal - parsed = Number.parseInt(val, 16); - } else if (val.indexOf('.') !== -1) { - parsed = Number.parseFloat(val); - val = val.replace(/\.?0+$/, ""); - } else { - parsed = Number.parseInt(val, 10); - } - if (parseTrueNumberOnly) { - parsed = String(parsed) === val ? parsed : val; - } - } - return parsed; - } else { - if (util.isExist(val)) { - return val; - } else { - return ''; - } +/** + * Determine if namespace is ignored. + */ + +function isignored (namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.noDeprecation) { + // --no-deprecation support + return true } + + var str = process.env.NO_DEPRECATION || '' + + // namespace ignored + return containsNamespace(str, namespace) } -//TODO: change regex to capture NS -//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm"); -const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])(.*?)\\3)?', 'g'); +/** + * Determine if namespace is traced. + */ -function buildAttributesMap(attrStr, options) { - if (!options.ignoreAttributes && typeof attrStr === 'string') { - attrStr = attrStr.replace(/\r?\n/g, ' '); - //attrStr = attrStr || attrStr.trim(); +function istraced (namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.traceDeprecation) { + // --trace-deprecation support + return true + } - const matches = util.getAllMatches(attrStr, attrsRegx); - const len = matches.length; //don't make it inline - const attrs = {}; - for (let i = 0; i < len; i++) { - const attrName = resolveNameSpace(matches[i][1], options); - if (attrName.length) { - if (matches[i][4] !== undefined) { - if (options.trimValues) { - matches[i][4] = matches[i][4].trim(); - } - matches[i][4] = options.attrValueProcessor(matches[i][4], attrName); - attrs[options.attributeNamePrefix + attrName] = parseValue( - matches[i][4], - options.parseAttributeValue, - options.parseTrueNumberOnly - ); - } else if (options.allowBooleanAttributes) { - attrs[options.attributeNamePrefix + attrName] = true; - } - } - } - if (!Object.keys(attrs).length) { - return; - } - if (options.attrNodeName) { - const attrCollection = {}; - attrCollection[options.attrNodeName] = attrs; - return attrCollection; + var str = process.env.TRACE_DEPRECATION || '' + + // namespace traced + return containsNamespace(str, namespace) +} + +/** + * Display deprecation message. + */ + +function log (message, site) { + var haslisteners = eventListenerCount(process, 'deprecation') !== 0 + + // abort early if no destination + if (!haslisteners && this._ignored) { + return + } + + var caller + var callFile + var callSite + var depSite + var i = 0 + var seen = false + var stack = getStack() + var file = this._file + + if (site) { + // provided site + depSite = site + callSite = callSiteLocation(stack[1]) + callSite.name = depSite.name + file = callSite[0] + } else { + // get call site + i = 2 + depSite = callSiteLocation(stack[i]) + callSite = depSite + } + + // get caller of deprecated thing in relation to file + for (; i < stack.length; i++) { + caller = callSiteLocation(stack[i]) + callFile = caller[0] + + if (callFile === file) { + seen = true + } else if (callFile === this._file) { + file = this._file + } else if (seen) { + break } - return attrs; } + + var key = caller + ? depSite.join(':') + '__' + caller.join(':') + : undefined + + if (key !== undefined && key in this._warned) { + // already warned + return + } + + this._warned[key] = true + + // generate automatic message from call site + var msg = message + if (!msg) { + msg = callSite === depSite || !callSite.name + ? defaultMessage(depSite) + : defaultMessage(callSite) + } + + // emit deprecation if listeners exist + if (haslisteners) { + var err = DeprecationError(this._namespace, msg, stack.slice(i)) + process.emit('deprecation', err) + return + } + + // format and write message + var format = process.stderr.isTTY + ? formatColor + : formatPlain + var output = format.call(this, msg, caller, stack.slice(i)) + process.stderr.write(output + '\n', 'utf8') } -const getTraversalObj = function(xmlData, options) { - xmlData = xmlData.replace(/\r\n?/g, "\n"); - options = buildOptions(options, defaultOptions, props); - const xmlObj = new xmlNode('!xml'); - let currentNode = xmlObj; - let textData = ""; +/** + * Get call site location as array. + */ -//function match(xmlData){ - for(let i=0; i< xmlData.length; i++){ - const ch = xmlData[i]; - if(ch === '<'){ - if( xmlData[i+1] === '/') {//Closing Tag - const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.") - let tagName = xmlData.substring(i+2,closeIndex).trim(); +function callSiteLocation (callSite) { + var file = callSite.getFileName() || '' + var line = callSite.getLineNumber() + var colm = callSite.getColumnNumber() - if(options.ignoreNameSpace){ - const colonIndex = tagName.indexOf(":"); - if(colonIndex !== -1){ - tagName = tagName.substr(colonIndex+1); - } - } + if (callSite.isEval()) { + file = callSite.getEvalOrigin() + ', ' + file + } - /* if (currentNode.parent) { - currentNode.parent.val = util.getValue(currentNode.parent.val) + '' + processTagValue2(tagName, textData , options); - } */ - if(currentNode){ - if(currentNode.val){ - currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(tagName, textData , options); - }else{ - currentNode.val = processTagValue(tagName, textData , options); - } - } + var site = [file, line, colm] - if (options.stopNodes.length && options.stopNodes.includes(currentNode.tagname)) { - currentNode.child = [] - if (currentNode.attrsMap == undefined) { currentNode.attrsMap = {}} - currentNode.val = xmlData.substr(currentNode.startIndex + 1, i - currentNode.startIndex - 1) - } - currentNode = currentNode.parent; - textData = ""; - i = closeIndex; - } else if( xmlData[i+1] === '?') { - i = findClosingIndex(xmlData, "?>", i, "Pi Tag is not closed.") - } else if(xmlData.substr(i + 1, 3) === '!--') { - i = findClosingIndex(xmlData, "-->", i, "Comment is not closed.") - } else if( xmlData.substr(i + 1, 2) === '!D') { - const closeIndex = findClosingIndex(xmlData, ">", i, "DOCTYPE is not closed.") - const tagExp = xmlData.substring(i, closeIndex); - if(tagExp.indexOf("[") >= 0){ - i = xmlData.indexOf("]>", i) + 1; - }else{ - i = closeIndex; - } - }else if(xmlData.substr(i + 1, 2) === '![') { - const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2 - const tagExp = xmlData.substring(i + 9,closeIndex); + site.callSite = callSite + site.name = callSite.getFunctionName() - //considerations - //1. CDATA will always have parent node - //2. A tag with CDATA is not a leaf node so it's value would be string type. - if(textData){ - currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(currentNode.tagname, textData , options); - textData = ""; - } + return site +} - if (options.cdataTagName) { - //add cdata node - const childNode = new xmlNode(options.cdataTagName, currentNode, tagExp); - currentNode.addChild(childNode); - //for backtracking - currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar; - //add rest value to parent node - if (tagExp) { - childNode.val = tagExp; - } - } else { - currentNode.val = (currentNode.val || '') + (tagExp || ''); - } +/** + * Generate a default message from the site. + */ - i = closeIndex + 2; - }else {//Opening tag - const result = closingIndexForOpeningTag(xmlData, i+1) - let tagExp = result.data; - const closeIndex = result.index; - const separatorIndex = tagExp.indexOf(" "); - let tagName = tagExp; - let shouldBuildAttributesMap = true; - if(separatorIndex !== -1){ - tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ''); - tagExp = tagExp.substr(separatorIndex + 1); - } +function defaultMessage (site) { + var callSite = site.callSite + var funcName = site.name - if(options.ignoreNameSpace){ - const colonIndex = tagName.indexOf(":"); - if(colonIndex !== -1){ - tagName = tagName.substr(colonIndex+1); - shouldBuildAttributesMap = tagName !== result.data.substr(colonIndex + 1); - } - } + // make useful anonymous name + if (!funcName) { + funcName = '' + } - //save text to parent node - if (currentNode && textData) { - if(currentNode.tagname !== '!xml'){ - currentNode.val = util.getValue(currentNode.val) + '' + processTagValue( currentNode.tagname, textData, options); - } - } + var context = callSite.getThis() + var typeName = context && callSite.getTypeName() - if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){//selfClosing tag + // ignore useless type name + if (typeName === 'Object') { + typeName = undefined + } - if(tagName[tagName.length - 1] === "/"){ //remove trailing '/' - tagName = tagName.substr(0, tagName.length - 1); - tagExp = tagName; - }else{ - tagExp = tagExp.substr(0, tagExp.length - 1); - } + // make useful type name + if (typeName === 'Function') { + typeName = context.name || typeName + } - const childNode = new xmlNode(tagName, currentNode, ''); - if(tagName !== tagExp){ - childNode.attrsMap = buildAttributesMap(tagExp, options); - } - currentNode.addChild(childNode); - }else{//opening tag + return typeName && callSite.getMethodName() + ? typeName + '.' + funcName + : funcName +} - const childNode = new xmlNode( tagName, currentNode ); - if (options.stopNodes.length && options.stopNodes.includes(childNode.tagname)) { - childNode.startIndex=closeIndex; - } - if(tagName !== tagExp && shouldBuildAttributesMap){ - childNode.attrsMap = buildAttributesMap(tagExp, options); - } - currentNode.addChild(childNode); - currentNode = childNode; - } - textData = ""; - i = closeIndex; - } - }else{ - textData += xmlData[i]; +/** + * Format deprecation message without color. + */ + +function formatPlain (msg, caller, stack) { + var timestamp = new Date().toUTCString() + + var formatted = timestamp + + ' ' + this._namespace + + ' deprecated ' + msg + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n at ' + callSiteToString(stack[i]) } + + return formatted } - return xmlObj; + + if (caller) { + formatted += ' at ' + formatLocation(caller) + } + + return formatted } -function closingIndexForOpeningTag(data, i){ - let attrBoundary; - let tagExp = ""; - for (let index = i; index < data.length; index++) { - let ch = data[index]; - if (attrBoundary) { - if (ch === attrBoundary) attrBoundary = "";//reset - } else if (ch === '"' || ch === "'") { - attrBoundary = ch; - } else if (ch === '>') { - return { - data: tagExp, - index: index - } - } else if (ch === '\t') { - ch = " " +/** + * Format deprecation message with color. + */ + +function formatColor (msg, caller, stack) { + var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan + ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow + ' \x1b[0m' + msg + '\x1b[39m' // reset + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan } - tagExp += ch; + + return formatted + } + + if (caller) { + formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan } + + return formatted } -function findClosingIndex(xmlData, str, i, errMsg){ - const closingIndex = xmlData.indexOf(str, i); - if(closingIndex === -1){ - throw new Error(errMsg) - }else{ - return closingIndex + str.length - 1; +/** + * Format call site location. + */ + +function formatLocation (callSite) { + return relative(basePath, callSite[0]) + + ':' + callSite[1] + + ':' + callSite[2] +} + +/** + * Get the stack as array of call sites. + */ + +function getStack () { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = Math.max(10, limit) + + // capture the stack + Error.captureStackTrace(obj) + + // slice this function off the top + var stack = obj.stack.slice(1) + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack +} + +/** + * Capture call site stack from v8. + */ + +function prepareObjectStackTrace (obj, stack) { + return stack +} + +/** + * Return a wrapped function in a deprecation message. + */ + +function wrapfunction (fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') } + + var args = createArgumentsString(fn.length) + var deprecate = this // eslint-disable-line no-unused-vars + var stack = getStack() + var site = callSiteLocation(stack[1]) + + site.name = fn.name + + // eslint-disable-next-line no-eval + var deprecatedfn = eval('(function (' + args + ') {\n' + + '"use strict"\n' + + 'log.call(deprecate, message, site)\n' + + 'return fn.apply(this, arguments)\n' + + '})') + + return deprecatedfn } -exports.getTraversalObj = getTraversalObj; +/** + * Wrap property in a deprecation message. + */ +function wrapproperty (obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } -/***/ }), + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) -/***/ 4351: -/***/ ((module) => { + if (!descriptor) { + throw new TypeError('must call property on owner object') + } -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + // set site name + site.name = prop + + // convert data descriptor + if ('value' in descriptor) { + descriptor = convertDataDescriptorToAccessor(obj, prop, message) + } + + var get = descriptor.get + var set = descriptor.set + + // wrap getter + if (typeof get === 'function') { + descriptor.get = function getter () { + log.call(deprecate, message, site) + return get.apply(this, arguments) + } + } + + // wrap setter + if (typeof set === 'function') { + descriptor.set = function setter () { + log.call(deprecate, message, site) + return set.apply(this, arguments) + } + } + + Object.defineProperty(obj, prop, descriptor) +} + +/** + * Create DeprecationError for deprecation + */ + +function DeprecationError (namespace, message, stack) { + var error = new Error() + var stackString + + Object.defineProperty(error, 'constructor', { + value: DeprecationError + }) + + Object.defineProperty(error, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }) + + Object.defineProperty(error, 'name', { + enumerable: false, + configurable: true, + value: 'DeprecationError', + writable: true + }) + + Object.defineProperty(error, 'namespace', { + configurable: true, + enumerable: false, + value: namespace, + writable: true + }) + + Object.defineProperty(error, 'stack', { + configurable: true, + enumerable: false, + get: function () { + if (stackString !== undefined) { + return stackString + } + + // prepare stack trace + return (stackString = createStackString.call(this, stack)) + }, + set: function setter (val) { + stackString = val + } + }) + + return error +} + + +/***/ }), + +/***/ 35554: +/***/ ((module) => { + +"use strict"; +/*! + * depd + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + */ + +module.exports = callSiteToString + +/** + * Format a CallSite file location to a string. + */ + +function callSiteFileLocation (callSite) { + var fileName + var fileLocation = '' + + if (callSite.isNative()) { + fileLocation = 'native' + } else if (callSite.isEval()) { + fileName = callSite.getScriptNameOrSourceURL() + if (!fileName) { + fileLocation = callSite.getEvalOrigin() + } + } else { + fileName = callSite.getFileName() + } + + if (fileName) { + fileLocation += fileName + + var lineNumber = callSite.getLineNumber() + if (lineNumber != null) { + fileLocation += ':' + lineNumber + + var columnNumber = callSite.getColumnNumber() + if (columnNumber) { + fileLocation += ':' + columnNumber + } + } + } + + return fileLocation || 'unknown source' +} + +/** + * Format a CallSite to a string. + */ + +function callSiteToString (callSite) { + var addSuffix = true + var fileLocation = callSiteFileLocation(callSite) + var functionName = callSite.getFunctionName() + var isConstructor = callSite.isConstructor() + var isMethodCall = !(callSite.isToplevel() || isConstructor) + var line = '' + + if (isMethodCall) { + var methodName = callSite.getMethodName() + var typeName = getConstructorName(callSite) + + if (functionName) { + if (typeName && functionName.indexOf(typeName) !== 0) { + line += typeName + '.' + } + + line += functionName + + if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) { + line += ' [as ' + methodName + ']' + } + } else { + line += typeName + '.' + (methodName || '') + } + } else if (isConstructor) { + line += 'new ' + (functionName || '') + } else if (functionName) { + line += functionName + } else { + addSuffix = false + line += fileLocation + } + + if (addSuffix) { + line += ' (' + fileLocation + ')' + } + + return line +} + +/** + * Get constructor name of reviver. + */ + +function getConstructorName (obj) { + var receiver = obj.receiver + return (receiver.constructor && receiver.constructor.name) || null +} + + +/***/ }), + +/***/ 12078: +/***/ ((module) => { + +"use strict"; +/*! + * depd + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = eventListenerCount + +/** + * Get the count of listeners on an event emitter of a specific type. + */ + +function eventListenerCount (emitter, type) { + return emitter.listeners(type).length +} + + +/***/ }), + +/***/ 69829: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * depd + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var EventEmitter = __nccwpck_require__(28614).EventEmitter + +/** + * Module exports. + * @public + */ + +lazyProperty(module.exports, 'callSiteToString', function callSiteToString () { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + function prepareObjectStackTrace (obj, stack) { + return stack + } + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = 2 + + // capture the stack + Error.captureStackTrace(obj) + + // slice the stack + var stack = obj.stack.slice() + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack[0].toString ? toString : __nccwpck_require__(35554) +}) + +lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount () { + return EventEmitter.listenerCount || __nccwpck_require__(12078) +}) + +/** + * Define a lazy property. + */ + +function lazyProperty (obj, prop, getter) { + function get () { + var val = getter() + + Object.defineProperty(obj, prop, { + configurable: true, + enumerable: true, + value: val + }) + + return val + } + + Object.defineProperty(obj, prop, { + configurable: true, + enumerable: true, + get: get + }) +} + +/** + * Call toString() on the obj + */ + +function toString (obj) { + return obj.toString() +} + + +/***/ }), + +/***/ 85107: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0; +var entities_json_1 = __importDefault(__nccwpck_require__(84007)); +var legacy_json_1 = __importDefault(__nccwpck_require__(17802)); +var xml_json_1 = __importDefault(__nccwpck_require__(2228)); +var decode_codepoint_1 = __importDefault(__nccwpck_require__(31227)); +var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; +exports.decodeXML = getStrictDecoder(xml_json_1.default); +exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); +function getStrictDecoder(map) { + var replace = getReplacer(map); + return function (str) { return String(str).replace(strictEntityRe, replace); }; +} +var sorter = function (a, b) { return (a < b ? 1 : -1); }; +exports.decodeHTML = (function () { + var legacy = Object.keys(legacy_json_1.default).sort(sorter); + var keys = Object.keys(entities_json_1.default).sort(sorter); + for (var i = 0, j = 0; i < keys.length; i++) { + if (legacy[j] === keys[i]) { + keys[i] += ";?"; + j++; + } + else { + keys[i] += ";"; + } + } + var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); + var replace = getReplacer(entities_json_1.default); + function replacer(str) { + if (str.substr(-1) !== ";") + str += ";"; + return replace(str); + } + // TODO consider creating a merged map + return function (str) { return String(str).replace(re, replacer); }; +})(); +function getReplacer(map) { + return function replace(str) { + if (str.charAt(1) === "#") { + var secondChar = str.charAt(2); + if (secondChar === "X" || secondChar === "x") { + return decode_codepoint_1.default(parseInt(str.substr(3), 16)); + } + return decode_codepoint_1.default(parseInt(str.substr(2), 10)); + } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + return map[str.slice(1, -1)] || str; + }; +} + + +/***/ }), + +/***/ 31227: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var decode_json_1 = __importDefault(__nccwpck_require__(14589)); +// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 +var fromCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.fromCodePoint || + function (codePoint) { + var output = ""; + if (codePoint > 0xffff) { + codePoint -= 0x10000; + output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); + codePoint = 0xdc00 | (codePoint & 0x3ff); + } + output += String.fromCharCode(codePoint); + return output; + }; +function decodeCodePoint(codePoint) { + if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { + return "\uFFFD"; + } + if (codePoint in decode_json_1.default) { + codePoint = decode_json_1.default[codePoint]; + } + return fromCodePoint(codePoint); +} +exports.default = decodeCodePoint; + + +/***/ }), + +/***/ 2006: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0; +var xml_json_1 = __importDefault(__nccwpck_require__(2228)); +var inverseXML = getInverseObj(xml_json_1.default); +var xmlReplacer = getInverseReplacer(inverseXML); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using XML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeXML = getASCIIEncoder(inverseXML); +var entities_json_1 = __importDefault(__nccwpck_require__(84007)); +var inverseHTML = getInverseObj(entities_json_1.default); +var htmlReplacer = getInverseReplacer(inverseHTML); +/** + * Encodes all entities and non-ASCII characters in the input. + * + * This includes characters that are valid ASCII characters in HTML documents. + * For example `#` will be encoded as `#`. To get a more compact output, + * consider using the `encodeNonAsciiHTML` function. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeHTML = getInverse(inverseHTML, htmlReplacer); +/** + * Encodes all non-ASCII characters, as well as characters not valid in HTML + * documents using HTML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); +function getInverseObj(obj) { + return Object.keys(obj) + .sort() + .reduce(function (inverse, name) { + inverse[obj[name]] = "&" + name + ";"; + return inverse; + }, {}); +} +function getInverseReplacer(inverse) { + var single = []; + var multiple = []; + for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { + var k = _a[_i]; + if (k.length === 1) { + // Add value to single array + single.push("\\" + k); + } + else { + // Add value to multiple array + multiple.push(k); + } + } + // Add ranges to single characters. + single.sort(); + for (var start = 0; start < single.length - 1; start++) { + // Find the end of a run of characters + var end = start; + while (end < single.length - 1 && + single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { + end += 1; + } + var count = 1 + end - start; + // We want to replace at least three characters + if (count < 3) + continue; + single.splice(start, count, single[start] + "-" + single[end]); + } + multiple.unshift("[" + single.join("") + "]"); + return new RegExp(multiple.join("|"), "g"); +} +// /[^\0-\x7F]/gu +var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; +var getCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.prototype.codePointAt != null + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + function (str) { return str.codePointAt(0); } + : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function (c) { + return (c.charCodeAt(0) - 0xd800) * 0x400 + + c.charCodeAt(1) - + 0xdc00 + + 0x10000; + }; +function singleCharReplacer(c) { + return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)) + .toString(16) + .toUpperCase() + ";"; +} +function getInverse(inverse, re) { + return function (data) { + return data + .replace(re, function (name) { return inverse[name]; }) + .replace(reNonASCII, singleCharReplacer); + }; +} +var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using numeric hexadecimal reference (eg. `ü`). + * + * Have a look at `escapeUTF8` if you want a more concise output at the expense + * of reduced transportability. + * + * @param data String to escape. + */ +function escape(data) { + return data.replace(reEscapeChars, singleCharReplacer); +} +exports.escape = escape; +/** + * Encodes all characters not valid in XML documents using numeric hexadecimal + * reference (eg. `ü`). + * + * Note that the output will be character-set dependent. + * + * @param data String to escape. + */ +function escapeUTF8(data) { + return data.replace(xmlReplacer, singleCharReplacer); +} +exports.escapeUTF8 = escapeUTF8; +function getASCIIEncoder(obj) { + return function (data) { + return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); }); + }; +} + + +/***/ }), + +/***/ 3000: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0; +var decode_1 = __nccwpck_require__(85107); +var encode_1 = __nccwpck_require__(2006); +/** + * Decodes a string with entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeXML` or `decodeHTML` directly. + */ +function decode(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); +} +exports.decode = decode; +/** + * Decodes a string with entities. Does not allow missing trailing semicolons for entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. + */ +function decodeStrict(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); +} +exports.decodeStrict = decodeStrict; +/** + * Encodes a string with entities. + * + * @param data String to encode. + * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + */ +function encode(data, level) { + return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); +} +exports.encode = encode; +var encode_2 = __nccwpck_require__(2006); +Object.defineProperty(exports, "encodeXML", ({ enumerable: true, get: function () { return encode_2.encodeXML; } })); +Object.defineProperty(exports, "encodeHTML", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +Object.defineProperty(exports, "encodeNonAsciiHTML", ({ enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } })); +Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return encode_2.escape; } })); +Object.defineProperty(exports, "escapeUTF8", ({ enumerable: true, get: function () { return encode_2.escapeUTF8; } })); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "encodeHTML4", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +Object.defineProperty(exports, "encodeHTML5", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +var decode_2 = __nccwpck_require__(85107); +Object.defineProperty(exports, "decodeXML", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); +Object.defineProperty(exports, "decodeHTML", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "decodeHTML4", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTML5", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTML4Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +Object.defineProperty(exports, "decodeHTML5Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +Object.defineProperty(exports, "decodeXMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); + + +/***/ }), + +/***/ 7991: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2015 Ingvar Stepanyan + Copyright (C) 2014 Ivan Nikulin + Copyright (C) 2012-2013 Michael Ficarra + Copyright (C) 2012-2013 Mathias Bynens + Copyright (C) 2013 Irakli Gozalishvili + Copyright (C) 2012 Robert Gust-Bardon + Copyright (C) 2012 John Freeman + Copyright (C) 2011-2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*global exports:true, require:true, global:true*/ +(function () { + 'use strict'; + + var Syntax, + Precedence, + BinaryPrecedence, + SourceNode, + estraverse, + esutils, + base, + indent, + json, + renumber, + hexadecimal, + quotes, + escapeless, + newline, + space, + parentheses, + semicolons, + safeConcatenation, + directive, + extra, + parse, + sourceMap, + sourceCode, + preserveBlankLines, + FORMAT_MINIFY, + FORMAT_DEFAULTS; + + estraverse = __nccwpck_require__(23479); + esutils = __nccwpck_require__(94038); + + Syntax = estraverse.Syntax; + + // Generation is done by generateExpression. + function isExpression(node) { + return CodeGenerator.Expression.hasOwnProperty(node.type); + } + + // Generation is done by generateStatement. + function isStatement(node) { + return CodeGenerator.Statement.hasOwnProperty(node.type); + } + + Precedence = { + Sequence: 0, + Yield: 1, + Assignment: 1, + Conditional: 2, + ArrowFunction: 2, + LogicalOR: 3, + LogicalAND: 4, + BitwiseOR: 5, + BitwiseXOR: 6, + BitwiseAND: 7, + Equality: 8, + Relational: 9, + BitwiseSHIFT: 10, + Additive: 11, + Multiplicative: 12, + Exponentiation: 13, + Await: 14, + Unary: 14, + Postfix: 15, + Call: 16, + New: 17, + TaggedTemplate: 18, + Member: 19, + Primary: 20 + }; + + BinaryPrecedence = { + '||': Precedence.LogicalOR, + '&&': Precedence.LogicalAND, + '|': Precedence.BitwiseOR, + '^': Precedence.BitwiseXOR, + '&': Precedence.BitwiseAND, + '==': Precedence.Equality, + '!=': Precedence.Equality, + '===': Precedence.Equality, + '!==': Precedence.Equality, + 'is': Precedence.Equality, + 'isnt': Precedence.Equality, + '<': Precedence.Relational, + '>': Precedence.Relational, + '<=': Precedence.Relational, + '>=': Precedence.Relational, + 'in': Precedence.Relational, + 'instanceof': Precedence.Relational, + '<<': Precedence.BitwiseSHIFT, + '>>': Precedence.BitwiseSHIFT, + '>>>': Precedence.BitwiseSHIFT, + '+': Precedence.Additive, + '-': Precedence.Additive, + '*': Precedence.Multiplicative, + '%': Precedence.Multiplicative, + '/': Precedence.Multiplicative, + '**': Precedence.Exponentiation + }; + + //Flags + var F_ALLOW_IN = 1, + F_ALLOW_CALL = 1 << 1, + F_ALLOW_UNPARATH_NEW = 1 << 2, + F_FUNC_BODY = 1 << 3, + F_DIRECTIVE_CTX = 1 << 4, + F_SEMICOLON_OPT = 1 << 5; + + //Expression flag sets + //NOTE: Flag order: + // F_ALLOW_IN + // F_ALLOW_CALL + // F_ALLOW_UNPARATH_NEW + var E_FTT = F_ALLOW_CALL | F_ALLOW_UNPARATH_NEW, + E_TTF = F_ALLOW_IN | F_ALLOW_CALL, + E_TTT = F_ALLOW_IN | F_ALLOW_CALL | F_ALLOW_UNPARATH_NEW, + E_TFF = F_ALLOW_IN, + E_FFT = F_ALLOW_UNPARATH_NEW, + E_TFT = F_ALLOW_IN | F_ALLOW_UNPARATH_NEW; + + //Statement flag sets + //NOTE: Flag order: + // F_ALLOW_IN + // F_FUNC_BODY + // F_DIRECTIVE_CTX + // F_SEMICOLON_OPT + var S_TFFF = F_ALLOW_IN, + S_TFFT = F_ALLOW_IN | F_SEMICOLON_OPT, + S_FFFF = 0x00, + S_TFTF = F_ALLOW_IN | F_DIRECTIVE_CTX, + S_TTFF = F_ALLOW_IN | F_FUNC_BODY; + + function getDefaultOptions() { + // default options + return { + indent: null, + base: null, + parse: null, + comment: false, + format: { + indent: { + style: ' ', + base: 0, + adjustMultilineComment: false + }, + newline: '\n', + space: ' ', + json: false, + renumber: false, + hexadecimal: false, + quotes: 'single', + escapeless: false, + compact: false, + parentheses: true, + semicolons: true, + safeConcatenation: false, + preserveBlankLines: false + }, + moz: { + comprehensionExpressionStartsWithAssignment: false, + starlessGenerator: false + }, + sourceMap: null, + sourceMapRoot: null, + sourceMapWithCode: false, + directive: false, + raw: true, + verbatim: null, + sourceCode: null + }; + } + + function stringRepeat(str, num) { + var result = ''; + + for (num |= 0; num > 0; num >>>= 1, str += str) { + if (num & 1) { + result += str; + } + } + + return result; + } + + function hasLineTerminator(str) { + return (/[\r\n]/g).test(str); + } + + function endsWithLineTerminator(str) { + var len = str.length; + return len && esutils.code.isLineTerminator(str.charCodeAt(len - 1)); + } + + function merge(target, override) { + var key; + for (key in override) { + if (override.hasOwnProperty(key)) { + target[key] = override[key]; + } + } + return target; + } + + function updateDeeply(target, override) { + var key, val; + + function isHashObject(target) { + return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); + } + + for (key in override) { + if (override.hasOwnProperty(key)) { + val = override[key]; + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; + } + + function generateNumber(value) { + var result, point, temp, exponent, pos; + + if (value !== value) { + throw new Error('Numeric literal whose value is NaN'); + } + if (value < 0 || (value === 0 && 1 / value < 0)) { + throw new Error('Numeric literal whose value is negative'); + } + + if (value === 1 / 0) { + return json ? 'null' : renumber ? '1e400' : '1e+400'; + } + + result = '' + value; + if (!renumber || result.length < 3) { + return result; + } + + point = result.indexOf('.'); + if (!json && result.charCodeAt(0) === 0x30 /* 0 */ && point === 1) { + point = 0; + result = result.slice(1); + } + temp = result; + result = result.replace('e+', 'e'); + exponent = 0; + if ((pos = temp.indexOf('e')) > 0) { + exponent = +temp.slice(pos + 1); + temp = temp.slice(0, pos); + } + if (point >= 0) { + exponent -= temp.length - point - 1; + temp = +(temp.slice(0, point) + temp.slice(point + 1)) + ''; + } + pos = 0; + while (temp.charCodeAt(temp.length + pos - 1) === 0x30 /* 0 */) { + --pos; + } + if (pos !== 0) { + exponent -= pos; + temp = temp.slice(0, pos); + } + if (exponent !== 0) { + temp += 'e' + exponent; + } + if ((temp.length < result.length || + (hexadecimal && value > 1e12 && Math.floor(value) === value && (temp = '0x' + value.toString(16)).length < result.length)) && + +temp === value) { + result = temp; + } + + return result; + } + + // Generate valid RegExp expression. + // This function is based on https://github.com/Constellation/iv Engine + + function escapeRegExpCharacter(ch, previousIsBackslash) { + // not handling '\' and handling \u2028 or \u2029 to unicode escape sequence + if ((ch & ~1) === 0x2028) { + return (previousIsBackslash ? 'u' : '\\u') + ((ch === 0x2028) ? '2028' : '2029'); + } else if (ch === 10 || ch === 13) { // \n, \r + return (previousIsBackslash ? '' : '\\') + ((ch === 10) ? 'n' : 'r'); + } + return String.fromCharCode(ch); + } + + function generateRegExp(reg) { + var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash; + + result = reg.toString(); + + if (reg.source) { + // extract flag from toString result + match = result.match(/\/([^/]*)$/); + if (!match) { + return result; + } + + flags = match[1]; + result = ''; + + characterInBrack = false; + previousIsBackslash = false; + for (i = 0, iz = reg.source.length; i < iz; ++i) { + ch = reg.source.charCodeAt(i); + + if (!previousIsBackslash) { + if (characterInBrack) { + if (ch === 93) { // ] + characterInBrack = false; + } + } else { + if (ch === 47) { // / + result += '\\'; + } else if (ch === 91) { // [ + characterInBrack = true; + } + } + result += escapeRegExpCharacter(ch, previousIsBackslash); + previousIsBackslash = ch === 92; // \ + } else { + // if new RegExp("\\\n') is provided, create /\n/ + result += escapeRegExpCharacter(ch, previousIsBackslash); + // prevent like /\\[/]/ + previousIsBackslash = false; + } + } + + return '/' + result + '/' + flags; + } + + return result; + } + + function escapeAllowedCharacter(code, next) { + var hex; + + if (code === 0x08 /* \b */) { + return '\\b'; + } + + if (code === 0x0C /* \f */) { + return '\\f'; + } + + if (code === 0x09 /* \t */) { + return '\\t'; + } + + hex = code.toString(16).toUpperCase(); + if (json || code > 0xFF) { + return '\\u' + '0000'.slice(hex.length) + hex; + } else if (code === 0x0000 && !esutils.code.isDecimalDigit(next)) { + return '\\0'; + } else if (code === 0x000B /* \v */) { // '\v' + return '\\x0B'; + } else { + return '\\x' + '00'.slice(hex.length) + hex; + } + } + + function escapeDisallowedCharacter(code) { + if (code === 0x5C /* \ */) { + return '\\\\'; + } + + if (code === 0x0A /* \n */) { + return '\\n'; + } + + if (code === 0x0D /* \r */) { + return '\\r'; + } + + if (code === 0x2028) { + return '\\u2028'; + } + + if (code === 0x2029) { + return '\\u2029'; + } + + throw new Error('Incorrectly classified character'); + } + + function escapeDirective(str) { + var i, iz, code, quote; + + quote = quotes === 'double' ? '"' : '\''; + for (i = 0, iz = str.length; i < iz; ++i) { + code = str.charCodeAt(i); + if (code === 0x27 /* ' */) { + quote = '"'; + break; + } else if (code === 0x22 /* " */) { + quote = '\''; + break; + } else if (code === 0x5C /* \ */) { + ++i; + } + } + + return quote + str + quote; + } + + function escapeString(str) { + var result = '', i, len, code, singleQuotes = 0, doubleQuotes = 0, single, quote; + + for (i = 0, len = str.length; i < len; ++i) { + code = str.charCodeAt(i); + if (code === 0x27 /* ' */) { + ++singleQuotes; + } else if (code === 0x22 /* " */) { + ++doubleQuotes; + } else if (code === 0x2F /* / */ && json) { + result += '\\'; + } else if (esutils.code.isLineTerminator(code) || code === 0x5C /* \ */) { + result += escapeDisallowedCharacter(code); + continue; + } else if (!esutils.code.isIdentifierPartES5(code) && (json && code < 0x20 /* SP */ || !json && !escapeless && (code < 0x20 /* SP */ || code > 0x7E /* ~ */))) { + result += escapeAllowedCharacter(code, str.charCodeAt(i + 1)); + continue; + } + result += String.fromCharCode(code); + } + + single = !(quotes === 'double' || (quotes === 'auto' && doubleQuotes < singleQuotes)); + quote = single ? '\'' : '"'; + + if (!(single ? singleQuotes : doubleQuotes)) { + return quote + result + quote; + } + + str = result; + result = quote; + + for (i = 0, len = str.length; i < len; ++i) { + code = str.charCodeAt(i); + if ((code === 0x27 /* ' */ && single) || (code === 0x22 /* " */ && !single)) { + result += '\\'; + } + result += String.fromCharCode(code); + } + + return result + quote; + } + + /** + * flatten an array to a string, where the array can contain + * either strings or nested arrays + */ + function flattenToString(arr) { + var i, iz, elem, result = ''; + for (i = 0, iz = arr.length; i < iz; ++i) { + elem = arr[i]; + result += Array.isArray(elem) ? flattenToString(elem) : elem; + } + return result; + } + + /** + * convert generated to a SourceNode when source maps are enabled. + */ + function toSourceNodeWhenNeeded(generated, node) { + if (!sourceMap) { + // with no source maps, generated is either an + // array or a string. if an array, flatten it. + // if a string, just return it + if (Array.isArray(generated)) { + return flattenToString(generated); + } else { + return generated; + } + } + if (node == null) { + if (generated instanceof SourceNode) { + return generated; + } else { + node = {}; + } + } + if (node.loc == null) { + return new SourceNode(null, null, sourceMap, generated, node.name || null); + } + return new SourceNode(node.loc.start.line, node.loc.start.column, (sourceMap === true ? node.loc.source || null : sourceMap), generated, node.name || null); + } + + function noEmptySpace() { + return (space) ? space : ' '; + } + + function join(left, right) { + var leftSource, + rightSource, + leftCharCode, + rightCharCode; + + leftSource = toSourceNodeWhenNeeded(left).toString(); + if (leftSource.length === 0) { + return [right]; + } + + rightSource = toSourceNodeWhenNeeded(right).toString(); + if (rightSource.length === 0) { + return [left]; + } + + leftCharCode = leftSource.charCodeAt(leftSource.length - 1); + rightCharCode = rightSource.charCodeAt(0); + + if ((leftCharCode === 0x2B /* + */ || leftCharCode === 0x2D /* - */) && leftCharCode === rightCharCode || + esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode) || + leftCharCode === 0x2F /* / */ && rightCharCode === 0x69 /* i */) { // infix word operators all start with `i` + return [left, noEmptySpace(), right]; + } else if (esutils.code.isWhiteSpace(leftCharCode) || esutils.code.isLineTerminator(leftCharCode) || + esutils.code.isWhiteSpace(rightCharCode) || esutils.code.isLineTerminator(rightCharCode)) { + return [left, right]; + } + return [left, space, right]; + } + + function addIndent(stmt) { + return [base, stmt]; + } + + function withIndent(fn) { + var previousBase; + previousBase = base; + base += indent; + fn(base); + base = previousBase; + } + + function calculateSpaces(str) { + var i; + for (i = str.length - 1; i >= 0; --i) { + if (esutils.code.isLineTerminator(str.charCodeAt(i))) { + break; + } + } + return (str.length - 1) - i; + } + + function adjustMultilineComment(value, specialBase) { + var array, i, len, line, j, spaces, previousBase, sn; + + array = value.split(/\r\n|[\r\n]/); + spaces = Number.MAX_VALUE; + + // first line doesn't have indentation + for (i = 1, len = array.length; i < len; ++i) { + line = array[i]; + j = 0; + while (j < line.length && esutils.code.isWhiteSpace(line.charCodeAt(j))) { + ++j; + } + if (spaces > j) { + spaces = j; + } + } + + if (typeof specialBase !== 'undefined') { + // pattern like + // { + // var t = 20; /* + // * this is comment + // */ + // } + previousBase = base; + if (array[1][spaces] === '*') { + specialBase += ' '; + } + base = specialBase; + } else { + if (spaces & 1) { + // /* + // * + // */ + // If spaces are odd number, above pattern is considered. + // We waste 1 space. + --spaces; + } + previousBase = base; + } + + for (i = 1, len = array.length; i < len; ++i) { + sn = toSourceNodeWhenNeeded(addIndent(array[i].slice(spaces))); + array[i] = sourceMap ? sn.join('') : sn; + } + + base = previousBase; + + return array.join('\n'); + } + + function generateComment(comment, specialBase) { + if (comment.type === 'Line') { + if (endsWithLineTerminator(comment.value)) { + return '//' + comment.value; + } else { + // Always use LineTerminator + var result = '//' + comment.value; + if (!preserveBlankLines) { + result += '\n'; + } + return result; + } + } + if (extra.format.indent.adjustMultilineComment && /[\n\r]/.test(comment.value)) { + return adjustMultilineComment('/*' + comment.value + '*/', specialBase); + } + return '/*' + comment.value + '*/'; + } + + function addComments(stmt, result) { + var i, len, comment, save, tailingToStatement, specialBase, fragment, + extRange, range, prevRange, prefix, infix, suffix, count; + + if (stmt.leadingComments && stmt.leadingComments.length > 0) { + save = result; + + if (preserveBlankLines) { + comment = stmt.leadingComments[0]; + result = []; + + extRange = comment.extendedRange; + range = comment.range; + + prefix = sourceCode.substring(extRange[0], range[0]); + count = (prefix.match(/\n/g) || []).length; + if (count > 0) { + result.push(stringRepeat('\n', count)); + result.push(addIndent(generateComment(comment))); + } else { + result.push(prefix); + result.push(generateComment(comment)); + } + + prevRange = range; + + for (i = 1, len = stmt.leadingComments.length; i < len; i++) { + comment = stmt.leadingComments[i]; + range = comment.range; + + infix = sourceCode.substring(prevRange[1], range[0]); + count = (infix.match(/\n/g) || []).length; + result.push(stringRepeat('\n', count)); + result.push(addIndent(generateComment(comment))); + + prevRange = range; + } + + suffix = sourceCode.substring(range[1], extRange[1]); + count = (suffix.match(/\n/g) || []).length; + result.push(stringRepeat('\n', count)); + } else { + comment = stmt.leadingComments[0]; + result = []; + if (safeConcatenation && stmt.type === Syntax.Program && stmt.body.length === 0) { + result.push('\n'); + } + result.push(generateComment(comment)); + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push('\n'); + } + + for (i = 1, len = stmt.leadingComments.length; i < len; ++i) { + comment = stmt.leadingComments[i]; + fragment = [generateComment(comment)]; + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + fragment.push('\n'); + } + result.push(addIndent(fragment)); + } + } + + result.push(addIndent(save)); + } + + if (stmt.trailingComments) { + + if (preserveBlankLines) { + comment = stmt.trailingComments[0]; + extRange = comment.extendedRange; + range = comment.range; + + prefix = sourceCode.substring(extRange[0], range[0]); + count = (prefix.match(/\n/g) || []).length; + + if (count > 0) { + result.push(stringRepeat('\n', count)); + result.push(addIndent(generateComment(comment))); + } else { + result.push(prefix); + result.push(generateComment(comment)); + } + } else { + tailingToStatement = !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()); + specialBase = stringRepeat(' ', calculateSpaces(toSourceNodeWhenNeeded([base, result, indent]).toString())); + for (i = 0, len = stmt.trailingComments.length; i < len; ++i) { + comment = stmt.trailingComments[i]; + if (tailingToStatement) { + // We assume target like following script + // + // var t = 20; /** + // * This is comment of t + // */ + if (i === 0) { + // first case + result = [result, indent]; + } else { + result = [result, specialBase]; + } + result.push(generateComment(comment, specialBase)); + } else { + result = [result, addIndent(generateComment(comment))]; + } + if (i !== len - 1 && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result = [result, '\n']; + } + } + } + } + + return result; + } + + function generateBlankLines(start, end, result) { + var j, newlineCount = 0; + + for (j = start; j < end; j++) { + if (sourceCode[j] === '\n') { + newlineCount++; + } + } + + for (j = 1; j < newlineCount; j++) { + result.push(newline); + } + } + + function parenthesize(text, current, should) { + if (current < should) { + return ['(', text, ')']; + } + return text; + } + + function generateVerbatimString(string) { + var i, iz, result; + result = string.split(/\r\n|\n/); + for (i = 1, iz = result.length; i < iz; i++) { + result[i] = newline + base + result[i]; + } + return result; + } + + function generateVerbatim(expr, precedence) { + var verbatim, result, prec; + verbatim = expr[extra.verbatim]; + + if (typeof verbatim === 'string') { + result = parenthesize(generateVerbatimString(verbatim), Precedence.Sequence, precedence); + } else { + // verbatim is object + result = generateVerbatimString(verbatim.content); + prec = (verbatim.precedence != null) ? verbatim.precedence : Precedence.Sequence; + result = parenthesize(result, prec, precedence); + } + + return toSourceNodeWhenNeeded(result, expr); + } + + function CodeGenerator() { + } + + // Helpers. + + CodeGenerator.prototype.maybeBlock = function(stmt, flags) { + var result, noLeadingComment, that = this; + + noLeadingComment = !extra.comment || !stmt.leadingComments; + + if (stmt.type === Syntax.BlockStatement && noLeadingComment) { + return [space, this.generateStatement(stmt, flags)]; + } + + if (stmt.type === Syntax.EmptyStatement && noLeadingComment) { + return ';'; + } + + withIndent(function () { + result = [ + newline, + addIndent(that.generateStatement(stmt, flags)) + ]; + }); + + return result; + }; + + CodeGenerator.prototype.maybeBlockSuffix = function (stmt, result) { + var ends = endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()); + if (stmt.type === Syntax.BlockStatement && (!extra.comment || !stmt.leadingComments) && !ends) { + return [result, space]; + } + if (ends) { + return [result, base]; + } + return [result, newline, base]; + }; + + function generateIdentifier(node) { + return toSourceNodeWhenNeeded(node.name, node); + } + + function generateAsyncPrefix(node, spaceRequired) { + return node.async ? 'async' + (spaceRequired ? noEmptySpace() : space) : ''; + } + + function generateStarSuffix(node) { + var isGenerator = node.generator && !extra.moz.starlessGenerator; + return isGenerator ? '*' + space : ''; + } + + function generateMethodPrefix(prop) { + var func = prop.value, prefix = ''; + if (func.async) { + prefix += generateAsyncPrefix(func, !prop.computed); + } + if (func.generator) { + // avoid space before method name + prefix += generateStarSuffix(func) ? '*' : ''; + } + return prefix; + } + + CodeGenerator.prototype.generatePattern = function (node, precedence, flags) { + if (node.type === Syntax.Identifier) { + return generateIdentifier(node); + } + return this.generateExpression(node, precedence, flags); + }; + + CodeGenerator.prototype.generateFunctionParams = function (node) { + var i, iz, result, hasDefault; + + hasDefault = false; + + if (node.type === Syntax.ArrowFunctionExpression && + !node.rest && (!node.defaults || node.defaults.length === 0) && + node.params.length === 1 && node.params[0].type === Syntax.Identifier) { + // arg => { } case + result = [generateAsyncPrefix(node, true), generateIdentifier(node.params[0])]; + } else { + result = node.type === Syntax.ArrowFunctionExpression ? [generateAsyncPrefix(node, false)] : []; + result.push('('); + if (node.defaults) { + hasDefault = true; + } + for (i = 0, iz = node.params.length; i < iz; ++i) { + if (hasDefault && node.defaults[i]) { + // Handle default values. + result.push(this.generateAssignment(node.params[i], node.defaults[i], '=', Precedence.Assignment, E_TTT)); + } else { + result.push(this.generatePattern(node.params[i], Precedence.Assignment, E_TTT)); + } + if (i + 1 < iz) { + result.push(',' + space); + } + } + + if (node.rest) { + if (node.params.length) { + result.push(',' + space); + } + result.push('...'); + result.push(generateIdentifier(node.rest)); + } + + result.push(')'); + } + + return result; + }; + + CodeGenerator.prototype.generateFunctionBody = function (node) { + var result, expr; + + result = this.generateFunctionParams(node); + + if (node.type === Syntax.ArrowFunctionExpression) { + result.push(space); + result.push('=>'); + } + + if (node.expression) { + result.push(space); + expr = this.generateExpression(node.body, Precedence.Assignment, E_TTT); + if (expr.toString().charAt(0) === '{') { + expr = ['(', expr, ')']; + } + result.push(expr); + } else { + result.push(this.maybeBlock(node.body, S_TTFF)); + } + + return result; + }; + + CodeGenerator.prototype.generateIterationForStatement = function (operator, stmt, flags) { + var result = ['for' + (stmt.await ? noEmptySpace() + 'await' : '') + space + '('], that = this; + withIndent(function () { + if (stmt.left.type === Syntax.VariableDeclaration) { + withIndent(function () { + result.push(stmt.left.kind + noEmptySpace()); + result.push(that.generateStatement(stmt.left.declarations[0], S_FFFF)); + }); + } else { + result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)); + } + + result = join(result, operator); + result = [join( + result, + that.generateExpression(stmt.right, Precedence.Assignment, E_TTT) + ), ')']; + }); + result.push(this.maybeBlock(stmt.body, flags)); + return result; + }; + + CodeGenerator.prototype.generatePropertyKey = function (expr, computed) { + var result = []; + + if (computed) { + result.push('['); + } + + result.push(this.generateExpression(expr, Precedence.Assignment, E_TTT)); + + if (computed) { + result.push(']'); + } + + return result; + }; + + CodeGenerator.prototype.generateAssignment = function (left, right, operator, precedence, flags) { + if (Precedence.Assignment < precedence) { + flags |= F_ALLOW_IN; + } + + return parenthesize( + [ + this.generateExpression(left, Precedence.Call, flags), + space + operator + space, + this.generateExpression(right, Precedence.Assignment, flags) + ], + Precedence.Assignment, + precedence + ); + }; + + CodeGenerator.prototype.semicolon = function (flags) { + if (!semicolons && flags & F_SEMICOLON_OPT) { + return ''; + } + return ';'; + }; + + // Statements. + + CodeGenerator.Statement = { + + BlockStatement: function (stmt, flags) { + var range, content, result = ['{', newline], that = this; + + withIndent(function () { + // handle functions without any code + if (stmt.body.length === 0 && preserveBlankLines) { + range = stmt.range; + if (range[1] - range[0] > 2) { + content = sourceCode.substring(range[0] + 1, range[1] - 1); + if (content[0] === '\n') { + result = ['{']; + } + result.push(content); + } + } + + var i, iz, fragment, bodyFlags; + bodyFlags = S_TFFF; + if (flags & F_FUNC_BODY) { + bodyFlags |= F_DIRECTIVE_CTX; + } + + for (i = 0, iz = stmt.body.length; i < iz; ++i) { + if (preserveBlankLines) { + // handle spaces before the first line + if (i === 0) { + if (stmt.body[0].leadingComments) { + range = stmt.body[0].leadingComments[0].extendedRange; + content = sourceCode.substring(range[0], range[1]); + if (content[0] === '\n') { + result = ['{']; + } + } + if (!stmt.body[0].leadingComments) { + generateBlankLines(stmt.range[0], stmt.body[0].range[0], result); + } + } + + // handle spaces between lines + if (i > 0) { + if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) { + generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result); + } + } + } + + if (i === iz - 1) { + bodyFlags |= F_SEMICOLON_OPT; + } + + if (stmt.body[i].leadingComments && preserveBlankLines) { + fragment = that.generateStatement(stmt.body[i], bodyFlags); + } else { + fragment = addIndent(that.generateStatement(stmt.body[i], bodyFlags)); + } + + result.push(fragment); + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + if (preserveBlankLines && i < iz - 1) { + // don't add a new line if there are leading coments + // in the next statement + if (!stmt.body[i + 1].leadingComments) { + result.push(newline); + } + } else { + result.push(newline); + } + } + + if (preserveBlankLines) { + // handle spaces after the last line + if (i === iz - 1) { + if (!stmt.body[i].trailingComments) { + generateBlankLines(stmt.body[i].range[1], stmt.range[1], result); + } + } + } + } + }); + + result.push(addIndent('}')); + return result; + }, + + BreakStatement: function (stmt, flags) { + if (stmt.label) { + return 'break ' + stmt.label.name + this.semicolon(flags); + } + return 'break' + this.semicolon(flags); + }, + + ContinueStatement: function (stmt, flags) { + if (stmt.label) { + return 'continue ' + stmt.label.name + this.semicolon(flags); + } + return 'continue' + this.semicolon(flags); + }, + + ClassBody: function (stmt, flags) { + var result = [ '{', newline], that = this; + + withIndent(function (indent) { + var i, iz; + + for (i = 0, iz = stmt.body.length; i < iz; ++i) { + result.push(indent); + result.push(that.generateExpression(stmt.body[i], Precedence.Sequence, E_TTT)); + if (i + 1 < iz) { + result.push(newline); + } + } + }); + + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(base); + result.push('}'); + return result; + }, + + ClassDeclaration: function (stmt, flags) { + var result, fragment; + result = ['class']; + if (stmt.id) { + result = join(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT)); + } + if (stmt.superClass) { + fragment = join('extends', this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)); + result = join(result, fragment); + } + result.push(space); + result.push(this.generateStatement(stmt.body, S_TFFT)); + return result; + }, + + DirectiveStatement: function (stmt, flags) { + if (extra.raw && stmt.raw) { + return stmt.raw + this.semicolon(flags); + } + return escapeDirective(stmt.directive) + this.semicolon(flags); + }, + + DoWhileStatement: function (stmt, flags) { + // Because `do 42 while (cond)` is Syntax Error. We need semicolon. + var result = join('do', this.maybeBlock(stmt.body, S_TFFF)); + result = this.maybeBlockSuffix(stmt.body, result); + return join(result, [ + 'while' + space + '(', + this.generateExpression(stmt.test, Precedence.Sequence, E_TTT), + ')' + this.semicolon(flags) + ]); + }, + + CatchClause: function (stmt, flags) { + var result, that = this; + withIndent(function () { + var guard; + + if (stmt.param) { + result = [ + 'catch' + space + '(', + that.generateExpression(stmt.param, Precedence.Sequence, E_TTT), + ')' + ]; + + if (stmt.guard) { + guard = that.generateExpression(stmt.guard, Precedence.Sequence, E_TTT); + result.splice(2, 0, ' if ', guard); + } + } else { + result = ['catch']; + } + }); + result.push(this.maybeBlock(stmt.body, S_TFFF)); + return result; + }, + + DebuggerStatement: function (stmt, flags) { + return 'debugger' + this.semicolon(flags); + }, + + EmptyStatement: function (stmt, flags) { + return ';'; + }, + + ExportDefaultDeclaration: function (stmt, flags) { + var result = [ 'export' ], bodyFlags; + + bodyFlags = (flags & F_SEMICOLON_OPT) ? S_TFFT : S_TFFF; + + // export default HoistableDeclaration[Default] + // export default AssignmentExpression[In] ; + result = join(result, 'default'); + if (isStatement(stmt.declaration)) { + result = join(result, this.generateStatement(stmt.declaration, bodyFlags)); + } else { + result = join(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)); + } + return result; + }, + + ExportNamedDeclaration: function (stmt, flags) { + var result = [ 'export' ], bodyFlags, that = this; + + bodyFlags = (flags & F_SEMICOLON_OPT) ? S_TFFT : S_TFFF; + + // export VariableStatement + // export Declaration[Default] + if (stmt.declaration) { + return join(result, this.generateStatement(stmt.declaration, bodyFlags)); + } + + // export ExportClause[NoReference] FromClause ; + // export ExportClause ; + if (stmt.specifiers) { + if (stmt.specifiers.length === 0) { + result = join(result, '{' + space + '}'); + } else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) { + result = join(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)); + } else { + result = join(result, '{'); + withIndent(function (indent) { + var i, iz; + result.push(newline); + for (i = 0, iz = stmt.specifiers.length; i < iz; ++i) { + result.push(indent); + result.push(that.generateExpression(stmt.specifiers[i], Precedence.Sequence, E_TTT)); + if (i + 1 < iz) { + result.push(',' + newline); + } + } + }); + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(base + '}'); + } + + if (stmt.source) { + result = join(result, [ + 'from' + space, + // ModuleSpecifier + this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), + this.semicolon(flags) + ]); + } else { + result.push(this.semicolon(flags)); + } + } + return result; + }, + + ExportAllDeclaration: function (stmt, flags) { + // export * FromClause ; + return [ + 'export' + space, + '*' + space, + 'from' + space, + // ModuleSpecifier + this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), + this.semicolon(flags) + ]; + }, + + ExpressionStatement: function (stmt, flags) { + var result, fragment; + + function isClassPrefixed(fragment) { + var code; + if (fragment.slice(0, 5) !== 'class') { + return false; + } + code = fragment.charCodeAt(5); + return code === 0x7B /* '{' */ || esutils.code.isWhiteSpace(code) || esutils.code.isLineTerminator(code); + } + + function isFunctionPrefixed(fragment) { + var code; + if (fragment.slice(0, 8) !== 'function') { + return false; + } + code = fragment.charCodeAt(8); + return code === 0x28 /* '(' */ || esutils.code.isWhiteSpace(code) || code === 0x2A /* '*' */ || esutils.code.isLineTerminator(code); + } + + function isAsyncPrefixed(fragment) { + var code, i, iz; + if (fragment.slice(0, 5) !== 'async') { + return false; + } + if (!esutils.code.isWhiteSpace(fragment.charCodeAt(5))) { + return false; + } + for (i = 6, iz = fragment.length; i < iz; ++i) { + if (!esutils.code.isWhiteSpace(fragment.charCodeAt(i))) { + break; + } + } + if (i === iz) { + return false; + } + if (fragment.slice(i, i + 8) !== 'function') { + return false; + } + code = fragment.charCodeAt(i + 8); + return code === 0x28 /* '(' */ || esutils.code.isWhiteSpace(code) || code === 0x2A /* '*' */ || esutils.code.isLineTerminator(code); + } + + result = [this.generateExpression(stmt.expression, Precedence.Sequence, E_TTT)]; + // 12.4 '{', 'function', 'class' is not allowed in this position. + // wrap expression with parentheses + fragment = toSourceNodeWhenNeeded(result).toString(); + if (fragment.charCodeAt(0) === 0x7B /* '{' */ || // ObjectExpression + isClassPrefixed(fragment) || + isFunctionPrefixed(fragment) || + isAsyncPrefixed(fragment) || + (directive && (flags & F_DIRECTIVE_CTX) && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string')) { + result = ['(', result, ')' + this.semicolon(flags)]; + } else { + result.push(this.semicolon(flags)); + } + return result; + }, + + ImportDeclaration: function (stmt, flags) { + // ES6: 15.2.1 valid import declarations: + // - import ImportClause FromClause ; + // - import ModuleSpecifier ; + var result, cursor, that = this; + + // If no ImportClause is present, + // this should be `import ModuleSpecifier` so skip `from` + // ModuleSpecifier is StringLiteral. + if (stmt.specifiers.length === 0) { + // import ModuleSpecifier ; + return [ + 'import', + space, + // ModuleSpecifier + this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), + this.semicolon(flags) + ]; + } + + // import ImportClause FromClause ; + result = [ + 'import' + ]; + cursor = 0; + + // ImportedBinding + if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) { + result = join(result, [ + this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT) + ]); + ++cursor; + } + + if (stmt.specifiers[cursor]) { + if (cursor !== 0) { + result.push(','); + } + + if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) { + // NameSpaceImport + result = join(result, [ + space, + this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT) + ]); + } else { + // NamedImports + result.push(space + '{'); + + if ((stmt.specifiers.length - cursor) === 1) { + // import { ... } from "..."; + result.push(space); + result.push(this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)); + result.push(space + '}' + space); + } else { + // import { + // ..., + // ..., + // } from "..."; + withIndent(function (indent) { + var i, iz; + result.push(newline); + for (i = cursor, iz = stmt.specifiers.length; i < iz; ++i) { + result.push(indent); + result.push(that.generateExpression(stmt.specifiers[i], Precedence.Sequence, E_TTT)); + if (i + 1 < iz) { + result.push(',' + newline); + } + } + }); + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(base + '}' + space); + } + } + } + + result = join(result, [ + 'from' + space, + // ModuleSpecifier + this.generateExpression(stmt.source, Precedence.Sequence, E_TTT), + this.semicolon(flags) + ]); + return result; + }, + + VariableDeclarator: function (stmt, flags) { + var itemFlags = (flags & F_ALLOW_IN) ? E_TTT : E_FTT; + if (stmt.init) { + return [ + this.generateExpression(stmt.id, Precedence.Assignment, itemFlags), + space, + '=', + space, + this.generateExpression(stmt.init, Precedence.Assignment, itemFlags) + ]; + } + return this.generatePattern(stmt.id, Precedence.Assignment, itemFlags); + }, + + VariableDeclaration: function (stmt, flags) { + // VariableDeclarator is typed as Statement, + // but joined with comma (not LineTerminator). + // So if comment is attached to target node, we should specialize. + var result, i, iz, node, bodyFlags, that = this; + + result = [ stmt.kind ]; + + bodyFlags = (flags & F_ALLOW_IN) ? S_TFFF : S_FFFF; + + function block() { + node = stmt.declarations[0]; + if (extra.comment && node.leadingComments) { + result.push('\n'); + result.push(addIndent(that.generateStatement(node, bodyFlags))); + } else { + result.push(noEmptySpace()); + result.push(that.generateStatement(node, bodyFlags)); + } + + for (i = 1, iz = stmt.declarations.length; i < iz; ++i) { + node = stmt.declarations[i]; + if (extra.comment && node.leadingComments) { + result.push(',' + newline); + result.push(addIndent(that.generateStatement(node, bodyFlags))); + } else { + result.push(',' + space); + result.push(that.generateStatement(node, bodyFlags)); + } + } + } + + if (stmt.declarations.length > 1) { + withIndent(block); + } else { + block(); + } + + result.push(this.semicolon(flags)); + + return result; + }, + + ThrowStatement: function (stmt, flags) { + return [join( + 'throw', + this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT) + ), this.semicolon(flags)]; + }, + + TryStatement: function (stmt, flags) { + var result, i, iz, guardedHandlers; + + result = ['try', this.maybeBlock(stmt.block, S_TFFF)]; + result = this.maybeBlockSuffix(stmt.block, result); + + if (stmt.handlers) { + // old interface + for (i = 0, iz = stmt.handlers.length; i < iz; ++i) { + result = join(result, this.generateStatement(stmt.handlers[i], S_TFFF)); + if (stmt.finalizer || i + 1 !== iz) { + result = this.maybeBlockSuffix(stmt.handlers[i].body, result); + } + } + } else { + guardedHandlers = stmt.guardedHandlers || []; + + for (i = 0, iz = guardedHandlers.length; i < iz; ++i) { + result = join(result, this.generateStatement(guardedHandlers[i], S_TFFF)); + if (stmt.finalizer || i + 1 !== iz) { + result = this.maybeBlockSuffix(guardedHandlers[i].body, result); + } + } + + // new interface + if (stmt.handler) { + if (Array.isArray(stmt.handler)) { + for (i = 0, iz = stmt.handler.length; i < iz; ++i) { + result = join(result, this.generateStatement(stmt.handler[i], S_TFFF)); + if (stmt.finalizer || i + 1 !== iz) { + result = this.maybeBlockSuffix(stmt.handler[i].body, result); + } + } + } else { + result = join(result, this.generateStatement(stmt.handler, S_TFFF)); + if (stmt.finalizer) { + result = this.maybeBlockSuffix(stmt.handler.body, result); + } + } + } + } + if (stmt.finalizer) { + result = join(result, ['finally', this.maybeBlock(stmt.finalizer, S_TFFF)]); + } + return result; + }, + + SwitchStatement: function (stmt, flags) { + var result, fragment, i, iz, bodyFlags, that = this; + withIndent(function () { + result = [ + 'switch' + space + '(', + that.generateExpression(stmt.discriminant, Precedence.Sequence, E_TTT), + ')' + space + '{' + newline + ]; + }); + if (stmt.cases) { + bodyFlags = S_TFFF; + for (i = 0, iz = stmt.cases.length; i < iz; ++i) { + if (i === iz - 1) { + bodyFlags |= F_SEMICOLON_OPT; + } + fragment = addIndent(this.generateStatement(stmt.cases[i], bodyFlags)); + result.push(fragment); + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + result.push(newline); + } + } + } + result.push(addIndent('}')); + return result; + }, + + SwitchCase: function (stmt, flags) { + var result, fragment, i, iz, bodyFlags, that = this; + withIndent(function () { + if (stmt.test) { + result = [ + join('case', that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)), + ':' + ]; + } else { + result = ['default:']; + } + + i = 0; + iz = stmt.consequent.length; + if (iz && stmt.consequent[0].type === Syntax.BlockStatement) { + fragment = that.maybeBlock(stmt.consequent[0], S_TFFF); + result.push(fragment); + i = 1; + } + + if (i !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + + bodyFlags = S_TFFF; + for (; i < iz; ++i) { + if (i === iz - 1 && flags & F_SEMICOLON_OPT) { + bodyFlags |= F_SEMICOLON_OPT; + } + fragment = addIndent(that.generateStatement(stmt.consequent[i], bodyFlags)); + result.push(fragment); + if (i + 1 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + result.push(newline); + } + } + }); + return result; + }, + + IfStatement: function (stmt, flags) { + var result, bodyFlags, semicolonOptional, that = this; + withIndent(function () { + result = [ + 'if' + space + '(', + that.generateExpression(stmt.test, Precedence.Sequence, E_TTT), + ')' + ]; + }); + semicolonOptional = flags & F_SEMICOLON_OPT; + bodyFlags = S_TFFF; + if (semicolonOptional) { + bodyFlags |= F_SEMICOLON_OPT; + } + if (stmt.alternate) { + result.push(this.maybeBlock(stmt.consequent, S_TFFF)); + result = this.maybeBlockSuffix(stmt.consequent, result); + if (stmt.alternate.type === Syntax.IfStatement) { + result = join(result, ['else ', this.generateStatement(stmt.alternate, bodyFlags)]); + } else { + result = join(result, join('else', this.maybeBlock(stmt.alternate, bodyFlags))); + } + } else { + result.push(this.maybeBlock(stmt.consequent, bodyFlags)); + } + return result; + }, + + ForStatement: function (stmt, flags) { + var result, that = this; + withIndent(function () { + result = ['for' + space + '(']; + if (stmt.init) { + if (stmt.init.type === Syntax.VariableDeclaration) { + result.push(that.generateStatement(stmt.init, S_FFFF)); + } else { + // F_ALLOW_IN becomes false. + result.push(that.generateExpression(stmt.init, Precedence.Sequence, E_FTT)); + result.push(';'); + } + } else { + result.push(';'); + } + + if (stmt.test) { + result.push(space); + result.push(that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)); + result.push(';'); + } else { + result.push(';'); + } + + if (stmt.update) { + result.push(space); + result.push(that.generateExpression(stmt.update, Precedence.Sequence, E_TTT)); + result.push(')'); + } else { + result.push(')'); + } + }); + + result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); + return result; + }, + + ForInStatement: function (stmt, flags) { + return this.generateIterationForStatement('in', stmt, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF); + }, + + ForOfStatement: function (stmt, flags) { + return this.generateIterationForStatement('of', stmt, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF); + }, + + LabeledStatement: function (stmt, flags) { + return [stmt.label.name + ':', this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)]; + }, + + Program: function (stmt, flags) { + var result, fragment, i, iz, bodyFlags; + iz = stmt.body.length; + result = [safeConcatenation && iz > 0 ? '\n' : '']; + bodyFlags = S_TFTF; + for (i = 0; i < iz; ++i) { + if (!safeConcatenation && i === iz - 1) { + bodyFlags |= F_SEMICOLON_OPT; + } + + if (preserveBlankLines) { + // handle spaces before the first line + if (i === 0) { + if (!stmt.body[0].leadingComments) { + generateBlankLines(stmt.range[0], stmt.body[i].range[0], result); + } + } + + // handle spaces between lines + if (i > 0) { + if (!stmt.body[i - 1].trailingComments && !stmt.body[i].leadingComments) { + generateBlankLines(stmt.body[i - 1].range[1], stmt.body[i].range[0], result); + } + } + } + + fragment = addIndent(this.generateStatement(stmt.body[i], bodyFlags)); + result.push(fragment); + if (i + 1 < iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + if (preserveBlankLines) { + if (!stmt.body[i + 1].leadingComments) { + result.push(newline); + } + } else { + result.push(newline); + } + } + + if (preserveBlankLines) { + // handle spaces after the last line + if (i === iz - 1) { + if (!stmt.body[i].trailingComments) { + generateBlankLines(stmt.body[i].range[1], stmt.range[1], result); + } + } + } + } + return result; + }, + + FunctionDeclaration: function (stmt, flags) { + return [ + generateAsyncPrefix(stmt, true), + 'function', + generateStarSuffix(stmt) || noEmptySpace(), + stmt.id ? generateIdentifier(stmt.id) : '', + this.generateFunctionBody(stmt) + ]; + }, + + ReturnStatement: function (stmt, flags) { + if (stmt.argument) { + return [join( + 'return', + this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT) + ), this.semicolon(flags)]; + } + return ['return' + this.semicolon(flags)]; + }, + + WhileStatement: function (stmt, flags) { + var result, that = this; + withIndent(function () { + result = [ + 'while' + space + '(', + that.generateExpression(stmt.test, Precedence.Sequence, E_TTT), + ')' + ]; + }); + result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); + return result; + }, + + WithStatement: function (stmt, flags) { + var result, that = this; + withIndent(function () { + result = [ + 'with' + space + '(', + that.generateExpression(stmt.object, Precedence.Sequence, E_TTT), + ')' + ]; + }); + result.push(this.maybeBlock(stmt.body, flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF)); + return result; + } + + }; + + merge(CodeGenerator.prototype, CodeGenerator.Statement); + + // Expressions. + + CodeGenerator.Expression = { + + SequenceExpression: function (expr, precedence, flags) { + var result, i, iz; + if (Precedence.Sequence < precedence) { + flags |= F_ALLOW_IN; + } + result = []; + for (i = 0, iz = expr.expressions.length; i < iz; ++i) { + result.push(this.generateExpression(expr.expressions[i], Precedence.Assignment, flags)); + if (i + 1 < iz) { + result.push(',' + space); + } + } + return parenthesize(result, Precedence.Sequence, precedence); + }, + + AssignmentExpression: function (expr, precedence, flags) { + return this.generateAssignment(expr.left, expr.right, expr.operator, precedence, flags); + }, + + ArrowFunctionExpression: function (expr, precedence, flags) { + return parenthesize(this.generateFunctionBody(expr), Precedence.ArrowFunction, precedence); + }, + + ConditionalExpression: function (expr, precedence, flags) { + if (Precedence.Conditional < precedence) { + flags |= F_ALLOW_IN; + } + return parenthesize( + [ + this.generateExpression(expr.test, Precedence.LogicalOR, flags), + space + '?' + space, + this.generateExpression(expr.consequent, Precedence.Assignment, flags), + space + ':' + space, + this.generateExpression(expr.alternate, Precedence.Assignment, flags) + ], + Precedence.Conditional, + precedence + ); + }, + + LogicalExpression: function (expr, precedence, flags) { + return this.BinaryExpression(expr, precedence, flags); + }, + + BinaryExpression: function (expr, precedence, flags) { + var result, leftPrecedence, rightPrecedence, currentPrecedence, fragment, leftSource; + currentPrecedence = BinaryPrecedence[expr.operator]; + leftPrecedence = expr.operator === '**' ? Precedence.Postfix : currentPrecedence; + rightPrecedence = expr.operator === '**' ? currentPrecedence : currentPrecedence + 1; + + if (currentPrecedence < precedence) { + flags |= F_ALLOW_IN; + } + + fragment = this.generateExpression(expr.left, leftPrecedence, flags); + + leftSource = fragment.toString(); + + if (leftSource.charCodeAt(leftSource.length - 1) === 0x2F /* / */ && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) { + result = [fragment, noEmptySpace(), expr.operator]; + } else { + result = join(fragment, expr.operator); + } + + fragment = this.generateExpression(expr.right, rightPrecedence, flags); + + if (expr.operator === '/' && fragment.toString().charAt(0) === '/' || + expr.operator.slice(-1) === '<' && fragment.toString().slice(0, 3) === '!--') { + // If '/' concats with '/' or `<` concats with `!--`, it is interpreted as comment start + result.push(noEmptySpace()); + result.push(fragment); + } else { + result = join(result, fragment); + } + + if (expr.operator === 'in' && !(flags & F_ALLOW_IN)) { + return ['(', result, ')']; + } + return parenthesize(result, currentPrecedence, precedence); + }, + + CallExpression: function (expr, precedence, flags) { + var result, i, iz; + // F_ALLOW_UNPARATH_NEW becomes false. + result = [this.generateExpression(expr.callee, Precedence.Call, E_TTF)]; + result.push('('); + for (i = 0, iz = expr['arguments'].length; i < iz; ++i) { + result.push(this.generateExpression(expr['arguments'][i], Precedence.Assignment, E_TTT)); + if (i + 1 < iz) { + result.push(',' + space); + } + } + result.push(')'); + + if (!(flags & F_ALLOW_CALL)) { + return ['(', result, ')']; + } + return parenthesize(result, Precedence.Call, precedence); + }, + + NewExpression: function (expr, precedence, flags) { + var result, length, i, iz, itemFlags; + length = expr['arguments'].length; + + // F_ALLOW_CALL becomes false. + // F_ALLOW_UNPARATH_NEW may become false. + itemFlags = (flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0) ? E_TFT : E_TFF; + + result = join( + 'new', + this.generateExpression(expr.callee, Precedence.New, itemFlags) + ); + + if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) { + result.push('('); + for (i = 0, iz = length; i < iz; ++i) { + result.push(this.generateExpression(expr['arguments'][i], Precedence.Assignment, E_TTT)); + if (i + 1 < iz) { + result.push(',' + space); + } + } + result.push(')'); + } + + return parenthesize(result, Precedence.New, precedence); + }, + + MemberExpression: function (expr, precedence, flags) { + var result, fragment; + + // F_ALLOW_UNPARATH_NEW becomes false. + result = [this.generateExpression(expr.object, Precedence.Call, (flags & F_ALLOW_CALL) ? E_TTF : E_TFF)]; + + if (expr.computed) { + result.push('['); + result.push(this.generateExpression(expr.property, Precedence.Sequence, flags & F_ALLOW_CALL ? E_TTT : E_TFT)); + result.push(']'); + } else { + if (expr.object.type === Syntax.Literal && typeof expr.object.value === 'number') { + fragment = toSourceNodeWhenNeeded(result).toString(); + // When the following conditions are all true, + // 1. No floating point + // 2. Don't have exponents + // 3. The last character is a decimal digit + // 4. Not hexadecimal OR octal number literal + // we should add a floating point. + if ( + fragment.indexOf('.') < 0 && + !/[eExX]/.test(fragment) && + esutils.code.isDecimalDigit(fragment.charCodeAt(fragment.length - 1)) && + !(fragment.length >= 2 && fragment.charCodeAt(0) === 48) // '0' + ) { + result.push(' '); + } + } + result.push('.'); + result.push(generateIdentifier(expr.property)); + } + + return parenthesize(result, Precedence.Member, precedence); + }, + + MetaProperty: function (expr, precedence, flags) { + var result; + result = []; + result.push(typeof expr.meta === "string" ? expr.meta : generateIdentifier(expr.meta)); + result.push('.'); + result.push(typeof expr.property === "string" ? expr.property : generateIdentifier(expr.property)); + return parenthesize(result, Precedence.Member, precedence); + }, + + UnaryExpression: function (expr, precedence, flags) { + var result, fragment, rightCharCode, leftSource, leftCharCode; + fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT); + + if (space === '') { + result = join(expr.operator, fragment); + } else { + result = [expr.operator]; + if (expr.operator.length > 2) { + // delete, void, typeof + // get `typeof []`, not `typeof[]` + result = join(result, fragment); + } else { + // Prevent inserting spaces between operator and argument if it is unnecessary + // like, `!cond` + leftSource = toSourceNodeWhenNeeded(result).toString(); + leftCharCode = leftSource.charCodeAt(leftSource.length - 1); + rightCharCode = fragment.toString().charCodeAt(0); + + if (((leftCharCode === 0x2B /* + */ || leftCharCode === 0x2D /* - */) && leftCharCode === rightCharCode) || + (esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode))) { + result.push(noEmptySpace()); + result.push(fragment); + } else { + result.push(fragment); + } + } + } + return parenthesize(result, Precedence.Unary, precedence); + }, + + YieldExpression: function (expr, precedence, flags) { + var result; + if (expr.delegate) { + result = 'yield*'; + } else { + result = 'yield'; + } + if (expr.argument) { + result = join( + result, + this.generateExpression(expr.argument, Precedence.Yield, E_TTT) + ); + } + return parenthesize(result, Precedence.Yield, precedence); + }, + + AwaitExpression: function (expr, precedence, flags) { + var result = join( + expr.all ? 'await*' : 'await', + this.generateExpression(expr.argument, Precedence.Await, E_TTT) + ); + return parenthesize(result, Precedence.Await, precedence); + }, + + UpdateExpression: function (expr, precedence, flags) { + if (expr.prefix) { + return parenthesize( + [ + expr.operator, + this.generateExpression(expr.argument, Precedence.Unary, E_TTT) + ], + Precedence.Unary, + precedence + ); + } + return parenthesize( + [ + this.generateExpression(expr.argument, Precedence.Postfix, E_TTT), + expr.operator + ], + Precedence.Postfix, + precedence + ); + }, + + FunctionExpression: function (expr, precedence, flags) { + var result = [ + generateAsyncPrefix(expr, true), + 'function' + ]; + if (expr.id) { + result.push(generateStarSuffix(expr) || noEmptySpace()); + result.push(generateIdentifier(expr.id)); + } else { + result.push(generateStarSuffix(expr) || space); + } + result.push(this.generateFunctionBody(expr)); + return result; + }, + + ArrayPattern: function (expr, precedence, flags) { + return this.ArrayExpression(expr, precedence, flags, true); + }, + + ArrayExpression: function (expr, precedence, flags, isPattern) { + var result, multiline, that = this; + if (!expr.elements.length) { + return '[]'; + } + multiline = isPattern ? false : expr.elements.length > 1; + result = ['[', multiline ? newline : '']; + withIndent(function (indent) { + var i, iz; + for (i = 0, iz = expr.elements.length; i < iz; ++i) { + if (!expr.elements[i]) { + if (multiline) { + result.push(indent); + } + if (i + 1 === iz) { + result.push(','); + } + } else { + result.push(multiline ? indent : ''); + result.push(that.generateExpression(expr.elements[i], Precedence.Assignment, E_TTT)); + } + if (i + 1 < iz) { + result.push(',' + (multiline ? newline : space)); + } + } + }); + if (multiline && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(multiline ? base : ''); + result.push(']'); + return result; + }, + + RestElement: function(expr, precedence, flags) { + return '...' + this.generatePattern(expr.argument); + }, + + ClassExpression: function (expr, precedence, flags) { + var result, fragment; + result = ['class']; + if (expr.id) { + result = join(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT)); + } + if (expr.superClass) { + fragment = join('extends', this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)); + result = join(result, fragment); + } + result.push(space); + result.push(this.generateStatement(expr.body, S_TFFT)); + return result; + }, + + MethodDefinition: function (expr, precedence, flags) { + var result, fragment; + if (expr['static']) { + result = ['static' + space]; + } else { + result = []; + } + if (expr.kind === 'get' || expr.kind === 'set') { + fragment = [ + join(expr.kind, this.generatePropertyKey(expr.key, expr.computed)), + this.generateFunctionBody(expr.value) + ]; + } else { + fragment = [ + generateMethodPrefix(expr), + this.generatePropertyKey(expr.key, expr.computed), + this.generateFunctionBody(expr.value) + ]; + } + return join(result, fragment); + }, + + Property: function (expr, precedence, flags) { + if (expr.kind === 'get' || expr.kind === 'set') { + return [ + expr.kind, noEmptySpace(), + this.generatePropertyKey(expr.key, expr.computed), + this.generateFunctionBody(expr.value) + ]; + } + + if (expr.shorthand) { + if (expr.value.type === "AssignmentPattern") { + return this.AssignmentPattern(expr.value, Precedence.Sequence, E_TTT); + } + return this.generatePropertyKey(expr.key, expr.computed); + } + + if (expr.method) { + return [ + generateMethodPrefix(expr), + this.generatePropertyKey(expr.key, expr.computed), + this.generateFunctionBody(expr.value) + ]; + } + + return [ + this.generatePropertyKey(expr.key, expr.computed), + ':' + space, + this.generateExpression(expr.value, Precedence.Assignment, E_TTT) + ]; + }, + + ObjectExpression: function (expr, precedence, flags) { + var multiline, result, fragment, that = this; + + if (!expr.properties.length) { + return '{}'; + } + multiline = expr.properties.length > 1; + + withIndent(function () { + fragment = that.generateExpression(expr.properties[0], Precedence.Sequence, E_TTT); + }); + + if (!multiline) { + // issues 4 + // Do not transform from + // dejavu.Class.declare({ + // method2: function () {} + // }); + // to + // dejavu.Class.declare({method2: function () { + // }}); + if (!hasLineTerminator(toSourceNodeWhenNeeded(fragment).toString())) { + return [ '{', space, fragment, space, '}' ]; + } + } + + withIndent(function (indent) { + var i, iz; + result = [ '{', newline, indent, fragment ]; + + if (multiline) { + result.push(',' + newline); + for (i = 1, iz = expr.properties.length; i < iz; ++i) { + result.push(indent); + result.push(that.generateExpression(expr.properties[i], Precedence.Sequence, E_TTT)); + if (i + 1 < iz) { + result.push(',' + newline); + } + } + } + }); + + if (!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(base); + result.push('}'); + return result; + }, + + AssignmentPattern: function(expr, precedence, flags) { + return this.generateAssignment(expr.left, expr.right, '=', precedence, flags); + }, + + ObjectPattern: function (expr, precedence, flags) { + var result, i, iz, multiline, property, that = this; + if (!expr.properties.length) { + return '{}'; + } + + multiline = false; + if (expr.properties.length === 1) { + property = expr.properties[0]; + if ( + property.type === Syntax.Property + && property.value.type !== Syntax.Identifier + ) { + multiline = true; + } + } else { + for (i = 0, iz = expr.properties.length; i < iz; ++i) { + property = expr.properties[i]; + if ( + property.type === Syntax.Property + && !property.shorthand + ) { + multiline = true; + break; + } + } + } + result = ['{', multiline ? newline : '' ]; + + withIndent(function (indent) { + var i, iz; + for (i = 0, iz = expr.properties.length; i < iz; ++i) { + result.push(multiline ? indent : ''); + result.push(that.generateExpression(expr.properties[i], Precedence.Sequence, E_TTT)); + if (i + 1 < iz) { + result.push(',' + (multiline ? newline : space)); + } + } + }); + + if (multiline && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())) { + result.push(newline); + } + result.push(multiline ? base : ''); + result.push('}'); + return result; + }, + + ThisExpression: function (expr, precedence, flags) { + return 'this'; + }, + + Super: function (expr, precedence, flags) { + return 'super'; + }, + + Identifier: function (expr, precedence, flags) { + return generateIdentifier(expr); + }, + + ImportDefaultSpecifier: function (expr, precedence, flags) { + return generateIdentifier(expr.id || expr.local); + }, + + ImportNamespaceSpecifier: function (expr, precedence, flags) { + var result = ['*']; + var id = expr.id || expr.local; + if (id) { + result.push(space + 'as' + noEmptySpace() + generateIdentifier(id)); + } + return result; + }, + + ImportSpecifier: function (expr, precedence, flags) { + var imported = expr.imported; + var result = [ imported.name ]; + var local = expr.local; + if (local && local.name !== imported.name) { + result.push(noEmptySpace() + 'as' + noEmptySpace() + generateIdentifier(local)); + } + return result; + }, + + ExportSpecifier: function (expr, precedence, flags) { + var local = expr.local; + var result = [ local.name ]; + var exported = expr.exported; + if (exported && exported.name !== local.name) { + result.push(noEmptySpace() + 'as' + noEmptySpace() + generateIdentifier(exported)); + } + return result; + }, + + Literal: function (expr, precedence, flags) { + var raw; + if (expr.hasOwnProperty('raw') && parse && extra.raw) { + try { + raw = parse(expr.raw).body[0].expression; + if (raw.type === Syntax.Literal) { + if (raw.value === expr.value) { + return expr.raw; + } + } + } catch (e) { + // not use raw property + } + } + + if (expr.regex) { + return '/' + expr.regex.pattern + '/' + expr.regex.flags; + } + + if (expr.value === null) { + return 'null'; + } + + if (typeof expr.value === 'string') { + return escapeString(expr.value); + } + + if (typeof expr.value === 'number') { + return generateNumber(expr.value); + } + + if (typeof expr.value === 'boolean') { + return expr.value ? 'true' : 'false'; + } + + return generateRegExp(expr.value); + }, + + GeneratorExpression: function (expr, precedence, flags) { + return this.ComprehensionExpression(expr, precedence, flags); + }, + + ComprehensionExpression: function (expr, precedence, flags) { + // GeneratorExpression should be parenthesized with (...), ComprehensionExpression with [...] + // Due to https://bugzilla.mozilla.org/show_bug.cgi?id=883468 position of expr.body can differ in Spidermonkey and ES6 + + var result, i, iz, fragment, that = this; + result = (expr.type === Syntax.GeneratorExpression) ? ['('] : ['[']; + + if (extra.moz.comprehensionExpressionStartsWithAssignment) { + fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT); + result.push(fragment); + } + + if (expr.blocks) { + withIndent(function () { + for (i = 0, iz = expr.blocks.length; i < iz; ++i) { + fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT); + if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) { + result = join(result, fragment); + } else { + result.push(fragment); + } + } + }); + } + + if (expr.filter) { + result = join(result, 'if' + space); + fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT); + result = join(result, [ '(', fragment, ')' ]); + } + + if (!extra.moz.comprehensionExpressionStartsWithAssignment) { + fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT); + + result = join(result, fragment); + } + + result.push((expr.type === Syntax.GeneratorExpression) ? ')' : ']'); + return result; + }, + + ComprehensionBlock: function (expr, precedence, flags) { + var fragment; + if (expr.left.type === Syntax.VariableDeclaration) { + fragment = [ + expr.left.kind, noEmptySpace(), + this.generateStatement(expr.left.declarations[0], S_FFFF) + ]; + } else { + fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT); + } + + fragment = join(fragment, expr.of ? 'of' : 'in'); + fragment = join(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)); + + return [ 'for' + space + '(', fragment, ')' ]; + }, + + SpreadElement: function (expr, precedence, flags) { + return [ + '...', + this.generateExpression(expr.argument, Precedence.Assignment, E_TTT) + ]; + }, + + TaggedTemplateExpression: function (expr, precedence, flags) { + var itemFlags = E_TTF; + if (!(flags & F_ALLOW_CALL)) { + itemFlags = E_TFF; + } + var result = [ + this.generateExpression(expr.tag, Precedence.Call, itemFlags), + this.generateExpression(expr.quasi, Precedence.Primary, E_FFT) + ]; + return parenthesize(result, Precedence.TaggedTemplate, precedence); + }, + + TemplateElement: function (expr, precedence, flags) { + // Don't use "cooked". Since tagged template can use raw template + // representation. So if we do so, it breaks the script semantics. + return expr.value.raw; + }, + + TemplateLiteral: function (expr, precedence, flags) { + var result, i, iz; + result = [ '`' ]; + for (i = 0, iz = expr.quasis.length; i < iz; ++i) { + result.push(this.generateExpression(expr.quasis[i], Precedence.Primary, E_TTT)); + if (i + 1 < iz) { + result.push('${' + space); + result.push(this.generateExpression(expr.expressions[i], Precedence.Sequence, E_TTT)); + result.push(space + '}'); + } + } + result.push('`'); + return result; + }, + + ModuleSpecifier: function (expr, precedence, flags) { + return this.Literal(expr, precedence, flags); + }, + + ImportExpression: function(expr, precedence, flag) { + return parenthesize([ + 'import(', + this.generateExpression(expr.source, Precedence.Assignment, E_TTT), + ')' + ], Precedence.Call, precedence); + }, + + }; + + merge(CodeGenerator.prototype, CodeGenerator.Expression); + + CodeGenerator.prototype.generateExpression = function (expr, precedence, flags) { + var result, type; + + type = expr.type || Syntax.Property; + + if (extra.verbatim && expr.hasOwnProperty(extra.verbatim)) { + return generateVerbatim(expr, precedence); + } + + result = this[type](expr, precedence, flags); + + + if (extra.comment) { + result = addComments(expr, result); + } + return toSourceNodeWhenNeeded(result, expr); + }; + + CodeGenerator.prototype.generateStatement = function (stmt, flags) { + var result, + fragment; + + result = this[stmt.type](stmt, flags); + + // Attach comments + + if (extra.comment) { + result = addComments(stmt, result); + } + + fragment = toSourceNodeWhenNeeded(result).toString(); + if (stmt.type === Syntax.Program && !safeConcatenation && newline === '' && fragment.charAt(fragment.length - 1) === '\n') { + result = sourceMap ? toSourceNodeWhenNeeded(result).replaceRight(/\s+$/, '') : fragment.replace(/\s+$/, ''); + } + + return toSourceNodeWhenNeeded(result, stmt); + }; + + function generateInternal(node) { + var codegen; + + codegen = new CodeGenerator(); + if (isStatement(node)) { + return codegen.generateStatement(node, S_TFFF); + } + + if (isExpression(node)) { + return codegen.generateExpression(node, Precedence.Sequence, E_TTT); + } + + throw new Error('Unknown node type: ' + node.type); + } + + function generate(node, options) { + var defaultOptions = getDefaultOptions(), result, pair; + + if (options != null) { + // Obsolete options + // + // `options.indent` + // `options.base` + // + // Instead of them, we can use `option.format.indent`. + if (typeof options.indent === 'string') { + defaultOptions.format.indent.style = options.indent; + } + if (typeof options.base === 'number') { + defaultOptions.format.indent.base = options.base; + } + options = updateDeeply(defaultOptions, options); + indent = options.format.indent.style; + if (typeof options.base === 'string') { + base = options.base; + } else { + base = stringRepeat(indent, options.format.indent.base); + } + } else { + options = defaultOptions; + indent = options.format.indent.style; + base = stringRepeat(indent, options.format.indent.base); + } + json = options.format.json; + renumber = options.format.renumber; + hexadecimal = json ? false : options.format.hexadecimal; + quotes = json ? 'double' : options.format.quotes; + escapeless = options.format.escapeless; + newline = options.format.newline; + space = options.format.space; + if (options.format.compact) { + newline = space = indent = base = ''; + } + parentheses = options.format.parentheses; + semicolons = options.format.semicolons; + safeConcatenation = options.format.safeConcatenation; + directive = options.directive; + parse = json ? null : options.parse; + sourceMap = options.sourceMap; + sourceCode = options.sourceCode; + preserveBlankLines = options.format.preserveBlankLines && sourceCode !== null; + extra = options; + + if (sourceMap) { + if (!exports.browser) { + // We assume environment is node.js + // And prevent from including source-map by browserify + SourceNode = __nccwpck_require__(56594).SourceNode; + } else { + SourceNode = global.sourceMap.SourceNode; + } + } + + result = generateInternal(node); + + if (!sourceMap) { + pair = {code: result.toString(), map: null}; + return options.sourceMapWithCode ? pair : pair.code; + } + + + pair = result.toStringWithSourceMap({ + file: options.file, + sourceRoot: options.sourceMapRoot + }); + + if (options.sourceContent) { + pair.map.setSourceContent(options.sourceMap, + options.sourceContent); + } + + if (options.sourceMapWithCode) { + return pair; + } + + return pair.map.toString(); + } + + FORMAT_MINIFY = { + indent: { + style: '', + base: 0 + }, + renumber: true, + hexadecimal: true, + quotes: 'auto', + escapeless: true, + compact: true, + parentheses: false, + semicolons: false + }; + + FORMAT_DEFAULTS = getDefaultOptions().format; + + exports.version = __nccwpck_require__(70149).version; + exports.generate = generate; + exports.attachComments = estraverse.attachComments; + exports.Precedence = updateDeeply({}, Precedence); + exports.browser = false; + exports.FORMAT_MINIFY = FORMAT_MINIFY; + exports.FORMAT_DEFAULTS = FORMAT_DEFAULTS; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ + + +/***/ }), + +/***/ 78823: +/***/ (function(module) { + +(function webpackUniversalModuleDefinition(root, factory) { +/* istanbul ignore next */ + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __nested_webpack_require_583__(moduleId) { + +/******/ // Check if module is in cache +/* istanbul ignore if */ +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_583__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __nested_webpack_require_583__.m = modules; + +/******/ // expose the module cache +/******/ __nested_webpack_require_583__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __nested_webpack_require_583__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __nested_webpack_require_583__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __nested_webpack_require_1808__) { + + "use strict"; + /* + Copyright JS Foundation and other contributors, https://js.foundation/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + Object.defineProperty(exports, "__esModule", { value: true }); + var comment_handler_1 = __nested_webpack_require_1808__(1); + var jsx_parser_1 = __nested_webpack_require_1808__(3); + var parser_1 = __nested_webpack_require_1808__(8); + var tokenizer_1 = __nested_webpack_require_1808__(15); + function parse(code, options, delegate) { + var commentHandler = null; + var proxyDelegate = function (node, metadata) { + if (delegate) { + delegate(node, metadata); + } + if (commentHandler) { + commentHandler.visit(node, metadata); + } + }; + var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null; + var collectComment = false; + if (options) { + collectComment = (typeof options.comment === 'boolean' && options.comment); + var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment); + if (collectComment || attachComment) { + commentHandler = new comment_handler_1.CommentHandler(); + commentHandler.attach = attachComment; + options.comment = true; + parserDelegate = proxyDelegate; + } + } + var isModule = false; + if (options && typeof options.sourceType === 'string') { + isModule = (options.sourceType === 'module'); + } + var parser; + if (options && typeof options.jsx === 'boolean' && options.jsx) { + parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); + } + else { + parser = new parser_1.Parser(code, options, parserDelegate); + } + var program = isModule ? parser.parseModule() : parser.parseScript(); + var ast = program; + if (collectComment && commentHandler) { + ast.comments = commentHandler.comments; + } + if (parser.config.tokens) { + ast.tokens = parser.tokens; + } + if (parser.config.tolerant) { + ast.errors = parser.errorHandler.errors; + } + return ast; + } + exports.parse = parse; + function parseModule(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'module'; + return parse(code, parsingOptions, delegate); + } + exports.parseModule = parseModule; + function parseScript(code, options, delegate) { + var parsingOptions = options || {}; + parsingOptions.sourceType = 'script'; + return parse(code, parsingOptions, delegate); + } + exports.parseScript = parseScript; + function tokenize(code, options, delegate) { + var tokenizer = new tokenizer_1.Tokenizer(code, options); + var tokens; + tokens = []; + try { + while (true) { + var token = tokenizer.getNextToken(); + if (!token) { + break; + } + if (delegate) { + token = delegate(token); + } + tokens.push(token); + } + } + catch (e) { + tokenizer.errorHandler.tolerate(e); + } + if (tokenizer.errorHandler.tolerant) { + tokens.errors = tokenizer.errors(); + } + return tokens; + } + exports.tokenize = tokenize; + var syntax_1 = __nested_webpack_require_1808__(2); + exports.Syntax = syntax_1.Syntax; + // Sync with *.json manifests. + exports.version = '4.0.1'; + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __nested_webpack_require_6456__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __nested_webpack_require_6456__(2); + var CommentHandler = (function () { + function CommentHandler() { + this.attach = false; + this.comments = []; + this.stack = []; + this.leading = []; + this.trailing = []; + } + CommentHandler.prototype.insertInnerComments = function (node, metadata) { + // innnerComments for properties empty block + // `function a() {/** comments **\/}` + if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { + var innerComments = []; + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (metadata.end.offset >= entry.start) { + innerComments.unshift(entry.comment); + this.leading.splice(i, 1); + this.trailing.splice(i, 1); + } + } + if (innerComments.length) { + node.innerComments = innerComments; + } + } + }; + CommentHandler.prototype.findTrailingComments = function (metadata) { + var trailingComments = []; + if (this.trailing.length > 0) { + for (var i = this.trailing.length - 1; i >= 0; --i) { + var entry_1 = this.trailing[i]; + if (entry_1.start >= metadata.end.offset) { + trailingComments.unshift(entry_1.comment); + } + } + this.trailing.length = 0; + return trailingComments; + } + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.node.trailingComments) { + var firstComment = entry.node.trailingComments[0]; + if (firstComment && firstComment.range[0] >= metadata.end.offset) { + trailingComments = entry.node.trailingComments; + delete entry.node.trailingComments; + } + } + return trailingComments; + }; + CommentHandler.prototype.findLeadingComments = function (metadata) { + var leadingComments = []; + var target; + while (this.stack.length > 0) { + var entry = this.stack[this.stack.length - 1]; + if (entry && entry.start >= metadata.start.offset) { + target = entry.node; + this.stack.pop(); + } + else { + break; + } + } + if (target) { + var count = target.leadingComments ? target.leadingComments.length : 0; + for (var i = count - 1; i >= 0; --i) { + var comment = target.leadingComments[i]; + if (comment.range[1] <= metadata.start.offset) { + leadingComments.unshift(comment); + target.leadingComments.splice(i, 1); + } + } + if (target.leadingComments && target.leadingComments.length === 0) { + delete target.leadingComments; + } + return leadingComments; + } + for (var i = this.leading.length - 1; i >= 0; --i) { + var entry = this.leading[i]; + if (entry.start <= metadata.start.offset) { + leadingComments.unshift(entry.comment); + this.leading.splice(i, 1); + } + } + return leadingComments; + }; + CommentHandler.prototype.visitNode = function (node, metadata) { + if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { + return; + } + this.insertInnerComments(node, metadata); + var trailingComments = this.findTrailingComments(metadata); + var leadingComments = this.findLeadingComments(metadata); + if (leadingComments.length > 0) { + node.leadingComments = leadingComments; + } + if (trailingComments.length > 0) { + node.trailingComments = trailingComments; + } + this.stack.push({ + node: node, + start: metadata.start.offset + }); + }; + CommentHandler.prototype.visitComment = function (node, metadata) { + var type = (node.type[0] === 'L') ? 'Line' : 'Block'; + var comment = { + type: type, + value: node.value + }; + if (node.range) { + comment.range = node.range; + } + if (node.loc) { + comment.loc = node.loc; + } + this.comments.push(comment); + if (this.attach) { + var entry = { + comment: { + type: type, + value: node.value, + range: [metadata.start.offset, metadata.end.offset] + }, + start: metadata.start.offset + }; + if (node.loc) { + entry.comment.loc = node.loc; + } + node.type = type; + this.leading.push(entry); + this.trailing.push(entry); + } + }; + CommentHandler.prototype.visit = function (node, metadata) { + if (node.type === 'LineComment') { + this.visitComment(node, metadata); + } + else if (node.type === 'BlockComment') { + this.visitComment(node, metadata); + } + else if (this.attach) { + this.visitNode(node, metadata); + } + }; + return CommentHandler; + }()); + exports.CommentHandler = CommentHandler; + + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __nested_webpack_require_15019__) { + + "use strict"; +/* istanbul ignore next */ + var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + var character_1 = __nested_webpack_require_15019__(4); + var JSXNode = __nested_webpack_require_15019__(5); + var jsx_syntax_1 = __nested_webpack_require_15019__(6); + var Node = __nested_webpack_require_15019__(7); + var parser_1 = __nested_webpack_require_15019__(8); + var token_1 = __nested_webpack_require_15019__(13); + var xhtml_entities_1 = __nested_webpack_require_15019__(14); + token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier'; + token_1.TokenName[101 /* Text */] = 'JSXText'; + // Fully qualified element name, e.g. returns "svg:path" + function getQualifiedElementName(elementName) { + var qualifiedName; + switch (elementName.type) { + case jsx_syntax_1.JSXSyntax.JSXIdentifier: + var id = elementName; + qualifiedName = id.name; + break; + case jsx_syntax_1.JSXSyntax.JSXNamespacedName: + var ns = elementName; + qualifiedName = getQualifiedElementName(ns.namespace) + ':' + + getQualifiedElementName(ns.name); + break; + case jsx_syntax_1.JSXSyntax.JSXMemberExpression: + var expr = elementName; + qualifiedName = getQualifiedElementName(expr.object) + '.' + + getQualifiedElementName(expr.property); + break; + /* istanbul ignore next */ + default: + break; + } + return qualifiedName; + } + var JSXParser = (function (_super) { + __extends(JSXParser, _super); + function JSXParser(code, options, delegate) { + return _super.call(this, code, options, delegate) || this; + } + JSXParser.prototype.parsePrimaryExpression = function () { + return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); + }; + JSXParser.prototype.startJSX = function () { + // Unwind the scanner before the lookahead token. + this.scanner.index = this.startMarker.index; + this.scanner.lineNumber = this.startMarker.line; + this.scanner.lineStart = this.startMarker.index - this.startMarker.column; + }; + JSXParser.prototype.finishJSX = function () { + // Prime the next lookahead. + this.nextToken(); + }; + JSXParser.prototype.reenterJSX = function () { + this.startJSX(); + this.expectJSX('}'); + // Pop the closing '}' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + }; + JSXParser.prototype.createJSXNode = function () { + this.collectComments(); + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.createJSXChildNode = function () { + return { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + }; + JSXParser.prototype.scanXHTMLEntity = function (quote) { + var result = '&'; + var valid = true; + var terminated = false; + var numeric = false; + var hex = false; + while (!this.scanner.eof() && valid && !terminated) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === quote) { + break; + } + terminated = (ch === ';'); + result += ch; + ++this.scanner.index; + if (!terminated) { + switch (result.length) { + case 2: + // e.g. '{' + numeric = (ch === '#'); + break; + case 3: + if (numeric) { + // e.g. 'A' + hex = (ch === 'x'); + valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); + numeric = numeric && !hex; + } + break; + default: + valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); + valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); + break; + } + } + } + if (valid && terminated && result.length > 2) { + // e.g. 'A' becomes just '#x41' + var str = result.substr(1, result.length - 2); + if (numeric && str.length > 1) { + result = String.fromCharCode(parseInt(str.substr(1), 10)); + } + else if (hex && str.length > 2) { + result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); + } + else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { + result = xhtml_entities_1.XHTMLEntities[str]; + } + } + return result; + }; + // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. + JSXParser.prototype.lexJSX = function () { + var cp = this.scanner.source.charCodeAt(this.scanner.index); + // < > / : = { } + if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { + var value = this.scanner.source[this.scanner.index++]; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index - 1, + end: this.scanner.index + }; + } + // " ' + if (cp === 34 || cp === 39) { + var start = this.scanner.index; + var quote = this.scanner.source[this.scanner.index++]; + var str = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index++]; + if (ch === quote) { + break; + } + else if (ch === '&') { + str += this.scanXHTMLEntity(quote); + } + else { + str += ch; + } + } + return { + type: 8 /* StringLiteral */, + value: str, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ... or . + if (cp === 46) { + var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); + var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); + var value = (n1 === 46 && n2 === 46) ? '...' : '.'; + var start = this.scanner.index; + this.scanner.index += value.length; + return { + type: 7 /* Punctuator */, + value: value, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + // ` + if (cp === 96) { + // Only placeholder, since it will be rescanned as a real assignment expression. + return { + type: 10 /* Template */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: this.scanner.index, + end: this.scanner.index + }; + } + // Identifer can not contain backslash (char code 92). + if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) { + var start = this.scanner.index; + ++this.scanner.index; + while (!this.scanner.eof()) { + var ch = this.scanner.source.charCodeAt(this.scanner.index); + if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) { + ++this.scanner.index; + } + else if (ch === 45) { + // Hyphen (char code 45) can be part of an identifier. + ++this.scanner.index; + } + else { + break; + } + } + var id = this.scanner.source.slice(start, this.scanner.index); + return { + type: 100 /* Identifier */, + value: id, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + } + return this.scanner.lex(); + }; + JSXParser.prototype.nextJSXToken = function () { + this.collectComments(); + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var token = this.lexJSX(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + if (this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.nextJSXText = function () { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + var start = this.scanner.index; + var text = ''; + while (!this.scanner.eof()) { + var ch = this.scanner.source[this.scanner.index]; + if (ch === '{' || ch === '<') { + break; + } + ++this.scanner.index; + text += ch; + if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { + ++this.scanner.lineNumber; + if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { + ++this.scanner.index; + } + this.scanner.lineStart = this.scanner.index; + } + } + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + var token = { + type: 101 /* Text */, + value: text, + lineNumber: this.scanner.lineNumber, + lineStart: this.scanner.lineStart, + start: start, + end: this.scanner.index + }; + if ((text.length > 0) && this.config.tokens) { + this.tokens.push(this.convertToken(token)); + } + return token; + }; + JSXParser.prototype.peekJSXToken = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.lexJSX(); + this.scanner.restoreState(state); + return next; + }; + // Expect the next JSX token to match the specified punctuator. + // If not, an exception will be thrown. + JSXParser.prototype.expectJSX = function (value) { + var token = this.nextJSXToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next JSX token matches the specified punctuator. + JSXParser.prototype.matchJSX = function (value) { + var next = this.peekJSXToken(); + return next.type === 7 /* Punctuator */ && next.value === value; + }; + JSXParser.prototype.parseJSXIdentifier = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 100 /* Identifier */) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); + }; + JSXParser.prototype.parseJSXElementName = function () { + var node = this.createJSXNode(); + var elementName = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = elementName; + this.expectJSX(':'); + var name_1 = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); + } + else if (this.matchJSX('.')) { + while (this.matchJSX('.')) { + var object = elementName; + this.expectJSX('.'); + var property = this.parseJSXIdentifier(); + elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); + } + } + return elementName; + }; + JSXParser.prototype.parseJSXAttributeName = function () { + var node = this.createJSXNode(); + var attributeName; + var identifier = this.parseJSXIdentifier(); + if (this.matchJSX(':')) { + var namespace = identifier; + this.expectJSX(':'); + var name_2 = this.parseJSXIdentifier(); + attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); + } + else { + attributeName = identifier; + } + return attributeName; + }; + JSXParser.prototype.parseJSXStringLiteralAttribute = function () { + var node = this.createJSXNode(); + var token = this.nextJSXToken(); + if (token.type !== 8 /* StringLiteral */) { + this.throwUnexpectedToken(token); + } + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + JSXParser.prototype.parseJSXExpressionAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.finishJSX(); + if (this.match('}')) { + this.tolerateError('JSX attributes must only be assigned a non-empty expression'); + } + var expression = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXAttributeValue = function () { + return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : + this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); + }; + JSXParser.prototype.parseJSXNameValueAttribute = function () { + var node = this.createJSXNode(); + var name = this.parseJSXAttributeName(); + var value = null; + if (this.matchJSX('=')) { + this.expectJSX('='); + value = this.parseJSXAttributeValue(); + } + return this.finalize(node, new JSXNode.JSXAttribute(name, value)); + }; + JSXParser.prototype.parseJSXSpreadAttribute = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + this.expectJSX('...'); + this.finishJSX(); + var argument = this.parseAssignmentExpression(); + this.reenterJSX(); + return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); + }; + JSXParser.prototype.parseJSXAttributes = function () { + var attributes = []; + while (!this.matchJSX('/') && !this.matchJSX('>')) { + var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : + this.parseJSXNameValueAttribute(); + attributes.push(attribute); + } + return attributes; + }; + JSXParser.prototype.parseJSXOpeningElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXBoundaryElement = function () { + var node = this.createJSXNode(); + this.expectJSX('<'); + if (this.matchJSX('/')) { + this.expectJSX('/'); + var name_3 = this.parseJSXElementName(); + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); + } + var name = this.parseJSXElementName(); + var attributes = this.parseJSXAttributes(); + var selfClosing = this.matchJSX('/'); + if (selfClosing) { + this.expectJSX('/'); + } + this.expectJSX('>'); + return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); + }; + JSXParser.prototype.parseJSXEmptyExpression = function () { + var node = this.createJSXChildNode(); + this.collectComments(); + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + return this.finalize(node, new JSXNode.JSXEmptyExpression()); + }; + JSXParser.prototype.parseJSXExpressionContainer = function () { + var node = this.createJSXNode(); + this.expectJSX('{'); + var expression; + if (this.matchJSX('}')) { + expression = this.parseJSXEmptyExpression(); + this.expectJSX('}'); + } + else { + this.finishJSX(); + expression = this.parseAssignmentExpression(); + this.reenterJSX(); + } + return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); + }; + JSXParser.prototype.parseJSXChildren = function () { + var children = []; + while (!this.scanner.eof()) { + var node = this.createJSXChildNode(); + var token = this.nextJSXText(); + if (token.start < token.end) { + var raw = this.getTokenRaw(token); + var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); + children.push(child); + } + if (this.scanner.source[this.scanner.index] === '{') { + var container = this.parseJSXExpressionContainer(); + children.push(container); + } + else { + break; + } + } + return children; + }; + JSXParser.prototype.parseComplexJSXElement = function (el) { + var stack = []; + while (!this.scanner.eof()) { + el.children = el.children.concat(this.parseJSXChildren()); + var node = this.createJSXChildNode(); + var element = this.parseJSXBoundaryElement(); + if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { + var opening = element; + if (opening.selfClosing) { + var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); + el.children.push(child); + } + else { + stack.push(el); + el = { node: node, opening: opening, closing: null, children: [] }; + } + } + if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { + el.closing = element; + var open_1 = getQualifiedElementName(el.opening.name); + var close_1 = getQualifiedElementName(el.closing.name); + if (open_1 !== close_1) { + this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); + } + if (stack.length > 0) { + var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); + el = stack[stack.length - 1]; + el.children.push(child); + stack.pop(); + } + else { + break; + } + } + } + return el; + }; + JSXParser.prototype.parseJSXElement = function () { + var node = this.createJSXNode(); + var opening = this.parseJSXOpeningElement(); + var children = []; + var closing = null; + if (!opening.selfClosing) { + var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children }); + children = el.children; + closing = el.closing; + } + return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); + }; + JSXParser.prototype.parseJSXRoot = function () { + // Pop the opening '<' added from the lookahead. + if (this.config.tokens) { + this.tokens.pop(); + } + this.startJSX(); + var element = this.parseJSXElement(); + this.finishJSX(); + return element; + }; + JSXParser.prototype.isStartOfExpression = function () { + return _super.prototype.isStartOfExpression.call(this) || this.match('<'); + }; + return JSXParser; + }(parser_1.Parser)); + exports.JSXParser = JSXParser; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // See also tools/generate-unicode-regex.js. + var Regex = { + // Unicode v8.0.0 NonAsciiIdentifierStart: + NonAsciiIdentifierStart: /[\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u1877\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\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, + // Unicode v8.0.0 NonAsciiIdentifierPart: + NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\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-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ + }; + exports.Character = { + /* tslint:disable:no-bitwise */ + fromCodePoint: function (cp) { + return (cp < 0x10000) ? String.fromCharCode(cp) : + String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) + + String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023)); + }, + // https://tc39.github.io/ecma262/#sec-white-space + isWhiteSpace: function (cp) { + return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) || + (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0); + }, + // https://tc39.github.io/ecma262/#sec-line-terminators + isLineTerminator: function (cp) { + return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029); + }, + // https://tc39.github.io/ecma262/#sec-names-and-keywords + isIdentifierStart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp))); + }, + isIdentifierPart: function (cp) { + return (cp === 0x24) || (cp === 0x5F) || + (cp >= 0x41 && cp <= 0x5A) || + (cp >= 0x61 && cp <= 0x7A) || + (cp >= 0x30 && cp <= 0x39) || + (cp === 0x5C) || + ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp))); + }, + // https://tc39.github.io/ecma262/#sec-literals-numeric-literals + isDecimalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39); // 0..9 + }, + isHexDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x39) || + (cp >= 0x41 && cp <= 0x46) || + (cp >= 0x61 && cp <= 0x66); // a..f + }, + isOctalDigit: function (cp) { + return (cp >= 0x30 && cp <= 0x37); // 0..7 + } + }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __nested_webpack_require_54354__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var jsx_syntax_1 = __nested_webpack_require_54354__(6); + /* tslint:disable:max-classes-per-file */ + var JSXClosingElement = (function () { + function JSXClosingElement(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; + this.name = name; + } + return JSXClosingElement; + }()); + exports.JSXClosingElement = JSXClosingElement; + var JSXElement = (function () { + function JSXElement(openingElement, children, closingElement) { + this.type = jsx_syntax_1.JSXSyntax.JSXElement; + this.openingElement = openingElement; + this.children = children; + this.closingElement = closingElement; + } + return JSXElement; + }()); + exports.JSXElement = JSXElement; + var JSXEmptyExpression = (function () { + function JSXEmptyExpression() { + this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; + } + return JSXEmptyExpression; + }()); + exports.JSXEmptyExpression = JSXEmptyExpression; + var JSXExpressionContainer = (function () { + function JSXExpressionContainer(expression) { + this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; + this.expression = expression; + } + return JSXExpressionContainer; + }()); + exports.JSXExpressionContainer = JSXExpressionContainer; + var JSXIdentifier = (function () { + function JSXIdentifier(name) { + this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; + this.name = name; + } + return JSXIdentifier; + }()); + exports.JSXIdentifier = JSXIdentifier; + var JSXMemberExpression = (function () { + function JSXMemberExpression(object, property) { + this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; + this.object = object; + this.property = property; + } + return JSXMemberExpression; + }()); + exports.JSXMemberExpression = JSXMemberExpression; + var JSXAttribute = (function () { + function JSXAttribute(name, value) { + this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; + this.name = name; + this.value = value; + } + return JSXAttribute; + }()); + exports.JSXAttribute = JSXAttribute; + var JSXNamespacedName = (function () { + function JSXNamespacedName(namespace, name) { + this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; + this.namespace = namespace; + this.name = name; + } + return JSXNamespacedName; + }()); + exports.JSXNamespacedName = JSXNamespacedName; + var JSXOpeningElement = (function () { + function JSXOpeningElement(name, selfClosing, attributes) { + this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; + this.name = name; + this.selfClosing = selfClosing; + this.attributes = attributes; + } + return JSXOpeningElement; + }()); + exports.JSXOpeningElement = JSXOpeningElement; + var JSXSpreadAttribute = (function () { + function JSXSpreadAttribute(argument) { + this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; + this.argument = argument; + } + return JSXSpreadAttribute; + }()); + exports.JSXSpreadAttribute = JSXSpreadAttribute; + var JSXText = (function () { + function JSXText(value, raw) { + this.type = jsx_syntax_1.JSXSyntax.JSXText; + this.value = value; + this.raw = raw; + } + return JSXText; + }()); + exports.JSXText = JSXText; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JSXSyntax = { + JSXAttribute: 'JSXAttribute', + JSXClosingElement: 'JSXClosingElement', + JSXElement: 'JSXElement', + JSXEmptyExpression: 'JSXEmptyExpression', + JSXExpressionContainer: 'JSXExpressionContainer', + JSXIdentifier: 'JSXIdentifier', + JSXMemberExpression: 'JSXMemberExpression', + JSXNamespacedName: 'JSXNamespacedName', + JSXOpeningElement: 'JSXOpeningElement', + JSXSpreadAttribute: 'JSXSpreadAttribute', + JSXText: 'JSXText' + }; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __nested_webpack_require_58416__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var syntax_1 = __nested_webpack_require_58416__(2); + /* tslint:disable:max-classes-per-file */ + var ArrayExpression = (function () { + function ArrayExpression(elements) { + this.type = syntax_1.Syntax.ArrayExpression; + this.elements = elements; + } + return ArrayExpression; + }()); + exports.ArrayExpression = ArrayExpression; + var ArrayPattern = (function () { + function ArrayPattern(elements) { + this.type = syntax_1.Syntax.ArrayPattern; + this.elements = elements; + } + return ArrayPattern; + }()); + exports.ArrayPattern = ArrayPattern; + var ArrowFunctionExpression = (function () { + function ArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = false; + } + return ArrowFunctionExpression; + }()); + exports.ArrowFunctionExpression = ArrowFunctionExpression; + var AssignmentExpression = (function () { + function AssignmentExpression(operator, left, right) { + this.type = syntax_1.Syntax.AssignmentExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return AssignmentExpression; + }()); + exports.AssignmentExpression = AssignmentExpression; + var AssignmentPattern = (function () { + function AssignmentPattern(left, right) { + this.type = syntax_1.Syntax.AssignmentPattern; + this.left = left; + this.right = right; + } + return AssignmentPattern; + }()); + exports.AssignmentPattern = AssignmentPattern; + var AsyncArrowFunctionExpression = (function () { + function AsyncArrowFunctionExpression(params, body, expression) { + this.type = syntax_1.Syntax.ArrowFunctionExpression; + this.id = null; + this.params = params; + this.body = body; + this.generator = false; + this.expression = expression; + this.async = true; + } + return AsyncArrowFunctionExpression; + }()); + exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; + var AsyncFunctionDeclaration = (function () { + function AsyncFunctionDeclaration(id, params, body) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionDeclaration; + }()); + exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; + var AsyncFunctionExpression = (function () { + function AsyncFunctionExpression(id, params, body) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = false; + this.expression = false; + this.async = true; + } + return AsyncFunctionExpression; + }()); + exports.AsyncFunctionExpression = AsyncFunctionExpression; + var AwaitExpression = (function () { + function AwaitExpression(argument) { + this.type = syntax_1.Syntax.AwaitExpression; + this.argument = argument; + } + return AwaitExpression; + }()); + exports.AwaitExpression = AwaitExpression; + var BinaryExpression = (function () { + function BinaryExpression(operator, left, right) { + var logical = (operator === '||' || operator === '&&'); + this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; + this.operator = operator; + this.left = left; + this.right = right; + } + return BinaryExpression; + }()); + exports.BinaryExpression = BinaryExpression; + var BlockStatement = (function () { + function BlockStatement(body) { + this.type = syntax_1.Syntax.BlockStatement; + this.body = body; + } + return BlockStatement; + }()); + exports.BlockStatement = BlockStatement; + var BreakStatement = (function () { + function BreakStatement(label) { + this.type = syntax_1.Syntax.BreakStatement; + this.label = label; + } + return BreakStatement; + }()); + exports.BreakStatement = BreakStatement; + var CallExpression = (function () { + function CallExpression(callee, args) { + this.type = syntax_1.Syntax.CallExpression; + this.callee = callee; + this.arguments = args; + } + return CallExpression; + }()); + exports.CallExpression = CallExpression; + var CatchClause = (function () { + function CatchClause(param, body) { + this.type = syntax_1.Syntax.CatchClause; + this.param = param; + this.body = body; + } + return CatchClause; + }()); + exports.CatchClause = CatchClause; + var ClassBody = (function () { + function ClassBody(body) { + this.type = syntax_1.Syntax.ClassBody; + this.body = body; + } + return ClassBody; + }()); + exports.ClassBody = ClassBody; + var ClassDeclaration = (function () { + function ClassDeclaration(id, superClass, body) { + this.type = syntax_1.Syntax.ClassDeclaration; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassDeclaration; + }()); + exports.ClassDeclaration = ClassDeclaration; + var ClassExpression = (function () { + function ClassExpression(id, superClass, body) { + this.type = syntax_1.Syntax.ClassExpression; + this.id = id; + this.superClass = superClass; + this.body = body; + } + return ClassExpression; + }()); + exports.ClassExpression = ClassExpression; + var ComputedMemberExpression = (function () { + function ComputedMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = true; + this.object = object; + this.property = property; + } + return ComputedMemberExpression; + }()); + exports.ComputedMemberExpression = ComputedMemberExpression; + var ConditionalExpression = (function () { + function ConditionalExpression(test, consequent, alternate) { + this.type = syntax_1.Syntax.ConditionalExpression; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return ConditionalExpression; + }()); + exports.ConditionalExpression = ConditionalExpression; + var ContinueStatement = (function () { + function ContinueStatement(label) { + this.type = syntax_1.Syntax.ContinueStatement; + this.label = label; + } + return ContinueStatement; + }()); + exports.ContinueStatement = ContinueStatement; + var DebuggerStatement = (function () { + function DebuggerStatement() { + this.type = syntax_1.Syntax.DebuggerStatement; + } + return DebuggerStatement; + }()); + exports.DebuggerStatement = DebuggerStatement; + var Directive = (function () { + function Directive(expression, directive) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + this.directive = directive; + } + return Directive; + }()); + exports.Directive = Directive; + var DoWhileStatement = (function () { + function DoWhileStatement(body, test) { + this.type = syntax_1.Syntax.DoWhileStatement; + this.body = body; + this.test = test; + } + return DoWhileStatement; + }()); + exports.DoWhileStatement = DoWhileStatement; + var EmptyStatement = (function () { + function EmptyStatement() { + this.type = syntax_1.Syntax.EmptyStatement; + } + return EmptyStatement; + }()); + exports.EmptyStatement = EmptyStatement; + var ExportAllDeclaration = (function () { + function ExportAllDeclaration(source) { + this.type = syntax_1.Syntax.ExportAllDeclaration; + this.source = source; + } + return ExportAllDeclaration; + }()); + exports.ExportAllDeclaration = ExportAllDeclaration; + var ExportDefaultDeclaration = (function () { + function ExportDefaultDeclaration(declaration) { + this.type = syntax_1.Syntax.ExportDefaultDeclaration; + this.declaration = declaration; + } + return ExportDefaultDeclaration; + }()); + exports.ExportDefaultDeclaration = ExportDefaultDeclaration; + var ExportNamedDeclaration = (function () { + function ExportNamedDeclaration(declaration, specifiers, source) { + this.type = syntax_1.Syntax.ExportNamedDeclaration; + this.declaration = declaration; + this.specifiers = specifiers; + this.source = source; + } + return ExportNamedDeclaration; + }()); + exports.ExportNamedDeclaration = ExportNamedDeclaration; + var ExportSpecifier = (function () { + function ExportSpecifier(local, exported) { + this.type = syntax_1.Syntax.ExportSpecifier; + this.exported = exported; + this.local = local; + } + return ExportSpecifier; + }()); + exports.ExportSpecifier = ExportSpecifier; + var ExpressionStatement = (function () { + function ExpressionStatement(expression) { + this.type = syntax_1.Syntax.ExpressionStatement; + this.expression = expression; + } + return ExpressionStatement; + }()); + exports.ExpressionStatement = ExpressionStatement; + var ForInStatement = (function () { + function ForInStatement(left, right, body) { + this.type = syntax_1.Syntax.ForInStatement; + this.left = left; + this.right = right; + this.body = body; + this.each = false; + } + return ForInStatement; + }()); + exports.ForInStatement = ForInStatement; + var ForOfStatement = (function () { + function ForOfStatement(left, right, body) { + this.type = syntax_1.Syntax.ForOfStatement; + this.left = left; + this.right = right; + this.body = body; + } + return ForOfStatement; + }()); + exports.ForOfStatement = ForOfStatement; + var ForStatement = (function () { + function ForStatement(init, test, update, body) { + this.type = syntax_1.Syntax.ForStatement; + this.init = init; + this.test = test; + this.update = update; + this.body = body; + } + return ForStatement; + }()); + exports.ForStatement = ForStatement; + var FunctionDeclaration = (function () { + function FunctionDeclaration(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionDeclaration; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionDeclaration; + }()); + exports.FunctionDeclaration = FunctionDeclaration; + var FunctionExpression = (function () { + function FunctionExpression(id, params, body, generator) { + this.type = syntax_1.Syntax.FunctionExpression; + this.id = id; + this.params = params; + this.body = body; + this.generator = generator; + this.expression = false; + this.async = false; + } + return FunctionExpression; + }()); + exports.FunctionExpression = FunctionExpression; + var Identifier = (function () { + function Identifier(name) { + this.type = syntax_1.Syntax.Identifier; + this.name = name; + } + return Identifier; + }()); + exports.Identifier = Identifier; + var IfStatement = (function () { + function IfStatement(test, consequent, alternate) { + this.type = syntax_1.Syntax.IfStatement; + this.test = test; + this.consequent = consequent; + this.alternate = alternate; + } + return IfStatement; + }()); + exports.IfStatement = IfStatement; + var ImportDeclaration = (function () { + function ImportDeclaration(specifiers, source) { + this.type = syntax_1.Syntax.ImportDeclaration; + this.specifiers = specifiers; + this.source = source; + } + return ImportDeclaration; + }()); + exports.ImportDeclaration = ImportDeclaration; + var ImportDefaultSpecifier = (function () { + function ImportDefaultSpecifier(local) { + this.type = syntax_1.Syntax.ImportDefaultSpecifier; + this.local = local; + } + return ImportDefaultSpecifier; + }()); + exports.ImportDefaultSpecifier = ImportDefaultSpecifier; + var ImportNamespaceSpecifier = (function () { + function ImportNamespaceSpecifier(local) { + this.type = syntax_1.Syntax.ImportNamespaceSpecifier; + this.local = local; + } + return ImportNamespaceSpecifier; + }()); + exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; + var ImportSpecifier = (function () { + function ImportSpecifier(local, imported) { + this.type = syntax_1.Syntax.ImportSpecifier; + this.local = local; + this.imported = imported; + } + return ImportSpecifier; + }()); + exports.ImportSpecifier = ImportSpecifier; + var LabeledStatement = (function () { + function LabeledStatement(label, body) { + this.type = syntax_1.Syntax.LabeledStatement; + this.label = label; + this.body = body; + } + return LabeledStatement; + }()); + exports.LabeledStatement = LabeledStatement; + var Literal = (function () { + function Literal(value, raw) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + } + return Literal; + }()); + exports.Literal = Literal; + var MetaProperty = (function () { + function MetaProperty(meta, property) { + this.type = syntax_1.Syntax.MetaProperty; + this.meta = meta; + this.property = property; + } + return MetaProperty; + }()); + exports.MetaProperty = MetaProperty; + var MethodDefinition = (function () { + function MethodDefinition(key, computed, value, kind, isStatic) { + this.type = syntax_1.Syntax.MethodDefinition; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.static = isStatic; + } + return MethodDefinition; + }()); + exports.MethodDefinition = MethodDefinition; + var Module = (function () { + function Module(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'module'; + } + return Module; + }()); + exports.Module = Module; + var NewExpression = (function () { + function NewExpression(callee, args) { + this.type = syntax_1.Syntax.NewExpression; + this.callee = callee; + this.arguments = args; + } + return NewExpression; + }()); + exports.NewExpression = NewExpression; + var ObjectExpression = (function () { + function ObjectExpression(properties) { + this.type = syntax_1.Syntax.ObjectExpression; + this.properties = properties; + } + return ObjectExpression; + }()); + exports.ObjectExpression = ObjectExpression; + var ObjectPattern = (function () { + function ObjectPattern(properties) { + this.type = syntax_1.Syntax.ObjectPattern; + this.properties = properties; + } + return ObjectPattern; + }()); + exports.ObjectPattern = ObjectPattern; + var Property = (function () { + function Property(kind, key, computed, value, method, shorthand) { + this.type = syntax_1.Syntax.Property; + this.key = key; + this.computed = computed; + this.value = value; + this.kind = kind; + this.method = method; + this.shorthand = shorthand; + } + return Property; + }()); + exports.Property = Property; + var RegexLiteral = (function () { + function RegexLiteral(value, raw, pattern, flags) { + this.type = syntax_1.Syntax.Literal; + this.value = value; + this.raw = raw; + this.regex = { pattern: pattern, flags: flags }; + } + return RegexLiteral; + }()); + exports.RegexLiteral = RegexLiteral; + var RestElement = (function () { + function RestElement(argument) { + this.type = syntax_1.Syntax.RestElement; + this.argument = argument; + } + return RestElement; + }()); + exports.RestElement = RestElement; + var ReturnStatement = (function () { + function ReturnStatement(argument) { + this.type = syntax_1.Syntax.ReturnStatement; + this.argument = argument; + } + return ReturnStatement; + }()); + exports.ReturnStatement = ReturnStatement; + var Script = (function () { + function Script(body) { + this.type = syntax_1.Syntax.Program; + this.body = body; + this.sourceType = 'script'; + } + return Script; + }()); + exports.Script = Script; + var SequenceExpression = (function () { + function SequenceExpression(expressions) { + this.type = syntax_1.Syntax.SequenceExpression; + this.expressions = expressions; + } + return SequenceExpression; + }()); + exports.SequenceExpression = SequenceExpression; + var SpreadElement = (function () { + function SpreadElement(argument) { + this.type = syntax_1.Syntax.SpreadElement; + this.argument = argument; + } + return SpreadElement; + }()); + exports.SpreadElement = SpreadElement; + var StaticMemberExpression = (function () { + function StaticMemberExpression(object, property) { + this.type = syntax_1.Syntax.MemberExpression; + this.computed = false; + this.object = object; + this.property = property; + } + return StaticMemberExpression; + }()); + exports.StaticMemberExpression = StaticMemberExpression; + var Super = (function () { + function Super() { + this.type = syntax_1.Syntax.Super; + } + return Super; + }()); + exports.Super = Super; + var SwitchCase = (function () { + function SwitchCase(test, consequent) { + this.type = syntax_1.Syntax.SwitchCase; + this.test = test; + this.consequent = consequent; + } + return SwitchCase; + }()); + exports.SwitchCase = SwitchCase; + var SwitchStatement = (function () { + function SwitchStatement(discriminant, cases) { + this.type = syntax_1.Syntax.SwitchStatement; + this.discriminant = discriminant; + this.cases = cases; + } + return SwitchStatement; + }()); + exports.SwitchStatement = SwitchStatement; + var TaggedTemplateExpression = (function () { + function TaggedTemplateExpression(tag, quasi) { + this.type = syntax_1.Syntax.TaggedTemplateExpression; + this.tag = tag; + this.quasi = quasi; + } + return TaggedTemplateExpression; + }()); + exports.TaggedTemplateExpression = TaggedTemplateExpression; + var TemplateElement = (function () { + function TemplateElement(value, tail) { + this.type = syntax_1.Syntax.TemplateElement; + this.value = value; + this.tail = tail; + } + return TemplateElement; + }()); + exports.TemplateElement = TemplateElement; + var TemplateLiteral = (function () { + function TemplateLiteral(quasis, expressions) { + this.type = syntax_1.Syntax.TemplateLiteral; + this.quasis = quasis; + this.expressions = expressions; + } + return TemplateLiteral; + }()); + exports.TemplateLiteral = TemplateLiteral; + var ThisExpression = (function () { + function ThisExpression() { + this.type = syntax_1.Syntax.ThisExpression; + } + return ThisExpression; + }()); + exports.ThisExpression = ThisExpression; + var ThrowStatement = (function () { + function ThrowStatement(argument) { + this.type = syntax_1.Syntax.ThrowStatement; + this.argument = argument; + } + return ThrowStatement; + }()); + exports.ThrowStatement = ThrowStatement; + var TryStatement = (function () { + function TryStatement(block, handler, finalizer) { + this.type = syntax_1.Syntax.TryStatement; + this.block = block; + this.handler = handler; + this.finalizer = finalizer; + } + return TryStatement; + }()); + exports.TryStatement = TryStatement; + var UnaryExpression = (function () { + function UnaryExpression(operator, argument) { + this.type = syntax_1.Syntax.UnaryExpression; + this.operator = operator; + this.argument = argument; + this.prefix = true; + } + return UnaryExpression; + }()); + exports.UnaryExpression = UnaryExpression; + var UpdateExpression = (function () { + function UpdateExpression(operator, argument, prefix) { + this.type = syntax_1.Syntax.UpdateExpression; + this.operator = operator; + this.argument = argument; + this.prefix = prefix; + } + return UpdateExpression; + }()); + exports.UpdateExpression = UpdateExpression; + var VariableDeclaration = (function () { + function VariableDeclaration(declarations, kind) { + this.type = syntax_1.Syntax.VariableDeclaration; + this.declarations = declarations; + this.kind = kind; + } + return VariableDeclaration; + }()); + exports.VariableDeclaration = VariableDeclaration; + var VariableDeclarator = (function () { + function VariableDeclarator(id, init) { + this.type = syntax_1.Syntax.VariableDeclarator; + this.id = id; + this.init = init; + } + return VariableDeclarator; + }()); + exports.VariableDeclarator = VariableDeclarator; + var WhileStatement = (function () { + function WhileStatement(test, body) { + this.type = syntax_1.Syntax.WhileStatement; + this.test = test; + this.body = body; + } + return WhileStatement; + }()); + exports.WhileStatement = WhileStatement; + var WithStatement = (function () { + function WithStatement(object, body) { + this.type = syntax_1.Syntax.WithStatement; + this.object = object; + this.body = body; + } + return WithStatement; + }()); + exports.WithStatement = WithStatement; + var YieldExpression = (function () { + function YieldExpression(argument, delegate) { + this.type = syntax_1.Syntax.YieldExpression; + this.argument = argument; + this.delegate = delegate; + } + return YieldExpression; + }()); + exports.YieldExpression = YieldExpression; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __nested_webpack_require_80491__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __nested_webpack_require_80491__(9); + var error_handler_1 = __nested_webpack_require_80491__(10); + var messages_1 = __nested_webpack_require_80491__(11); + var Node = __nested_webpack_require_80491__(7); + var scanner_1 = __nested_webpack_require_80491__(12); + var syntax_1 = __nested_webpack_require_80491__(2); + var token_1 = __nested_webpack_require_80491__(13); + var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; + var Parser = (function () { + function Parser(code, options, delegate) { + if (options === void 0) { options = {}; } + this.config = { + range: (typeof options.range === 'boolean') && options.range, + loc: (typeof options.loc === 'boolean') && options.loc, + source: null, + tokens: (typeof options.tokens === 'boolean') && options.tokens, + comment: (typeof options.comment === 'boolean') && options.comment, + tolerant: (typeof options.tolerant === 'boolean') && options.tolerant + }; + if (this.config.loc && options.source && options.source !== null) { + this.config.source = String(options.source); + } + this.delegate = delegate; + this.errorHandler = new error_handler_1.ErrorHandler(); + this.errorHandler.tolerant = this.config.tolerant; + this.scanner = new scanner_1.Scanner(code, this.errorHandler); + this.scanner.trackComment = this.config.comment; + this.operatorPrecedence = { + ')': 0, + ';': 0, + ',': 0, + '=': 0, + ']': 0, + '||': 1, + '&&': 2, + '|': 3, + '^': 4, + '&': 5, + '==': 6, + '!=': 6, + '===': 6, + '!==': 6, + '<': 7, + '>': 7, + '<=': 7, + '>=': 7, + '<<': 8, + '>>': 8, + '>>>': 8, + '+': 9, + '-': 9, + '*': 11, + '/': 11, + '%': 11 + }; + this.lookahead = { + type: 2 /* EOF */, + value: '', + lineNumber: this.scanner.lineNumber, + lineStart: 0, + start: 0, + end: 0 + }; + this.hasLineTerminator = false; + this.context = { + isModule: false, + await: false, + allowIn: true, + allowStrictDirective: true, + allowYield: true, + firstCoverInitializedNameError: null, + isAssignmentTarget: false, + isBindingElement: false, + inFunctionBody: false, + inIteration: false, + inSwitch: false, + labelSet: {}, + strict: false + }; + this.tokens = []; + this.startMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.lastMarker = { + index: 0, + line: this.scanner.lineNumber, + column: 0 + }; + this.nextToken(); + this.lastMarker = { + index: this.scanner.index, + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + }; + } + Parser.prototype.throwError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + throw this.errorHandler.createError(index, line, column, msg); + }; + Parser.prototype.tolerateError = function (messageFormat) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + var args = Array.prototype.slice.call(arguments, 1); + var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { + assert_1.assert(idx < args.length, 'Message reference must be in range'); + return args[idx]; + }); + var index = this.lastMarker.index; + var line = this.scanner.lineNumber; + var column = this.lastMarker.column + 1; + this.errorHandler.tolerateError(index, line, column, msg); + }; + // Throw an exception because of the token. + Parser.prototype.unexpectedTokenError = function (token, message) { + var msg = message || messages_1.Messages.UnexpectedToken; + var value; + if (token) { + if (!message) { + msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS : + (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier : + (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber : + (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString : + (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate : + messages_1.Messages.UnexpectedToken; + if (token.type === 4 /* Keyword */) { + if (this.scanner.isFutureReservedWord(token.value)) { + msg = messages_1.Messages.UnexpectedReserved; + } + else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { + msg = messages_1.Messages.StrictReservedWord; + } + } + } + value = token.value; + } + else { + value = 'ILLEGAL'; + } + msg = msg.replace('%0', value); + if (token && typeof token.lineNumber === 'number') { + var index = token.start; + var line = token.lineNumber; + var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; + var column = token.start - lastMarkerLineStart + 1; + return this.errorHandler.createError(index, line, column, msg); + } + else { + var index = this.lastMarker.index; + var line = this.lastMarker.line; + var column = this.lastMarker.column + 1; + return this.errorHandler.createError(index, line, column, msg); + } + }; + Parser.prototype.throwUnexpectedToken = function (token, message) { + throw this.unexpectedTokenError(token, message); + }; + Parser.prototype.tolerateUnexpectedToken = function (token, message) { + this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); + }; + Parser.prototype.collectComments = function () { + if (!this.config.comment) { + this.scanner.scanComments(); + } + else { + var comments = this.scanner.scanComments(); + if (comments.length > 0 && this.delegate) { + for (var i = 0; i < comments.length; ++i) { + var e = comments[i]; + var node = void 0; + node = { + type: e.multiLine ? 'BlockComment' : 'LineComment', + value: this.scanner.source.slice(e.slice[0], e.slice[1]) + }; + if (this.config.range) { + node.range = e.range; + } + if (this.config.loc) { + node.loc = e.loc; + } + var metadata = { + start: { + line: e.loc.start.line, + column: e.loc.start.column, + offset: e.range[0] + }, + end: { + line: e.loc.end.line, + column: e.loc.end.column, + offset: e.range[1] + } + }; + this.delegate(node, metadata); + } + } + } + }; + // From internal representation to an external structure + Parser.prototype.getTokenRaw = function (token) { + return this.scanner.source.slice(token.start, token.end); + }; + Parser.prototype.convertToken = function (token) { + var t = { + type: token_1.TokenName[token.type], + value: this.getTokenRaw(token) + }; + if (this.config.range) { + t.range = [token.start, token.end]; + } + if (this.config.loc) { + t.loc = { + start: { + line: this.startMarker.line, + column: this.startMarker.column + }, + end: { + line: this.scanner.lineNumber, + column: this.scanner.index - this.scanner.lineStart + } + }; + } + if (token.type === 9 /* RegularExpression */) { + var pattern = token.pattern; + var flags = token.flags; + t.regex = { pattern: pattern, flags: flags }; + } + return t; + }; + Parser.prototype.nextToken = function () { + var token = this.lookahead; + this.lastMarker.index = this.scanner.index; + this.lastMarker.line = this.scanner.lineNumber; + this.lastMarker.column = this.scanner.index - this.scanner.lineStart; + this.collectComments(); + if (this.scanner.index !== this.startMarker.index) { + this.startMarker.index = this.scanner.index; + this.startMarker.line = this.scanner.lineNumber; + this.startMarker.column = this.scanner.index - this.scanner.lineStart; + } + var next = this.scanner.lex(); + this.hasLineTerminator = (token.lineNumber !== next.lineNumber); + if (next && this.context.strict && next.type === 3 /* Identifier */) { + if (this.scanner.isStrictModeReservedWord(next.value)) { + next.type = 4 /* Keyword */; + } + } + this.lookahead = next; + if (this.config.tokens && next.type !== 2 /* EOF */) { + this.tokens.push(this.convertToken(next)); + } + return token; + }; + Parser.prototype.nextRegexToken = function () { + this.collectComments(); + var token = this.scanner.scanRegExp(); + if (this.config.tokens) { + // Pop the previous token, '/' or '/=' + // This is added from the lookahead token. + this.tokens.pop(); + this.tokens.push(this.convertToken(token)); + } + // Prime the next lookahead. + this.lookahead = token; + this.nextToken(); + return token; + }; + Parser.prototype.createNode = function () { + return { + index: this.startMarker.index, + line: this.startMarker.line, + column: this.startMarker.column + }; + }; + Parser.prototype.startNode = function (token, lastLineStart) { + if (lastLineStart === void 0) { lastLineStart = 0; } + var column = token.start - token.lineStart; + var line = token.lineNumber; + if (column < 0) { + column += lastLineStart; + line--; + } + return { + index: token.start, + line: line, + column: column + }; + }; + Parser.prototype.finalize = function (marker, node) { + if (this.config.range) { + node.range = [marker.index, this.lastMarker.index]; + } + if (this.config.loc) { + node.loc = { + start: { + line: marker.line, + column: marker.column, + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column + } + }; + if (this.config.source) { + node.loc.source = this.config.source; + } + } + if (this.delegate) { + var metadata = { + start: { + line: marker.line, + column: marker.column, + offset: marker.index + }, + end: { + line: this.lastMarker.line, + column: this.lastMarker.column, + offset: this.lastMarker.index + } + }; + this.delegate(node, metadata); + } + return node; + }; + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + Parser.prototype.expect = function (value) { + var token = this.nextToken(); + if (token.type !== 7 /* Punctuator */ || token.value !== value) { + this.throwUnexpectedToken(token); + } + }; + // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). + Parser.prototype.expectCommaSeparator = function () { + if (this.config.tolerant) { + var token = this.lookahead; + if (token.type === 7 /* Punctuator */ && token.value === ',') { + this.nextToken(); + } + else if (token.type === 7 /* Punctuator */ && token.value === ';') { + this.nextToken(); + this.tolerateUnexpectedToken(token); + } + else { + this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); + } + } + else { + this.expect(','); + } + }; + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + Parser.prototype.expectKeyword = function (keyword) { + var token = this.nextToken(); + if (token.type !== 4 /* Keyword */ || token.value !== keyword) { + this.throwUnexpectedToken(token); + } + }; + // Return true if the next token matches the specified punctuator. + Parser.prototype.match = function (value) { + return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value; + }; + // Return true if the next token matches the specified keyword + Parser.prototype.matchKeyword = function (keyword) { + return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword; + }; + // Return true if the next token matches the specified contextual keyword + // (where an identifier is sometimes a keyword depending on the context) + Parser.prototype.matchContextualKeyword = function (keyword) { + return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword; + }; + // Return true if the next token is an assignment operator + Parser.prototype.matchAssign = function () { + if (this.lookahead.type !== 7 /* Punctuator */) { + return false; + } + var op = this.lookahead.value; + return op === '=' || + op === '*=' || + op === '**=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + }; + // Cover grammar support. + // + // When an assignment expression position starts with an left parenthesis, the determination of the type + // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) + // or the first comma. This situation also defers the determination of all the expressions nested in the pair. + // + // There are three productions that can be parsed in a parentheses pair that needs to be determined + // after the outermost pair is closed. They are: + // + // 1. AssignmentExpression + // 2. BindingElements + // 3. AssignmentTargets + // + // In order to avoid exponential backtracking, we use two flags to denote if the production can be + // binding element or assignment target. + // + // The three productions have the relationship: + // + // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression + // + // with a single exception that CoverInitializedName when used directly in an Expression, generates + // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the + // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. + // + // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not + // effect the current flags. This means the production the parser parses is only used as an expression. Therefore + // the CoverInitializedName check is conducted. + // + // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates + // the flags outside of the parser. This means the production the parser parses is used as a part of a potential + // pattern. The CoverInitializedName check is deferred. + Parser.prototype.isolateCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + if (this.context.firstCoverInitializedNameError !== null) { + this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); + } + this.context.isBindingElement = previousIsBindingElement; + this.context.isAssignmentTarget = previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; + return result; + }; + Parser.prototype.inheritCoverGrammar = function (parseFunction) { + var previousIsBindingElement = this.context.isBindingElement; + var previousIsAssignmentTarget = this.context.isAssignmentTarget; + var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; + this.context.isBindingElement = true; + this.context.isAssignmentTarget = true; + this.context.firstCoverInitializedNameError = null; + var result = parseFunction.call(this); + this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; + this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; + this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; + return result; + }; + Parser.prototype.consumeSemicolon = function () { + if (this.match(';')) { + this.nextToken(); + } + else if (!this.hasLineTerminator) { + if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) { + this.throwUnexpectedToken(this.lookahead); + } + this.lastMarker.index = this.startMarker.index; + this.lastMarker.line = this.startMarker.line; + this.lastMarker.column = this.startMarker.column; + } + }; + // https://tc39.github.io/ecma262/#sec-primary-expression + Parser.prototype.parsePrimaryExpression = function () { + var node = this.createNode(); + var expr; + var token, raw; + switch (this.lookahead.type) { + case 3 /* Identifier */: + if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { + this.tolerateUnexpectedToken(this.lookahead); + } + expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); + break; + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + if (this.context.strict && this.lookahead.octal) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 1 /* BooleanLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); + break; + case 5 /* NullLiteral */: + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + token = this.nextToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.Literal(null, raw)); + break; + case 10 /* Template */: + expr = this.parseTemplateLiteral(); + break; + case 7 /* Punctuator */: + switch (this.lookahead.value) { + case '(': + this.context.isBindingElement = false; + expr = this.inheritCoverGrammar(this.parseGroupExpression); + break; + case '[': + expr = this.inheritCoverGrammar(this.parseArrayInitializer); + break; + case '{': + expr = this.inheritCoverGrammar(this.parseObjectInitializer); + break; + case '/': + case '/=': + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.scanner.index = this.startMarker.index; + token = this.nextRegexToken(); + raw = this.getTokenRaw(token); + expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + break; + case 4 /* Keyword */: + if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseIdentifierName(); + } + else if (!this.context.strict && this.matchKeyword('let')) { + expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); + } + else { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + if (this.matchKeyword('function')) { + expr = this.parseFunctionExpression(); + } + else if (this.matchKeyword('this')) { + this.nextToken(); + expr = this.finalize(node, new Node.ThisExpression()); + } + else if (this.matchKeyword('class')) { + expr = this.parseClassExpression(); + } + else { + expr = this.throwUnexpectedToken(this.nextToken()); + } + } + break; + default: + expr = this.throwUnexpectedToken(this.nextToken()); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-array-initializer + Parser.prototype.parseSpreadElement = function () { + var node = this.createNode(); + this.expect('...'); + var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); + return this.finalize(node, new Node.SpreadElement(arg)); + }; + Parser.prototype.parseArrayInitializer = function () { + var node = this.createNode(); + var elements = []; + this.expect('['); + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else if (this.match('...')) { + var element = this.parseSpreadElement(); + if (!this.match(']')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + this.expect(','); + } + elements.push(element); + } + else { + elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayExpression(elements)); + }; + // https://tc39.github.io/ecma262/#sec-object-initializer + Parser.prototype.parsePropertyMethod = function (params) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = params.simple; + var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); + if (this.context.strict && params.firstRestricted) { + this.tolerateUnexpectedToken(params.firstRestricted, params.message); + } + if (this.context.strict && params.stricted) { + this.tolerateUnexpectedToken(params.stricted, params.message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + return body; + }; + Parser.prototype.parsePropertyMethodFunction = function () { + var isGenerator = false; + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + Parser.prototype.parsePropertyMethodAsyncFunction = function () { + var node = this.createNode(); + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = false; + this.context.await = true; + var params = this.parseFormalParameters(); + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); + }; + Parser.prototype.parseObjectPropertyKey = function () { + var node = this.createNode(); + var token = this.nextToken(); + var key; + switch (token.type) { + case 8 /* StringLiteral */: + case 6 /* NumericLiteral */: + if (this.context.strict && token.octal) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); + } + var raw = this.getTokenRaw(token); + key = this.finalize(node, new Node.Literal(token.value, raw)); + break; + case 3 /* Identifier */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 4 /* Keyword */: + key = this.finalize(node, new Node.Identifier(token.value)); + break; + case 7 /* Punctuator */: + if (token.value === '[') { + key = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.expect(']'); + } + else { + key = this.throwUnexpectedToken(token); + } + break; + default: + key = this.throwUnexpectedToken(token); + } + return key; + }; + Parser.prototype.isPropertyKey = function (key, value) { + return (key.type === syntax_1.Syntax.Identifier && key.name === value) || + (key.type === syntax_1.Syntax.Literal && key.value === value); + }; + Parser.prototype.parseObjectProperty = function (hasProto) { + var node = this.createNode(); + var token = this.lookahead; + var kind; + var key = null; + var value = null; + var computed = false; + var method = false; + var shorthand = false; + var isAsync = false; + if (token.type === 3 /* Identifier */) { + var id = token.value; + this.nextToken(); + computed = this.match('['); + isAsync = !this.hasLineTerminator && (id === 'async') && + !this.match(':') && !this.match('(') && !this.match('*') && !this.match(','); + key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); + } + else if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + else { + if (!key) { + this.throwUnexpectedToken(this.lookahead); + } + kind = 'init'; + if (this.match(':') && !isAsync) { + if (!computed && this.isPropertyKey(key, '__proto__')) { + if (hasProto.value) { + this.tolerateError(messages_1.Messages.DuplicateProtoProperty); + } + hasProto.value = true; + } + this.nextToken(); + value = this.inheritCoverGrammar(this.parseAssignmentExpression); + } + else if (this.match('(')) { + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + else if (token.type === 3 /* Identifier */) { + var id = this.finalize(node, new Node.Identifier(token.value)); + if (this.match('=')) { + this.context.firstCoverInitializedNameError = this.lookahead; + this.nextToken(); + shorthand = true; + var init = this.isolateCoverGrammar(this.parseAssignmentExpression); + value = this.finalize(node, new Node.AssignmentPattern(id, init)); + } + else { + shorthand = true; + value = id; + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectInitializer = function () { + var node = this.createNode(); + this.expect('{'); + var properties = []; + var hasProto = { value: false }; + while (!this.match('}')) { + properties.push(this.parseObjectProperty(hasProto)); + if (!this.match('}')) { + this.expectCommaSeparator(); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectExpression(properties)); + }; + // https://tc39.github.io/ecma262/#sec-template-literals + Parser.prototype.parseTemplateHead = function () { + assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateElement = function () { + if (this.lookahead.type !== 10 /* Template */) { + this.throwUnexpectedToken(); + } + var node = this.createNode(); + var token = this.nextToken(); + var raw = token.value; + var cooked = token.cooked; + return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail)); + }; + Parser.prototype.parseTemplateLiteral = function () { + var node = this.createNode(); + var expressions = []; + var quasis = []; + var quasi = this.parseTemplateHead(); + quasis.push(quasi); + while (!quasi.tail) { + expressions.push(this.parseExpression()); + quasi = this.parseTemplateElement(); + quasis.push(quasi); + } + return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); + }; + // https://tc39.github.io/ecma262/#sec-grouping-operator + Parser.prototype.reinterpretExpressionAsPattern = function (expr) { + switch (expr.type) { + case syntax_1.Syntax.Identifier: + case syntax_1.Syntax.MemberExpression: + case syntax_1.Syntax.RestElement: + case syntax_1.Syntax.AssignmentPattern: + break; + case syntax_1.Syntax.SpreadElement: + expr.type = syntax_1.Syntax.RestElement; + this.reinterpretExpressionAsPattern(expr.argument); + break; + case syntax_1.Syntax.ArrayExpression: + expr.type = syntax_1.Syntax.ArrayPattern; + for (var i = 0; i < expr.elements.length; i++) { + if (expr.elements[i] !== null) { + this.reinterpretExpressionAsPattern(expr.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectExpression: + expr.type = syntax_1.Syntax.ObjectPattern; + for (var i = 0; i < expr.properties.length; i++) { + this.reinterpretExpressionAsPattern(expr.properties[i].value); + } + break; + case syntax_1.Syntax.AssignmentExpression: + expr.type = syntax_1.Syntax.AssignmentPattern; + delete expr.operator; + this.reinterpretExpressionAsPattern(expr.left); + break; + default: + // Allow other node type for tolerant parsing. + break; + } + }; + Parser.prototype.parseGroupExpression = function () { + var expr; + this.expect('('); + if (this.match(')')) { + this.nextToken(); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [], + async: false + }; + } + else { + var startToken = this.lookahead; + var params = []; + if (this.match('...')) { + expr = this.parseRestElement(params); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + else { + var arrow = false; + this.context.isBindingElement = true; + expr = this.inheritCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + this.context.isAssignmentTarget = false; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + if (this.match(')')) { + this.nextToken(); + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else if (this.match('...')) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + expressions.push(this.parseRestElement(params)); + this.expect(')'); + if (!this.match('=>')) { + this.expect('=>'); + } + this.context.isBindingElement = false; + for (var i = 0; i < expressions.length; i++) { + this.reinterpretExpressionAsPattern(expressions[i]); + } + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: expressions, + async: false + }; + } + else { + expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); + } + if (arrow) { + break; + } + } + if (!arrow) { + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + } + if (!arrow) { + this.expect(')'); + if (this.match('=>')) { + if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { + arrow = true; + expr = { + type: ArrowParameterPlaceHolder, + params: [expr], + async: false + }; + } + if (!arrow) { + if (!this.context.isBindingElement) { + this.throwUnexpectedToken(this.lookahead); + } + if (expr.type === syntax_1.Syntax.SequenceExpression) { + for (var i = 0; i < expr.expressions.length; i++) { + this.reinterpretExpressionAsPattern(expr.expressions[i]); + } + } + else { + this.reinterpretExpressionAsPattern(expr); + } + var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]); + expr = { + type: ArrowParameterPlaceHolder, + params: parameters, + async: false + }; + } + } + this.context.isBindingElement = false; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions + Parser.prototype.parseArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAssignmentExpression); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.isIdentifierName = function (token) { + return token.type === 3 /* Identifier */ || + token.type === 4 /* Keyword */ || + token.type === 1 /* BooleanLiteral */ || + token.type === 5 /* NullLiteral */; + }; + Parser.prototype.parseIdentifierName = function () { + var node = this.createNode(); + var token = this.nextToken(); + if (!this.isIdentifierName(token)) { + this.throwUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseNewExpression = function () { + var node = this.createNode(); + var id = this.parseIdentifierName(); + assert_1.assert(id.name === 'new', 'New expression must start with `new`'); + var expr; + if (this.match('.')) { + this.nextToken(); + if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') { + var property = this.parseIdentifierName(); + expr = new Node.MetaProperty(id, property); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); + var args = this.match('(') ? this.parseArguments() : []; + expr = new Node.NewExpression(callee, args); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return this.finalize(node, expr); + }; + Parser.prototype.parseAsyncArgument = function () { + var arg = this.parseAssignmentExpression(); + this.context.firstCoverInitializedNameError = null; + return arg; + }; + Parser.prototype.parseAsyncArguments = function () { + this.expect('('); + var args = []; + if (!this.match(')')) { + while (true) { + var expr = this.match('...') ? this.parseSpreadElement() : + this.isolateCoverGrammar(this.parseAsyncArgument); + args.push(expr); + if (this.match(')')) { + break; + } + this.expectCommaSeparator(); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return args; + }; + Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { + var startToken = this.lookahead; + var maybeAsync = this.matchContextualKeyword('async'); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var expr; + if (this.matchKeyword('super') && this.context.inFunctionBody) { + expr = this.createNode(); + this.nextToken(); + expr = this.finalize(expr, new Node.Super()); + if (!this.match('(') && !this.match('.') && !this.match('[')) { + this.throwUnexpectedToken(this.lookahead); + } + } + else { + expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + } + while (true) { + if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); + } + else if (this.match('(')) { + var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber); + this.context.isBindingElement = false; + this.context.isAssignmentTarget = false; + var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); + expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); + if (asyncArrow && this.match('=>')) { + for (var i = 0; i < args.length; ++i) { + this.reinterpretExpressionAsPattern(args[i]); + } + expr = { + type: ArrowParameterPlaceHolder, + params: args, + async: true + }; + } + } + else if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + this.context.allowIn = previousAllowIn; + return expr; + }; + Parser.prototype.parseSuper = function () { + var node = this.createNode(); + this.expectKeyword('super'); + if (!this.match('[') && !this.match('.')) { + this.throwUnexpectedToken(this.lookahead); + } + return this.finalize(node, new Node.Super()); + }; + Parser.prototype.parseLeftHandSideExpression = function () { + assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); + var node = this.startNode(this.lookahead); + var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() : + this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); + while (true) { + if (this.match('[')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('['); + var property = this.isolateCoverGrammar(this.parseExpression); + this.expect(']'); + expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); + } + else if (this.match('.')) { + this.context.isBindingElement = false; + this.context.isAssignmentTarget = true; + this.expect('.'); + var property = this.parseIdentifierName(); + expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); + } + else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) { + var quasi = this.parseTemplateLiteral(); + expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); + } + else { + break; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-update-expressions + Parser.prototype.parseUpdateExpression = function () { + var expr; + var startToken = this.lookahead; + if (this.match('++') || this.match('--')) { + var node = this.startNode(startToken); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPrefix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + var prefix = true; + expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) { + if (this.match('++') || this.match('--')) { + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { + this.tolerateError(messages_1.Messages.StrictLHSPostfix); + } + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var operator = this.nextToken().value; + var prefix = false; + expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-unary-operators + Parser.prototype.parseAwaitExpression = function () { + var node = this.createNode(); + this.nextToken(); + var argument = this.parseUnaryExpression(); + return this.finalize(node, new Node.AwaitExpression(argument)); + }; + Parser.prototype.parseUnaryExpression = function () { + var expr; + if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || + this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { + var node = this.startNode(this.lookahead); + var token = this.nextToken(); + expr = this.inheritCoverGrammar(this.parseUnaryExpression); + expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); + if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { + this.tolerateError(messages_1.Messages.StrictDelete); + } + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else if (this.context.await && this.matchContextualKeyword('await')) { + expr = this.parseAwaitExpression(); + } + else { + expr = this.parseUpdateExpression(); + } + return expr; + }; + Parser.prototype.parseExponentiationExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseUnaryExpression); + if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-exp-operator + // https://tc39.github.io/ecma262/#sec-multiplicative-operators + // https://tc39.github.io/ecma262/#sec-additive-operators + // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators + // https://tc39.github.io/ecma262/#sec-relational-operators + // https://tc39.github.io/ecma262/#sec-equality-operators + // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators + // https://tc39.github.io/ecma262/#sec-binary-logical-operators + Parser.prototype.binaryPrecedence = function (token) { + var op = token.value; + var precedence; + if (token.type === 7 /* Punctuator */) { + precedence = this.operatorPrecedence[op] || 0; + } + else if (token.type === 4 /* Keyword */) { + precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0; + } + else { + precedence = 0; + } + return precedence; + }; + Parser.prototype.parseBinaryExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); + var token = this.lookahead; + var prec = this.binaryPrecedence(token); + if (prec > 0) { + this.nextToken(); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var markers = [startToken, this.lookahead]; + var left = expr; + var right = this.isolateCoverGrammar(this.parseExponentiationExpression); + var stack = [left, token.value, right]; + var precedences = [prec]; + while (true) { + prec = this.binaryPrecedence(this.lookahead); + if (prec <= 0) { + break; + } + // Reduce: make a binary expression from the three topmost entries. + while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) { + right = stack.pop(); + var operator = stack.pop(); + precedences.pop(); + left = stack.pop(); + markers.pop(); + var node = this.startNode(markers[markers.length - 1]); + stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); + } + // Shift. + stack.push(this.nextToken().value); + precedences.push(prec); + markers.push(this.lookahead); + stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); + } + // Final reduce to clean-up the stack. + var i = stack.length - 1; + expr = stack[i]; + var lastMarker = markers.pop(); + while (i > 1) { + var marker = markers.pop(); + var lastLineStart = lastMarker && lastMarker.lineStart; + var node = this.startNode(marker, lastLineStart); + var operator = stack[i - 1]; + expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); + i -= 2; + lastMarker = marker; + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-conditional-operator + Parser.prototype.parseConditionalExpression = function () { + var startToken = this.lookahead; + var expr = this.inheritCoverGrammar(this.parseBinaryExpression); + if (this.match('?')) { + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + this.expect(':'); + var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-assignment-operators + Parser.prototype.checkPatternParam = function (options, param) { + switch (param.type) { + case syntax_1.Syntax.Identifier: + this.validateParam(options, param, param.name); + break; + case syntax_1.Syntax.RestElement: + this.checkPatternParam(options, param.argument); + break; + case syntax_1.Syntax.AssignmentPattern: + this.checkPatternParam(options, param.left); + break; + case syntax_1.Syntax.ArrayPattern: + for (var i = 0; i < param.elements.length; i++) { + if (param.elements[i] !== null) { + this.checkPatternParam(options, param.elements[i]); + } + } + break; + case syntax_1.Syntax.ObjectPattern: + for (var i = 0; i < param.properties.length; i++) { + this.checkPatternParam(options, param.properties[i].value); + } + break; + default: + break; + } + options.simple = options.simple && (param instanceof Node.Identifier); + }; + Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { + var params = [expr]; + var options; + var asyncArrow = false; + switch (expr.type) { + case syntax_1.Syntax.Identifier: + break; + case ArrowParameterPlaceHolder: + params = expr.params; + asyncArrow = expr.async; + break; + default: + return null; + } + options = { + simple: true, + paramSet: {} + }; + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.AssignmentPattern) { + if (param.right.type === syntax_1.Syntax.YieldExpression) { + if (param.right.argument) { + this.throwUnexpectedToken(this.lookahead); + } + param.right.type = syntax_1.Syntax.Identifier; + param.right.name = 'yield'; + delete param.right.argument; + delete param.right.delegate; + } + } + else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { + this.throwUnexpectedToken(this.lookahead); + } + this.checkPatternParam(options, param); + params[i] = param; + } + if (this.context.strict || !this.context.allowYield) { + for (var i = 0; i < params.length; ++i) { + var param = params[i]; + if (param.type === syntax_1.Syntax.YieldExpression) { + this.throwUnexpectedToken(this.lookahead); + } + } + } + if (options.message === messages_1.Messages.StrictParamDupe) { + var token = this.context.strict ? options.stricted : options.firstRestricted; + this.throwUnexpectedToken(token, options.message); + } + return { + simple: options.simple, + params: params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.parseAssignmentExpression = function () { + var expr; + if (!this.context.allowYield && this.matchKeyword('yield')) { + expr = this.parseYieldExpression(); + } + else { + var startToken = this.lookahead; + var token = startToken; + expr = this.parseConditionalExpression(); + if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { + if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) { + var arg = this.parsePrimaryExpression(); + this.reinterpretExpressionAsPattern(arg); + expr = { + type: ArrowParameterPlaceHolder, + params: [arg], + async: true + }; + } + } + if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { + // https://tc39.github.io/ecma262/#sec-arrow-function-definitions + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + var isAsync = expr.async; + var list = this.reinterpretAsCoverFormalsList(expr); + if (list) { + if (this.hasLineTerminator) { + this.tolerateUnexpectedToken(this.lookahead); + } + this.context.firstCoverInitializedNameError = null; + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = list.simple; + var previousAllowYield = this.context.allowYield; + var previousAwait = this.context.await; + this.context.allowYield = true; + this.context.await = isAsync; + var node = this.startNode(startToken); + this.expect('=>'); + var body = void 0; + if (this.match('{')) { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = true; + body = this.parseFunctionSourceElements(); + this.context.allowIn = previousAllowIn; + } + else { + body = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + var expression = body.type !== syntax_1.Syntax.BlockStatement; + if (this.context.strict && list.firstRestricted) { + this.throwUnexpectedToken(list.firstRestricted, list.message); + } + if (this.context.strict && list.stricted) { + this.tolerateUnexpectedToken(list.stricted, list.message); + } + expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : + this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.allowYield = previousAllowYield; + this.context.await = previousAwait; + } + } + else { + if (this.matchAssign()) { + if (!this.context.isAssignmentTarget) { + this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); + } + if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { + var id = expr; + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); + } + if (this.scanner.isStrictModeReservedWord(id.name)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + } + if (!this.match('=')) { + this.context.isAssignmentTarget = false; + this.context.isBindingElement = false; + } + else { + this.reinterpretExpressionAsPattern(expr); + } + token = this.nextToken(); + var operator = token.value; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); + this.context.firstCoverInitializedNameError = null; + } + } + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-comma-operator + Parser.prototype.parseExpression = function () { + var startToken = this.lookahead; + var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); + if (this.match(',')) { + var expressions = []; + expressions.push(expr); + while (this.lookahead.type !== 2 /* EOF */) { + if (!this.match(',')) { + break; + } + this.nextToken(); + expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); + } + return expr; + }; + // https://tc39.github.io/ecma262/#sec-block + Parser.prototype.parseStatementListItem = function () { + var statement; + this.context.isAssignmentTarget = true; + this.context.isBindingElement = true; + if (this.lookahead.type === 4 /* Keyword */) { + switch (this.lookahead.value) { + case 'export': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); + } + statement = this.parseExportDeclaration(); + break; + case 'import': + if (!this.context.isModule) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); + } + statement = this.parseImportDeclaration(); + break; + case 'const': + statement = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'class': + statement = this.parseClassDeclaration(); + break; + case 'let': + statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement(); + break; + default: + statement = this.parseStatement(); + break; + } + } + else { + statement = this.parseStatement(); + } + return statement; + }; + Parser.prototype.parseBlock = function () { + var node = this.createNode(); + this.expect('{'); + var block = []; + while (true) { + if (this.match('}')) { + break; + } + block.push(this.parseStatementListItem()); + } + this.expect('}'); + return this.finalize(node, new Node.BlockStatement(block)); + }; + // https://tc39.github.io/ecma262/#sec-let-and-const-declarations + Parser.prototype.parseLexicalBinding = function (kind, options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, kind); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (kind === 'const') { + if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else { + this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); + } + } + } + else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) { + this.expect('='); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseBindingList = function (kind, options) { + var list = [this.parseLexicalBinding(kind, options)]; + while (this.match(',')) { + this.nextToken(); + list.push(this.parseLexicalBinding(kind, options)); + } + return list; + }; + Parser.prototype.isLexicalDeclaration = function () { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + return (next.type === 3 /* Identifier */) || + (next.type === 7 /* Punctuator */ && next.value === '[') || + (next.type === 7 /* Punctuator */ && next.value === '{') || + (next.type === 4 /* Keyword */ && next.value === 'let') || + (next.type === 4 /* Keyword */ && next.value === 'yield'); + }; + Parser.prototype.parseLexicalDeclaration = function (options) { + var node = this.createNode(); + var kind = this.nextToken().value; + assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); + var declarations = this.parseBindingList(kind, options); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); + }; + // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns + Parser.prototype.parseBindingRestElement = function (params, kind) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params, kind); + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseArrayPattern = function (params, kind) { + var node = this.createNode(); + this.expect('['); + var elements = []; + while (!this.match(']')) { + if (this.match(',')) { + this.nextToken(); + elements.push(null); + } + else { + if (this.match('...')) { + elements.push(this.parseBindingRestElement(params, kind)); + break; + } + else { + elements.push(this.parsePatternWithDefault(params, kind)); + } + if (!this.match(']')) { + this.expect(','); + } + } + } + this.expect(']'); + return this.finalize(node, new Node.ArrayPattern(elements)); + }; + Parser.prototype.parsePropertyPattern = function (params, kind) { + var node = this.createNode(); + var computed = false; + var shorthand = false; + var method = false; + var key; + var value; + if (this.lookahead.type === 3 /* Identifier */) { + var keyToken = this.lookahead; + key = this.parseVariableIdentifier(); + var init = this.finalize(node, new Node.Identifier(keyToken.value)); + if (this.match('=')) { + params.push(keyToken); + shorthand = true; + this.nextToken(); + var expr = this.parseAssignmentExpression(); + value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); + } + else if (!this.match(':')) { + params.push(keyToken); + shorthand = true; + value = init; + } + else { + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.expect(':'); + value = this.parsePatternWithDefault(params, kind); + } + return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); + }; + Parser.prototype.parseObjectPattern = function (params, kind) { + var node = this.createNode(); + var properties = []; + this.expect('{'); + while (!this.match('}')) { + properties.push(this.parsePropertyPattern(params, kind)); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return this.finalize(node, new Node.ObjectPattern(properties)); + }; + Parser.prototype.parsePattern = function (params, kind) { + var pattern; + if (this.match('[')) { + pattern = this.parseArrayPattern(params, kind); + } + else if (this.match('{')) { + pattern = this.parseObjectPattern(params, kind); + } + else { + if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { + this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); + } + params.push(this.lookahead); + pattern = this.parseVariableIdentifier(kind); + } + return pattern; + }; + Parser.prototype.parsePatternWithDefault = function (params, kind) { + var startToken = this.lookahead; + var pattern = this.parsePattern(params, kind); + if (this.match('=')) { + this.nextToken(); + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var right = this.isolateCoverGrammar(this.parseAssignmentExpression); + this.context.allowYield = previousAllowYield; + pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); + } + return pattern; + }; + // https://tc39.github.io/ecma262/#sec-variable-statement + Parser.prototype.parseVariableIdentifier = function (kind) { + var node = this.createNode(); + var token = this.nextToken(); + if (token.type === 4 /* Keyword */ && token.value === 'yield') { + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else if (!this.context.allowYield) { + this.throwUnexpectedToken(token); + } + } + else if (token.type !== 3 /* Identifier */) { + if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); + } + else { + if (this.context.strict || token.value !== 'let' || kind !== 'var') { + this.throwUnexpectedToken(token); + } + } + } + else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') { + this.tolerateUnexpectedToken(token); + } + return this.finalize(node, new Node.Identifier(token.value)); + }; + Parser.prototype.parseVariableDeclaration = function (options) { + var node = this.createNode(); + var params = []; + var id = this.parsePattern(params, 'var'); + if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(id.name)) { + this.tolerateError(messages_1.Messages.StrictVarName); + } + } + var init = null; + if (this.match('=')) { + this.nextToken(); + init = this.isolateCoverGrammar(this.parseAssignmentExpression); + } + else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { + this.expect('='); + } + return this.finalize(node, new Node.VariableDeclarator(id, init)); + }; + Parser.prototype.parseVariableDeclarationList = function (options) { + var opt = { inFor: options.inFor }; + var list = []; + list.push(this.parseVariableDeclaration(opt)); + while (this.match(',')) { + this.nextToken(); + list.push(this.parseVariableDeclaration(opt)); + } + return list; + }; + Parser.prototype.parseVariableStatement = function () { + var node = this.createNode(); + this.expectKeyword('var'); + var declarations = this.parseVariableDeclarationList({ inFor: false }); + this.consumeSemicolon(); + return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); + }; + // https://tc39.github.io/ecma262/#sec-empty-statement + Parser.prototype.parseEmptyStatement = function () { + var node = this.createNode(); + this.expect(';'); + return this.finalize(node, new Node.EmptyStatement()); + }; + // https://tc39.github.io/ecma262/#sec-expression-statement + Parser.prototype.parseExpressionStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ExpressionStatement(expr)); + }; + // https://tc39.github.io/ecma262/#sec-if-statement + Parser.prototype.parseIfClause = function () { + if (this.context.strict && this.matchKeyword('function')) { + this.tolerateError(messages_1.Messages.StrictFunction); + } + return this.parseStatement(); + }; + Parser.prototype.parseIfStatement = function () { + var node = this.createNode(); + var consequent; + var alternate = null; + this.expectKeyword('if'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + consequent = this.parseIfClause(); + if (this.matchKeyword('else')) { + this.nextToken(); + alternate = this.parseIfClause(); + } + } + return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); + }; + // https://tc39.github.io/ecma262/#sec-do-while-statement + Parser.prototype.parseDoWhileStatement = function () { + var node = this.createNode(); + this.expectKeyword('do'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + var body = this.parseStatement(); + this.context.inIteration = previousInIteration; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + } + else { + this.expect(')'); + if (this.match(';')) { + this.nextToken(); + } + } + return this.finalize(node, new Node.DoWhileStatement(body, test)); + }; + // https://tc39.github.io/ecma262/#sec-while-statement + Parser.prototype.parseWhileStatement = function () { + var node = this.createNode(); + var body; + this.expectKeyword('while'); + this.expect('('); + var test = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.parseStatement(); + this.context.inIteration = previousInIteration; + } + return this.finalize(node, new Node.WhileStatement(test, body)); + }; + // https://tc39.github.io/ecma262/#sec-for-statement + // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements + Parser.prototype.parseForStatement = function () { + var init = null; + var test = null; + var update = null; + var forIn = true; + var left, right; + var node = this.createNode(); + this.expectKeyword('for'); + this.expect('('); + if (this.match(';')) { + this.nextToken(); + } + else { + if (this.matchKeyword('var')) { + init = this.createNode(); + this.nextToken(); + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseVariableDeclarationList({ inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && this.matchKeyword('in')) { + var decl = declarations[0]; + if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { + this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); + } + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); + this.expect(';'); + } + } + else if (this.matchKeyword('const') || this.matchKeyword('let')) { + init = this.createNode(); + var kind = this.nextToken().value; + if (!this.context.strict && this.lookahead.value === 'in') { + init = this.finalize(init, new Node.Identifier(kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else { + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + var declarations = this.parseBindingList(kind, { inFor: true }); + this.context.allowIn = previousAllowIn; + if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseExpression(); + init = null; + } + else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + this.nextToken(); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + this.consumeSemicolon(); + init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); + } + } + } + else { + var initStartToken = this.lookahead; + var previousAllowIn = this.context.allowIn; + this.context.allowIn = false; + init = this.inheritCoverGrammar(this.parseAssignmentExpression); + this.context.allowIn = previousAllowIn; + if (this.matchKeyword('in')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForIn); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseExpression(); + init = null; + } + else if (this.matchContextualKeyword('of')) { + if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { + this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); + } + this.nextToken(); + this.reinterpretExpressionAsPattern(init); + left = init; + right = this.parseAssignmentExpression(); + init = null; + forIn = false; + } + else { + if (this.match(',')) { + var initSeq = [init]; + while (this.match(',')) { + this.nextToken(); + initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); + } + init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); + } + this.expect(';'); + } + } + } + if (typeof left === 'undefined') { + if (!this.match(';')) { + test = this.parseExpression(); + } + this.expect(';'); + if (!this.match(')')) { + update = this.parseExpression(); + } + } + var body; + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + var previousInIteration = this.context.inIteration; + this.context.inIteration = true; + body = this.isolateCoverGrammar(this.parseStatement); + this.context.inIteration = previousInIteration; + } + return (typeof left === 'undefined') ? + this.finalize(node, new Node.ForStatement(init, test, update, body)) : + forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : + this.finalize(node, new Node.ForOfStatement(left, right, body)); + }; + // https://tc39.github.io/ecma262/#sec-continue-statement + Parser.prototype.parseContinueStatement = function () { + var node = this.createNode(); + this.expectKeyword('continue'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + label = id; + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration) { + this.throwError(messages_1.Messages.IllegalContinue); + } + return this.finalize(node, new Node.ContinueStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-break-statement + Parser.prototype.parseBreakStatement = function () { + var node = this.createNode(); + this.expectKeyword('break'); + var label = null; + if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) { + var id = this.parseVariableIdentifier(); + var key = '$' + id.name; + if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.UnknownLabel, id.name); + } + label = id; + } + this.consumeSemicolon(); + if (label === null && !this.context.inIteration && !this.context.inSwitch) { + this.throwError(messages_1.Messages.IllegalBreak); + } + return this.finalize(node, new Node.BreakStatement(label)); + }; + // https://tc39.github.io/ecma262/#sec-return-statement + Parser.prototype.parseReturnStatement = function () { + if (!this.context.inFunctionBody) { + this.tolerateError(messages_1.Messages.IllegalReturn); + } + var node = this.createNode(); + this.expectKeyword('return'); + var hasArgument = (!this.match(';') && !this.match('}') && + !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) || + this.lookahead.type === 8 /* StringLiteral */ || + this.lookahead.type === 10 /* Template */; + var argument = hasArgument ? this.parseExpression() : null; + this.consumeSemicolon(); + return this.finalize(node, new Node.ReturnStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-with-statement + Parser.prototype.parseWithStatement = function () { + if (this.context.strict) { + this.tolerateError(messages_1.Messages.StrictModeWith); + } + var node = this.createNode(); + var body; + this.expectKeyword('with'); + this.expect('('); + var object = this.parseExpression(); + if (!this.match(')') && this.config.tolerant) { + this.tolerateUnexpectedToken(this.nextToken()); + body = this.finalize(this.createNode(), new Node.EmptyStatement()); + } + else { + this.expect(')'); + body = this.parseStatement(); + } + return this.finalize(node, new Node.WithStatement(object, body)); + }; + // https://tc39.github.io/ecma262/#sec-switch-statement + Parser.prototype.parseSwitchCase = function () { + var node = this.createNode(); + var test; + if (this.matchKeyword('default')) { + this.nextToken(); + test = null; + } + else { + this.expectKeyword('case'); + test = this.parseExpression(); + } + this.expect(':'); + var consequent = []; + while (true) { + if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { + break; + } + consequent.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.SwitchCase(test, consequent)); + }; + Parser.prototype.parseSwitchStatement = function () { + var node = this.createNode(); + this.expectKeyword('switch'); + this.expect('('); + var discriminant = this.parseExpression(); + this.expect(')'); + var previousInSwitch = this.context.inSwitch; + this.context.inSwitch = true; + var cases = []; + var defaultFound = false; + this.expect('{'); + while (true) { + if (this.match('}')) { + break; + } + var clause = this.parseSwitchCase(); + if (clause.test === null) { + if (defaultFound) { + this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); + } + defaultFound = true; + } + cases.push(clause); + } + this.expect('}'); + this.context.inSwitch = previousInSwitch; + return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); + }; + // https://tc39.github.io/ecma262/#sec-labelled-statements + Parser.prototype.parseLabelledStatement = function () { + var node = this.createNode(); + var expr = this.parseExpression(); + var statement; + if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) { + this.nextToken(); + var id = expr; + var key = '$' + id.name; + if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { + this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); + } + this.context.labelSet[key] = true; + var body = void 0; + if (this.matchKeyword('class')) { + this.tolerateUnexpectedToken(this.lookahead); + body = this.parseClassDeclaration(); + } + else if (this.matchKeyword('function')) { + var token = this.lookahead; + var declaration = this.parseFunctionDeclaration(); + if (this.context.strict) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); + } + else if (declaration.generator) { + this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); + } + body = declaration; + } + else { + body = this.parseStatement(); + } + delete this.context.labelSet[key]; + statement = new Node.LabeledStatement(id, body); + } + else { + this.consumeSemicolon(); + statement = new Node.ExpressionStatement(expr); + } + return this.finalize(node, statement); + }; + // https://tc39.github.io/ecma262/#sec-throw-statement + Parser.prototype.parseThrowStatement = function () { + var node = this.createNode(); + this.expectKeyword('throw'); + if (this.hasLineTerminator) { + this.throwError(messages_1.Messages.NewlineAfterThrow); + } + var argument = this.parseExpression(); + this.consumeSemicolon(); + return this.finalize(node, new Node.ThrowStatement(argument)); + }; + // https://tc39.github.io/ecma262/#sec-try-statement + Parser.prototype.parseCatchClause = function () { + var node = this.createNode(); + this.expectKeyword('catch'); + this.expect('('); + if (this.match(')')) { + this.throwUnexpectedToken(this.lookahead); + } + var params = []; + var param = this.parsePattern(params); + var paramMap = {}; + for (var i = 0; i < params.length; i++) { + var key = '$' + params[i].value; + if (Object.prototype.hasOwnProperty.call(paramMap, key)) { + this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); + } + paramMap[key] = true; + } + if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { + if (this.scanner.isRestrictedWord(param.name)) { + this.tolerateError(messages_1.Messages.StrictCatchVariable); + } + } + this.expect(')'); + var body = this.parseBlock(); + return this.finalize(node, new Node.CatchClause(param, body)); + }; + Parser.prototype.parseFinallyClause = function () { + this.expectKeyword('finally'); + return this.parseBlock(); + }; + Parser.prototype.parseTryStatement = function () { + var node = this.createNode(); + this.expectKeyword('try'); + var block = this.parseBlock(); + var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; + var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; + if (!handler && !finalizer) { + this.throwError(messages_1.Messages.NoCatchOrFinally); + } + return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); + }; + // https://tc39.github.io/ecma262/#sec-debugger-statement + Parser.prototype.parseDebuggerStatement = function () { + var node = this.createNode(); + this.expectKeyword('debugger'); + this.consumeSemicolon(); + return this.finalize(node, new Node.DebuggerStatement()); + }; + // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations + Parser.prototype.parseStatement = function () { + var statement; + switch (this.lookahead.type) { + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 8 /* StringLiteral */: + case 10 /* Template */: + case 9 /* RegularExpression */: + statement = this.parseExpressionStatement(); + break; + case 7 /* Punctuator */: + var value = this.lookahead.value; + if (value === '{') { + statement = this.parseBlock(); + } + else if (value === '(') { + statement = this.parseExpressionStatement(); + } + else if (value === ';') { + statement = this.parseEmptyStatement(); + } + else { + statement = this.parseExpressionStatement(); + } + break; + case 3 /* Identifier */: + statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); + break; + case 4 /* Keyword */: + switch (this.lookahead.value) { + case 'break': + statement = this.parseBreakStatement(); + break; + case 'continue': + statement = this.parseContinueStatement(); + break; + case 'debugger': + statement = this.parseDebuggerStatement(); + break; + case 'do': + statement = this.parseDoWhileStatement(); + break; + case 'for': + statement = this.parseForStatement(); + break; + case 'function': + statement = this.parseFunctionDeclaration(); + break; + case 'if': + statement = this.parseIfStatement(); + break; + case 'return': + statement = this.parseReturnStatement(); + break; + case 'switch': + statement = this.parseSwitchStatement(); + break; + case 'throw': + statement = this.parseThrowStatement(); + break; + case 'try': + statement = this.parseTryStatement(); + break; + case 'var': + statement = this.parseVariableStatement(); + break; + case 'while': + statement = this.parseWhileStatement(); + break; + case 'with': + statement = this.parseWithStatement(); + break; + default: + statement = this.parseExpressionStatement(); + break; + } + break; + default: + statement = this.throwUnexpectedToken(this.lookahead); + } + return statement; + }; + // https://tc39.github.io/ecma262/#sec-function-definitions + Parser.prototype.parseFunctionSourceElements = function () { + var node = this.createNode(); + this.expect('{'); + var body = this.parseDirectivePrologues(); + var previousLabelSet = this.context.labelSet; + var previousInIteration = this.context.inIteration; + var previousInSwitch = this.context.inSwitch; + var previousInFunctionBody = this.context.inFunctionBody; + this.context.labelSet = {}; + this.context.inIteration = false; + this.context.inSwitch = false; + this.context.inFunctionBody = true; + while (this.lookahead.type !== 2 /* EOF */) { + if (this.match('}')) { + break; + } + body.push(this.parseStatementListItem()); + } + this.expect('}'); + this.context.labelSet = previousLabelSet; + this.context.inIteration = previousInIteration; + this.context.inSwitch = previousInSwitch; + this.context.inFunctionBody = previousInFunctionBody; + return this.finalize(node, new Node.BlockStatement(body)); + }; + Parser.prototype.validateParam = function (options, param, name) { + var key = '$' + name; + if (this.context.strict) { + if (this.scanner.isRestrictedWord(name)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamName; + } + if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + else if (!options.firstRestricted) { + if (this.scanner.isRestrictedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictParamName; + } + else if (this.scanner.isStrictModeReservedWord(name)) { + options.firstRestricted = param; + options.message = messages_1.Messages.StrictReservedWord; + } + else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { + options.stricted = param; + options.message = messages_1.Messages.StrictParamDupe; + } + } + /* istanbul ignore next */ + if (typeof Object.defineProperty === 'function') { + Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true }); + } + else { + options.paramSet[key] = true; + } + }; + Parser.prototype.parseRestElement = function (params) { + var node = this.createNode(); + this.expect('...'); + var arg = this.parsePattern(params); + if (this.match('=')) { + this.throwError(messages_1.Messages.DefaultRestParameter); + } + if (!this.match(')')) { + this.throwError(messages_1.Messages.ParameterAfterRestParameter); + } + return this.finalize(node, new Node.RestElement(arg)); + }; + Parser.prototype.parseFormalParameter = function (options) { + var params = []; + var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); + for (var i = 0; i < params.length; i++) { + this.validateParam(options, params[i], params[i].value); + } + options.simple = options.simple && (param instanceof Node.Identifier); + options.params.push(param); + }; + Parser.prototype.parseFormalParameters = function (firstRestricted) { + var options; + options = { + simple: true, + params: [], + firstRestricted: firstRestricted + }; + this.expect('('); + if (!this.match(')')) { + options.paramSet = {}; + while (this.lookahead.type !== 2 /* EOF */) { + this.parseFormalParameter(options); + if (this.match(')')) { + break; + } + this.expect(','); + if (this.match(')')) { + break; + } + } + } + this.expect(')'); + return { + simple: options.simple, + params: options.params, + stricted: options.stricted, + firstRestricted: options.firstRestricted, + message: options.message + }; + }; + Parser.prototype.matchAsyncFunction = function () { + var match = this.matchContextualKeyword('async'); + if (match) { + var state = this.scanner.saveState(); + this.scanner.scanComments(); + var next = this.scanner.lex(); + this.scanner.restoreState(state); + match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function'); + } + return match; + }; + Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted = null; + if (!identifierIsOptional || !this.match('(')) { + var token = this.lookahead; + id = this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : + this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); + }; + Parser.prototype.parseFunctionExpression = function () { + var node = this.createNode(); + var isAsync = this.matchContextualKeyword('async'); + if (isAsync) { + this.nextToken(); + } + this.expectKeyword('function'); + var isGenerator = isAsync ? false : this.match('*'); + if (isGenerator) { + this.nextToken(); + } + var message; + var id = null; + var firstRestricted; + var previousAllowAwait = this.context.await; + var previousAllowYield = this.context.allowYield; + this.context.await = isAsync; + this.context.allowYield = !isGenerator; + if (!this.match('(')) { + var token = this.lookahead; + id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier(); + if (this.context.strict) { + if (this.scanner.isRestrictedWord(token.value)) { + this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); + } + } + else { + if (this.scanner.isRestrictedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictFunctionName; + } + else if (this.scanner.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = messages_1.Messages.StrictReservedWord; + } + } + } + var formalParameters = this.parseFormalParameters(firstRestricted); + var params = formalParameters.params; + var stricted = formalParameters.stricted; + firstRestricted = formalParameters.firstRestricted; + if (formalParameters.message) { + message = formalParameters.message; + } + var previousStrict = this.context.strict; + var previousAllowStrictDirective = this.context.allowStrictDirective; + this.context.allowStrictDirective = formalParameters.simple; + var body = this.parseFunctionSourceElements(); + if (this.context.strict && firstRestricted) { + this.throwUnexpectedToken(firstRestricted, message); + } + if (this.context.strict && stricted) { + this.tolerateUnexpectedToken(stricted, message); + } + this.context.strict = previousStrict; + this.context.allowStrictDirective = previousAllowStrictDirective; + this.context.await = previousAllowAwait; + this.context.allowYield = previousAllowYield; + return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : + this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive + Parser.prototype.parseDirective = function () { + var token = this.lookahead; + var node = this.createNode(); + var expr = this.parseExpression(); + var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null; + this.consumeSemicolon(); + return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); + }; + Parser.prototype.parseDirectivePrologues = function () { + var firstRestricted = null; + var body = []; + while (true) { + var token = this.lookahead; + if (token.type !== 8 /* StringLiteral */) { + break; + } + var statement = this.parseDirective(); + body.push(statement); + var directive = statement.directive; + if (typeof directive !== 'string') { + break; + } + if (directive === 'use strict') { + this.context.strict = true; + if (firstRestricted) { + this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); + } + if (!this.context.allowStrictDirective) { + this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); + } + } + else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + return body; + }; + // https://tc39.github.io/ecma262/#sec-method-definitions + Parser.prototype.qualifiedPropertyName = function (token) { + switch (token.type) { + case 3 /* Identifier */: + case 8 /* StringLiteral */: + case 1 /* BooleanLiteral */: + case 5 /* NullLiteral */: + case 6 /* NumericLiteral */: + case 4 /* Keyword */: + return true; + case 7 /* Punctuator */: + return token.value === '['; + default: + break; + } + return false; + }; + Parser.prototype.parseGetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length > 0) { + this.tolerateError(messages_1.Messages.BadGetterArity); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseSetterMethod = function () { + var node = this.createNode(); + var isGenerator = false; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = !isGenerator; + var formalParameters = this.parseFormalParameters(); + if (formalParameters.params.length !== 1) { + this.tolerateError(messages_1.Messages.BadSetterArity); + } + else if (formalParameters.params[0] instanceof Node.RestElement) { + this.tolerateError(messages_1.Messages.BadSetterRestParameter); + } + var method = this.parsePropertyMethod(formalParameters); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); + }; + Parser.prototype.parseGeneratorMethod = function () { + var node = this.createNode(); + var isGenerator = true; + var previousAllowYield = this.context.allowYield; + this.context.allowYield = true; + var params = this.parseFormalParameters(); + this.context.allowYield = false; + var method = this.parsePropertyMethod(params); + this.context.allowYield = previousAllowYield; + return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); + }; + // https://tc39.github.io/ecma262/#sec-generator-function-definitions + Parser.prototype.isStartOfExpression = function () { + var start = true; + var value = this.lookahead.value; + switch (this.lookahead.type) { + case 7 /* Punctuator */: + start = (value === '[') || (value === '(') || (value === '{') || + (value === '+') || (value === '-') || + (value === '!') || (value === '~') || + (value === '++') || (value === '--') || + (value === '/') || (value === '/='); // regular expression literal + break; + case 4 /* Keyword */: + start = (value === 'class') || (value === 'delete') || + (value === 'function') || (value === 'let') || (value === 'new') || + (value === 'super') || (value === 'this') || (value === 'typeof') || + (value === 'void') || (value === 'yield'); + break; + default: + break; + } + return start; + }; + Parser.prototype.parseYieldExpression = function () { + var node = this.createNode(); + this.expectKeyword('yield'); + var argument = null; + var delegate = false; + if (!this.hasLineTerminator) { + var previousAllowYield = this.context.allowYield; + this.context.allowYield = false; + delegate = this.match('*'); + if (delegate) { + this.nextToken(); + argument = this.parseAssignmentExpression(); + } + else if (this.isStartOfExpression()) { + argument = this.parseAssignmentExpression(); + } + this.context.allowYield = previousAllowYield; + } + return this.finalize(node, new Node.YieldExpression(argument, delegate)); + }; + // https://tc39.github.io/ecma262/#sec-class-definitions + Parser.prototype.parseClassElement = function (hasConstructor) { + var token = this.lookahead; + var node = this.createNode(); + var kind = ''; + var key = null; + var value = null; + var computed = false; + var method = false; + var isStatic = false; + var isAsync = false; + if (this.match('*')) { + this.nextToken(); + } + else { + computed = this.match('['); + key = this.parseObjectPropertyKey(); + var id = key; + if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { + token = this.lookahead; + isStatic = true; + computed = this.match('['); + if (this.match('*')) { + this.nextToken(); + } + else { + key = this.parseObjectPropertyKey(); + } + } + if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) { + var punctuator = this.lookahead.value; + if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { + isAsync = true; + token = this.lookahead; + key = this.parseObjectPropertyKey(); + if (token.type === 3 /* Identifier */ && token.value === 'constructor') { + this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); + } + } + } + } + var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); + if (token.type === 3 /* Identifier */) { + if (token.value === 'get' && lookaheadPropertyKey) { + kind = 'get'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + this.context.allowYield = false; + value = this.parseGetterMethod(); + } + else if (token.value === 'set' && lookaheadPropertyKey) { + kind = 'set'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseSetterMethod(); + } + } + else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) { + kind = 'init'; + computed = this.match('['); + key = this.parseObjectPropertyKey(); + value = this.parseGeneratorMethod(); + method = true; + } + if (!kind && key && this.match('(')) { + kind = 'init'; + value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); + method = true; + } + if (!kind) { + this.throwUnexpectedToken(this.lookahead); + } + if (kind === 'init') { + kind = 'method'; + } + if (!computed) { + if (isStatic && this.isPropertyKey(key, 'prototype')) { + this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); + } + if (!isStatic && this.isPropertyKey(key, 'constructor')) { + if (kind !== 'method' || !method || (value && value.generator)) { + this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); + } + if (hasConstructor.value) { + this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); + } + else { + hasConstructor.value = true; + } + kind = 'constructor'; + } + } + return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); + }; + Parser.prototype.parseClassElementList = function () { + var body = []; + var hasConstructor = { value: false }; + this.expect('{'); + while (!this.match('}')) { + if (this.match(';')) { + this.nextToken(); + } + else { + body.push(this.parseClassElement(hasConstructor)); + } + } + this.expect('}'); + return body; + }; + Parser.prototype.parseClassBody = function () { + var node = this.createNode(); + var elementList = this.parseClassElementList(); + return this.finalize(node, new Node.ClassBody(elementList)); + }; + Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier(); + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); + }; + Parser.prototype.parseClassExpression = function () { + var node = this.createNode(); + var previousStrict = this.context.strict; + this.context.strict = true; + this.expectKeyword('class'); + var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null; + var superClass = null; + if (this.matchKeyword('extends')) { + this.nextToken(); + superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); + } + var classBody = this.parseClassBody(); + this.context.strict = previousStrict; + return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); + }; + // https://tc39.github.io/ecma262/#sec-scripts + // https://tc39.github.io/ecma262/#sec-modules + Parser.prototype.parseModule = function () { + this.context.strict = true; + this.context.isModule = true; + this.scanner.isModule = true; + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Module(body)); + }; + Parser.prototype.parseScript = function () { + var node = this.createNode(); + var body = this.parseDirectivePrologues(); + while (this.lookahead.type !== 2 /* EOF */) { + body.push(this.parseStatementListItem()); + } + return this.finalize(node, new Node.Script(body)); + }; + // https://tc39.github.io/ecma262/#sec-imports + Parser.prototype.parseModuleSpecifier = function () { + var node = this.createNode(); + if (this.lookahead.type !== 8 /* StringLiteral */) { + this.throwError(messages_1.Messages.InvalidModuleSpecifier); + } + var token = this.nextToken(); + var raw = this.getTokenRaw(token); + return this.finalize(node, new Node.Literal(token.value, raw)); + }; + // import {} ...; + Parser.prototype.parseImportSpecifier = function () { + var node = this.createNode(); + var imported; + var local; + if (this.lookahead.type === 3 /* Identifier */) { + imported = this.parseVariableIdentifier(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + } + else { + imported = this.parseIdentifierName(); + local = imported; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + local = this.parseVariableIdentifier(); + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + } + return this.finalize(node, new Node.ImportSpecifier(local, imported)); + }; + // {foo, bar as bas} + Parser.prototype.parseNamedImports = function () { + this.expect('{'); + var specifiers = []; + while (!this.match('}')) { + specifiers.push(this.parseImportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + return specifiers; + }; + // import ...; + Parser.prototype.parseImportDefaultSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportDefaultSpecifier(local)); + }; + // import <* as foo> ...; + Parser.prototype.parseImportNamespaceSpecifier = function () { + var node = this.createNode(); + this.expect('*'); + if (!this.matchContextualKeyword('as')) { + this.throwError(messages_1.Messages.NoAsAfterImportNamespace); + } + this.nextToken(); + var local = this.parseIdentifierName(); + return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); + }; + Parser.prototype.parseImportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalImportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('import'); + var src; + var specifiers = []; + if (this.lookahead.type === 8 /* StringLiteral */) { + // import 'foo'; + src = this.parseModuleSpecifier(); + } + else { + if (this.match('{')) { + // import {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else if (this.match('*')) { + // import * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { + // import foo + specifiers.push(this.parseImportDefaultSpecifier()); + if (this.match(',')) { + this.nextToken(); + if (this.match('*')) { + // import foo, * as foo + specifiers.push(this.parseImportNamespaceSpecifier()); + } + else if (this.match('{')) { + // import foo, {bar} + specifiers = specifiers.concat(this.parseNamedImports()); + } + else { + this.throwUnexpectedToken(this.lookahead); + } + } + } + else { + this.throwUnexpectedToken(this.nextToken()); + } + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + src = this.parseModuleSpecifier(); + } + this.consumeSemicolon(); + return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); + }; + // https://tc39.github.io/ecma262/#sec-exports + Parser.prototype.parseExportSpecifier = function () { + var node = this.createNode(); + var local = this.parseIdentifierName(); + var exported = local; + if (this.matchContextualKeyword('as')) { + this.nextToken(); + exported = this.parseIdentifierName(); + } + return this.finalize(node, new Node.ExportSpecifier(local, exported)); + }; + Parser.prototype.parseExportDeclaration = function () { + if (this.context.inFunctionBody) { + this.throwError(messages_1.Messages.IllegalExportDeclaration); + } + var node = this.createNode(); + this.expectKeyword('export'); + var exportDeclaration; + if (this.matchKeyword('default')) { + // export default ... + this.nextToken(); + if (this.matchKeyword('function')) { + // export default function foo () {} + // export default function () {} + var declaration = this.parseFunctionDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchKeyword('class')) { + // export default class foo {} + var declaration = this.parseClassDeclaration(true); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else if (this.matchContextualKeyword('async')) { + // export default async function f () {} + // export default async function () {} + // export default async x => x + var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + else { + if (this.matchContextualKeyword('from')) { + this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); + } + // export default {}; + // export default []; + // export default (1 + 2); + var declaration = this.match('{') ? this.parseObjectInitializer() : + this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); + } + } + else if (this.match('*')) { + // export * from 'foo'; + this.nextToken(); + if (!this.matchContextualKeyword('from')) { + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + this.nextToken(); + var src = this.parseModuleSpecifier(); + this.consumeSemicolon(); + exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); + } + else if (this.lookahead.type === 4 /* Keyword */) { + // export var f = 1; + var declaration = void 0; + switch (this.lookahead.value) { + case 'let': + case 'const': + declaration = this.parseLexicalDeclaration({ inFor: false }); + break; + case 'var': + case 'class': + case 'function': + declaration = this.parseStatementListItem(); + break; + default: + this.throwUnexpectedToken(this.lookahead); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else if (this.matchAsyncFunction()) { + var declaration = this.parseFunctionDeclaration(); + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); + } + else { + var specifiers = []; + var source = null; + var isExportFromIdentifier = false; + this.expect('{'); + while (!this.match('}')) { + isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); + specifiers.push(this.parseExportSpecifier()); + if (!this.match('}')) { + this.expect(','); + } + } + this.expect('}'); + if (this.matchContextualKeyword('from')) { + // export {default} from 'foo'; + // export {foo} from 'foo'; + this.nextToken(); + source = this.parseModuleSpecifier(); + this.consumeSemicolon(); + } + else if (isExportFromIdentifier) { + // export {default}; // missing fromClause + var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; + this.throwError(message, this.lookahead.value); + } + else { + // export {foo}; + this.consumeSemicolon(); + } + exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); + } + return exportDeclaration; + }; + return Parser; + }()); + exports.Parser = Parser; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + Object.defineProperty(exports, "__esModule", { value: true }); + function assert(condition, message) { + /* istanbul ignore if */ + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + exports.assert = assert; + + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + "use strict"; + /* tslint:disable:max-classes-per-file */ + Object.defineProperty(exports, "__esModule", { value: true }); + var ErrorHandler = (function () { + function ErrorHandler() { + this.errors = []; + this.tolerant = false; + } + ErrorHandler.prototype.recordError = function (error) { + this.errors.push(error); + }; + ErrorHandler.prototype.tolerate = function (error) { + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + ErrorHandler.prototype.constructError = function (msg, column) { + var error = new Error(msg); + try { + throw error; + } + catch (base) { + /* istanbul ignore else */ + if (Object.create && Object.defineProperty) { + error = Object.create(base); + Object.defineProperty(error, 'column', { value: column }); + } + } + /* istanbul ignore next */ + return error; + }; + ErrorHandler.prototype.createError = function (index, line, col, description) { + var msg = 'Line ' + line + ': ' + description; + var error = this.constructError(msg, col); + error.index = index; + error.lineNumber = line; + error.description = description; + return error; + }; + ErrorHandler.prototype.throwError = function (index, line, col, description) { + throw this.createError(index, line, col, description); + }; + ErrorHandler.prototype.tolerateError = function (index, line, col, description) { + var error = this.createError(index, line, col, description); + if (this.tolerant) { + this.recordError(error); + } + else { + throw error; + } + }; + return ErrorHandler; + }()); + exports.ErrorHandler = ErrorHandler; + + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + // Error messages should be identical to V8. + exports.Messages = { + BadGetterArity: 'Getter must not have any formal parameters', + BadSetterArity: 'Setter must have exactly one formal parameter', + BadSetterRestParameter: 'Setter function argument must not be a rest parameter', + ConstructorIsAsync: 'Class constructor may not be an async method', + ConstructorSpecialMethod: 'Class constructor may not be an accessor', + DeclarationMissingInitializer: 'Missing initializer in %0 declaration', + DefaultRestParameter: 'Unexpected token =', + DuplicateBinding: 'Duplicate binding %0', + DuplicateConstructor: 'A class may only have one constructor', + DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', + ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', + GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', + IllegalBreak: 'Illegal break statement', + IllegalContinue: 'Illegal continue statement', + IllegalExportDeclaration: 'Unexpected token', + IllegalImportDeclaration: 'Unexpected token', + IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', + IllegalReturn: 'Illegal return statement', + InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', + InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', + InvalidModuleSpecifier: 'Unexpected token', + InvalidRegExp: 'Invalid regular expression', + LetInLexicalBinding: 'let is disallowed as a lexically bound name', + MissingFromClause: 'Unexpected token', + MultipleDefaultsInSwitch: 'More than one default clause in switch statement', + NewlineAfterThrow: 'Illegal newline after throw', + NoAsAfterImportNamespace: 'Unexpected token', + NoCatchOrFinally: 'Missing catch or finally after try', + ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', + Redeclaration: '%0 \'%1\' has already been declared', + StaticPrototype: 'Classes may not have static property named prototype', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', + UnexpectedEOS: 'Unexpected end of input', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedNumber: 'Unexpected number', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedString: 'Unexpected string', + UnexpectedTemplate: 'Unexpected quasi %0', + UnexpectedToken: 'Unexpected token %0', + UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', + UnknownLabel: 'Undefined label \'%0\'', + UnterminatedRegExp: 'Invalid regular expression: missing /' + }; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __nested_webpack_require_226595__) { + + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var assert_1 = __nested_webpack_require_226595__(9); + var character_1 = __nested_webpack_require_226595__(4); + var messages_1 = __nested_webpack_require_226595__(11); + function hexValue(ch) { + return '0123456789abcdef'.indexOf(ch.toLowerCase()); + } + function octalValue(ch) { + return '01234567'.indexOf(ch); + } + var Scanner = (function () { + function Scanner(code, handler) { + this.source = code; + this.errorHandler = handler; + this.trackComment = false; + this.isModule = false; + this.length = code.length; + this.index = 0; + this.lineNumber = (code.length > 0) ? 1 : 0; + this.lineStart = 0; + this.curlyStack = []; + } + Scanner.prototype.saveState = function () { + return { + index: this.index, + lineNumber: this.lineNumber, + lineStart: this.lineStart + }; + }; + Scanner.prototype.restoreState = function (state) { + this.index = state.index; + this.lineNumber = state.lineNumber; + this.lineStart = state.lineStart; + }; + Scanner.prototype.eof = function () { + return this.index >= this.length; + }; + Scanner.prototype.throwUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + Scanner.prototype.tolerateUnexpectedToken = function (message) { + if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; } + this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); + }; + // https://tc39.github.io/ecma262/#sec-comments + Scanner.prototype.skipSingleLineComment = function (offset) { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - offset; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - offset + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + ++this.index; + if (character_1.Character.isLineTerminator(ch)) { + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart - 1 + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index - 1], + range: [start, this.index - 1], + loc: loc + }; + comments.push(entry); + } + if (ch === 13 && this.source.charCodeAt(this.index) === 10) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + return comments; + } + } + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: false, + slice: [start + offset, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + }; + Scanner.prototype.skipMultiLineComment = function () { + var comments = []; + var start, loc; + if (this.trackComment) { + comments = []; + start = this.index - 2; + loc = { + start: { + line: this.lineNumber, + column: this.index - this.lineStart - 2 + }, + end: {} + }; + } + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isLineTerminator(ch)) { + if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + ++this.index; + this.lineStart = this.index; + } + else if (ch === 0x2A) { + // Block comment ends with '*/'. + if (this.source.charCodeAt(this.index + 1) === 0x2F) { + this.index += 2; + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index - 2], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + return comments; + } + ++this.index; + } + else { + ++this.index; + } + } + // Ran off the end of the file - the whole thing is a comment + if (this.trackComment) { + loc.end = { + line: this.lineNumber, + column: this.index - this.lineStart + }; + var entry = { + multiLine: true, + slice: [start + 2, this.index], + range: [start, this.index], + loc: loc + }; + comments.push(entry); + } + this.tolerateUnexpectedToken(); + return comments; + }; + Scanner.prototype.scanComments = function () { + var comments; + if (this.trackComment) { + comments = []; + } + var start = (this.index === 0); + while (!this.eof()) { + var ch = this.source.charCodeAt(this.index); + if (character_1.Character.isWhiteSpace(ch)) { + ++this.index; + } + else if (character_1.Character.isLineTerminator(ch)) { + ++this.index; + if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { + ++this.index; + } + ++this.lineNumber; + this.lineStart = this.index; + start = true; + } + else if (ch === 0x2F) { + ch = this.source.charCodeAt(this.index + 1); + if (ch === 0x2F) { + this.index += 2; + var comment = this.skipSingleLineComment(2); + if (this.trackComment) { + comments = comments.concat(comment); + } + start = true; + } + else if (ch === 0x2A) { + this.index += 2; + var comment = this.skipMultiLineComment(); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (start && ch === 0x2D) { + // U+003E is '>' + if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) { + // '-->' is a single-line comment + this.index += 3; + var comment = this.skipSingleLineComment(3); + if (this.trackComment) { + comments = comments.concat(comment); + } + } + else { + break; + } + } + else if (ch === 0x3C && !this.isModule) { + if (this.source.slice(this.index + 1, this.index + 4) === '!--') { + this.index += 4; // `", i, "Comment is not closed.") + } else if( xmlData.substr(i + 1, 2) === '!D') { + const closeIndex = findClosingIndex(xmlData, ">", i, "DOCTYPE is not closed.") + const tagExp = xmlData.substring(i, closeIndex); + if(tagExp.indexOf("[") >= 0){ + i = xmlData.indexOf("]>", i) + 1; + }else{ + i = closeIndex; + } + }else if(xmlData.substr(i + 1, 2) === '![') { + const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2 + const tagExp = xmlData.substring(i + 9,closeIndex); + + //considerations + //1. CDATA will always have parent node + //2. A tag with CDATA is not a leaf node so it's value would be string type. + if(textData){ + currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(currentNode.tagname, textData , options); + textData = ""; + } + + if (options.cdataTagName) { + //add cdata node + const childNode = new xmlNode(options.cdataTagName, currentNode, tagExp); + currentNode.addChild(childNode); + //for backtracking + currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar; + //add rest value to parent node + if (tagExp) { + childNode.val = tagExp; + } + } else { + currentNode.val = (currentNode.val || '') + (tagExp || ''); + } + + i = closeIndex + 2; + }else {//Opening tag + const result = closingIndexForOpeningTag(xmlData, i+1) + let tagExp = result.data; + const closeIndex = result.index; + const separatorIndex = tagExp.indexOf(" "); + let tagName = tagExp; + let shouldBuildAttributesMap = true; + if(separatorIndex !== -1){ + tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ''); + tagExp = tagExp.substr(separatorIndex + 1); + } + + if(options.ignoreNameSpace){ + const colonIndex = tagName.indexOf(":"); + if(colonIndex !== -1){ + tagName = tagName.substr(colonIndex+1); + shouldBuildAttributesMap = tagName !== result.data.substr(colonIndex + 1); + } + } + + //save text to parent node + if (currentNode && textData) { + if(currentNode.tagname !== '!xml'){ + currentNode.val = util.getValue(currentNode.val) + '' + processTagValue( currentNode.tagname, textData, options); + } + } + + if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){//selfClosing tag + + if(tagName[tagName.length - 1] === "/"){ //remove trailing '/' + tagName = tagName.substr(0, tagName.length - 1); + tagExp = tagName; + }else{ + tagExp = tagExp.substr(0, tagExp.length - 1); + } + + const childNode = new xmlNode(tagName, currentNode, ''); + if(tagName !== tagExp){ + childNode.attrsMap = buildAttributesMap(tagExp, options); + } + currentNode.addChild(childNode); + }else{//opening tag + + const childNode = new xmlNode( tagName, currentNode ); + if (options.stopNodes.length && options.stopNodes.includes(childNode.tagname)) { + childNode.startIndex=closeIndex; + } + if(tagName !== tagExp && shouldBuildAttributesMap){ + childNode.attrsMap = buildAttributesMap(tagExp, options); + } + currentNode.addChild(childNode); + currentNode = childNode; + } + textData = ""; + i = closeIndex; + } + }else{ + textData += xmlData[i]; + } + } + return xmlObj; +} + +function closingIndexForOpeningTag(data, i){ + let attrBoundary; + let tagExp = ""; + for (let index = i; index < data.length; index++) { + let ch = data[index]; + if (attrBoundary) { + if (ch === attrBoundary) attrBoundary = "";//reset + } else if (ch === '"' || ch === "'") { + attrBoundary = ch; + } else if (ch === '>') { + return { + data: tagExp, + index: index + } + } else if (ch === '\t') { + ch = " " + } + tagExp += ch; + } +} + +function findClosingIndex(xmlData, str, i, errMsg){ + const closingIndex = xmlData.indexOf(str, i); + if(closingIndex === -1){ + throw new Error(errMsg) + }else{ + return closingIndex + str.length - 1; + } +} + +exports.getTraversalObj = getTraversalObj; + + +/***/ }), + +/***/ 91683: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const path_1 = __nccwpck_require__(85622); +/** + * File URI to Path function. + * + * @param {String} uri + * @return {String} path + * @api public + */ +function fileUriToPath(uri) { + if (typeof uri !== 'string' || + uri.length <= 7 || + uri.substring(0, 7) !== 'file://') { + throw new TypeError('must pass in a file:// URI to convert to a file path'); + } + const rest = decodeURI(uri.substring(7)); + const firstSlash = rest.indexOf('/'); + let host = rest.substring(0, firstSlash); + let path = rest.substring(firstSlash + 1); + // 2. Scheme Definition + // As a special case, can be the string "localhost" or the empty + // string; this is interpreted as "the machine from which the URL is + // being interpreted". + if (host === 'localhost') { + host = ''; + } + if (host) { + host = path_1.sep + path_1.sep + host; + } + // 3.2 Drives, drive letters, mount points, file system root + // Drive letters are mapped into the top of a file URI in various ways, + // depending on the implementation; some applications substitute + // vertical bar ("|") for the colon after the drive letter, yielding + // "file:///c|/tmp/test.txt". In some cases, the colon is left + // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the + // colon is simply omitted, as in "file:///c/tmp/test.txt". + path = path.replace(/^(.+)\|/, '$1:'); + // for Windows, we need to invert the path separators from what a URI uses + if (path_1.sep === '\\') { + path = path.replace(/\//g, '\\'); + } + if (/^.+:/.test(path)) { + // has Windows drive at beginning of path + } + else { + // unix path… + path = path_1.sep + path; + } + return host + path; +} +module.exports = fileUriToPath; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 43338: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const mkdirpSync = __nccwpck_require__(12915).mkdirsSync +const utimesSync = __nccwpck_require__(52548).utimesMillisSync +const stat = __nccwpck_require__(73901) + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} + +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) + } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} + +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = __nccwpck_require__(47696)(BUF_LENGTH) + + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 + + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } + + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + + fs.closeSync(fdr) + fs.closeSync(fdw) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) +} + +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync + + +/***/ }), + +/***/ 11135: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = { + copySync: __nccwpck_require__(43338) +} + + +/***/ }), + +/***/ 38834: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const mkdirp = __nccwpck_require__(12915).mkdirs +const pathExists = __nccwpck_require__(43835).pathExists +const utimes = __nccwpck_require__(52548).utimesMillis +const stat = __nccwpck_require__(73901) + +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } + + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) +} + +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) +} + +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} + +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} + +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + }) +} + +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} + +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} + +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) +} + +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) +} + +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) + } + return cb() + }) +} + +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + return copyDir(src, dest, opts, cb) +} + +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) +} + +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} + +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} + +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} + +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} + +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} + +module.exports = copy + + +/***/ }), + +/***/ 61335: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +module.exports = { + copy: u(__nccwpck_require__(38834)) +} + + +/***/ }), + +/***/ 96970: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const mkdir = __nccwpck_require__(12915) +const remove = __nccwpck_require__(47357) + +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) + + items = items.map(item => path.join(dir, item)) + + deleteItem() + + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) + } + }) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} + + +/***/ }), + +/***/ 2164: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const path = __nccwpck_require__(85622) +const fs = __nccwpck_require__(14178) +const mkdir = __nccwpck_require__(12915) +const pathExists = __nccwpck_require__(43835).pathExists + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } + + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} + + +/***/ }), + +/***/ 40055: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const file = __nccwpck_require__(2164) +const link = __nccwpck_require__(53797) +const symlink = __nccwpck_require__(72549) + +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync +} + + +/***/ }), + +/***/ 53797: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const path = __nccwpck_require__(85622) +const fs = __nccwpck_require__(14178) +const mkdir = __nccwpck_require__(12915) +const pathExists = __nccwpck_require__(43835).pathExists + +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } + + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} + +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} + + +/***/ }), + +/***/ 53727: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const path = __nccwpck_require__(85622) +const fs = __nccwpck_require__(14178) +const pathExists = __nccwpck_require__(43835).pathExists + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': srcpath + } + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + exists = fs.existsSync(relativeToDst) + if (exists) { + return { + 'toCwd': relativeToDst, + 'toDst': srcpath + } + } else { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('relative srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + } + } + } +} + +module.exports = { + symlinkPaths, + symlinkPathsSync +} + + +/***/ }), + +/***/ 18254: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) + +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} + +function symlinkTypeSync (srcpath, type) { + let stats + + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +module.exports = { + symlinkType, + symlinkTypeSync +} + + +/***/ }), + +/***/ 72549: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const path = __nccwpck_require__(85622) +const fs = __nccwpck_require__(14178) +const _mkdirs = __nccwpck_require__(12915) +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync + +const _symlinkPaths = __nccwpck_require__(53727) +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + +const _symlinkType = __nccwpck_require__(18254) +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync + +const pathExists = __nccwpck_require__(43835).pathExists + +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} + +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} + + +/***/ }), + +/***/ 61176: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const fs = __nccwpck_require__(14178) + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read() & fs.write need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} + + +/***/ }), + +/***/ 5630: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + __nccwpck_require__(61176), + // Export extra methods: + __nccwpck_require__(11135), + __nccwpck_require__(61335), + __nccwpck_require__(96970), + __nccwpck_require__(40055), + __nccwpck_require__(40213), + __nccwpck_require__(12915), + __nccwpck_require__(69665), + __nccwpck_require__(41497), + __nccwpck_require__(16570), + __nccwpck_require__(43835), + __nccwpck_require__(47357) +) + +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = __nccwpck_require__(35747) +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, "promises", ({ + get () { return fs.promises } + })) +} + + +/***/ }), + +/***/ 40213: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const jsonFile = __nccwpck_require__(18970) + +jsonFile.outputJson = u(__nccwpck_require__(60531)) +jsonFile.outputJsonSync = __nccwpck_require__(19421) +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile + + +/***/ }), + +/***/ 18970: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const jsonFile = __nccwpck_require__(26160) + +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync +} + + +/***/ }), + +/***/ 19421: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const mkdir = __nccwpck_require__(12915) +const jsonFile = __nccwpck_require__(18970) + +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) + + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + jsonFile.writeJsonSync(file, data, options) +} + +module.exports = outputJsonSync + + +/***/ }), + +/***/ 60531: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const path = __nccwpck_require__(85622) +const mkdir = __nccwpck_require__(12915) +const pathExists = __nccwpck_require__(43835).pathExists +const jsonFile = __nccwpck_require__(18970) + +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } + + const dir = path.dirname(file) + + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) +} + +module.exports = outputJson + + +/***/ }), + +/***/ 12915: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const mkdirs = u(__nccwpck_require__(59677)) +const mkdirsSync = __nccwpck_require__(30684) + +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} + + +/***/ }), + +/***/ 30684: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const invalidWin32Path = __nccwpck_require__(71590).invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } + + let mode = opts.mode + const xfs = opts.fs || fs + + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + p = path.resolve(p) + + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 + } + if (!stat.isDirectory()) throw err0 + } + } + + return made +} + +module.exports = mkdirsSync + + +/***/ }), + +/***/ 59677: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const invalidWin32Path = __nccwpck_require__(71590).invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } + + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) + } + + let mode = opts.mode + const xfs = opts.fs || fs + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + callback = callback || function () {} + p = path.resolve(p) + + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break + } + }) +} + +module.exports = mkdirs + + +/***/ }), + +/***/ 71590: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const path = __nccwpck_require__(85622) + +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} + +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ + +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) +} + +module.exports = { + getRootPath, + invalidWin32Path +} + + +/***/ }), + +/***/ 69665: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +module.exports = { + moveSync: __nccwpck_require__(96445) +} + + +/***/ }), + +/***/ 96445: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const copySync = __nccwpck_require__(11135).copySync +const removeSync = __nccwpck_require__(47357).removeSync +const mkdirpSync = __nccwpck_require__(12915).mkdirpSync +const stat = __nccwpck_require__(73901) + +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) +} + +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} + +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} + +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} + +module.exports = moveSync + + +/***/ }), + +/***/ 41497: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +module.exports = { + move: u(__nccwpck_require__(72231)) +} + + +/***/ }), + +/***/ 72231: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const copy = __nccwpck_require__(61335).copy +const remove = __nccwpck_require__(47357).remove +const mkdirp = __nccwpck_require__(12915).mkdirp +const pathExists = __nccwpck_require__(43835).pathExists +const stat = __nccwpck_require__(73901) + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + const overwrite = opts.overwrite || opts.clobber || false + + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} + +function doRename (src, dest, overwrite, cb) { + if (overwrite) { + return remove(dest, err => { + if (err) return cb(err) + return rename(src, dest, overwrite, cb) + }) + } + pathExists(dest, (err, destExists) => { + if (err) return cb(err) + if (destExists) return cb(new Error('dest already exists.')) + return rename(src, dest, overwrite, cb) + }) +} + +function rename (src, dest, overwrite, cb) { + fs.rename(src, dest, err => { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} + +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} + +module.exports = move + + +/***/ }), + +/***/ 16570: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const mkdir = __nccwpck_require__(12915) +const pathExists = __nccwpck_require__(43835).pathExists + +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } + + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + + fs.writeFile(file, data, encoding, callback) + }) + }) +} + +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} + +module.exports = { + outputFile: u(outputFile), + outputFileSync +} + + +/***/ }), + +/***/ 43835: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const u = __nccwpck_require__(9046)/* .fromPromise */ .p +const fs = __nccwpck_require__(61176) + +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} + +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} + + +/***/ }), + +/***/ 47357: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const u = __nccwpck_require__(9046)/* .fromCallback */ .E +const rimraf = __nccwpck_require__(38761) + +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync +} + + +/***/ }), + +/***/ 38761: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) +const assert = __nccwpck_require__(42357) + +const isWindows = (process.platform === 'win32') + +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 +} + +function rimraf (p, options, cb) { + let busyTries = 0 + + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } + + // already gone + if (er.code === 'ENOENT') er = null + } + + cb(er) + }) +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } + + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } + + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) + } + + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) +} + +function fixWinEPERMSync (p, options, er) { + let stats + + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) + } + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } + + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } + + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) +} + +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) return cb(er) + + let n = files.length + let errState + + if (n === 0) return options.rmdir(p, cb) + + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st + + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } + + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} + +module.exports = rimraf +rimraf.sync = rimrafSync + + +/***/ }), + +/***/ 47696: +/***/ ((module) => { + +"use strict"; + +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) + } + } + return new Buffer(size) +} + + +/***/ }), + +/***/ 73901: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const path = __nccwpck_require__(85622) + +const NODE_VERSION_MAJOR_WITH_BIGINT = 10 +const NODE_VERSION_MINOR_WITH_BIGINT = 5 +const NODE_VERSION_PATCH_WITH_BIGINT = 0 +const nodeVersion = process.versions.node.split('.') +const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) +const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) +const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) + +function nodeSupportsBigInt () { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true + } + } + } + return false +} + +function getStats (src, dest, cb) { + if (nodeSupportsBigInt()) { + fs.stat(src, { bigint: true }, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } else { + fs.stat(src, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } +} + +function getStatsSync (src, dest) { + let srcStat, destStat + if (nodeSupportsBigInt()) { + srcStat = fs.statSync(src, { bigint: true }) + } else { + srcStat = fs.statSync(src) + } + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(dest, { bigint: true }) + } else { + destStat = fs.statSync(dest) + } + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } +} + +function checkPaths (src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) + }) +} + +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} + +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +function checkParentPaths (src, srcStat, dest, funcName, cb) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() + if (nodeSupportsBigInt()) { + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } else { + fs.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } +} + +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(destParent, { bigint: true }) + } else { + destStat = fs.statSync(destParent) + } + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} + +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} + +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} + +module.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir +} + + +/***/ }), + +/***/ 52548: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fs = __nccwpck_require__(14178) +const os = __nccwpck_require__(12087) +const path = __nccwpck_require__(85622) + +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} + +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { + if (err) return callback(err) + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) + }) + }) + }) +} + +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') + } +} + +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + fs.open(path, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, atime, mtime, futimesErr => { + fs.close(fd, closeErr => { + if (callback) callback(futimesErr || closeErr) + }) + }) + }) +} + +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync +} + + +/***/ }), + +/***/ 25086: +/***/ ((module) => { + +"use strict"; + + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} + + +/***/ }), + +/***/ 14178: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var fs = __nccwpck_require__(35747) +var polyfills = __nccwpck_require__(35027) +var legacy = __nccwpck_require__(73836) +var clone = __nccwpck_require__(25086) + +var util = __nccwpck_require__(31669) + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + __nccwpck_require__(42357).equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readdir(path, options, cb) + + function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + }) + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} + + +/***/ }), + +/***/ 73836: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = __nccwpck_require__(92413).Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} + + +/***/ }), + +/***/ 35027: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var constants = __nccwpck_require__(27619) + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} + + +/***/ }), + +/***/ 79203: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var fs = __nccwpck_require__(35747), + tls = __nccwpck_require__(4016), + zlib = __nccwpck_require__(78761), + Socket = __nccwpck_require__(11631).Socket, + EventEmitter = __nccwpck_require__(28614).EventEmitter, + inherits = __nccwpck_require__(31669).inherits, + inspect = __nccwpck_require__(31669).inspect; + +var Parser = __nccwpck_require__(69330); +var XRegExp = __nccwpck_require__(56155)/* .XRegExp */ .d; + +var REX_TIMEVAL = XRegExp.cache('^(?\\d{4})(?\\d{2})(?\\d{2})(?\\d{2})(?\\d{2})(?\\d+)(?:.\\d+)?$'), + RE_PASV = /([\d]+),([\d]+),([\d]+),([\d]+),([-\d]+),([-\d]+)/, + RE_EOL = /\r?\n/g, + RE_WD = /"(.+)"(?: |$)/, + RE_SYST = /^([^ ]+)(?: |$)/; + +var /*TYPE = { + SYNTAX: 0, + INFO: 1, + SOCKETS: 2, + AUTH: 3, + UNSPEC: 4, + FILESYS: 5 + },*/ + RETVAL = { + PRELIM: 1, + OK: 2, + WAITING: 3, + ERR_TEMP: 4, + ERR_PERM: 5 + }, + /*ERRORS = { + 421: 'Service not available, closing control connection', + 425: 'Can\'t open data connection', + 426: 'Connection closed; transfer aborted', + 450: 'Requested file action not taken / File unavailable (e.g., file busy)', + 451: 'Requested action aborted: local error in processing', + 452: 'Requested action not taken / Insufficient storage space in system', + 500: 'Syntax error / Command unrecognized', + 501: 'Syntax error in parameters or arguments', + 502: 'Command not implemented', + 503: 'Bad sequence of commands', + 504: 'Command not implemented for that parameter', + 530: 'Not logged in', + 532: 'Need account for storing files', + 550: 'Requested action not taken / File unavailable (e.g., file not found, no access)', + 551: 'Requested action aborted: page type unknown', + 552: 'Requested file action aborted / Exceeded storage allocation (for current directory or dataset)', + 553: 'Requested action not taken / File name not allowed' + },*/ + bytesNOOP = new Buffer('NOOP\r\n'); + +var FTP = module.exports = function() { + if (!(this instanceof FTP)) + return new FTP(); + + this._socket = undefined; + this._pasvSock = undefined; + this._feat = undefined; + this._curReq = undefined; + this._queue = []; + this._secstate = undefined; + this._debug = undefined; + this._keepalive = undefined; + this._ending = false; + this._parser = undefined; + this.options = { + host: undefined, + port: undefined, + user: undefined, + password: undefined, + secure: false, + secureOptions: undefined, + connTimeout: undefined, + pasvTimeout: undefined, + aliveTimeout: undefined + }; + this.connected = false; +}; +inherits(FTP, EventEmitter); + +FTP.prototype.connect = function(options) { + var self = this; + if (typeof options !== 'object') + options = {}; + this.connected = false; + this.options.host = options.host || 'localhost'; + this.options.port = options.port || 21; + this.options.user = options.user || 'anonymous'; + this.options.password = options.password || 'anonymous@'; + this.options.secure = options.secure || false; + this.options.secureOptions = options.secureOptions; + this.options.connTimeout = options.connTimeout || 10000; + this.options.pasvTimeout = options.pasvTimeout || 10000; + this.options.aliveTimeout = options.keepalive || 10000; + + if (typeof options.debug === 'function') + this._debug = options.debug; + + var secureOptions, + debug = this._debug, + socket = new Socket(); + + socket.setTimeout(0); + socket.setKeepAlive(true); + + this._parser = new Parser({ debug: debug }); + this._parser.on('response', function(code, text) { + var retval = code / 100 >> 0; + if (retval === RETVAL.ERR_TEMP || retval === RETVAL.ERR_PERM) { + if (self._curReq) + self._curReq.cb(makeError(code, text), undefined, code); + else + self.emit('error', makeError(code, text)); + } else if (self._curReq) + self._curReq.cb(undefined, text, code); + + // a hack to signal we're waiting for a PASV data connection to complete + // first before executing any more queued requests ... + // + // also: don't forget our current request if we're expecting another + // terminating response .... + if (self._curReq && retval !== RETVAL.PRELIM) { + self._curReq = undefined; + self._send(); + } + + noopreq.cb(); + }); + + if (this.options.secure) { + secureOptions = {}; + secureOptions.host = this.options.host; + for (var k in this.options.secureOptions) + secureOptions[k] = this.options.secureOptions[k]; + secureOptions.socket = socket; + this.options.secureOptions = secureOptions; + } + + if (this.options.secure === 'implicit') + this._socket = tls.connect(secureOptions, onconnect); + else { + socket.once('connect', onconnect); + this._socket = socket; + } + + var noopreq = { + cmd: 'NOOP', + cb: function() { + clearTimeout(self._keepalive); + self._keepalive = setTimeout(donoop, self.options.aliveTimeout); + } + }; + + function donoop() { + if (!self._socket || !self._socket.writable) + clearTimeout(self._keepalive); + else if (!self._curReq && self._queue.length === 0) { + self._curReq = noopreq; + debug&&debug('[connection] > NOOP'); + self._socket.write(bytesNOOP); + } else + noopreq.cb(); + } + + function onconnect() { + clearTimeout(timer); + clearTimeout(self._keepalive); + self.connected = true; + self._socket = socket; // re-assign for implicit secure connections + + var cmd; + + if (self._secstate) { + if (self._secstate === 'upgraded-tls' && self.options.secure === true) { + cmd = 'PBSZ'; + self._send('PBSZ 0', reentry, true); + } else { + cmd = 'USER'; + self._send('USER ' + self.options.user, reentry, true); + } + } else { + self._curReq = { + cmd: '', + cb: reentry + }; + } + + function reentry(err, text, code) { + if (err && (!cmd || cmd === 'USER' || cmd === 'PASS' || cmd === 'TYPE')) { + self.emit('error', err); + return self._socket && self._socket.end(); + } + if ((cmd === 'AUTH TLS' && code !== 234 && self.options.secure !== true) + || (cmd === 'AUTH SSL' && code !== 334) + || (cmd === 'PBSZ' && code !== 200) + || (cmd === 'PROT' && code !== 200)) { + self.emit('error', makeError(code, 'Unable to secure connection(s)')); + return self._socket && self._socket.end(); + } + + if (!cmd) { + // sometimes the initial greeting can contain useful information + // about authorized use, other limits, etc. + self.emit('greeting', text); + + if (self.options.secure && self.options.secure !== 'implicit') { + cmd = 'AUTH TLS'; + self._send(cmd, reentry, true); + } else { + cmd = 'USER'; + self._send('USER ' + self.options.user, reentry, true); + } + } else if (cmd === 'USER') { + if (code !== 230) { + // password required + if (!self.options.password) { + self.emit('error', makeError(code, 'Password required')); + return self._socket && self._socket.end(); + } + cmd = 'PASS'; + self._send('PASS ' + self.options.password, reentry, true); + } else { + // no password required + cmd = 'PASS'; + reentry(undefined, text, code); + } + } else if (cmd === 'PASS') { + cmd = 'FEAT'; + self._send(cmd, reentry, true); + } else if (cmd === 'FEAT') { + if (!err) + self._feat = Parser.parseFeat(text); + cmd = 'TYPE'; + self._send('TYPE I', reentry, true); + } else if (cmd === 'TYPE') + self.emit('ready'); + else if (cmd === 'PBSZ') { + cmd = 'PROT'; + self._send('PROT P', reentry, true); + } else if (cmd === 'PROT') { + cmd = 'USER'; + self._send('USER ' + self.options.user, reentry, true); + } else if (cmd.substr(0, 4) === 'AUTH') { + if (cmd === 'AUTH TLS' && code !== 234) { + cmd = 'AUTH SSL'; + return self._send(cmd, reentry, true); + } else if (cmd === 'AUTH TLS') + self._secstate = 'upgraded-tls'; + else if (cmd === 'AUTH SSL') + self._secstate = 'upgraded-ssl'; + socket.removeAllListeners('data'); + socket.removeAllListeners('error'); + socket._decoder = null; + self._curReq = null; // prevent queue from being processed during + // TLS/SSL negotiation + secureOptions.socket = self._socket; + secureOptions.session = undefined; + socket = tls.connect(secureOptions, onconnect); + socket.setEncoding('binary'); + socket.on('data', ondata); + socket.once('end', onend); + socket.on('error', onerror); + } + } + } + + socket.on('data', ondata); + function ondata(chunk) { + debug&&debug('[connection] < ' + inspect(chunk.toString('binary'))); + if (self._parser) + self._parser.write(chunk); + } + + socket.on('error', onerror); + function onerror(err) { + clearTimeout(timer); + clearTimeout(self._keepalive); + self.emit('error', err); + } + + socket.once('end', onend); + function onend() { + ondone(); + self.emit('end'); + } + + socket.once('close', function(had_err) { + ondone(); + self.emit('close', had_err); + }); + + var hasReset = false; + function ondone() { + if (!hasReset) { + hasReset = true; + clearTimeout(timer); + self._reset(); + } + } + + var timer = setTimeout(function() { + self.emit('error', new Error('Timeout while connecting to server')); + self._socket && self._socket.destroy(); + self._reset(); + }, this.options.connTimeout); + + this._socket.connect(this.options.port, this.options.host); +}; + +FTP.prototype.end = function() { + if (this._queue.length) + this._ending = true; + else + this._reset(); +}; + +FTP.prototype.destroy = function() { + this._reset(); +}; + +// "Standard" (RFC 959) commands +FTP.prototype.ascii = function(cb) { + return this._send('TYPE A', cb); +}; + +FTP.prototype.binary = function(cb) { + return this._send('TYPE I', cb); +}; + +FTP.prototype.abort = function(immediate, cb) { + if (typeof immediate === 'function') { + cb = immediate; + immediate = true; + } + if (immediate) + this._send('ABOR', cb, true); + else + this._send('ABOR', cb); +}; + +FTP.prototype.cwd = function(path, cb, promote) { + this._send('CWD ' + path, function(err, text, code) { + if (err) + return cb(err); + var m = RE_WD.exec(text); + cb(undefined, m ? m[1] : undefined); + }, promote); +}; + +FTP.prototype.delete = function(path, cb) { + this._send('DELE ' + path, cb); +}; + +FTP.prototype.site = function(cmd, cb) { + this._send('SITE ' + cmd, cb); +}; + +FTP.prototype.status = function(cb) { + this._send('STAT', cb); +}; + +FTP.prototype.rename = function(from, to, cb) { + var self = this; + this._send('RNFR ' + from, function(err) { + if (err) + return cb(err); + + self._send('RNTO ' + to, cb, true); + }); +}; + +FTP.prototype.logout = function(cb) { + this._send('QUIT', cb); +}; + +FTP.prototype.listSafe = function(path, zcomp, cb) { + if (typeof path === 'string') { + var self = this; + // store current path + this.pwd(function(err, origpath) { + if (err) return cb(err); + // change to destination path + self.cwd(path, function(err) { + if (err) return cb(err); + // get dir listing + self.list(zcomp || false, function(err, list) { + // change back to original path + if (err) return self.cwd(origpath, cb); + self.cwd(origpath, function(err) { + if (err) return cb(err); + cb(err, list); + }); + }); + }); + }); + } else + this.list(path, zcomp, cb); +}; + +FTP.prototype.list = function(path, zcomp, cb) { + var self = this, cmd; + + if (typeof path === 'function') { + // list(function() {}) + cb = path; + path = undefined; + cmd = 'LIST'; + zcomp = false; + } else if (typeof path === 'boolean') { + // list(true, function() {}) + cb = zcomp; + zcomp = path; + path = undefined; + cmd = 'LIST'; + } else if (typeof zcomp === 'function') { + // list('/foo', function() {}) + cb = zcomp; + cmd = 'LIST ' + path; + zcomp = false; + } else + cmd = 'LIST ' + path; + + this._pasv(function(err, sock) { + if (err) + return cb(err); + + if (self._queue[0] && self._queue[0].cmd === 'ABOR') { + sock.destroy(); + return cb(); + } + + var sockerr, done = false, replies = 0, entries, buffer = '', source = sock; + + if (zcomp) { + source = zlib.createInflate(); + sock.pipe(source); + } + + source.on('data', function(chunk) { buffer += chunk.toString('binary'); }); + source.once('error', function(err) { + if (!sock.aborting) + sockerr = err; + }); + source.once('end', ondone); + source.once('close', ondone); + + function ondone() { + done = true; + final(); + } + function final() { + if (done && replies === 2) { + replies = 3; + if (sockerr) + return cb(new Error('Unexpected data connection error: ' + sockerr)); + if (sock.aborting) + return cb(); + + // process received data + entries = buffer.split(RE_EOL); + entries.pop(); // ending EOL + var parsed = []; + for (var i = 0, len = entries.length; i < len; ++i) { + var parsedVal = Parser.parseListEntry(entries[i]); + if (parsedVal !== null) + parsed.push(parsedVal); + } + + if (zcomp) { + self._send('MODE S', function() { + cb(undefined, parsed); + }, true); + } else + cb(undefined, parsed); + } + } + + if (zcomp) { + self._send('MODE Z', function(err, text, code) { + if (err) { + sock.destroy(); + return cb(makeError(code, 'Compression not supported')); + } + sendList(); + }, true); + } else + sendList(); + + function sendList() { + // this callback will be executed multiple times, the first is when server + // replies with 150 and then a final reply to indicate whether the + // transfer was actually a success or not + self._send(cmd, function(err, text, code) { + if (err) { + sock.destroy(); + if (zcomp) { + self._send('MODE S', function() { + cb(err); + }, true); + } else + cb(err); + return; + } + + // some servers may not open a data connection for empty directories + if (++replies === 1 && code === 226) { + replies = 2; + sock.destroy(); + final(); + } else if (replies === 2) + final(); + }, true); + } + }); +}; + +FTP.prototype.get = function(path, zcomp, cb) { + var self = this; + if (typeof zcomp === 'function') { + cb = zcomp; + zcomp = false; + } + + this._pasv(function(err, sock) { + if (err) + return cb(err); + + if (self._queue[0] && self._queue[0].cmd === 'ABOR') { + sock.destroy(); + return cb(); + } + + // modify behavior of socket events so that we can emit 'error' once for + // either a TCP-level error OR an FTP-level error response that we get when + // the socket is closed (e.g. the server ran out of space). + var sockerr, started = false, lastreply = false, done = false, + source = sock; + + if (zcomp) { + source = zlib.createInflate(); + sock.pipe(source); + sock._emit = sock.emit; + sock.emit = function(ev, arg1) { + if (ev === 'error') { + if (!sockerr) + sockerr = arg1; + return; + } + sock._emit.apply(sock, Array.prototype.slice.call(arguments)); + }; + } + + source._emit = source.emit; + source.emit = function(ev, arg1) { + if (ev === 'error') { + if (!sockerr) + sockerr = arg1; + return; + } else if (ev === 'end' || ev === 'close') { + if (!done) { + done = true; + ondone(); + } + return; + } + source._emit.apply(source, Array.prototype.slice.call(arguments)); + }; + + function ondone() { + if (done && lastreply) { + self._send('MODE S', function() { + source._emit('end'); + source._emit('close'); + }, true); + } + } + + sock.pause(); + + if (zcomp) { + self._send('MODE Z', function(err, text, code) { + if (err) { + sock.destroy(); + return cb(makeError(code, 'Compression not supported')); + } + sendRetr(); + }, true); + } else + sendRetr(); + + function sendRetr() { + // this callback will be executed multiple times, the first is when server + // replies with 150, then a final reply after the data connection closes + // to indicate whether the transfer was actually a success or not + self._send('RETR ' + path, function(err, text, code) { + if (sockerr || err) { + sock.destroy(); + if (!started) { + if (zcomp) { + self._send('MODE S', function() { + cb(sockerr || err); + }, true); + } else + cb(sockerr || err); + } else { + source._emit('error', sockerr || err); + source._emit('close', true); + } + return; + } + // server returns 125 when data connection is already open; we treat it + // just like a 150 + if (code === 150 || code === 125) { + started = true; + cb(undefined, source); + sock.resume(); + } else { + lastreply = true; + ondone(); + } + }, true); + } + }); +}; + +FTP.prototype.put = function(input, path, zcomp, cb) { + this._store('STOR ' + path, input, zcomp, cb); +}; + +FTP.prototype.append = function(input, path, zcomp, cb) { + this._store('APPE ' + path, input, zcomp, cb); +}; + +FTP.prototype.pwd = function(cb) { // PWD is optional + var self = this; + this._send('PWD', function(err, text, code) { + if (code === 502) { + return self.cwd('.', function(cwderr, cwd) { + if (cwderr) + return cb(cwderr); + if (cwd === undefined) + cb(err); + else + cb(undefined, cwd); + }, true); + } else if (err) + return cb(err); + cb(undefined, RE_WD.exec(text)[1]); + }); +}; + +FTP.prototype.cdup = function(cb) { // CDUP is optional + var self = this; + this._send('CDUP', function(err, text, code) { + if (code === 502) + self.cwd('..', cb, true); + else + cb(err); + }); +}; + +FTP.prototype.mkdir = function(path, recursive, cb) { // MKD is optional + if (typeof recursive === 'function') { + cb = recursive; + recursive = false; + } + if (!recursive) + this._send('MKD ' + path, cb); + else { + var self = this, owd, abs, dirs, dirslen, i = -1, searching = true; + + abs = (path[0] === '/'); + + var nextDir = function() { + if (++i === dirslen) { + // return to original working directory + return self._send('CWD ' + owd, cb, true); + } + if (searching) { + self._send('CWD ' + dirs[i], function(err, text, code) { + if (code === 550) { + searching = false; + --i; + } else if (err) { + // return to original working directory + return self._send('CWD ' + owd, function() { + cb(err); + }, true); + } + nextDir(); + }, true); + } else { + self._send('MKD ' + dirs[i], function(err, text, code) { + if (err) { + // return to original working directory + return self._send('CWD ' + owd, function() { + cb(err); + }, true); + } + self._send('CWD ' + dirs[i], nextDir, true); + }, true); + } + }; + this.pwd(function(err, cwd) { + if (err) + return cb(err); + owd = cwd; + if (abs) + path = path.substr(1); + if (path[path.length - 1] === '/') + path = path.substring(0, path.length - 1); + dirs = path.split('/'); + dirslen = dirs.length; + if (abs) + self._send('CWD /', function(err) { + if (err) + return cb(err); + nextDir(); + }, true); + else + nextDir(); + }); + } +}; + +FTP.prototype.rmdir = function(path, recursive, cb) { // RMD is optional + if (typeof recursive === 'function') { + cb = recursive; + recursive = false; + } + if (!recursive) { + return this._send('RMD ' + path, cb); + } + + var self = this; + this.list(path, function(err, list) { + if (err) return cb(err); + var idx = 0; + + // this function will be called once per listing entry + var deleteNextEntry; + deleteNextEntry = function(err) { + if (err) return cb(err); + if (idx >= list.length) { + if (list[0] && list[0].name === path) { + return cb(null); + } else { + return self.rmdir(path, cb); + } + } + + var entry = list[idx++]; + + // get the path to the file + var subpath = null; + if (entry.name[0] === '/') { + // this will be the case when you call deleteRecursively() and pass + // the path to a plain file + subpath = entry.name; + } else { + if (path[path.length - 1] == '/') { + subpath = path + entry.name; + } else { + subpath = path + '/' + entry.name + } + } + + // delete the entry (recursively) according to its type + if (entry.type === 'd') { + if (entry.name === "." || entry.name === "..") { + return deleteNextEntry(); + } + self.rmdir(subpath, true, deleteNextEntry); + } else { + self.delete(subpath, deleteNextEntry); + } + } + deleteNextEntry(); + }); +}; + +FTP.prototype.system = function(cb) { // SYST is optional + this._send('SYST', function(err, text) { + if (err) + return cb(err); + cb(undefined, RE_SYST.exec(text)[1]); + }); +}; + +// "Extended" (RFC 3659) commands +FTP.prototype.size = function(path, cb) { + var self = this; + this._send('SIZE ' + path, function(err, text, code) { + if (code === 502) { + // Note: this may cause a problem as list() is _appended_ to the queue + return self.list(path, function(err, list) { + if (err) + return cb(err); + if (list.length === 1) + cb(undefined, list[0].size); + else { + // path could have been a directory and we got a listing of its + // contents, but here we echo the behavior of the real SIZE and + // return 'File not found' for directories + cb(new Error('File not found')); + } + }, true); + } else if (err) + return cb(err); + cb(undefined, parseInt(text, 10)); + }); +}; + +FTP.prototype.lastMod = function(path, cb) { + var self = this; + this._send('MDTM ' + path, function(err, text, code) { + if (code === 502) { + return self.list(path, function(err, list) { + if (err) + return cb(err); + if (list.length === 1) + cb(undefined, list[0].date); + else + cb(new Error('File not found')); + }, true); + } else if (err) + return cb(err); + var val = XRegExp.exec(text, REX_TIMEVAL), ret; + if (!val) + return cb(new Error('Invalid date/time format from server')); + ret = new Date(val.year + '-' + val.month + '-' + val.date + 'T' + val.hour + + ':' + val.minute + ':' + val.second); + cb(undefined, ret); + }); +}; + +FTP.prototype.restart = function(offset, cb) { + this._send('REST ' + offset, cb); +}; + + + +// Private/Internal methods +FTP.prototype._pasv = function(cb) { + var self = this, first = true, ip, port; + this._send('PASV', function reentry(err, text) { + if (err) + return cb(err); + + self._curReq = undefined; + + if (first) { + var m = RE_PASV.exec(text); + if (!m) + return cb(new Error('Unable to parse PASV server response')); + ip = m[1]; + ip += '.'; + ip += m[2]; + ip += '.'; + ip += m[3]; + ip += '.'; + ip += m[4]; + port = (parseInt(m[5], 10) * 256) + parseInt(m[6], 10); + + first = false; + } + self._pasvConnect(ip, port, function(err, sock) { + if (err) { + // try the IP of the control connection if the server was somehow + // misconfigured and gave for example a LAN IP instead of WAN IP over + // the Internet + if (self._socket && ip !== self._socket.remoteAddress) { + ip = self._socket.remoteAddress; + return reentry(); + } + + // automatically abort PASV mode + self._send('ABOR', function() { + cb(err); + self._send(); + }, true); + + return; + } + cb(undefined, sock); + self._send(); + }); + }); +}; + +FTP.prototype._pasvConnect = function(ip, port, cb) { + var self = this, + socket = new Socket(), + sockerr, + timedOut = false, + timer = setTimeout(function() { + timedOut = true; + socket.destroy(); + cb(new Error('Timed out while making data connection')); + }, this.options.pasvTimeout); + + socket.setTimeout(0); + + socket.once('connect', function() { + self._debug&&self._debug('[connection] PASV socket connected'); + if (self.options.secure === true) { + self.options.secureOptions.socket = socket; + self.options.secureOptions.session = self._socket.getSession(); + //socket.removeAllListeners('error'); + socket = tls.connect(self.options.secureOptions); + //socket.once('error', onerror); + socket.setTimeout(0); + } + clearTimeout(timer); + self._pasvSocket = socket; + cb(undefined, socket); + }); + socket.once('error', onerror); + function onerror(err) { + sockerr = err; + } + socket.once('end', function() { + clearTimeout(timer); + }); + socket.once('close', function(had_err) { + clearTimeout(timer); + if (!self._pasvSocket && !timedOut) { + var errmsg = 'Unable to make data connection'; + if (sockerr) { + errmsg += '( ' + sockerr + ')'; + sockerr = undefined; + } + cb(new Error(errmsg)); + } + self._pasvSocket = undefined; + }); + + socket.connect(port, ip); +}; + +FTP.prototype._store = function(cmd, input, zcomp, cb) { + var isBuffer = Buffer.isBuffer(input); + + if (!isBuffer && input.pause !== undefined) + input.pause(); + + if (typeof zcomp === 'function') { + cb = zcomp; + zcomp = false; + } + + var self = this; + this._pasv(function(err, sock) { + if (err) + return cb(err); + + if (self._queue[0] && self._queue[0].cmd === 'ABOR') { + sock.destroy(); + return cb(); + } + + var sockerr, dest = sock; + sock.once('error', function(err) { + sockerr = err; + }); + + if (zcomp) { + self._send('MODE Z', function(err, text, code) { + if (err) { + sock.destroy(); + return cb(makeError(code, 'Compression not supported')); + } + // draft-preston-ftpext-deflate-04 says min of 8 should be supported + dest = zlib.createDeflate({ level: 8 }); + dest.pipe(sock); + sendStore(); + }, true); + } else + sendStore(); + + function sendStore() { + // this callback will be executed multiple times, the first is when server + // replies with 150, then a final reply after the data connection closes + // to indicate whether the transfer was actually a success or not + self._send(cmd, function(err, text, code) { + if (sockerr || err) { + if (zcomp) { + self._send('MODE S', function() { + cb(sockerr || err); + }, true); + } else + cb(sockerr || err); + return; + } + + if (code === 150 || code === 125) { + if (isBuffer) + dest.end(input); + else if (typeof input === 'string') { + // check if input is a file path or just string data to store + fs.stat(input, function(err, stats) { + if (err) + dest.end(input); + else + fs.createReadStream(input).pipe(dest); + }); + } else { + input.pipe(dest); + input.resume(); + } + } else { + if (zcomp) + self._send('MODE S', cb, true); + else + cb(); + } + }, true); + } + }); +}; + +FTP.prototype._send = function(cmd, cb, promote) { + clearTimeout(this._keepalive); + if (cmd !== undefined) { + if (promote) + this._queue.unshift({ cmd: cmd, cb: cb }); + else + this._queue.push({ cmd: cmd, cb: cb }); + } + var queueLen = this._queue.length; + if (!this._curReq && queueLen && this._socket && this._socket.readable) { + this._curReq = this._queue.shift(); + if (this._curReq.cmd === 'ABOR' && this._pasvSocket) + this._pasvSocket.aborting = true; + this._debug&&this._debug('[connection] > ' + inspect(this._curReq.cmd)); + this._socket.write(this._curReq.cmd + '\r\n'); + } else if (!this._curReq && !queueLen && this._ending) + this._reset(); +}; + +FTP.prototype._reset = function() { + if (this._pasvSock && this._pasvSock.writable) + this._pasvSock.end(); + if (this._socket && this._socket.writable) + this._socket.end(); + this._socket = undefined; + this._pasvSock = undefined; + this._feat = undefined; + this._curReq = undefined; + this._secstate = undefined; + clearTimeout(this._keepalive); + this._keepalive = undefined; + this._queue = []; + this._ending = false; + this._parser = undefined; + this.options.host = this.options.port = this.options.user + = this.options.password = this.options.secure + = this.options.connTimeout = this.options.pasvTimeout + = this.options.keepalive = this._debug = undefined; + this.connected = false; +}; + +// Utility functions +function makeError(code, text) { + var err = new Error(text); + err.code = code; + return err; +} + + +/***/ }), + +/***/ 69330: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var WritableStream = __nccwpck_require__(92413).Writable + || __nccwpck_require__(51642).Writable, + inherits = __nccwpck_require__(31669).inherits, + inspect = __nccwpck_require__(31669).inspect; + +var XRegExp = __nccwpck_require__(56155)/* .XRegExp */ .d; + +var REX_LISTUNIX = XRegExp.cache('^(?[\\-ld])(?([\\-r][\\-w][\\-xstT]){3})(?(\\+))?\\s+(?\\d+)\\s+(?\\S+)\\s+(?\\S+)\\s+(?\\d+)\\s+(?((?\\w{3})\\s+(?\\d{1,2})\\s+(?\\d{1,2}):(?\\d{2}))|((?\\w{3})\\s+(?\\d{1,2})\\s+(?\\d{4})))\\s+(?.+)$'), + REX_LISTMSDOS = XRegExp.cache('^(?\\d{2})(?:\\-|\\/)(?\\d{2})(?:\\-|\\/)(?\\d{2,4})\\s+(?\\d{2}):(?\\d{2})\\s{0,1}(?[AaMmPp]{1,2})\\s+(?:(?\\d+)|(?\\))\\s+(?.+)$'), + RE_ENTRY_TOTAL = /^total/, + RE_RES_END = /(?:^|\r?\n)(\d{3}) [^\r\n]*\r?\n/, + RE_EOL = /\r?\n/g, + RE_DASH = /\-/g; + +var MONTHS = { + jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, + jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 + }; + +function Parser(options) { + if (!(this instanceof Parser)) + return new Parser(options); + WritableStream.call(this); + + this._buffer = ''; + this._debug = options.debug; +} +inherits(Parser, WritableStream); + +Parser.prototype._write = function(chunk, encoding, cb) { + var m, code, reRmLeadCode, rest = '', debug = this._debug; + + this._buffer += chunk.toString('binary'); + + while (m = RE_RES_END.exec(this._buffer)) { + // support multiple terminating responses in the buffer + rest = this._buffer.substring(m.index + m[0].length); + if (rest.length) + this._buffer = this._buffer.substring(0, m.index + m[0].length); + + debug&&debug('[parser] < ' + inspect(this._buffer)); + + // we have a terminating response line + code = parseInt(m[1], 10); + + // RFC 959 does not require each line in a multi-line response to begin + // with '-', but many servers will do this. + // + // remove this leading '-' (or ' ' from last line) from each + // line in the response ... + reRmLeadCode = '(^|\\r?\\n)'; + reRmLeadCode += m[1]; + reRmLeadCode += '(?: |\\-)'; + reRmLeadCode = new RegExp(reRmLeadCode, 'g'); + var text = this._buffer.replace(reRmLeadCode, '$1').trim(); + this._buffer = rest; + + debug&&debug('[parser] Response: code=' + code + ', buffer=' + inspect(text)); + this.emit('response', code, text); + } + + cb(); +}; + +Parser.parseFeat = function(text) { + var lines = text.split(RE_EOL); + lines.shift(); // initial response line + lines.pop(); // final response line + + for (var i = 0, len = lines.length; i < len; ++i) + lines[i] = lines[i].trim(); + + // just return the raw lines for now + return lines; +}; + +Parser.parseListEntry = function(line) { + var ret, + info, + month, day, year, + hour, mins; + + if (ret = XRegExp.exec(line, REX_LISTUNIX)) { + info = { + type: ret.type, + name: undefined, + target: undefined, + sticky: false, + rights: { + user: ret.permission.substr(0, 3).replace(RE_DASH, ''), + group: ret.permission.substr(3, 3).replace(RE_DASH, ''), + other: ret.permission.substr(6, 3).replace(RE_DASH, '') + }, + acl: (ret.acl === '+'), + owner: ret.owner, + group: ret.group, + size: parseInt(ret.size, 10), + date: undefined + }; + + // check for sticky bit + var lastbit = info.rights.other.slice(-1); + if (lastbit === 't') { + info.rights.other = info.rights.other.slice(0, -1) + 'x'; + info.sticky = true; + } else if (lastbit === 'T') { + info.rights.other = info.rights.other.slice(0, -1); + info.sticky = true; + } + + if (ret.month1 !== undefined) { + month = parseInt(MONTHS[ret.month1.toLowerCase()], 10); + day = parseInt(ret.date1, 10); + year = (new Date()).getFullYear(); + hour = parseInt(ret.hour, 10); + mins = parseInt(ret.minute, 10); + if (month < 10) + month = '0' + month; + if (day < 10) + day = '0' + day; + if (hour < 10) + hour = '0' + hour; + if (mins < 10) + mins = '0' + mins; + info.date = new Date(year + '-' + + month + '-' + + day + 'T' + + hour + ':' + + mins); + // If the date is in the past but no more than 6 months old, year + // isn't displayed and doesn't have to be the current year. + // + // If the date is in the future (less than an hour from now), year + // isn't displayed and doesn't have to be the current year. + // That second case is much more rare than the first and less annoying. + // It's impossible to fix without knowing about the server's timezone, + // so we just don't do anything about it. + // + // If we're here with a time that is more than 28 hours into the + // future (1 hour + maximum timezone offset which is 27 hours), + // there is a problem -- we should be in the second conditional block + if (info.date.getTime() - Date.now() > 100800000) { + info.date = new Date((year - 1) + '-' + + month + '-' + + day + 'T' + + hour + ':' + + mins); + } + + // If we're here with a time that is more than 6 months old, there's + // a problem as well. + // Maybe local & remote servers aren't on the same timezone (with remote + // ahead of local) + // For instance, remote is in 2014 while local is still in 2013. In + // this case, a date like 01/01/13 02:23 could be detected instead of + // 01/01/14 02:23 + // Our trigger point will be 3600*24*31*6 (since we already use 31 + // as an upper bound, no need to add the 27 hours timezone offset) + if (Date.now() - info.date.getTime() > 16070400000) { + info.date = new Date((year + 1) + '-' + + month + '-' + + day + 'T' + + hour + ':' + + mins); + } + } else if (ret.month2 !== undefined) { + month = parseInt(MONTHS[ret.month2.toLowerCase()], 10); + day = parseInt(ret.date2, 10); + year = parseInt(ret.year, 10); + if (month < 10) + month = '0' + month; + if (day < 10) + day = '0' + day; + info.date = new Date(year + '-' + month + '-' + day); + } + if (ret.type === 'l') { + var pos = ret.name.indexOf(' -> '); + info.name = ret.name.substring(0, pos); + info.target = ret.name.substring(pos+4); + } else + info.name = ret.name; + ret = info; + } else if (ret = XRegExp.exec(line, REX_LISTMSDOS)) { + info = { + name: ret.name, + type: (ret.isdir ? 'd' : '-'), + size: (ret.isdir ? 0 : parseInt(ret.size, 10)), + date: undefined, + }; + month = parseInt(ret.month, 10), + day = parseInt(ret.date, 10), + year = parseInt(ret.year, 10), + hour = parseInt(ret.hour, 10), + mins = parseInt(ret.minute, 10); + + if (year < 70) + year += 2000; + else + year += 1900; + + if (ret.ampm[0].toLowerCase() === 'p' && hour < 12) + hour += 12; + else if (ret.ampm[0].toLowerCase() === 'a' && hour === 12) + hour = 0; + + info.date = new Date(year, month - 1, day, hour, mins); + + ret = info; + } else if (!RE_ENTRY_TOTAL.test(line)) + ret = line; // could not parse, so at least give the end user a chance to + // look at the raw listing themselves + + return ret; +}; + +module.exports = Parser; + + +/***/ }), + +/***/ 15525: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const stream_1 = __nccwpck_require__(92413); +const crypto_1 = __nccwpck_require__(76417); +const data_uri_to_buffer_1 = __importDefault(__nccwpck_require__(92371)); +const notmodified_1 = __importDefault(__nccwpck_require__(70186)); +const debug = debug_1.default('get-uri:data'); +class DataReadable extends stream_1.Readable { + constructor(hash, buf) { + super(); + this.push(buf); + this.push(null); + this.hash = hash; + } +} +/** + * Returns a Readable stream from a "data:" URI. + */ +function get({ href: uri }, { cache }) { + return __awaiter(this, void 0, void 0, function* () { + // need to create a SHA1 hash of the URI string, for cacheability checks + // in future `getUri()` calls with the same data URI passed in. + const shasum = crypto_1.createHash('sha1'); + shasum.update(uri); + const hash = shasum.digest('hex'); + debug('generated SHA1 hash for "data:" URI: %o', hash); + // check if the cache is the same "data:" URI that was previously passed in. + if (cache && cache.hash === hash) { + debug('got matching cache SHA1 hash: %o', hash); + throw new notmodified_1.default(); + } + else { + debug('creating Readable stream from "data:" URI buffer'); + const buf = data_uri_to_buffer_1.default(uri); + return new DataReadable(hash, buf); + } + }); +} +exports.default = get; +//# sourceMappingURL=data.js.map + +/***/ }), + +/***/ 50878: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const fs_1 = __nccwpck_require__(35747); +const fs_extra_1 = __nccwpck_require__(5630); +const file_uri_to_path_1 = __importDefault(__nccwpck_require__(91683)); +const notfound_1 = __importDefault(__nccwpck_require__(25767)); +const notmodified_1 = __importDefault(__nccwpck_require__(70186)); +const debug = debug_1.default('get-uri:file'); +/** + * Returns a `fs.ReadStream` instance from a "file:" URI. + */ +function get({ href: uri }, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { cache, flags = 'r', mode = 438 // =0666 + } = opts; + try { + // Convert URI → Path + const filepath = file_uri_to_path_1.default(uri); + debug('Normalized pathname: %o', filepath); + // `open()` first to get a file descriptor and ensure that the file + // exists. + const fd = yield fs_extra_1.open(filepath, flags, mode); + // Now `fstat()` to check the `mtime` and store the stat object for + // the cache. + const stat = yield fs_extra_1.fstat(fd); + // if a `cache` was provided, check if the file has not been modified + if (cache && cache.stat && stat && isNotModified(cache.stat, stat)) { + throw new notmodified_1.default(); + } + // `fs.ReadStream` takes care of calling `fs.close()` on the + // fd after it's done reading + // @ts-ignore - `@types/node` doesn't allow `null` as file path :/ + const rs = fs_1.createReadStream(null, Object.assign(Object.assign({ autoClose: true }, opts), { fd })); + rs.stat = stat; + return rs; + } + catch (err) { + if (err.code === 'ENOENT') { + throw new notfound_1.default(); + } + throw err; + } + }); +} +exports.default = get; +// returns `true` if the `mtime` of the 2 stat objects are equal +function isNotModified(prev, curr) { + return +prev.mtime === +curr.mtime; +} +//# sourceMappingURL=file.js.map + +/***/ }), + +/***/ 49886: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const once_1 = __importDefault(__nccwpck_require__(81040)); +const ftp_1 = __importDefault(__nccwpck_require__(79203)); +const path_1 = __nccwpck_require__(85622); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const notfound_1 = __importDefault(__nccwpck_require__(25767)); +const notmodified_1 = __importDefault(__nccwpck_require__(70186)); +const debug = debug_1.default('get-uri:ftp'); +/** + * Returns a Readable stream from an "ftp:" URI. + */ +function get(parsed, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { cache } = opts; + const filepath = parsed.pathname; + let lastModified = null; + if (!filepath) { + throw new TypeError('No "pathname"!'); + } + const client = new ftp_1.default(); + client.once('greeting', (greeting) => { + debug('FTP greeting: %o', greeting); + }); + function onend() { + // close the FTP client socket connection + client.end(); + } + try { + opts.host = parsed.hostname || parsed.host || 'localhost'; + opts.port = parseInt(parsed.port || '0', 10) || 21; + opts.debug = debug; + if (parsed.auth) { + const [user, password] = parsed.auth.split(':'); + opts.user = user; + opts.password = password; + } + // await cb(_ => client.connect(opts, _)); + const readyPromise = once_1.default(client, 'ready'); + client.connect(opts); + yield readyPromise; + // first we have to figure out the Last Modified date. + // try the MDTM command first, which is an optional extension command. + try { + lastModified = yield new Promise((resolve, reject) => { + client.lastMod(filepath, (err, res) => { + return err ? reject(err) : resolve(res); + }); + }); + } + catch (err) { + // handle the "file not found" error code + if (err.code === 550) { + throw new notfound_1.default(); + } + } + if (!lastModified) { + // Try to get the last modified date via the LIST command (uses + // more bandwidth, but is more compatible with older FTP servers + const list = yield new Promise((resolve, reject) => { + client.list(path_1.dirname(filepath), (err, res) => { + return err ? reject(err) : resolve(res); + }); + }); + // attempt to find the "entry" with a matching "name" + const name = path_1.basename(filepath); + const entry = list.find(e => e.name === name); + if (entry) { + lastModified = entry.date; + } + } + if (lastModified) { + if (isNotModified()) { + throw new notmodified_1.default(); + } + } + else { + throw new notfound_1.default(); + } + // XXX: a small timeout seemed necessary otherwise FTP servers + // were returning empty sockets for the file occasionally + // setTimeout(client.get.bind(client, filepath, onfile), 10); + const rs = (yield new Promise((resolve, reject) => { + client.get(filepath, (err, res) => { + return err ? reject(err) : resolve(res); + }); + })); + rs.once('end', onend); + rs.lastModified = lastModified; + return rs; + } + catch (err) { + client.destroy(); + throw err; + } + // called when `lastModified` is set, and a "cache" stream was provided + function isNotModified() { + if (cache && cache.lastModified && lastModified) { + return +cache.lastModified === +lastModified; + } + return false; + } + }); +} +exports.default = get; +//# sourceMappingURL=ftp.js.map + +/***/ }), + +/***/ 8558: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const http_1 = __nccwpck_require__(98605); +/** + * Error subclass to use when an HTTP application error has occurred. + */ +class HTTPError extends Error { + constructor(statusCode, message = http_1.STATUS_CODES[statusCode]) { + super(message); + Object.setPrototypeOf(this, new.target.prototype); + this.statusCode = statusCode; + this.code = `E${String(message) + .toUpperCase() + .replace(/\s+/g, '')}`; + } +} +exports.default = HTTPError; +//# sourceMappingURL=http-error.js.map + +/***/ }), + +/***/ 33582: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const http_1 = __importDefault(__nccwpck_require__(98605)); +const https_1 = __importDefault(__nccwpck_require__(57211)); +const once_1 = __importDefault(__nccwpck_require__(81040)); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const url_1 = __nccwpck_require__(78835); +const http_error_1 = __importDefault(__nccwpck_require__(8558)); +const notfound_1 = __importDefault(__nccwpck_require__(25767)); +const notmodified_1 = __importDefault(__nccwpck_require__(70186)); +const debug = debug_1.default('get-uri:http'); +/** + * Returns a Readable stream from an "http:" URI. + */ +function get(parsed, opts) { + return __awaiter(this, void 0, void 0, function* () { + debug('GET %o', parsed.href); + const cache = getCache(parsed, opts.cache); + // first check the previous Expires and/or Cache-Control headers + // of a previous response if a `cache` was provided + if (cache && isFresh(cache) && typeof cache.statusCode === 'number') { + // check for a 3xx "redirect" status code on the previous cache + const type = (cache.statusCode / 100) | 0; + if (type === 3 && cache.headers.location) { + debug('cached redirect'); + throw new Error('TODO: implement cached redirects!'); + } + // otherwise we assume that it's the destination endpoint, + // since there's nowhere else to redirect to + throw new notmodified_1.default(); + } + // 5 redirects allowed by default + const maxRedirects = typeof opts.maxRedirects === 'number' ? opts.maxRedirects : 5; + debug('allowing %o max redirects', maxRedirects); + let mod; + if (opts.http) { + // the `https` module passed in from the "http.js" file + mod = opts.http; + debug('using secure `https` core module'); + } + else { + mod = http_1.default; + debug('using `http` core module'); + } + const options = Object.assign(Object.assign({}, opts), parsed); + // add "cache validation" headers if a `cache` was provided + if (cache) { + if (!options.headers) { + options.headers = {}; + } + const lastModified = cache.headers['last-modified']; + if (lastModified) { + options.headers['If-Modified-Since'] = lastModified; + debug('added "If-Modified-Since" request header: %o', lastModified); + } + const etag = cache.headers.etag; + if (etag) { + options.headers['If-None-Match'] = etag; + debug('added "If-None-Match" request header: %o', etag); + } + } + const req = mod.get(options); + const res = yield once_1.default(req, 'response'); + const code = res.statusCode || 0; + // assign a Date to this response for the "Cache-Control" delta calculation + res.date = Date.now(); + res.parsed = parsed; + debug('got %o response status code', code); + // any 2xx response is a "success" code + let type = (code / 100) | 0; + // check for a 3xx "redirect" status code + let location = res.headers.location; + if (type === 3 && location) { + if (!opts.redirects) + opts.redirects = []; + let redirects = opts.redirects; + if (redirects.length < maxRedirects) { + debug('got a "redirect" status code with Location: %o', location); + // flush this response - we're not going to use it + res.resume(); + // hang on to this Response object for the "redirects" Array + redirects.push(res); + let newUri = url_1.resolve(parsed.href, location); + debug('resolved redirect URL: %o', newUri); + let left = maxRedirects - redirects.length; + debug('%o more redirects allowed after this one', left); + // check if redirecting to a different protocol + let parsedUrl = url_1.parse(newUri); + if (parsedUrl.protocol !== parsed.protocol) { + opts.http = parsedUrl.protocol === 'https:' ? https_1.default : undefined; + } + return get(parsedUrl, opts); + } + } + // if we didn't get a 2xx "success" status code, then create an Error object + if (type !== 2) { + res.resume(); + if (code === 304) { + throw new notmodified_1.default(); + } + else if (code === 404) { + throw new notfound_1.default(); + } + // other HTTP-level error + throw new http_error_1.default(code); + } + if (opts.redirects) { + // store a reference to the "redirects" Array on the Response object so that + // they can be inspected during a subsequent call to GET the same URI + res.redirects = opts.redirects; + } + return res; + }); +} +exports.default = get; +/** + * Returns `true` if the provided cache's "freshness" is valid. That is, either + * the Cache-Control header or Expires header values are still within the allowed + * time period. + * + * @return {Boolean} + * @api private + */ +function isFresh(cache) { + let fresh = false; + let expires = parseInt(cache.headers.expires || '', 10); + const cacheControl = cache.headers['cache-control']; + if (cacheControl) { + // for Cache-Control rules, see: http://www.mnot.net/cache_docs/#CACHE-CONTROL + debug('Cache-Control: %o', cacheControl); + const parts = cacheControl.split(/,\s*?\b/); + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + const subparts = part.split('='); + const name = subparts[0]; + switch (name) { + case 'max-age': + expires = (cache.date || 0) + parseInt(subparts[1], 10) * 1000; + fresh = Date.now() < expires; + if (fresh) { + debug('cache is "fresh" due to previous %o Cache-Control param', part); + } + return fresh; + case 'must-revalidate': + // XXX: what we supposed to do here? + break; + case 'no-cache': + case 'no-store': + debug('cache is "stale" due to explicit %o Cache-Control param', name); + return false; + default: + // ignore unknown cache value + break; + } + } + } + else if (expires) { + // for Expires rules, see: http://www.mnot.net/cache_docs/#EXPIRES + debug('Expires: %o', expires); + fresh = Date.now() < expires; + if (fresh) { + debug('cache is "fresh" due to previous Expires response header'); + } + return fresh; + } + return false; +} +/** + * Attempts to return a previous Response object from a previous GET call to the + * same URI. + * + * @api private + */ +function getCache(parsed, cache) { + if (cache) { + if (cache.parsed && cache.parsed.href === parsed.href) { + return cache; + } + if (cache.redirects) { + for (let i = 0; i < cache.redirects.length; i++) { + const c = getCache(parsed, cache.redirects[i]); + if (c) { + return c; + } + } + } + } + return null; +} +//# sourceMappingURL=http.js.map + +/***/ }), + +/***/ 15227: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const https_1 = __importDefault(__nccwpck_require__(57211)); +const http_1 = __importDefault(__nccwpck_require__(33582)); +/** + * Returns a Readable stream from an "https:" URI. + */ +function get(parsed, opts) { + return http_1.default(parsed, Object.assign(Object.assign({}, opts), { http: https_1.default })); +} +exports.default = get; +//# sourceMappingURL=https.js.map + +/***/ }), + +/***/ 11792: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const url_1 = __nccwpck_require__(78835); +// Built-in protocols +const data_1 = __importDefault(__nccwpck_require__(15525)); +const file_1 = __importDefault(__nccwpck_require__(50878)); +const ftp_1 = __importDefault(__nccwpck_require__(49886)); +const http_1 = __importDefault(__nccwpck_require__(33582)); +const https_1 = __importDefault(__nccwpck_require__(15227)); +const debug = debug_1.default('get-uri'); +function getUri(uri, opts, fn) { + const p = new Promise((resolve, reject) => { + debug('getUri(%o)', uri); + if (typeof opts === 'function') { + fn = opts; + opts = undefined; + } + if (!uri) { + reject(new TypeError('Must pass in a URI to "get"')); + return; + } + const parsed = url_1.parse(uri); + // Strip trailing `:` + const protocol = (parsed.protocol || '').replace(/:$/, ''); + if (!protocol) { + reject(new TypeError(`URI does not contain a protocol: ${uri}`)); + return; + } + const getter = getUri.protocols[protocol]; + if (typeof getter !== 'function') { + throw new TypeError(`Unsupported protocol "${protocol}" specified in URI: ${uri}`); + } + resolve(getter(parsed, opts || {})); + }); + if (typeof fn === 'function') { + p.then(rtn => fn(null, rtn), err => fn(err)); + } + else { + return p; + } +} +(function (getUri) { + getUri.protocols = { + data: data_1.default, + file: file_1.default, + ftp: ftp_1.default, + http: http_1.default, + https: https_1.default + }; +})(getUri || (getUri = {})); +module.exports = getUri; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 25767: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Error subclass to use when the source does not exist at the specified endpoint. + * + * @param {String} message optional "message" property to set + * @api protected + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +class NotFoundError extends Error { + constructor(message) { + super(message || 'File does not exist at the specified endpoint'); + this.code = 'ENOTFOUND'; + Object.setPrototypeOf(this, new.target.prototype); + } +} +exports.default = NotFoundError; +//# sourceMappingURL=notfound.js.map + +/***/ }), + +/***/ 70186: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Error subclass to use when the source has not been modified. + * + * @param {String} message optional "message" property to set + * @api protected + */ +class NotModifiedError extends Error { + constructor(message) { + super(message || + 'Source has not been modified since the provied "cache", re-use previous results'); + this.code = 'ENOTMODIFIED'; + Object.setPrototypeOf(this, new.target.prototype); + } +} +exports.default = NotModifiedError; +//# sourceMappingURL=notmodified.js.map + +/***/ }), + +/***/ 31621: +/***/ ((module) => { + +"use strict"; + + +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + + +/***/ }), + +/***/ 95193: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * http-errors + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var deprecate = __nccwpck_require__(18883)('http-errors') +var setPrototypeOf = __nccwpck_require__(40414) +var statuses = __nccwpck_require__(57415) +var inherits = __nccwpck_require__(44124) +var toIdentifier = __nccwpck_require__(46399) + +/** + * Module exports. + * @public + */ + +module.exports = createError +module.exports.HttpError = createHttpErrorConstructor() +module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError) + +// Populate exports for all constructors +populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError) + +/** + * Get the code class of a status code. + * @private + */ + +function codeClass (status) { + return Number(String(status).charAt(0) + '00') +} + +/** + * Create a new HTTP Error. + * + * @returns {Error} + * @public + */ + +function createError () { + // so much arity going on ~_~ + var err + var msg + var status = 500 + var props = {} + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i] + if (arg instanceof Error) { + err = arg + status = err.status || err.statusCode || status + continue + } + switch (typeof arg) { + case 'string': + msg = arg + break + case 'number': + status = arg + if (i !== 0) { + deprecate('non-first-argument status code; replace with createError(' + arg + ', ...)') + } + break + case 'object': + props = arg + break + } + } + + if (typeof status === 'number' && (status < 400 || status >= 600)) { + deprecate('non-error status code; use only 4xx or 5xx status codes') + } + + if (typeof status !== 'number' || + (!statuses[status] && (status < 400 || status >= 600))) { + status = 500 + } + + // constructor + var HttpError = createError[status] || createError[codeClass(status)] + + if (!err) { + // create error + err = HttpError + ? new HttpError(msg) + : new Error(msg || statuses[status]) + Error.captureStackTrace(err, createError) + } + + if (!HttpError || !(err instanceof HttpError) || err.status !== status) { + // add properties to generic error + err.expose = status < 500 + err.status = err.statusCode = status + } + + for (var key in props) { + if (key !== 'status' && key !== 'statusCode') { + err[key] = props[key] + } + } + + return err +} + +/** + * Create HTTP error abstract base class. + * @private + */ + +function createHttpErrorConstructor () { + function HttpError () { + throw new TypeError('cannot construct abstract class') + } + + inherits(HttpError, Error) + + return HttpError +} + +/** + * Create a constructor for a client error. + * @private + */ + +function createClientErrorConstructor (HttpError, name, code) { + var className = toClassName(name) + + function ClientError (message) { + // create the error object + var msg = message != null ? message : statuses[code] + var err = new Error(msg) + + // capture a stack trace to the construction point + Error.captureStackTrace(err, ClientError) + + // adjust the [[Prototype]] + setPrototypeOf(err, ClientError.prototype) + + // redefine the error message + Object.defineProperty(err, 'message', { + enumerable: true, + configurable: true, + value: msg, + writable: true + }) + + // redefine the error name + Object.defineProperty(err, 'name', { + enumerable: false, + configurable: true, + value: className, + writable: true + }) + + return err + } + + inherits(ClientError, HttpError) + nameFunc(ClientError, className) + + ClientError.prototype.status = code + ClientError.prototype.statusCode = code + ClientError.prototype.expose = true + + return ClientError +} + +/** + * Create function to test is a value is a HttpError. + * @private + */ + +function createIsHttpErrorFunction (HttpError) { + return function isHttpError (val) { + if (!val || typeof val !== 'object') { + return false + } + + if (val instanceof HttpError) { + return true + } + + return val instanceof Error && + typeof val.expose === 'boolean' && + typeof val.statusCode === 'number' && val.status === val.statusCode + } +} + +/** + * Create a constructor for a server error. + * @private + */ + +function createServerErrorConstructor (HttpError, name, code) { + var className = toClassName(name) + + function ServerError (message) { + // create the error object + var msg = message != null ? message : statuses[code] + var err = new Error(msg) + + // capture a stack trace to the construction point + Error.captureStackTrace(err, ServerError) + + // adjust the [[Prototype]] + setPrototypeOf(err, ServerError.prototype) + + // redefine the error message + Object.defineProperty(err, 'message', { + enumerable: true, + configurable: true, + value: msg, + writable: true + }) + + // redefine the error name + Object.defineProperty(err, 'name', { + enumerable: false, + configurable: true, + value: className, + writable: true + }) + + return err + } + + inherits(ServerError, HttpError) + nameFunc(ServerError, className) + + ServerError.prototype.status = code + ServerError.prototype.statusCode = code + ServerError.prototype.expose = false + + return ServerError +} + +/** + * Set the name of a function, if possible. + * @private + */ + +function nameFunc (func, name) { + var desc = Object.getOwnPropertyDescriptor(func, 'name') + + if (desc && desc.configurable) { + desc.value = name + Object.defineProperty(func, 'name', desc) + } +} + +/** + * Populate the exports object with constructors for every error class. + * @private + */ + +function populateConstructorExports (exports, codes, HttpError) { + codes.forEach(function forEachCode (code) { + var CodeError + var name = toIdentifier(statuses[code]) + + switch (codeClass(code)) { + case 400: + CodeError = createClientErrorConstructor(HttpError, name, code) + break + case 500: + CodeError = createServerErrorConstructor(HttpError, name, code) + break + } + + if (CodeError) { + // export the constructor + exports[code] = CodeError + exports[name] = CodeError + } + }) + + // backwards-compatibility + exports["I'mateapot"] = deprecate.function(exports.ImATeapot, + '"I\'mateapot"; use "ImATeapot" instead') +} + +/** + * Get a class name from a name identifier. + * @private + */ + +function toClassName (name) { + return name.substr(-5) !== 'Error' + ? name + 'Error' + : name +} + + +/***/ }), + +/***/ 77492: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const net_1 = __importDefault(__nccwpck_require__(11631)); +const tls_1 = __importDefault(__nccwpck_require__(4016)); +const url_1 = __importDefault(__nccwpck_require__(78835)); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const once_1 = __importDefault(__nccwpck_require__(81040)); +const agent_base_1 = __nccwpck_require__(49690); +const debug = debug_1.default('http-proxy-agent'); +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +/** + * The `HttpProxyAgent` implements an HTTP Agent subclass that connects + * to the specified "HTTP proxy server" in order to proxy HTTP requests. + * + * @api public + */ +class HttpProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('Creating new HttpProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + const parsed = url_1.default.parse(req.path); + if (!parsed.protocol) { + parsed.protocol = 'http:'; + } + if (!parsed.hostname) { + parsed.hostname = opts.hostname || opts.host || null; + } + if (parsed.port == null && typeof opts.port) { + parsed.port = String(opts.port); + } + if (parsed.port === '80') { + // if port is 80, then we can remove the port so that the + // ":80" portion is not on the produced URL + delete parsed.port; + } + // Change the `http.ClientRequest` instance's "path" field + // to the absolute path of the URL that will be requested. + req.path = url_1.default.format(parsed); + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`); + } + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + // At this point, the http ClientRequest's internal `_header` field + // might have already been set. If this is the case then we'll need + // to re-generate the string since we just changed the `req.path`. + if (req._header) { + let first; + let endOfHeaders; + debug('Regenerating stored HTTP header string for request'); + req._header = null; + req._implicitHeader(); + if (req.output && req.output.length > 0) { + // Node < 12 + debug('Patching connection write() output buffer with updated header'); + first = req.output[0]; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.output[0] = req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.output); + } + else if (req.outputData && req.outputData.length > 0) { + // Node >= 12 + debug('Patching connection write() output buffer with updated header'); + first = req.outputData[0].data; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.outputData[0].data = + req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.outputData[0].data); + } + } + // Wait for the socket's `connect` event, so that this `callback()` + // function throws instead of the `http` request machinery. This is + // important for i.e. `PacProxyAgent` which determines a failed proxy + // connection via the `callback()` function throwing. + yield once_1.default(socket, 'connect'); + return socket; + }); + } +} +exports.default = HttpProxyAgent; +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 23764: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(__nccwpck_require__(77492)); +function createHttpProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpProxyAgent) { + createHttpProxyAgent.HttpProxyAgent = agent_1.default; + createHttpProxyAgent.prototype = agent_1.default.prototype; +})(createHttpProxyAgent || (createHttpProxyAgent = {})); +module.exports = createHttpProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 15098: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const net_1 = __importDefault(__nccwpck_require__(11631)); +const tls_1 = __importDefault(__nccwpck_require__(4016)); +const url_1 = __importDefault(__nccwpck_require__(78835)); +const assert_1 = __importDefault(__nccwpck_require__(42357)); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const agent_base_1 = __nccwpck_require__(49690); +const parse_proxy_response_1 = __importDefault(__nccwpck_require__(595)); +const debug = debug_1.default('https-proxy-agent:agent'); +/** + * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to + * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. + * + * Outgoing HTTP requests are first tunneled through the proxy server using the + * `CONNECT` HTTP request method to establish a connection to the proxy server, + * and then the proxy server connects to the destination target and issues the + * HTTP request from the proxy server. + * + * `https:` requests have their socket connection upgraded to TLS once + * the connection to the proxy server has been established. + * + * @api public + */ +class HttpsProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('creating new HttpsProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + // ALPN is supported by Node.js >= v5. + // attempt to negotiate http/1.1 for proxy servers that support http/2 + if (this.secureProxy && !('ALPNProtocols' in proxy)) { + proxy.ALPNProtocols = ['http 1.1']; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + const headers = Object.assign({}, proxy.headers); + const hostname = `${opts.host}:${opts.port}`; + let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`; + } + // The `Host` header should only include the port + // number when it is not the default port. + let { host, port, secureEndpoint } = opts; + if (!isDefaultPort(port, secureEndpoint)) { + host += `:${port}`; + } + headers.Host = host; + headers.Connection = 'close'; + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r\n`; + } + const proxyResponsePromise = parse_proxy_response_1.default(socket); + socket.write(`${payload}\r\n`); + const { statusCode, buffered } = yield proxyResponsePromise; + if (statusCode === 200) { + req.once('socket', resume); + if (opts.secureEndpoint) { + const servername = opts.servername || opts.host; + if (!servername) { + throw new Error('Could not determine "servername"'); + } + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername })); + } + return socket; + } + // Some other status code that's not 200... need to re-play the HTTP + // header "data" events onto the socket once the HTTP machinery is + // attached so that the node core `http` can parse and handle the + // error status code. + // Close the original socket, and a new "fake" socket is returned + // instead, so that the proxy doesn't get the HTTP request + // written to it (which may contain `Authorization` headers or other + // sensitive data). + // + // See: https://hackerone.com/reports/541502 + socket.destroy(); + const fakeSocket = new net_1.default.Socket(); + fakeSocket.readable = true; + // Need to wait for the "socket" event to re-play the "data" events. + req.once('socket', (s) => { + debug('replaying proxy buffer for failed request'); + assert_1.default(s.listenerCount('data') > 0); + // Replay the "buffered" Buffer onto the fake `socket`, since at + // this point the HTTP module machinery has been hooked up for + // the user. + s.push(buffered); + s.push(null); + }); + return fakeSocket; + }); + } +} +exports.default = HttpsProxyAgent; +function resume(socket) { + socket.resume(); +} +function isDefaultPort(port, secure) { + return Boolean((!secure && port === 80) || (secure && port === 443)); +} +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; +} +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 77219: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(__nccwpck_require__(15098)); +function createHttpsProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpsProxyAgent) { + createHttpsProxyAgent.HttpsProxyAgent = agent_1.default; + createHttpsProxyAgent.prototype = agent_1.default.prototype; +})(createHttpsProxyAgent || (createHttpsProxyAgent = {})); +module.exports = createHttpsProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 595: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); +function parseProxyResponse(socket) { + return new Promise((resolve, reject) => { + // we need to buffer any HTTP traffic that happens with the proxy before we get + // the CONNECT response, so that if the response is anything other than an "200" + // response code, then we can re-play the "data" events on the socket once the + // HTTP parser is hooked up... + let buffersLength = 0; + const buffers = []; + function read() { + const b = socket.read(); + if (b) + ondata(b); + else + socket.once('readable', read); + } + function cleanup() { + socket.removeListener('end', onend); + socket.removeListener('error', onerror); + socket.removeListener('close', onclose); + socket.removeListener('readable', read); + } + function onclose(err) { + debug('onclose had error %o', err); + } + function onend() { + debug('onend'); + } + function onerror(err) { + cleanup(); + debug('onerror %o', err); + reject(err); + } + function ondata(b) { + buffers.push(b); + buffersLength += b.length; + const buffered = Buffer.concat(buffers, buffersLength); + const endOfHeaders = buffered.indexOf('\r\n\r\n'); + if (endOfHeaders === -1) { + // keep buffering + debug('have not received end of HTTP headers yet...'); + read(); + return; + } + const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n')); + const statusCode = +firstLine.split(' ')[1]; + debug('got proxy server response: %o', firstLine); + resolve({ + statusCode, + buffered + }); + } + socket.on('error', onerror); + socket.on('close', onclose); + socket.on('end', onend); + read(); + }); +} +exports.default = parseProxyResponse; +//# sourceMappingURL=parse-proxy-response.js.map + +/***/ }), + +/***/ 39695: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(15118).Buffer; + +// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. +// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. +// To save memory and loading time, we read table files only when requested. + +exports._dbcs = DBCSCodec; + +var UNASSIGNED = -1, + GB18030_CODE = -2, + SEQ_START = -10, + NODE_START = -1000, + UNASSIGNED_NODE = new Array(0x100), + DEF_CHAR = -1; + +for (var i = 0; i < 0x100; i++) + UNASSIGNED_NODE[i] = UNASSIGNED; + + +// Class DBCSCodec reads and initializes mapping tables. +function DBCSCodec(codecOptions, iconv) { + this.encodingName = codecOptions.encodingName; + if (!codecOptions) + throw new Error("DBCS codec is called without the data.") + if (!codecOptions.table) + throw new Error("Encoding '" + this.encodingName + "' has no data."); + + // Load tables. + var mappingTable = codecOptions.table(); + + + // Decode tables: MBCS -> Unicode. + + // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. + // Trie root is decodeTables[0]. + // Values: >= 0 -> unicode character code. can be > 0xFFFF + // == UNASSIGNED -> unknown/unassigned sequence. + // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. + // <= NODE_START -> index of the next node in our trie to process next byte. + // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. + this.decodeTables = []; + this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. + + // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. + this.decodeTableSeq = []; + + // Actual mapping tables consist of chunks. Use them to fill up decode tables. + for (var i = 0; i < mappingTable.length; i++) + this._addDecodeChunk(mappingTable[i]); + + this.defaultCharUnicode = iconv.defaultCharUnicode; + + + // Encode tables: Unicode -> DBCS. + + // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. + // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. + // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). + // == UNASSIGNED -> no conversion found. Output a default char. + // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. + this.encodeTable = []; + + // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of + // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key + // means end of sequence (needed when one sequence is a strict subsequence of another). + // Objects are kept separately from encodeTable to increase performance. + this.encodeTableSeq = []; + + // Some chars can be decoded, but need not be encoded. + var skipEncodeChars = {}; + if (codecOptions.encodeSkipVals) + for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { + var val = codecOptions.encodeSkipVals[i]; + if (typeof val === 'number') + skipEncodeChars[val] = true; + else + for (var j = val.from; j <= val.to; j++) + skipEncodeChars[j] = true; + } + + // Use decode trie to recursively fill out encode tables. + this._fillEncodeTable(0, 0, skipEncodeChars); + + // Add more encoding pairs when needed. + if (codecOptions.encodeAdd) { + for (var uChar in codecOptions.encodeAdd) + if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) + this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); + } + + this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; + if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; + if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); + + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 decode tables. + var thirdByteNodeIdx = this.decodeTables.length; + var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + var fourthByteNodeIdx = this.decodeTables.length; + var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; + var secondByteNode = this.decodeTables[secondByteNodeIdx]; + for (var j = 0x30; j <= 0x39; j++) + secondByteNode[j] = NODE_START - thirdByteNodeIdx; + } + for (var i = 0x81; i <= 0xFE; i++) + thirdByteNode[i] = NODE_START - fourthByteNodeIdx; + for (var i = 0x30; i <= 0x39; i++) + fourthByteNode[i] = GB18030_CODE + } +} + +DBCSCodec.prototype.encoder = DBCSEncoder; +DBCSCodec.prototype.decoder = DBCSDecoder; + +// Decoder helpers +DBCSCodec.prototype._getDecodeTrieNode = function(addr) { + var bytes = []; + for (; addr > 0; addr >>= 8) + bytes.push(addr & 0xFF); + if (bytes.length == 0) + bytes.push(0); + + var node = this.decodeTables[0]; + for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. + var val = node[bytes[i]]; + + if (val == UNASSIGNED) { // Create new node. + node[bytes[i]] = NODE_START - this.decodeTables.length; + this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); + } + else if (val <= NODE_START) { // Existing node. + node = this.decodeTables[NODE_START - val]; + } + else + throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); + } + return node; +} + + +DBCSCodec.prototype._addDecodeChunk = function(chunk) { + // First element of chunk is the hex mbcs code where we start. + var curAddr = parseInt(chunk[0], 16); + + // Choose the decoding node where we'll write our chars. + var writeTable = this._getDecodeTrieNode(curAddr); + curAddr = curAddr & 0xFF; + + // Write all other elements of the chunk to the table. + for (var k = 1; k < chunk.length; k++) { + var part = chunk[k]; + if (typeof part === "string") { // String, write as-is. + for (var l = 0; l < part.length;) { + var code = part.charCodeAt(l++); + if (0xD800 <= code && code < 0xDC00) { // Decode surrogate + var codeTrail = part.charCodeAt(l++); + if (0xDC00 <= codeTrail && codeTrail < 0xE000) + writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); + else + throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); + } + else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) + var len = 0xFFF - code + 2; + var seq = []; + for (var m = 0; m < len; m++) + seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. + + writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; + this.decodeTableSeq.push(seq); + } + else + writeTable[curAddr++] = code; // Basic char + } + } + else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. + var charCode = writeTable[curAddr - 1] + 1; + for (var l = 0; l < part; l++) + writeTable[curAddr++] = charCode++; + } + else + throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); + } + if (curAddr > 0xFF) + throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); +} + +// Encoder helpers +DBCSCodec.prototype._getEncodeBucket = function(uCode) { + var high = uCode >> 8; // This could be > 0xFF because of astral characters. + if (this.encodeTable[high] === undefined) + this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. + return this.encodeTable[high]; +} + +DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + if (bucket[low] <= SEQ_START) + this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. + else if (bucket[low] == UNASSIGNED) + bucket[low] = dbcsCode; +} + +DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { + + // Get the root of character tree according to first character of the sequence. + var uCode = seq[0]; + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + + var node; + if (bucket[low] <= SEQ_START) { + // There's already a sequence with - use it. + node = this.encodeTableSeq[SEQ_START-bucket[low]]; + } + else { + // There was no sequence object - allocate a new one. + node = {}; + if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. + bucket[low] = SEQ_START - this.encodeTableSeq.length; + this.encodeTableSeq.push(node); + } + + // Traverse the character tree, allocating new nodes as needed. + for (var j = 1; j < seq.length-1; j++) { + var oldVal = node[uCode]; + if (typeof oldVal === 'object') + node = oldVal; + else { + node = node[uCode] = {} + if (oldVal !== undefined) + node[DEF_CHAR] = oldVal + } + } + + // Set the leaf to given dbcsCode. + uCode = seq[seq.length-1]; + node[uCode] = dbcsCode; +} + +DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { + var node = this.decodeTables[nodeIdx]; + for (var i = 0; i < 0x100; i++) { + var uCode = node[i]; + var mbCode = prefix + i; + if (skipEncodeChars[mbCode]) + continue; + + if (uCode >= 0) + this._setEncodeChar(uCode, mbCode); + else if (uCode <= NODE_START) + this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); + else if (uCode <= SEQ_START) + this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); + } +} + + + +// == Encoder ================================================================== + +function DBCSEncoder(options, codec) { + // Encoder state + this.leadSurrogate = -1; + this.seqObj = undefined; + + // Static data + this.encodeTable = codec.encodeTable; + this.encodeTableSeq = codec.encodeTableSeq; + this.defaultCharSingleByte = codec.defCharSB; + this.gb18030 = codec.gb18030; +} + +DBCSEncoder.prototype.write = function(str) { + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), + leadSurrogate = this.leadSurrogate, + seqObj = this.seqObj, nextChar = -1, + i = 0, j = 0; + + while (true) { + // 0. Get next character. + if (nextChar === -1) { + if (i == str.length) break; + var uCode = str.charCodeAt(i++); + } + else { + var uCode = nextChar; + nextChar = -1; + } + + // 1. Handle surrogates. + if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. + if (uCode < 0xDC00) { // We've got lead surrogate. + if (leadSurrogate === -1) { + leadSurrogate = uCode; + continue; + } else { + leadSurrogate = uCode; + // Double lead surrogate found. + uCode = UNASSIGNED; + } + } else { // We've got trail surrogate. + if (leadSurrogate !== -1) { + uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); + leadSurrogate = -1; + } else { + // Incomplete surrogate pair - only trail surrogate found. + uCode = UNASSIGNED; + } + + } + } + else if (leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. + leadSurrogate = -1; + } + + // 2. Convert uCode character. + var dbcsCode = UNASSIGNED; + if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence + var resCode = seqObj[uCode]; + if (typeof resCode === 'object') { // Sequence continues. + seqObj = resCode; + continue; + + } else if (typeof resCode == 'number') { // Sequence finished. Write it. + dbcsCode = resCode; + + } else if (resCode == undefined) { // Current character is not part of the sequence. + + // Try default character for this sequence + resCode = seqObj[DEF_CHAR]; + if (resCode !== undefined) { + dbcsCode = resCode; // Found. Write it. + nextChar = uCode; // Current character will be written too in the next iteration. + + } else { + // TODO: What if we have no default? (resCode == undefined) + // Then, we should write first char of the sequence as-is and try the rest recursively. + // Didn't do it for now because no encoding has this situation yet. + // Currently, just skip the sequence and write current char. + } + } + seqObj = undefined; + } + else if (uCode >= 0) { // Regular character + var subtable = this.encodeTable[uCode >> 8]; + if (subtable !== undefined) + dbcsCode = subtable[uCode & 0xFF]; + + if (dbcsCode <= SEQ_START) { // Sequence start + seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; + continue; + } + + if (dbcsCode == UNASSIGNED && this.gb18030) { + // Use GB18030 algorithm to find character(s) to write. + var idx = findIdx(this.gb18030.uChars, uCode); + if (idx != -1) { + var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; + newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; + newBuf[j++] = 0x30 + dbcsCode; + continue; + } + } + } + + // 3. Write dbcsCode character. + if (dbcsCode === UNASSIGNED) + dbcsCode = this.defaultCharSingleByte; + + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else if (dbcsCode < 0x10000) { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + else { + newBuf[j++] = dbcsCode >> 16; + newBuf[j++] = (dbcsCode >> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } + } + + this.seqObj = seqObj; + this.leadSurrogate = leadSurrogate; + return newBuf.slice(0, j); +} + +DBCSEncoder.prototype.end = function() { + if (this.leadSurrogate === -1 && this.seqObj === undefined) + return; // All clean. Most often case. + + var newBuf = Buffer.alloc(10), j = 0; + + if (this.seqObj) { // We're in the sequence. + var dbcsCode = this.seqObj[DEF_CHAR]; + if (dbcsCode !== undefined) { // Write beginning of the sequence. + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + } else { + // See todo above. + } + this.seqObj = undefined; + } + + if (this.leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + newBuf[j++] = this.defaultCharSingleByte; + this.leadSurrogate = -1; + } + + return newBuf.slice(0, j); +} + +// Export for testing +DBCSEncoder.prototype.findIdx = findIdx; + + +// == Decoder ================================================================== + +function DBCSDecoder(options, codec) { + // Decoder state + this.nodeIdx = 0; + this.prevBuf = Buffer.alloc(0); + + // Static data + this.decodeTables = codec.decodeTables; + this.decodeTableSeq = codec.decodeTableSeq; + this.defaultCharUnicode = codec.defaultCharUnicode; + this.gb18030 = codec.gb18030; +} + +DBCSDecoder.prototype.write = function(buf) { + var newBuf = Buffer.alloc(buf.length*2), + nodeIdx = this.nodeIdx, + prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, + seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. + uCode; + + if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. + prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); + + for (var i = 0, j = 0; i < buf.length; i++) { + var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; + + // Lookup in current trie node. + var uCode = this.decodeTables[nodeIdx][curByte]; + + if (uCode >= 0) { + // Normal character, just use it. + } + else if (uCode === UNASSIGNED) { // Unknown char. + // TODO: Callback with seq. + //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). + uCode = this.defaultCharUnicode.charCodeAt(0); + } + else if (uCode === GB18030_CODE) { + var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); + var idx = findIdx(this.gb18030.gbChars, ptr); + uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; + } + else if (uCode <= NODE_START) { // Go to next trie node. + nodeIdx = NODE_START - uCode; + continue; + } + else if (uCode <= SEQ_START) { // Output a sequence of chars. + var seq = this.decodeTableSeq[SEQ_START - uCode]; + for (var k = 0; k < seq.length - 1; k++) { + uCode = seq[k]; + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + } + uCode = seq[seq.length-1]; + } + else + throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); + + // Write the character to buffer, handling higher planes using surrogate pair. + if (uCode > 0xFFFF) { + uCode -= 0x10000; + var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); + newBuf[j++] = uCodeLead & 0xFF; + newBuf[j++] = uCodeLead >> 8; + + uCode = 0xDC00 + uCode % 0x400; + } + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + + // Reset trie node. + nodeIdx = 0; seqStart = i+1; + } + + this.nodeIdx = nodeIdx; + this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); + return newBuf.slice(0, j).toString('ucs2'); +} + +DBCSDecoder.prototype.end = function() { + var ret = ''; + + // Try to parse all remaining chars. + while (this.prevBuf.length > 0) { + // Skip 1 character in the buffer. + ret += this.defaultCharUnicode; + var buf = this.prevBuf.slice(1); + + // Parse remaining as usual. + this.prevBuf = Buffer.alloc(0); + this.nodeIdx = 0; + if (buf.length > 0) + ret += this.write(buf); + } + + this.nodeIdx = 0; + return ret; +} + +// Binary search for GB18030. Returns largest i such that table[i] <= val. +function findIdx(table, val) { + if (table[0] > val) + return -1; + + var l = 0, r = table.length; + while (l < r-1) { // always table[l] <= val < table[r] + var mid = l + Math.floor((r-l+1)/2); + if (table[mid] <= val) + l = mid; + else + r = mid; + } + return l; +} + + + +/***/ }), + +/***/ 91386: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// Description of supported double byte encodings and aliases. +// Tables are not require()-d until they are needed to speed up library load. +// require()-s are direct to support Browserify. + +module.exports = { + + // == Japanese/ShiftJIS ==================================================== + // All japanese encodings are based on JIS X set of standards: + // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. + // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. + // Has several variations in 1978, 1983, 1990 and 1997. + // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. + // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. + // 2 planes, first is superset of 0208, second - revised 0212. + // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) + + // Byte encodings are: + // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte + // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. + // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. + // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. + // 0x00-0x7F - lower part of 0201 + // 0x8E, 0xA1-0xDF - upper part of 0201 + // (0xA1-0xFE)x2 - 0208 plane (94x94). + // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). + // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. + // Used as-is in ISO2022 family. + // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, + // 0201-1976 Roman, 0208-1978, 0208-1983. + // * ISO2022-JP-1: Adds esc seq for 0212-1990. + // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. + // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. + // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. + // + // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. + // + // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html + + 'shiftjis': { + type: '_dbcs', + table: function() { return __nccwpck_require__(64108) }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + encodeSkipVals: [{from: 0xED40, to: 0xF940}], + }, + 'csshiftjis': 'shiftjis', + 'mskanji': 'shiftjis', + 'sjis': 'shiftjis', + 'windows31j': 'shiftjis', + 'ms31j': 'shiftjis', + 'xsjis': 'shiftjis', + 'windows932': 'shiftjis', + 'ms932': 'shiftjis', + '932': 'shiftjis', + 'cp932': 'shiftjis', + + 'eucjp': { + type: '_dbcs', + table: function() { return __nccwpck_require__(72417) }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + }, + + // TODO: KDDI extension to Shift_JIS + // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. + // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. + + + // == Chinese/GBK ========================================================== + // http://en.wikipedia.org/wiki/GBK + // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder + + // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 + 'gb2312': 'cp936', + 'gb231280': 'cp936', + 'gb23121980': 'cp936', + 'csgb2312': 'cp936', + 'csiso58gb231280': 'cp936', + 'euccn': 'cp936', + + // Microsoft's CP936 is a subset and approximation of GBK. + 'windows936': 'cp936', + 'ms936': 'cp936', + '936': 'cp936', + 'cp936': { + type: '_dbcs', + table: function() { return __nccwpck_require__(97803) }, + }, + + // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. + 'gbk': { + type: '_dbcs', + table: function() { return __nccwpck_require__(97803).concat(__nccwpck_require__(37419)) }, + }, + 'xgbk': 'gbk', + 'isoir58': 'gbk', + + // GB18030 is an algorithmic extension of GBK. + // Main source: https://www.w3.org/TR/encoding/#gbk-encoder + // http://icu-project.org/docs/papers/gb18030.html + // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml + // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 + 'gb18030': { + type: '_dbcs', + table: function() { return __nccwpck_require__(97803).concat(__nccwpck_require__(37419)) }, + gb18030: function() { return __nccwpck_require__(86351) }, + encodeSkipVals: [0x80], + encodeAdd: {'€': 0xA2E3}, + }, + + 'chinese': 'gb18030', + + + // == Korean =============================================================== + // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. + 'windows949': 'cp949', + 'ms949': 'cp949', + '949': 'cp949', + 'cp949': { + type: '_dbcs', + table: function() { return __nccwpck_require__(87013) }, + }, + + 'cseuckr': 'cp949', + 'csksc56011987': 'cp949', + 'euckr': 'cp949', + 'isoir149': 'cp949', + 'korean': 'cp949', + 'ksc56011987': 'cp949', + 'ksc56011989': 'cp949', + 'ksc5601': 'cp949', + + + // == Big5/Taiwan/Hong Kong ================================================ + // There are lots of tables for Big5 and cp950. Please see the following links for history: + // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html + // Variations, in roughly number of defined chars: + // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT + // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ + // * Big5-2003 (Taiwan standard) almost superset of cp950. + // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. + // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. + // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. + // Plus, it has 4 combining sequences. + // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 + // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. + // Implementations are not consistent within browsers; sometimes labeled as just big5. + // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. + // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 + // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. + // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt + // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt + // + // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder + // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. + + 'windows950': 'cp950', + 'ms950': 'cp950', + '950': 'cp950', + 'cp950': { + type: '_dbcs', + table: function() { return __nccwpck_require__(33104) }, + }, + + // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. + 'big5': 'big5hkscs', + 'big5hkscs': { + type: '_dbcs', + table: function() { return __nccwpck_require__(33104).concat(__nccwpck_require__(43612)) }, + encodeSkipVals: [0xa2cc], + }, + + 'cnbig5': 'big5hkscs', + 'csbig5': 'big5hkscs', + 'xxbig5': 'big5hkscs', +}; + + +/***/ }), + +/***/ 82733: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +// Update this array if you add/rename/remove files in this directory. +// We support Browserify by skipping automatic module discovery and requiring modules directly. +var modules = [ + __nccwpck_require__(12376), + __nccwpck_require__(11155), + __nccwpck_require__(51644), + __nccwpck_require__(26657), + __nccwpck_require__(41080), + __nccwpck_require__(21012), + __nccwpck_require__(39695), + __nccwpck_require__(91386), +]; + +// Put all encoding/alias/codec definitions to single object and export it. +for (var i = 0; i < modules.length; i++) { + var module = modules[i]; + for (var enc in module) + if (Object.prototype.hasOwnProperty.call(module, enc)) + exports[enc] = module[enc]; +} + + +/***/ }), + +/***/ 12376: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(15118).Buffer; + +// Export Node.js internal encodings. + +module.exports = { + // Encodings + utf8: { type: "_internal", bomAware: true}, + cesu8: { type: "_internal", bomAware: true}, + unicode11utf8: "utf8", + + ucs2: { type: "_internal", bomAware: true}, + utf16le: "ucs2", + + binary: { type: "_internal" }, + base64: { type: "_internal" }, + hex: { type: "_internal" }, + + // Codec. + _internal: InternalCodec, +}; + +//------------------------------------------------------------------------------ + +function InternalCodec(codecOptions, iconv) { + this.enc = codecOptions.encodingName; + this.bomAware = codecOptions.bomAware; + + if (this.enc === "base64") + this.encoder = InternalEncoderBase64; + else if (this.enc === "cesu8") { + this.enc = "utf8"; // Use utf8 for decoding. + this.encoder = InternalEncoderCesu8; + + // Add decoder for versions of Node not supporting CESU-8 + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { + this.decoder = InternalDecoderCesu8; + this.defaultCharUnicode = iconv.defaultCharUnicode; + } + } +} + +InternalCodec.prototype.encoder = InternalEncoder; +InternalCodec.prototype.decoder = InternalDecoder; + +//------------------------------------------------------------------------------ + +// We use node.js internal decoder. Its signature is the same as ours. +var StringDecoder = __nccwpck_require__(24304).StringDecoder; + +if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. + StringDecoder.prototype.end = function() {}; + + +function InternalDecoder(options, codec) { + StringDecoder.call(this, codec.enc); +} + +InternalDecoder.prototype = StringDecoder.prototype; + + +//------------------------------------------------------------------------------ +// Encoder is mostly trivial + +function InternalEncoder(options, codec) { + this.enc = codec.enc; +} + +InternalEncoder.prototype.write = function(str) { + return Buffer.from(str, this.enc); +} + +InternalEncoder.prototype.end = function() { +} + + +//------------------------------------------------------------------------------ +// Except base64 encoder, which must keep its state. + +function InternalEncoderBase64(options, codec) { + this.prevStr = ''; +} + +InternalEncoderBase64.prototype.write = function(str) { + str = this.prevStr + str; + var completeQuads = str.length - (str.length % 4); + this.prevStr = str.slice(completeQuads); + str = str.slice(0, completeQuads); + + return Buffer.from(str, "base64"); +} + +InternalEncoderBase64.prototype.end = function() { + return Buffer.from(this.prevStr, "base64"); +} + + +//------------------------------------------------------------------------------ +// CESU-8 encoder is also special. + +function InternalEncoderCesu8(options, codec) { +} + +InternalEncoderCesu8.prototype.write = function(str) { + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; + for (var i = 0; i < str.length; i++) { + var charCode = str.charCodeAt(i); + // Naive implementation, but it works because CESU-8 is especially easy + // to convert from UTF-16 (which all JS strings are encoded in). + if (charCode < 0x80) + buf[bufIdx++] = charCode; + else if (charCode < 0x800) { + buf[bufIdx++] = 0xC0 + (charCode >>> 6); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + else { // charCode will always be < 0x10000 in javascript. + buf[bufIdx++] = 0xE0 + (charCode >>> 12); + buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + } + return buf.slice(0, bufIdx); +} + +InternalEncoderCesu8.prototype.end = function() { +} + +//------------------------------------------------------------------------------ +// CESU-8 decoder is not implemented in Node v4.0+ + +function InternalDecoderCesu8(options, codec) { + this.acc = 0; + this.contBytes = 0; + this.accBytes = 0; + this.defaultCharUnicode = codec.defaultCharUnicode; +} + +InternalDecoderCesu8.prototype.write = function(buf) { + var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, + res = ''; + for (var i = 0; i < buf.length; i++) { + var curByte = buf[i]; + if ((curByte & 0xC0) !== 0x80) { // Leading byte + if (contBytes > 0) { // Previous code is invalid + res += this.defaultCharUnicode; + contBytes = 0; + } + + if (curByte < 0x80) { // Single-byte code + res += String.fromCharCode(curByte); + } else if (curByte < 0xE0) { // Two-byte code + acc = curByte & 0x1F; + contBytes = 1; accBytes = 1; + } else if (curByte < 0xF0) { // Three-byte code + acc = curByte & 0x0F; + contBytes = 2; accBytes = 1; + } else { // Four or more are not supported for CESU-8. + res += this.defaultCharUnicode; + } + } else { // Continuation byte + if (contBytes > 0) { // We're waiting for it. + acc = (acc << 6) | (curByte & 0x3f); + contBytes--; accBytes++; + if (contBytes === 0) { + // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) + if (accBytes === 2 && acc < 0x80 && acc > 0) + res += this.defaultCharUnicode; + else if (accBytes === 3 && acc < 0x800) + res += this.defaultCharUnicode; + else + // Actually add character. + res += String.fromCharCode(acc); + } + } else { // Unexpected continuation byte + res += this.defaultCharUnicode; + } + } + } + this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; + return res; +} + +InternalDecoderCesu8.prototype.end = function() { + var res = 0; + if (this.contBytes > 0) + res += this.defaultCharUnicode; + return res; +} + + +/***/ }), + +/***/ 26657: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(15118).Buffer; + +// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that +// correspond to encoded bytes (if 128 - then lower half is ASCII). + +exports._sbcs = SBCSCodec; +function SBCSCodec(codecOptions, iconv) { + if (!codecOptions) + throw new Error("SBCS codec is called without the data.") + + // Prepare char buffer for decoding. + if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) + throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); + + if (codecOptions.chars.length === 128) { + var asciiString = ""; + for (var i = 0; i < 128; i++) + asciiString += String.fromCharCode(i); + codecOptions.chars = asciiString + codecOptions.chars; + } + + this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); + + // Encoding buffer. + var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); + + for (var i = 0; i < codecOptions.chars.length; i++) + encodeBuf[codecOptions.chars.charCodeAt(i)] = i; + + this.encodeBuf = encodeBuf; +} + +SBCSCodec.prototype.encoder = SBCSEncoder; +SBCSCodec.prototype.decoder = SBCSDecoder; + + +function SBCSEncoder(options, codec) { + this.encodeBuf = codec.encodeBuf; +} + +SBCSEncoder.prototype.write = function(str) { + var buf = Buffer.alloc(str.length); + for (var i = 0; i < str.length; i++) + buf[i] = this.encodeBuf[str.charCodeAt(i)]; + + return buf; +} + +SBCSEncoder.prototype.end = function() { +} + + +function SBCSDecoder(options, codec) { + this.decodeBuf = codec.decodeBuf; +} + +SBCSDecoder.prototype.write = function(buf) { + // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. + var decodeBuf = this.decodeBuf; + var newBuf = Buffer.alloc(buf.length*2); + var idx1 = 0, idx2 = 0; + for (var i = 0; i < buf.length; i++) { + idx1 = buf[i]*2; idx2 = i*2; + newBuf[idx2] = decodeBuf[idx1]; + newBuf[idx2+1] = decodeBuf[idx1+1]; + } + return newBuf.toString('ucs2'); +} + +SBCSDecoder.prototype.end = function() { +} + + +/***/ }), + +/***/ 21012: +/***/ ((module) => { + +"use strict"; + + +// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. +module.exports = { + "437": "cp437", + "737": "cp737", + "775": "cp775", + "850": "cp850", + "852": "cp852", + "855": "cp855", + "856": "cp856", + "857": "cp857", + "858": "cp858", + "860": "cp860", + "861": "cp861", + "862": "cp862", + "863": "cp863", + "864": "cp864", + "865": "cp865", + "866": "cp866", + "869": "cp869", + "874": "windows874", + "922": "cp922", + "1046": "cp1046", + "1124": "cp1124", + "1125": "cp1125", + "1129": "cp1129", + "1133": "cp1133", + "1161": "cp1161", + "1162": "cp1162", + "1163": "cp1163", + "1250": "windows1250", + "1251": "windows1251", + "1252": "windows1252", + "1253": "windows1253", + "1254": "windows1254", + "1255": "windows1255", + "1256": "windows1256", + "1257": "windows1257", + "1258": "windows1258", + "28591": "iso88591", + "28592": "iso88592", + "28593": "iso88593", + "28594": "iso88594", + "28595": "iso88595", + "28596": "iso88596", + "28597": "iso88597", + "28598": "iso88598", + "28599": "iso88599", + "28600": "iso885910", + "28601": "iso885911", + "28603": "iso885913", + "28604": "iso885914", + "28605": "iso885915", + "28606": "iso885916", + "windows874": { + "type": "_sbcs", + "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "win874": "windows874", + "cp874": "windows874", + "windows1250": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "win1250": "windows1250", + "cp1250": "windows1250", + "windows1251": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "win1251": "windows1251", + "cp1251": "windows1251", + "windows1252": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "win1252": "windows1252", + "cp1252": "windows1252", + "windows1253": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "win1253": "windows1253", + "cp1253": "windows1253", + "windows1254": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "win1254": "windows1254", + "cp1254": "windows1254", + "windows1255": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "win1255": "windows1255", + "cp1255": "windows1255", + "windows1256": { + "type": "_sbcs", + "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" + }, + "win1256": "windows1256", + "cp1256": "windows1256", + "windows1257": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" + }, + "win1257": "windows1257", + "cp1257": "windows1257", + "windows1258": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "win1258": "windows1258", + "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", + "iso88592": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "cp28592": "iso88592", + "iso88593": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" + }, + "cp28593": "iso88593", + "iso88594": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" + }, + "cp28594": "iso88594", + "iso88595": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" + }, + "cp28595": "iso88595", + "iso88596": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" + }, + "cp28596": "iso88596", + "iso88597": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "cp28597": "iso88597", + "iso88598": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "cp28598": "iso88598", + "iso88599": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "cp28599": "iso88599", + "iso885910": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨĶ§ĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" + }, + "cp28600": "iso885910", + "iso885911": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "cp28601": "iso885911", + "iso885913": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" + }, + "cp28603": "iso885913", + "iso885914": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" + }, + "cp28604": "iso885914", + "iso885915": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28605": "iso885915", + "iso885916": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Š§š©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" + }, + "cp28606": "iso885916", + "cp437": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm437": "cp437", + "csibm437": "cp437", + "cp737": { + "type": "_sbcs", + "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " + }, + "ibm737": "cp737", + "csibm737": "cp737", + "cp775": { + "type": "_sbcs", + "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£ØפĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " + }, + "ibm775": "cp775", + "csibm775": "cp775", + "cp850": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm850": "cp850", + "csibm850": "cp850", + "cp852": { + "type": "_sbcs", + "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " + }, + "ibm852": "cp852", + "csibm852": "cp852", + "cp855": { + "type": "_sbcs", + "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " + }, + "ibm855": "cp855", + "csibm855": "cp855", + "cp856": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm856": "cp856", + "csibm856": "cp856", + "cp857": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " + }, + "ibm857": "cp857", + "csibm857": "cp857", + "cp858": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm858": "cp858", + "csibm858": "cp858", + "cp860": { + "type": "_sbcs", + "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm860": "cp860", + "csibm860": "cp860", + "cp861": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm861": "cp861", + "csibm861": "cp861", + "cp862": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm862": "cp862", + "csibm862": "cp862", + "cp863": { + "type": "_sbcs", + "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm863": "cp863", + "csibm863": "cp863", + "cp864": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" + }, + "ibm864": "cp864", + "csibm864": "cp864", + "cp865": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm865": "cp865", + "csibm865": "cp865", + "cp866": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " + }, + "ibm866": "cp866", + "csibm866": "cp866", + "cp869": { + "type": "_sbcs", + "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " + }, + "ibm869": "cp869", + "csibm869": "cp869", + "cp922": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖ×ØÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" + }, + "ibm922": "cp922", + "csibm922": "cp922", + "cp1046": { + "type": "_sbcs", + "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" + }, + "ibm1046": "cp1046", + "csibm1046": "cp1046", + "cp1124": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" + }, + "ibm1124": "cp1124", + "csibm1124": "cp1124", + "cp1125": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " + }, + "ibm1125": "cp1125", + "csibm1125": "cp1125", + "cp1129": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1129": "cp1129", + "csibm1129": "cp1129", + "cp1133": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" + }, + "ibm1133": "cp1133", + "csibm1133": "cp1133", + "cp1161": { + "type": "_sbcs", + "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " + }, + "ibm1161": "cp1161", + "csibm1161": "cp1161", + "cp1162": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "ibm1162": "cp1162", + "csibm1162": "cp1162", + "cp1163": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1163": "cp1163", + "csibm1163": "cp1163", + "maccroatian": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" + }, + "maccyrillic": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "macgreek": { + "type": "_sbcs", + "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" + }, + "maciceland": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macroman": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macromania": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macthai": { + "type": "_sbcs", + "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" + }, + "macturkish": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macukraine": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "koi8r": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8u": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8ru": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8t": { + "type": "_sbcs", + "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "armscii8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" + }, + "rk1048": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "tcvn": { + "type": "_sbcs", + "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" + }, + "georgianacademy": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "georgianps": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "pt154": { + "type": "_sbcs", + "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "viscii": { + "type": "_sbcs", + "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" + }, + "iso646cn": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "iso646jp": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "hproman8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" + }, + "macintosh": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "ascii": { + "type": "_sbcs", + "chars": "��������������������������������������������������������������������������������������������������������������������������������" + }, + "tis620": { + "type": "_sbcs", + "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + } +} + +/***/ }), + +/***/ 41080: +/***/ ((module) => { + +"use strict"; + + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + + + +/***/ }), + +/***/ 11155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(15118).Buffer; + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBytes = []; + this.initialBytesLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBytes.push(buf); + this.initialBytesLen += buf.length; + + if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + this.initialBytes.length = this.initialBytesLen = 0; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var res = this.decoder.write(buf), + trail = this.decoder.end(); + + return trail ? (res + trail) : res; + } + return this.decoder.end(); +} + +function detectEncoding(buf, defaultEncoding) { + var enc = defaultEncoding || 'utf-16le'; + + if (buf.length >= 2) { + // Check BOM. + if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM + enc = 'utf-16be'; + else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM + enc = 'utf-16le'; + else { + // No BOM found. Try to deduce encoding from initial content. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions + _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. + + for (var i = 0; i < _len; i += 2) { + if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; + if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; + } + + if (asciiCharsBE > asciiCharsLE) + enc = 'utf-16be'; + else if (asciiCharsBE < asciiCharsLE) + enc = 'utf-16le'; + } + } + + return enc; +} + + + + +/***/ }), + +/***/ 51644: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(15118).Buffer; + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString(); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString(); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + + + +/***/ }), + +/***/ 67961: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + + + +/***/ }), + +/***/ 30393: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +var Buffer = __nccwpck_require__(64293).Buffer; +// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer + +// == Extend Node primitives to use iconv-lite ================================= + +module.exports = function (iconv) { + var original = undefined; // Place to keep original methods. + + // Node authors rewrote Buffer internals to make it compatible with + // Uint8Array and we cannot patch key functions since then. + // Note: this does use older Buffer API on a purpose + iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); + + iconv.extendNodeEncodings = function extendNodeEncodings() { + if (original) return; + original = {}; + + if (!iconv.supportsNodeEncodingsExtension) { + console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node"); + console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility"); + return; + } + + var nodeNativeEncodings = { + 'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, + 'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true, + }; + + Buffer.isNativeEncoding = function(enc) { + return enc && nodeNativeEncodings[enc.toLowerCase()]; + } + + // -- SlowBuffer ----------------------------------------------------------- + var SlowBuffer = __nccwpck_require__(64293).SlowBuffer; + + original.SlowBufferToString = SlowBuffer.prototype.toString; + SlowBuffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.SlowBufferWrite = SlowBuffer.prototype.write; + SlowBuffer.prototype.write = function(string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferWrite.call(this, string, offset, length, encoding); + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + } + + // -- Buffer --------------------------------------------------------------- + + original.BufferIsEncoding = Buffer.isEncoding; + Buffer.isEncoding = function(encoding) { + return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding); + } + + original.BufferByteLength = Buffer.byteLength; + Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferByteLength.call(this, str, encoding); + + // Slow, I know, but we don't have a better way yet. + return iconv.encode(str, encoding).length; + } + + original.BufferToString = Buffer.prototype.toString; + Buffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.BufferWrite = Buffer.prototype.write; + Buffer.prototype.write = function(string, offset, length, encoding) { + var _offset = offset, _length = length, _encoding = encoding; + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferWrite.call(this, string, _offset, _length, _encoding); + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + + // TODO: Set _charsWritten. + } + + + // -- Readable ------------------------------------------------------------- + if (iconv.supportsStreams) { + var Readable = __nccwpck_require__(92413).Readable; + + original.ReadableSetEncoding = Readable.prototype.setEncoding; + Readable.prototype.setEncoding = function setEncoding(enc, options) { + // Use our own decoder, it has the same interface. + // We cannot use original function as it doesn't handle BOM-s. + this._readableState.decoder = iconv.getDecoder(enc, options); + this._readableState.encoding = enc; + } + + Readable.prototype.collect = iconv._collect; + } + } + + // Remove iconv-lite Node primitive extensions. + iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() { + if (!iconv.supportsNodeEncodingsExtension) + return; + if (!original) + throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.") + + delete Buffer.isNativeEncoding; + + var SlowBuffer = __nccwpck_require__(64293).SlowBuffer; + + SlowBuffer.prototype.toString = original.SlowBufferToString; + SlowBuffer.prototype.write = original.SlowBufferWrite; + + Buffer.isEncoding = original.BufferIsEncoding; + Buffer.byteLength = original.BufferByteLength; + Buffer.prototype.toString = original.BufferToString; + Buffer.prototype.write = original.BufferWrite; + + if (iconv.supportsStreams) { + var Readable = __nccwpck_require__(92413).Readable; + + Readable.prototype.setEncoding = original.ReadableSetEncoding; + delete Readable.prototype.collect; + } + + original = undefined; + } +} + + +/***/ }), + +/***/ 19032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// Some environments don't have global Buffer (e.g. React Native). +// Solution would be installing npm modules "buffer" and "stream" explicitly. +var Buffer = __nccwpck_require__(15118).Buffer; + +var bomHandling = __nccwpck_require__(67961), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = __nccwpck_require__(82733); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + + +// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. +var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; +if (nodeVer) { + + // Load streaming support in Node v0.10+ + var nodeVerArr = nodeVer.split(".").map(Number); + if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { + __nccwpck_require__(76409)(iconv); + } + + // Load Node primitive extensions. + __nccwpck_require__(30393)(iconv); +} + +if (false) {} + + +/***/ }), + +/***/ 76409: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var Buffer = __nccwpck_require__(64293).Buffer, + Transform = __nccwpck_require__(92413).Transform; + + +// == Exports ================================================================== +module.exports = function(iconv) { + + // Additional Public API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; + + + // Not published yet. + iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; + iconv._collect = IconvLiteDecoderStream.prototype.collect; +}; + + +// == Encoder stream ======================================================= +function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); +} + +IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } +}); + +IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; +} + + +// == Decoder stream ======================================================= +function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); +} + +IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } +}); + +IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; +} + + + +/***/ }), + +/***/ 44124: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +try { + var util = __nccwpck_require__(31669); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __nccwpck_require__(8544); +} + + +/***/ }), + +/***/ 8544: +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 87547: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var ip = exports; +var Buffer = __nccwpck_require__(64293).Buffer; +var os = __nccwpck_require__(12087); + +ip.toBuffer = function(ip, buff, offset) { + offset = ~~offset; + + var result; + + if (this.isV4Format(ip)) { + result = buff || new Buffer(offset + 4); + ip.split(/\./g).map(function(byte) { + result[offset++] = parseInt(byte, 10) & 0xff; + }); + } else if (this.isV6Format(ip)) { + var sections = ip.split(':', 8); + + var i; + for (i = 0; i < sections.length; i++) { + var isv4 = this.isV4Format(sections[i]); + var v4Buffer; + + if (isv4) { + v4Buffer = this.toBuffer(sections[i]); + sections[i] = v4Buffer.slice(0, 2).toString('hex'); + } + + if (v4Buffer && ++i < 8) { + sections.splice(i, 0, v4Buffer.slice(2, 4).toString('hex')); + } + } + + if (sections[0] === '') { + while (sections.length < 8) sections.unshift('0'); + } else if (sections[sections.length - 1] === '') { + while (sections.length < 8) sections.push('0'); + } else if (sections.length < 8) { + for (i = 0; i < sections.length && sections[i] !== ''; i++); + var argv = [ i, 1 ]; + for (i = 9 - sections.length; i > 0; i--) { + argv.push('0'); + } + sections.splice.apply(sections, argv); + } + + result = buff || new Buffer(offset + 16); + for (i = 0; i < sections.length; i++) { + var word = parseInt(sections[i], 16); + result[offset++] = (word >> 8) & 0xff; + result[offset++] = word & 0xff; + } + } + + if (!result) { + throw Error('Invalid ip address: ' + ip); + } + + return result; +}; + +ip.toString = function(buff, offset, length) { + offset = ~~offset; + length = length || (buff.length - offset); + + var result = []; + if (length === 4) { + // IPv4 + for (var i = 0; i < length; i++) { + result.push(buff[offset + i]); + } + result = result.join('.'); + } else if (length === 16) { + // IPv6 + for (var i = 0; i < length; i += 2) { + result.push(buff.readUInt16BE(offset + i).toString(16)); + } + result = result.join(':'); + result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3'); + result = result.replace(/:{3,4}/, '::'); + } + + return result; +}; + +var ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/; +var ipv6Regex = + /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i; + +ip.isV4Format = function(ip) { + return ipv4Regex.test(ip); +}; + +ip.isV6Format = function(ip) { + return ipv6Regex.test(ip); +}; +function _normalizeFamily(family) { + return family ? family.toLowerCase() : 'ipv4'; +} + +ip.fromPrefixLen = function(prefixlen, family) { + if (prefixlen > 32) { + family = 'ipv6'; + } else { + family = _normalizeFamily(family); + } + + var len = 4; + if (family === 'ipv6') { + len = 16; + } + var buff = new Buffer(len); + + for (var i = 0, n = buff.length; i < n; ++i) { + var bits = 8; + if (prefixlen < 8) { + bits = prefixlen; + } + prefixlen -= bits; + + buff[i] = ~(0xff >> bits) & 0xff; + } + + return ip.toString(buff); +}; + +ip.mask = function(addr, mask) { + addr = ip.toBuffer(addr); + mask = ip.toBuffer(mask); + + var result = new Buffer(Math.max(addr.length, mask.length)); + + var i = 0; + // Same protocol - do bitwise and + if (addr.length === mask.length) { + for (i = 0; i < addr.length; i++) { + result[i] = addr[i] & mask[i]; + } + } else if (mask.length === 4) { + // IPv6 address and IPv4 mask + // (Mask low bits) + for (i = 0; i < mask.length; i++) { + result[i] = addr[addr.length - 4 + i] & mask[i]; + } + } else { + // IPv6 mask and IPv4 addr + for (var i = 0; i < result.length - 6; i++) { + result[i] = 0; + } + + // ::ffff:ipv4 + result[10] = 0xff; + result[11] = 0xff; + for (i = 0; i < addr.length; i++) { + result[i + 12] = addr[i] & mask[i + 12]; + } + i = i + 12; + } + for (; i < result.length; i++) + result[i] = 0; + + return ip.toString(result); +}; + +ip.cidr = function(cidrString) { + var cidrParts = cidrString.split('/'); + + var addr = cidrParts[0]; + if (cidrParts.length !== 2) + throw new Error('invalid CIDR subnet: ' + addr); + + var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.mask(addr, mask); +}; + +ip.subnet = function(addr, mask) { + var networkAddress = ip.toLong(ip.mask(addr, mask)); + + // Calculate the mask's length. + var maskBuffer = ip.toBuffer(mask); + var maskLength = 0; + + for (var i = 0; i < maskBuffer.length; i++) { + if (maskBuffer[i] === 0xff) { + maskLength += 8; + } else { + var octet = maskBuffer[i] & 0xff; + while (octet) { + octet = (octet << 1) & 0xff; + maskLength++; + } + } + } + + var numberOfAddresses = Math.pow(2, 32 - maskLength); + + return { + networkAddress: ip.fromLong(networkAddress), + firstAddress: numberOfAddresses <= 2 ? + ip.fromLong(networkAddress) : + ip.fromLong(networkAddress + 1), + lastAddress: numberOfAddresses <= 2 ? + ip.fromLong(networkAddress + numberOfAddresses - 1) : + ip.fromLong(networkAddress + numberOfAddresses - 2), + broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1), + subnetMask: mask, + subnetMaskLength: maskLength, + numHosts: numberOfAddresses <= 2 ? + numberOfAddresses : numberOfAddresses - 2, + length: numberOfAddresses, + contains: function(other) { + return networkAddress === ip.toLong(ip.mask(other, mask)); + } + }; +}; + +ip.cidrSubnet = function(cidrString) { + var cidrParts = cidrString.split('/'); + + var addr = cidrParts[0]; + if (cidrParts.length !== 2) + throw new Error('invalid CIDR subnet: ' + addr); + + var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.subnet(addr, mask); +}; + +ip.not = function(addr) { + var buff = ip.toBuffer(addr); + for (var i = 0; i < buff.length; i++) { + buff[i] = 0xff ^ buff[i]; + } + return ip.toString(buff); +}; + +ip.or = function(a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // same protocol + if (a.length === b.length) { + for (var i = 0; i < a.length; ++i) { + a[i] |= b[i]; + } + return ip.toString(a); + + // mixed protocols + } else { + var buff = a; + var other = b; + if (b.length > a.length) { + buff = b; + other = a; + } + + var offset = buff.length - other.length; + for (var i = offset; i < buff.length; ++i) { + buff[i] |= other[i - offset]; + } + + return ip.toString(buff); + } +}; + +ip.isEqual = function(a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // Same protocol + if (a.length === b.length) { + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + + // Swap + if (b.length === 4) { + var t = b; + b = a; + a = t; + } + + // a - IPv4, b - IPv6 + for (var i = 0; i < 10; i++) { + if (b[i] !== 0) return false; + } + + var word = b.readUInt16BE(10); + if (word !== 0 && word !== 0xffff) return false; + + for (var i = 0; i < 4; i++) { + if (a[i] !== b[i + 12]) return false; + } + + return true; +}; + +ip.isPrivate = function(addr) { + return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i + .test(addr) || + /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || + /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i + .test(addr) || + /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || + /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || + /^f[cd][0-9a-f]{2}:/i.test(addr) || + /^fe80:/i.test(addr) || + /^::1$/.test(addr) || + /^::$/.test(addr); +}; + +ip.isPublic = function(addr) { + return !ip.isPrivate(addr); +}; + +ip.isLoopback = function(addr) { + return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/ + .test(addr) || + /^fe80::1$/.test(addr) || + /^::1$/.test(addr) || + /^::$/.test(addr); +}; + +ip.loopback = function(family) { + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + if (family !== 'ipv4' && family !== 'ipv6') { + throw new Error('family must be ipv4 or ipv6'); + } + + return family === 'ipv4' ? '127.0.0.1' : 'fe80::1'; +}; + +// +// ### function address (name, family) +// #### @name {string|'public'|'private'} **Optional** Name or security +// of the network interface. +// #### @family {ipv4|ipv6} **Optional** IP family of the address (defaults +// to ipv4). +// +// Returns the address for the network interface on the current system with +// the specified `name`: +// * String: First `family` address of the interface. +// If not found see `undefined`. +// * 'public': the first public ip address of family. +// * 'private': the first private ip address of family. +// * undefined: First address with `ipv4` or loopback address `127.0.0.1`. +// +ip.address = function(name, family) { + var interfaces = os.networkInterfaces(); + var all; + + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + // + // If a specific network interface has been named, + // return the address. + // + if (name && name !== 'private' && name !== 'public') { + var res = interfaces[name].filter(function(details) { + var itemFamily = details.family.toLowerCase(); + return itemFamily === family; + }); + if (res.length === 0) + return undefined; + return res[0].address; + } + + var all = Object.keys(interfaces).map(function (nic) { + // + // Note: name will only be `public` or `private` + // when this is called. + // + var addresses = interfaces[nic].filter(function (details) { + details.family = details.family.toLowerCase(); + if (details.family !== family || ip.isLoopback(details.address)) { + return false; + } else if (!name) { + return true; + } + + return name === 'public' ? ip.isPrivate(details.address) : + ip.isPublic(details.address); + }); + + return addresses.length ? addresses[0].address : undefined; + }).filter(Boolean); + + return !all.length ? ip.loopback(family) : all[0]; +}; + +ip.toLong = function(ip) { + var ipl = 0; + ip.split('.').forEach(function(octet) { + ipl <<= 8; + ipl += parseInt(octet); + }); + return(ipl >>> 0); +}; + +ip.fromLong = function(ipl) { + return ((ipl >>> 24) + '.' + + (ipl >> 16 & 255) + '.' + + (ipl >> 8 & 255) + '.' + + (ipl & 255) ); +}; + + +/***/ }), + +/***/ 20893: +/***/ ((module) => { + +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ 26160: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var _fs +try { + _fs = __nccwpck_require__(17017) +} catch (_) { + _fs = __nccwpck_require__(35747) +} + +function readFile (file, options, callback) { + if (callback == null) { + callback = options + options = {} + } + + if (typeof options === 'string') { + options = {encoding: options} + } + + options = options || {} + var fs = options.fs || _fs + + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws + } + + fs.readFile(file, options, function (err, data) { + if (err) return callback(err) + + data = stripBom(data) + + var obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err2) { + if (shouldThrow) { + err2.message = file + ': ' + err2.message + return callback(err2) + } else { + return callback(null, null) + } + } + + callback(null, obj) + }) +} + +function readFileSync (file, options) { + options = options || {} + if (typeof options === 'string') { + options = {encoding: options} + } + + var fs = options.fs || _fs + + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws + } + + try { + var content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = file + ': ' + err.message + throw err + } else { + return null + } + } +} + +function stringify (obj, options) { + var spaces + var EOL = '\n' + if (typeof options === 'object' && options !== null) { + if (options.spaces) { + spaces = options.spaces + } + if (options.EOL) { + EOL = options.EOL + } + } + + var str = JSON.stringify(obj, options ? options.replacer : null, spaces) + + return str.replace(/\n/g, EOL) + EOL +} + +function writeFile (file, obj, options, callback) { + if (callback == null) { + callback = options + options = {} + } + options = options || {} + var fs = options.fs || _fs + + var str = '' + try { + str = stringify(obj, options) + } catch (err) { + // Need to return whether a callback was passed or not + if (callback) callback(err, null) + return + } + + fs.writeFile(file, str, options, callback) +} + +function writeFileSync (file, obj, options) { + options = options || {} + var fs = options.fs || _fs + + var str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} + +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + content = content.replace(/^\uFEFF/, '') + return content +} + +var jsonfile = { + readFile: readFile, + readFileSync: readFileSync, + writeFile: writeFile, + writeFileSync: writeFileSync +} + +module.exports = jsonfile + + +/***/ }), + +/***/ 87466: +/***/ ((module) => { + +"use strict"; + + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} + + +/***/ }), + +/***/ 17017: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var fs = __nccwpck_require__(35747) +var polyfills = __nccwpck_require__(36194) +var legacy = __nccwpck_require__(89217) +var clone = __nccwpck_require__(87466) + +var util = __nccwpck_require__(31669) + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + __nccwpck_require__(42357).equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readdir(path, options, cb) + + function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + }) + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} + + +/***/ }), + +/***/ 89217: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = __nccwpck_require__(92413).Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} + + +/***/ }), + +/***/ 36194: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var constants = __nccwpck_require__(27619) + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} + + +/***/ }), + +/***/ 7129: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// A linked list to keep track of recently-used-ness +const Yallist = __nccwpck_require__(40665) + +const MAX = Symbol('max') +const LENGTH = Symbol('length') +const LENGTH_CALCULATOR = Symbol('lengthCalculator') +const ALLOW_STALE = Symbol('allowStale') +const MAX_AGE = Symbol('maxAge') +const DISPOSE = Symbol('dispose') +const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet') +const LRU_LIST = Symbol('lruList') +const CACHE = Symbol('cache') +const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet') + +const naiveLength = () => 1 + +// lruList is a yallist where the head is the youngest +// item, and the tail is the oldest. the list contains the Hit +// objects as the entries. +// Each Hit object has a reference to its Yallist.Node. This +// never changes. +// +// cache is a Map (or PseudoMap) that matches the keys to +// the Yallist.Node object. +class LRUCache { + constructor (options) { + if (typeof options === 'number') + options = { max: options } + + if (!options) + options = {} + + if (options.max && (typeof options.max !== 'number' || options.max < 0)) + throw new TypeError('max must be a non-negative number') + // Kind of weird to have a default max of Infinity, but oh well. + const max = this[MAX] = options.max || Infinity + + const lc = options.length || naiveLength + this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc + this[ALLOW_STALE] = options.stale || false + if (options.maxAge && typeof options.maxAge !== 'number') + throw new TypeError('maxAge must be a number') + this[MAX_AGE] = options.maxAge || 0 + this[DISPOSE] = options.dispose + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false + this.reset() + } + + // resize the cache when the max changes. + set max (mL) { + if (typeof mL !== 'number' || mL < 0) + throw new TypeError('max must be a non-negative number') + + this[MAX] = mL || Infinity + trim(this) + } + get max () { + return this[MAX] + } + + set allowStale (allowStale) { + this[ALLOW_STALE] = !!allowStale + } + get allowStale () { + return this[ALLOW_STALE] + } + + set maxAge (mA) { + if (typeof mA !== 'number') + throw new TypeError('maxAge must be a non-negative number') + + this[MAX_AGE] = mA + trim(this) + } + get maxAge () { + return this[MAX_AGE] + } + + // resize the cache when the lengthCalculator changes. + set lengthCalculator (lC) { + if (typeof lC !== 'function') + lC = naiveLength + + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC + this[LENGTH] = 0 + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) + this[LENGTH] += hit.length + }) + } + trim(this) + } + get lengthCalculator () { return this[LENGTH_CALCULATOR] } + + get length () { return this[LENGTH] } + get itemCount () { return this[LRU_LIST].length } + + rforEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev + forEachStep(this, fn, walker, thisp) + walker = prev + } + } + + forEach (fn, thisp) { + thisp = thisp || this + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next + forEachStep(this, fn, walker, thisp) + walker = next + } + } + + keys () { + return this[LRU_LIST].toArray().map(k => k.key) + } + + values () { + return this[LRU_LIST].toArray().map(k => k.value) + } + + reset () { + if (this[DISPOSE] && + this[LRU_LIST] && + this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)) + } + + this[CACHE] = new Map() // hash of items by key + this[LRU_LIST] = new Yallist() // list of items in order of use recency + this[LENGTH] = 0 // length of items in the list + } + + dump () { + return this[LRU_LIST].map(hit => + isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h) + } + + dumpLru () { + return this[LRU_LIST] + } + + set (key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE] + + if (maxAge && typeof maxAge !== 'number') + throw new TypeError('maxAge must be a number') + + const now = maxAge ? Date.now() : 0 + const len = this[LENGTH_CALCULATOR](value, key) + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)) + return false + } + + const node = this[CACHE].get(key) + const item = node.value + + // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value) + } + + item.now = now + item.maxAge = maxAge + item.value = value + this[LENGTH] += len - item.length + item.length = len + this.get(key) + trim(this) + return true + } + + const hit = new Entry(key, value, len, now, maxAge) + + // oversized objects fall out of cache automatically. + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value) + + return false + } + + this[LENGTH] += hit.length + this[LRU_LIST].unshift(hit) + this[CACHE].set(key, this[LRU_LIST].head) + trim(this) + return true + } + + has (key) { + if (!this[CACHE].has(key)) return false + const hit = this[CACHE].get(key).value + return !isStale(this, hit) + } + + get (key) { + return get(this, key, true) + } + + peek (key) { + return get(this, key, false) + } + + pop () { + const node = this[LRU_LIST].tail + if (!node) + return null + + del(this, node) + return node.value + } + + del (key) { + del(this, this[CACHE].get(key)) + } + + load (arr) { + // reset the cache + this.reset() + + const now = Date.now() + // A previous serialized cache has the most recent items first + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l] + const expiresAt = hit.e || 0 + if (expiresAt === 0) + // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + else { + const maxAge = expiresAt - now + // dont add already expired items + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge) + } + } + } + } + + prune () { + this[CACHE].forEach((value, key) => get(this, key, false)) + } +} + +const get = (self, key, doUse) => { + const node = self[CACHE].get(key) + if (node) { + const hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + return undefined + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) + node.value.now = Date.now() + self[LRU_LIST].unshiftNode(node) + } + } + return hit.value + } +} + +const isStale = (self, hit) => { + if (!hit || (!hit.maxAge && !self[MAX_AGE])) + return false + + const diff = Date.now() - hit.now + return hit.maxAge ? diff > hit.maxAge + : self[MAX_AGE] && (diff > self[MAX_AGE]) +} + +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; + self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev + del(self, walker) + walker = prev + } + } +} + +const del = (self, node) => { + if (node) { + const hit = node.value + if (self[DISPOSE]) + self[DISPOSE](hit.key, hit.value) + + self[LENGTH] -= hit.length + self[CACHE].delete(hit.key) + self[LRU_LIST].removeNode(node) + } +} + +class Entry { + constructor (key, value, length, now, maxAge) { + this.key = key + this.value = value + this.length = length + this.now = now + this.maxAge = maxAge || 0 + } +} + +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value + if (isStale(self, hit)) { + del(self, node) + if (!self[ALLOW_STALE]) + hit = undefined + } + if (hit) + fn.call(thisp, hit.value, hit.key, self) +} + +module.exports = LRUCache + + +/***/ }), + +/***/ 80900: +/***/ ((module) => { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} + + +/***/ }), + +/***/ 11494: +/***/ (function(__unused_webpack_module, exports) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var Netmask, atob, chr, chr0, chrA, chra, ip2long, long2ip; + + long2ip = function(long) { + var a, b, c, d; + a = (long & (0xff << 24)) >>> 24; + b = (long & (0xff << 16)) >>> 16; + c = (long & (0xff << 8)) >>> 8; + d = long & 0xff; + return [a, b, c, d].join('.'); + }; + + ip2long = function(ip) { + var b, c, i, j, n, ref; + b = []; + for (i = j = 0; j <= 3; i = ++j) { + if (ip.length === 0) { + break; + } + if (i > 0) { + if (ip[0] !== '.') { + throw new Error('Invalid IP'); + } + ip = ip.substring(1); + } + ref = atob(ip), n = ref[0], c = ref[1]; + ip = ip.substring(c); + b.push(n); + } + if (ip.length !== 0) { + throw new Error('Invalid IP'); + } + switch (b.length) { + case 1: + if (b[0] > 0xFFFFFFFF) { + throw new Error('Invalid IP'); + } + return b[0] >>> 0; + case 2: + if (b[0] > 0xFF || b[1] > 0xFFFFFF) { + throw new Error('Invalid IP'); + } + return (b[0] << 24 | b[1]) >>> 0; + case 3: + if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFFFF) { + throw new Error('Invalid IP'); + } + return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0; + case 4: + if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFF || b[3] > 0xFF) { + throw new Error('Invalid IP'); + } + return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0; + default: + throw new Error('Invalid IP'); + } + }; + + chr = function(b) { + return b.charCodeAt(0); + }; + + chr0 = chr('0'); + + chra = chr('a'); + + chrA = chr('A'); + + atob = function(s) { + var base, dmax, i, n, start; + n = 0; + base = 10; + dmax = '9'; + i = 0; + if (s.length > 1 && s[i] === '0') { + if (s[i + 1] === 'x' || s[i + 1] === 'X') { + i += 2; + base = 16; + } else if ('0' <= s[i + 1] && s[i + 1] <= '9') { + i++; + base = 8; + dmax = '7'; + } + } + start = i; + while (i < s.length) { + if ('0' <= s[i] && s[i] <= dmax) { + n = (n * base + (chr(s[i]) - chr0)) >>> 0; + } else if (base === 16) { + if ('a' <= s[i] && s[i] <= 'f') { + n = (n * base + (10 + chr(s[i]) - chra)) >>> 0; + } else if ('A' <= s[i] && s[i] <= 'F') { + n = (n * base + (10 + chr(s[i]) - chrA)) >>> 0; + } else { + break; + } + } else { + break; + } + if (n > 0xFFFFFFFF) { + throw new Error('too large'); + } + i++; + } + if (i === start) { + throw new Error('empty octet'); + } + return [n, i]; + }; + + Netmask = (function() { + function Netmask(net, mask) { + var error, i, j, ref; + if (typeof net !== 'string') { + throw new Error("Missing `net' parameter"); + } + if (!mask) { + ref = net.split('/', 2), net = ref[0], mask = ref[1]; + } + if (!mask) { + mask = 32; + } + if (typeof mask === 'string' && mask.indexOf('.') > -1) { + try { + this.maskLong = ip2long(mask); + } catch (error1) { + error = error1; + throw new Error("Invalid mask: " + mask); + } + for (i = j = 32; j >= 0; i = --j) { + if (this.maskLong === (0xffffffff << (32 - i)) >>> 0) { + this.bitmask = i; + break; + } + } + } else if (mask || mask === 0) { + this.bitmask = parseInt(mask, 10); + this.maskLong = 0; + if (this.bitmask > 0) { + this.maskLong = (0xffffffff << (32 - this.bitmask)) >>> 0; + } + } else { + throw new Error("Invalid mask: empty"); + } + try { + this.netLong = (ip2long(net) & this.maskLong) >>> 0; + } catch (error1) { + error = error1; + throw new Error("Invalid net address: " + net); + } + if (!(this.bitmask <= 32)) { + throw new Error("Invalid mask for ip4: " + mask); + } + this.size = Math.pow(2, 32 - this.bitmask); + this.base = long2ip(this.netLong); + this.mask = long2ip(this.maskLong); + this.hostmask = long2ip(~this.maskLong); + this.first = this.bitmask <= 30 ? long2ip(this.netLong + 1) : this.base; + this.last = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 2) : long2ip(this.netLong + this.size - 1); + this.broadcast = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 1) : void 0; + } + + Netmask.prototype.contains = function(ip) { + if (typeof ip === 'string' && (ip.indexOf('/') > 0 || ip.split('.').length !== 4)) { + ip = new Netmask(ip); + } + if (ip instanceof Netmask) { + return this.contains(ip.base) && this.contains(ip.broadcast || ip.last); + } else { + return (ip2long(ip) & this.maskLong) >>> 0 === (this.netLong & this.maskLong) >>> 0; + } + }; + + Netmask.prototype.next = function(count) { + if (count == null) { + count = 1; + } + return new Netmask(long2ip(this.netLong + (this.size * count)), this.mask); + }; + + Netmask.prototype.forEach = function(fn) { + var index, lastLong, long; + long = ip2long(this.first); + lastLong = ip2long(this.last); + index = 0; + while (long <= lastLong) { + fn(long2ip(long), long, index); + index++; + long++; + } + }; + + Netmask.prototype.toString = function() { + return this.base + "/" + this.bitmask; + }; + + return Netmask; + + })(); + + exports.ip2long = ip2long; + + exports.long2ip = long2ip; + + exports.Netmask = Netmask; + +}).call(this); + + +/***/ }), + +/***/ 18476: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const net_1 = __importDefault(__nccwpck_require__(11631)); +const tls_1 = __importDefault(__nccwpck_require__(4016)); +const once_1 = __importDefault(__nccwpck_require__(81040)); +const crypto_1 = __importDefault(__nccwpck_require__(76417)); +const get_uri_1 = __importDefault(__nccwpck_require__(11792)); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const raw_body_1 = __importDefault(__nccwpck_require__(47742)); +const url_1 = __nccwpck_require__(78835); +const http_proxy_agent_1 = __nccwpck_require__(23764); +const https_proxy_agent_1 = __nccwpck_require__(77219); +const socks_proxy_agent_1 = __nccwpck_require__(25038); +const pac_resolver_1 = __importDefault(__nccwpck_require__(37055)); +const agent_base_1 = __nccwpck_require__(49690); +const debug = debug_1.default('pac-proxy-agent'); +/** + * The `PacProxyAgent` class. + * + * A few different "protocol" modes are supported (supported protocols are + * backed by the `get-uri` module): + * + * - "pac+data", "data" - refers to an embedded "data:" URI + * - "pac+file", "file" - refers to a local file + * - "pac+ftp", "ftp" - refers to a file located on an FTP server + * - "pac+http", "http" - refers to an HTTP endpoint + * - "pac+https", "https" - refers to an HTTPS endpoint + * + * @api public + */ +class PacProxyAgent extends agent_base_1.Agent { + constructor(uri, opts = {}) { + super(opts); + this.clearResolverPromise = () => { + this.resolverPromise = undefined; + }; + debug('Creating PacProxyAgent with URI %o and options %o', uri, opts); + // Strip the "pac+" prefix + this.uri = uri.replace(/^pac\+/i, ''); + this.opts = Object.assign({}, opts); + this.cache = undefined; + this.resolver = undefined; + this.resolverHash = ''; + this.resolverPromise = undefined; + // For `PacResolver` + if (!this.opts.filename) { + this.opts.filename = uri; + } + } + /** + * Loads the PAC proxy file from the source if necessary, and returns + * a generated `FindProxyForURL()` resolver function to use. + * + * @api private + */ + getResolver() { + if (!this.resolverPromise) { + this.resolverPromise = this.loadResolver(); + this.resolverPromise.then(this.clearResolverPromise, this.clearResolverPromise); + } + return this.resolverPromise; + } + loadResolver() { + return __awaiter(this, void 0, void 0, function* () { + try { + // (Re)load the contents of the PAC file URI + const code = yield this.loadPacFile(); + // Create a sha1 hash of the JS code + const hash = crypto_1.default + .createHash('sha1') + .update(code) + .digest('hex'); + if (this.resolver && this.resolverHash === hash) { + debug('Same sha1 hash for code - contents have not changed, reusing previous proxy resolver'); + return this.resolver; + } + // Cache the resolver + debug('Creating new proxy resolver instance'); + this.resolver = pac_resolver_1.default(code, this.opts); + // Store that sha1 hash for future comparison purposes + this.resolverHash = hash; + return this.resolver; + } + catch (err) { + if (this.resolver && err.code === 'ENOTMODIFIED') { + debug('Got ENOTMODIFIED response, reusing previous proxy resolver'); + return this.resolver; + } + throw err; + } + }); + } + /** + * Loads the contents of the PAC proxy file. + * + * @api private + */ + loadPacFile() { + return __awaiter(this, void 0, void 0, function* () { + debug('Loading PAC file: %o', this.uri); + const rs = yield get_uri_1.default(this.uri, { cache: this.cache }); + debug('Got `Readable` instance for URI'); + this.cache = rs; + const buf = yield raw_body_1.default(rs); + debug('Read %o byte PAC file from URI', buf.length); + return buf.toString('utf8'); + }); + } + /** + * Called when the node-core HTTP client library is creating a new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { secureEndpoint } = opts; + // First, get a generated `FindProxyForURL()` function, + // either cached or retrieved from the source + const resolver = yield this.getResolver(); + // Calculate the `url` parameter + const defaultPort = secureEndpoint ? 443 : 80; + let path = req.path; + let search = null; + const firstQuestion = path.indexOf('?'); + if (firstQuestion !== -1) { + search = path.substring(firstQuestion); + path = path.substring(0, firstQuestion); + } + const urlOpts = Object.assign(Object.assign({}, opts), { protocol: secureEndpoint ? 'https:' : 'http:', pathname: path, search, + // need to use `hostname` instead of `host` otherwise `port` is ignored + hostname: opts.host, host: null, href: null, + // set `port` to null when it is the protocol default port (80 / 443) + port: defaultPort === opts.port ? null : opts.port }); + const url = url_1.format(urlOpts); + debug('url: %o', url); + let result = yield resolver(url); + // Default to "DIRECT" if a falsey value was returned (or nothing) + if (!result) { + result = 'DIRECT'; + } + const proxies = String(result) + .trim() + .split(/\s*;\s*/g) + .filter(Boolean); + if (this.opts.fallbackToDirect && !proxies.includes('DIRECT')) { + proxies.push('DIRECT'); + } + for (const proxy of proxies) { + let agent = null; + let socket = null; + const [type, target] = proxy.split(/\s+/); + debug('Attempting to use proxy: %o', proxy); + if (type === 'DIRECT') { + // Direct connection to the destination endpoint + socket = secureEndpoint ? tls_1.default.connect(opts) : net_1.default.connect(opts); + } + else if (type === 'SOCKS' || type === 'SOCKS5') { + // Use a SOCKSv5h proxy + agent = new socks_proxy_agent_1.SocksProxyAgent(`socks://${target}`); + } + else if (type === 'SOCKS4') { + // Use a SOCKSv4a proxy + agent = new socks_proxy_agent_1.SocksProxyAgent(`socks4a://${target}`); + } + else if (type === 'PROXY' || + type === 'HTTP' || + type === 'HTTPS') { + // Use an HTTP or HTTPS proxy + // http://dev.chromium.org/developers/design-documents/secure-web-proxy + const proxyURL = `${type === 'HTTPS' ? 'https' : 'http'}://${target}`; + const proxyOpts = Object.assign(Object.assign({}, this.opts), url_1.parse(proxyURL)); + if (secureEndpoint) { + agent = new https_proxy_agent_1.HttpsProxyAgent(proxyOpts); + } + else { + agent = new http_proxy_agent_1.HttpProxyAgent(proxyOpts); + } + } + try { + if (socket) { + // "DIRECT" connection, wait for connection confirmation + yield once_1.default(socket, 'connect'); + req.emit('proxy', { proxy, socket }); + return socket; + } + if (agent) { + const s = yield agent.callback(req, opts); + req.emit('proxy', { proxy, socket: s }); + return s; + } + throw new Error(`Could not determine proxy type for: ${proxy}`); + } + catch (err) { + debug('Got error for proxy %o: %o', proxy, err); + req.emit('proxy', { proxy, error: err }); + } + } + throw new Error(`Failed to establish a socket connection to proxies: ${JSON.stringify(proxies)}`); + }); + } +} +exports.default = PacProxyAgent; +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 26338: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const get_uri_1 = __importDefault(__nccwpck_require__(11792)); +const url_1 = __nccwpck_require__(78835); +const agent_1 = __importDefault(__nccwpck_require__(18476)); +function createPacProxyAgent(uri, opts) { + // was an options object passed in first? + if (typeof uri === 'object') { + opts = uri; + // result of a url.parse() call? + if (opts.href) { + if (opts.path && !opts.pathname) { + opts.pathname = opts.path; + } + opts.slashes = true; + uri = url_1.format(opts); + } + else { + uri = opts.uri; + } + } + if (!opts) { + opts = {}; + } + if (typeof uri !== 'string') { + throw new TypeError('a PAC file URI must be specified!'); + } + return new agent_1.default(uri, opts); +} +(function (createPacProxyAgent) { + createPacProxyAgent.PacProxyAgent = agent_1.default; + /** + * Supported "protocols". Delegates out to the `get-uri` module. + */ + createPacProxyAgent.protocols = Object.keys(get_uri_1.default.protocols); + createPacProxyAgent.prototype = agent_1.default.prototype; +})(createPacProxyAgent || (createPacProxyAgent = {})); +module.exports = createPacProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 14001: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * If only a single value is specified (from each category: day, month, year), the + * function returns a true value only on days that match that specification. If + * both values are specified, the result is true between those times, including + * bounds. + * + * Even though the examples don't show, the "GMT" parameter can be specified + * in any of the 9 different call profiles, always as the last parameter. + * + * Examples: + * + * ``` js + * dateRange(1) + * true on the first day of each month, local timezone. + * + * dateRange(1, "GMT") + * true on the first day of each month, GMT timezone. + * + * dateRange(1, 15) + * true on the first half of each month. + * + * dateRange(24, "DEC") + * true on 24th of December each year. + * + * dateRange(24, "DEC", 1995) + * true on 24th of December, 1995. + * + * dateRange("JAN", "MAR") + * true on the first quarter of the year. + * + * dateRange(1, "JUN", 15, "AUG") + * true from June 1st until August 15th, each year (including June 1st and August + * 15th). + * + * dateRange(1, "JUN", 15, 1995, "AUG", 1995) + * true from June 1st, 1995, until August 15th, same year. + * + * dateRange("OCT", 1995, "MAR", 1996) + * true from October 1995 until March 1996 (including the entire month of October + * 1995 and March 1996). + * + * dateRange(1995) + * true during the entire year 1995. + * + * dateRange(1995, 1997) + * true from beginning of year 1995 until the end of year 1997. + * ``` + * + * dateRange(day) + * dateRange(day1, day2) + * dateRange(mon) + * dateRange(month1, month2) + * dateRange(year) + * dateRange(year1, year2) + * dateRange(day1, month1, day2, month2) + * dateRange(month1, year1, month2, year2) + * dateRange(day1, month1, year1, day2, month2, year2) + * dateRange(day1, month1, year1, day2, month2, year2, gmt) + * + * @param {String} day is the day of month between 1 and 31 (as an integer). + * @param {String} month is one of the month strings: JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC + * @param {String} year is the full year number, for example 1995 (but not 95). Integer. + * @param {String} gmt is either the string "GMT", which makes time comparison occur in GMT timezone; if left unspecified, times are taken to be in the local timezone. + * @return {Boolean} + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +function dateRange() { + // TODO: implement me! + return false; +} +exports.default = dateRange; +//# sourceMappingURL=dateRange.js.map + +/***/ }), + +/***/ 20936: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Returns true iff the domain of hostname matches. + * + * Examples: + * + * ``` js + * dnsDomainIs("www.netscape.com", ".netscape.com") + * // is true. + * + * dnsDomainIs("www", ".netscape.com") + * // is false. + * + * dnsDomainIs("www.mcom.com", ".netscape.com") + * // is false. + * ``` + * + * + * @param {String} host is the hostname from the URL. + * @param {String} domain is the domain name to test the hostname against. + * @return {Boolean} true iff the domain of the hostname matches. + */ +function dnsDomainIs(host, domain) { + host = String(host); + domain = String(domain); + return host.substr(domain.length * -1) === domain; +} +exports.default = dnsDomainIs; +//# sourceMappingURL=dnsDomainIs.js.map + +/***/ }), + +/***/ 58595: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Returns the number (integer) of DNS domain levels (number of dots) in the + * hostname. + * + * Examples: + * + * ``` js + * dnsDomainLevels("www") + * // returns 0. + * dnsDomainLevels("www.netscape.com") + * // returns 2. + * ``` + * + * @param {String} host is the hostname from the URL. + * @return {Number} number of domain levels + */ +function dnsDomainLevels(host) { + var match = String(host).match(/\./g); + var levels = 0; + if (match) { + levels = match.length; + } + return levels; +} +exports.default = dnsDomainLevels; +//# sourceMappingURL=dnsDomainLevels.js.map + +/***/ }), + +/***/ 87685: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const util_1 = __nccwpck_require__(52754); +/** + * Resolves the given DNS hostname into an IP address, and returns it in the dot + * separated format as a string. + * + * Example: + * + * ``` js + * dnsResolve("home.netscape.com") + * // returns the string "198.95.249.79". + * ``` + * + * @param {String} host hostname to resolve + * @return {String} resolved IP address + */ +function dnsResolve(host) { + return __awaiter(this, void 0, void 0, function* () { + const family = 4; + try { + const r = yield util_1.dnsLookup(host, { family }); + if (typeof r === 'string') { + return r; + } + } + catch (err) { + // @ignore + } + return null; + }); +} +exports.default = dnsResolve; +//# sourceMappingURL=dnsResolve.js.map + +/***/ }), + +/***/ 37055: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const url_1 = __nccwpck_require__(78835); +const degenerator_1 = __nccwpck_require__(64033); +/** + * Built-in PAC functions. + */ +const dateRange_1 = __importDefault(__nccwpck_require__(14001)); +const dnsDomainIs_1 = __importDefault(__nccwpck_require__(20936)); +const dnsDomainLevels_1 = __importDefault(__nccwpck_require__(58595)); +const dnsResolve_1 = __importDefault(__nccwpck_require__(87685)); +const isInNet_1 = __importDefault(__nccwpck_require__(83815)); +const isPlainHostName_1 = __importDefault(__nccwpck_require__(96423)); +const isResolvable_1 = __importDefault(__nccwpck_require__(87541)); +const localHostOrDomainIs_1 = __importDefault(__nccwpck_require__(32586)); +const myIpAddress_1 = __importDefault(__nccwpck_require__(6494)); +const shExpMatch_1 = __importDefault(__nccwpck_require__(84693)); +const timeRange_1 = __importDefault(__nccwpck_require__(49547)); +const weekdayRange_1 = __importDefault(__nccwpck_require__(79281)); +/** + * Returns an asynchronous `FindProxyForURL()` function + * from the given JS string (from a PAC file). + * + * @param {String} str JS string + * @param {Object} opts optional "options" object + * @return {Function} async resolver function + */ +function createPacResolver(_str, _opts = {}) { + const str = Buffer.isBuffer(_str) ? _str.toString('utf8') : _str; + // The sandbox to use for the `vm` context. + const sandbox = Object.assign(Object.assign({}, createPacResolver.sandbox), _opts.sandbox); + const opts = Object.assign(Object.assign({ filename: 'proxy.pac' }, _opts), { sandbox }); + // Construct the array of async function names to add `await` calls to. + const names = Object.keys(sandbox).filter((k) => isAsyncFunction(sandbox[k])); + // Compile the JS `FindProxyForURL()` function into an async function. + const resolver = degenerator_1.compile(str, 'FindProxyForURL', names, opts); + function FindProxyForURL(url, _host, _callback) { + let host = null; + let callback = null; + if (typeof _callback === 'function') { + callback = _callback; + } + if (typeof _host === 'string') { + host = _host; + } + else if (typeof _host === 'function') { + callback = _host; + } + if (!host) { + host = url_1.parse(url).hostname; + } + if (!host) { + throw new TypeError('Could not determine `host`'); + } + const promise = resolver(url, host); + if (typeof callback === 'function') { + toCallback(promise, callback); + } + else { + return promise; + } + } + Object.defineProperty(FindProxyForURL, 'toString', { + value: () => resolver.toString(), + enumerable: false, + }); + return FindProxyForURL; +} +(function (createPacResolver) { + createPacResolver.sandbox = Object.freeze({ + alert: (message = '') => console.log('%s', message), + dateRange: dateRange_1.default, + dnsDomainIs: dnsDomainIs_1.default, + dnsDomainLevels: dnsDomainLevels_1.default, + dnsResolve: dnsResolve_1.default, + isInNet: isInNet_1.default, + isPlainHostName: isPlainHostName_1.default, + isResolvable: isResolvable_1.default, + localHostOrDomainIs: localHostOrDomainIs_1.default, + myIpAddress: myIpAddress_1.default, + shExpMatch: shExpMatch_1.default, + timeRange: timeRange_1.default, + weekdayRange: weekdayRange_1.default, + }); +})(createPacResolver || (createPacResolver = {})); +function toCallback(promise, callback) { + promise.then((rtn) => callback(null, rtn), callback); +} +function isAsyncFunction(v) { + if (typeof v !== 'function') + return false; + // Native `AsyncFunction` + if (v.constructor.name === 'AsyncFunction') + return true; + // TypeScript compiled + if (String(v).indexOf('__awaiter(') !== -1) + return true; + // Legacy behavior - set `async` property on the function + return Boolean(v.async); +} +module.exports = createPacResolver; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 83815: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/** + * Module dependencies. + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const netmask_1 = __nccwpck_require__(11494); +const util_1 = __nccwpck_require__(52754); +/** + * True iff the IP address of the host matches the specified IP address pattern. + * + * Pattern and mask specification is done the same way as for SOCKS configuration. + * + * Examples: + * + * ``` js + * isInNet(host, "198.95.249.79", "255.255.255.255") + * // is true iff the IP address of host matches exactly 198.95.249.79. + * + * isInNet(host, "198.95.0.0", "255.255.0.0") + * // is true iff the IP address of the host matches 198.95.*.*. + * ``` + * + * @param {String} host a DNS hostname, or IP address. If a hostname is passed, + * it will be resoved into an IP address by this function. + * @param {String} pattern an IP address pattern in the dot-separated format mask. + * @param {String} mask for the IP address pattern informing which parts of the + * IP address should be matched against. 0 means ignore, 255 means match. + * @return {Boolean} + */ +function isInNet(host, pattern, mask) { + return __awaiter(this, void 0, void 0, function* () { + const family = 4; + try { + const ip = yield util_1.dnsLookup(host, { family }); + if (typeof ip === 'string') { + const netmask = new netmask_1.Netmask(pattern, mask); + return netmask.contains(ip); + } + } + catch (err) { } + return false; + }); +} +exports.default = isInNet; +//# sourceMappingURL=isInNet.js.map + +/***/ }), + +/***/ 96423: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * True iff there is no domain name in the hostname (no dots). + * + * Examples: + * + * ``` js + * isPlainHostName("www") + * // is true. + * + * isPlainHostName("www.netscape.com") + * // is false. + * ``` + * + * @param {String} host The hostname from the URL (excluding port number). + * @return {Boolean} + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +function isPlainHostName(host) { + return !/\./.test(host); +} +exports.default = isPlainHostName; +//# sourceMappingURL=isPlainHostName.js.map + +/***/ }), + +/***/ 87541: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const util_1 = __nccwpck_require__(52754); +/** + * Tries to resolve the hostname. Returns true if succeeds. + * + * @param {String} host is the hostname from the URL. + * @return {Boolean} + */ +function isResolvable(host) { + return __awaiter(this, void 0, void 0, function* () { + const family = 4; + try { + if (yield util_1.dnsLookup(host, { family })) { + return true; + } + } + catch (err) { + // ignore + } + return false; + }); +} +exports.default = isResolvable; +//# sourceMappingURL=isResolvable.js.map + +/***/ }), + +/***/ 32586: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Is true if the hostname matches exactly the specified hostname, or if there is + * no domain name part in the hostname, but the unqualified hostname matches. + * + * Examples: + * + * ``` js + * localHostOrDomainIs("www.netscape.com", "www.netscape.com") + * // is true (exact match). + * + * localHostOrDomainIs("www", "www.netscape.com") + * // is true (hostname match, domain not specified). + * + * localHostOrDomainIs("www.mcom.com", "www.netscape.com") + * // is false (domain name mismatch). + * + * localHostOrDomainIs("home.netscape.com", "www.netscape.com") + * // is false (hostname mismatch). + * ``` + * + * @param {String} host the hostname from the URL. + * @param {String} hostdom fully qualified hostname to match against. + * @return {Boolean} + */ +function localHostOrDomainIs(host, hostdom) { + const parts = host.split('.'); + const domparts = hostdom.split('.'); + let matches = true; + for (let i = 0; i < parts.length; i++) { + if (parts[i] !== domparts[i]) { + matches = false; + break; + } + } + return matches; +} +exports.default = localHostOrDomainIs; +//# sourceMappingURL=localHostOrDomainIs.js.map + +/***/ }), + +/***/ 6494: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const ip_1 = __importDefault(__nccwpck_require__(87547)); +const net_1 = __importDefault(__nccwpck_require__(11631)); +/** + * Returns the IP address of the host that the Navigator is running on, as + * a string in the dot-separated integer format. + * + * Example: + * + * ``` js + * myIpAddress() + * // would return the string "198.95.249.79" if you were running the + * // Navigator on that host. + * ``` + * + * @return {String} external IP address + */ +function myIpAddress() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + // 8.8.8.8:53 is "Google Public DNS": + // https://developers.google.com/speed/public-dns/ + const socket = net_1.default.connect({ host: '8.8.8.8', port: 53 }); + const onError = (err) => { + // if we fail to access Google DNS (as in firewall blocks access), + // fallback to querying IP locally + resolve(ip_1.default.address()); + }; + socket.once('error', onError); + socket.once('connect', () => { + socket.removeListener('error', onError); + const addr = socket.address(); + socket.destroy(); + if (typeof addr === 'string') { + resolve(addr); + } + else if (addr.address) { + resolve(addr.address); + } + else { + reject(new Error('Expected a `string`')); + } + }); + }); + }); +} +exports.default = myIpAddress; +//# sourceMappingURL=myIpAddress.js.map + +/***/ }), + +/***/ 84693: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Returns true if the string matches the specified shell + * expression. + * + * Actually, currently the patterns are shell expressions, + * not regular expressions. + * + * Examples: + * + * ``` js + * shExpMatch("http://home.netscape.com/people/ari/index.html", "*\/ari/*") + * // is true. + * + * shExpMatch("http://home.netscape.com/people/montulli/index.html", "*\/ari/*") + * // is false. + * ``` + * + * @param {String} str is any string to compare (e.g. the URL, or the hostname). + * @param {String} shexp is a shell expression to compare against. + * @return {Boolean} true if the string matches the shell expression. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +function shExpMatch(str, shexp) { + var re = toRegExp(shexp); + return re.test(str); +} +exports.default = shExpMatch; +/** + * Converts a "shell expression" to a JavaScript RegExp. + * + * @api private + */ +function toRegExp(str) { + str = String(str) + .replace(/\./g, '\\.') + .replace(/\?/g, '.') + .replace(/\*/g, '.*'); + return new RegExp('^' + str + '$'); +} +//# sourceMappingURL=shExpMatch.js.map + +/***/ }), + +/***/ 49547: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * True during (or between) the specified time(s). + * + * Even though the examples don't show it, this parameter may be present in + * each of the different parameter profiles, always as the last parameter. + * + * + * Examples: + * + * ``` js + * timerange(12) + * true from noon to 1pm. + * + * timerange(12, 13) + * same as above. + * + * timerange(12, "GMT") + * true from noon to 1pm, in GMT timezone. + * + * timerange(9, 17) + * true from 9am to 5pm. + * + * timerange(8, 30, 17, 00) + * true from 8:30am to 5:00pm. + * + * timerange(0, 0, 0, 0, 0, 30) + * true between midnight and 30 seconds past midnight. + * ``` + * + * timeRange(hour) + * timeRange(hour1, hour2) + * timeRange(hour1, min1, hour2, min2) + * timeRange(hour1, min1, sec1, hour2, min2, sec2) + * timeRange(hour1, min1, sec1, hour2, min2, sec2, gmt) + * + * @param {String} hour is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.) + * @param {String} min minutes from 0 to 59. + * @param {String} sec seconds from 0 to 59. + * @param {String} gmt either the string "GMT" for GMT timezone, or not specified, for local timezone. + * @return {Boolean} + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +function timeRange() { + var args = Array.prototype.slice.call(arguments), lastArg = args.pop(), useGMTzone = lastArg == 'GMT', currentDate = new Date(); + if (!useGMTzone) { + args.push(lastArg); + } + var noOfArgs = args.length, result = false, numericArgs = args.map(function (n) { + return parseInt(n); + }); + // timeRange(hour) + if (noOfArgs == 1) { + result = getCurrentHour(useGMTzone, currentDate) == numericArgs[0]; + // timeRange(hour1, hour2) + } + else if (noOfArgs == 2) { + var currentHour = getCurrentHour(useGMTzone, currentDate); + result = numericArgs[0] <= currentHour && currentHour < numericArgs[1]; + // timeRange(hour1, min1, hour2, min2) + } + else if (noOfArgs == 4) { + result = valueInRange(secondsElapsedToday(numericArgs[0], numericArgs[1], 0), secondsElapsedToday(getCurrentHour(useGMTzone, currentDate), getCurrentMinute(useGMTzone, currentDate), 0), secondsElapsedToday(numericArgs[2], numericArgs[3], 59)); + // timeRange(hour1, min1, sec1, hour2, min2, sec2) + } + else if (noOfArgs == 6) { + result = valueInRange(secondsElapsedToday(numericArgs[0], numericArgs[1], numericArgs[2]), secondsElapsedToday(getCurrentHour(useGMTzone, currentDate), getCurrentMinute(useGMTzone, currentDate), getCurrentSecond(useGMTzone, currentDate)), secondsElapsedToday(numericArgs[3], numericArgs[4], numericArgs[5])); + } + return result; +} +exports.default = timeRange; +function secondsElapsedToday(hh, mm, ss) { + return hh * 3600 + mm * 60 + ss; +} +function getCurrentHour(gmt, currentDate) { + return gmt ? currentDate.getUTCHours() : currentDate.getHours(); +} +function getCurrentMinute(gmt, currentDate) { + return gmt ? currentDate.getUTCMinutes() : currentDate.getMinutes(); +} +function getCurrentSecond(gmt, currentDate) { + return gmt ? currentDate.getUTCSeconds() : currentDate.getSeconds(); +} +// start <= value <= finish +function valueInRange(start, value, finish) { + return start <= value && value <= finish; +} +//# sourceMappingURL=timeRange.js.map + +/***/ }), + +/***/ 52754: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isGMT = exports.dnsLookup = void 0; +const dns_1 = __nccwpck_require__(40881); +function dnsLookup(host, opts) { + return new Promise((resolve, reject) => { + dns_1.lookup(host, opts, (err, res) => { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + }); +} +exports.dnsLookup = dnsLookup; +function isGMT(v) { + return v === 'GMT'; +} +exports.isGMT = isGMT; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 79281: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const util_1 = __nccwpck_require__(52754); +const weekdays = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; +/** + * Only the first parameter is mandatory. Either the second, the third, or both + * may be left out. + * + * If only one parameter is present, the function yeilds a true value on the + * weekday that the parameter represents. If the string "GMT" is specified as + * a second parameter, times are taken to be in GMT, otherwise in local timezone. + * + * If both wd1 and wd1 are defined, the condition is true if the current weekday + * is in between those two weekdays. Bounds are inclusive. If the "GMT" parameter + * is specified, times are taken to be in GMT, otherwise the local timezone is + * used. + * + * Valid "weekday strings" are: + * + * SUN MON TUE WED THU FRI SAT + * + * Examples: + * + * ``` js + * weekdayRange("MON", "FRI") + * true Monday trhough Friday (local timezone). + * + * weekdayRange("MON", "FRI", "GMT") + * same as above, but GMT timezone. + * + * weekdayRange("SAT") + * true on Saturdays local time. + * + * weekdayRange("SAT", "GMT") + * true on Saturdays GMT time. + * + * weekdayRange("FRI", "MON") + * true Friday through Monday (note, order does matter!). + * ``` + * + * + * @param {String} wd1 one of the weekday strings. + * @param {String} wd2 one of the weekday strings. + * @param {String} gmt is either the string: GMT or is left out. + * @return {Boolean} + */ +function weekdayRange(wd1, wd2, gmt) { + let useGMTzone = false; + let wd1Index = -1; + let wd2Index = -1; + let wd2IsGmt = false; + if (util_1.isGMT(gmt)) { + useGMTzone = true; + } + else if (util_1.isGMT(wd2)) { + useGMTzone = true; + wd2IsGmt = true; + } + wd1Index = weekdays.indexOf(wd1); + if (!wd2IsGmt && isWeekday(wd2)) { + wd2Index = weekdays.indexOf(wd2); + } + let todaysDay = getTodaysDay(useGMTzone); + let result = false; + if (wd2Index < 0) { + result = todaysDay == wd1Index; + } + else { + if (wd1Index <= wd2Index) { + result = valueInRange(wd1Index, todaysDay, wd2Index); + } + else { + result = + valueInRange(wd1Index, todaysDay, 6) || + valueInRange(0, todaysDay, wd2Index); + } + } + return result; +} +exports.default = weekdayRange; +function getTodaysDay(gmt) { + return gmt ? new Date().getUTCDay() : new Date().getDay(); +} +// start <= value <= finish +function valueInRange(start, value, finish) { + return start <= value && value <= finish; +} +function isWeekday(v) { + return weekdays.indexOf(v) !== -1; +} +//# sourceMappingURL=weekdayRange.js.map + +/***/ }), + +/***/ 67367: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * Module dependencies. + */ + +var url = __nccwpck_require__(78835); +var LRU = __nccwpck_require__(7129); +var Agent = __nccwpck_require__(49690); +var inherits = __nccwpck_require__(31669).inherits; +var debug = __nccwpck_require__(38237)('proxy-agent'); +var getProxyForUrl = __nccwpck_require__(63329)/* .getProxyForUrl */ .j; + +var http = __nccwpck_require__(98605); +var https = __nccwpck_require__(57211); +var PacProxyAgent = __nccwpck_require__(26338); +var HttpProxyAgent = __nccwpck_require__(23764); +var HttpsProxyAgent = __nccwpck_require__(77219); +var SocksProxyAgent = __nccwpck_require__(25038); + +/** + * Module exports. + */ + +exports = module.exports = ProxyAgent; + +/** + * Number of `http.Agent` instances to cache. + * + * This value was arbitrarily chosen... a better + * value could be conceived with some benchmarks. + */ + +var cacheSize = 20; + +/** + * Cache for `http.Agent` instances. + */ + +exports.cache = new LRU(cacheSize); + +/** + * Built-in proxy types. + */ + +exports.proxies = Object.create(null); +exports.proxies.http = httpOrHttpsProxy; +exports.proxies.https = httpOrHttpsProxy; +exports.proxies.socks = SocksProxyAgent; +exports.proxies.socks4 = SocksProxyAgent; +exports.proxies.socks4a = SocksProxyAgent; +exports.proxies.socks5 = SocksProxyAgent; +exports.proxies.socks5h = SocksProxyAgent; + +PacProxyAgent.protocols.forEach(function (protocol) { + exports.proxies['pac+' + protocol] = PacProxyAgent; +}); + +function httpOrHttps(opts, secureEndpoint) { + if (secureEndpoint) { + // HTTPS + return https.globalAgent; + } else { + // HTTP + return http.globalAgent; + } +} + +function httpOrHttpsProxy(opts, secureEndpoint) { + if (secureEndpoint) { + // HTTPS + return new HttpsProxyAgent(opts); + } else { + // HTTP + return new HttpProxyAgent(opts); + } +} + +function mapOptsToProxy(opts) { + // NO_PROXY case + if (!opts) { + return { + uri: 'no proxy', + fn: httpOrHttps + }; + } + + if ('string' == typeof opts) opts = url.parse(opts); + + var proxies; + if (opts.proxies) { + proxies = Object.assign({}, exports.proxies, opts.proxies); + } else { + proxies = exports.proxies; + } + + // get the requested proxy "protocol" + var protocol = opts.protocol; + if (!protocol) { + throw new TypeError('You must specify a "protocol" for the ' + + 'proxy type (' + Object.keys(proxies).join(', ') + ')'); + } + + // strip the trailing ":" if present + if (':' == protocol[protocol.length - 1]) { + protocol = protocol.substring(0, protocol.length - 1); + } + + // get the proxy `http.Agent` creation function + var proxyFn = proxies[protocol]; + if ('function' != typeof proxyFn) { + throw new TypeError('unsupported proxy protocol: "' + protocol + '"'); + } + + // format the proxy info back into a URI, since an opts object + // could have been passed in originally. This generated URI is used + // as part of the "key" for the LRU cache + return { + opts: opts, + uri: url.format({ + protocol: protocol + ':', + slashes: true, + auth: opts.auth, + hostname: opts.hostname || opts.host, + port: opts.port + }), + fn: proxyFn, + } +} + +/** + * Attempts to get an `http.Agent` instance based off of the given proxy URI + * information, and the `secure` flag. + * + * An LRU cache is used, to prevent unnecessary creation of proxy + * `http.Agent` instances. + * + * @param {String} uri proxy url + * @param {Boolean} secure true if this is for an HTTPS request, false for HTTP + * @return {http.Agent} + * @api public + */ + +function ProxyAgent (opts) { + if (!(this instanceof ProxyAgent)) return new ProxyAgent(opts); + debug('creating new ProxyAgent instance: %o', opts); + Agent.call(this); + + if (opts) { + var proxy = mapOptsToProxy(opts); + this.proxy = proxy.opts; + this.proxyUri = proxy.uri; + this.proxyFn = proxy.fn; + } +} +inherits(ProxyAgent, Agent); + +/** + * + */ + +ProxyAgent.prototype.callback = function(req, opts, fn) { + var proxyOpts = this.proxy; + var proxyUri = this.proxyUri; + var proxyFn = this.proxyFn; + + // if we did not instantiate with a proxy, set one per request + if (!proxyOpts) { + var urlOpts = getProxyForUrl(opts); + var proxy = mapOptsToProxy(urlOpts, opts); + proxyOpts = proxy.opts; + proxyUri = proxy.uri; + proxyFn = proxy.fn; + } + + // create the "key" for the LRU cache + var key = proxyUri; + if (opts.secureEndpoint) key += ' secure'; + + // attempt to get a cached `http.Agent` instance first + var agent = exports.cache.get(key); + if (!agent) { + // get an `http.Agent` instance from protocol-specific agent function + agent = proxyFn(proxyOpts, opts.secureEndpoint); + if (agent) { + exports.cache.set(key, agent); + } + } else { + debug('cache hit with key: %o', key); + } + + if (!proxyOpts) { + agent.addRequest(req, opts); + } else { + // XXX: agent.callback() is an agent-base-ism + agent.callback(req, opts) + .then(function(socket) { fn(null, socket); }) + .catch(function(error) { fn(error); }); + } +} + + +/***/ }), + +/***/ 63329: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var parseUrl = __nccwpck_require__(78835).parse; + +var DEFAULT_PORTS = { + ftp: 21, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443, +}; + +var stringEndsWith = String.prototype.endsWith || function(s) { + return s.length <= this.length && + this.indexOf(s, this.length - s.length) !== -1; +}; + +/** + * @param {string|object} url - The URL, or the result from url.parse. + * @return {string} The URL of the proxy that should handle the request to the + * given URL. If no proxy is set, this will be an empty string. + */ +function getProxyForUrl(url) { + var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {}; + var proto = parsedUrl.protocol; + var hostname = parsedUrl.host; + var port = parsedUrl.port; + if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') { + return ''; // Don't proxy URLs without a valid scheme or host. + } + + proto = proto.split(':', 1)[0]; + // Stripping ports in this way instead of using parsedUrl.hostname to make + // sure that the brackets around IPv6 addresses are kept. + hostname = hostname.replace(/:\d*$/, ''); + port = parseInt(port) || DEFAULT_PORTS[proto] || 0; + if (!shouldProxy(hostname, port)) { + return ''; // Don't proxy URLs that match NO_PROXY. + } + + var proxy = + getEnv('npm_config_' + proto + '_proxy') || + getEnv(proto + '_proxy') || + getEnv('npm_config_proxy') || + getEnv('all_proxy'); + if (proxy && proxy.indexOf('://') === -1) { + // Missing scheme in proxy, default to the requested URL's scheme. + proxy = proto + '://' + proxy; + } + return proxy; +} + +/** + * Determines whether a given URL should be proxied. + * + * @param {string} hostname - The host name of the URL. + * @param {number} port - The effective port of the URL. + * @returns {boolean} Whether the given URL should be proxied. + * @private + */ +function shouldProxy(hostname, port) { + var NO_PROXY = + (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase(); + if (!NO_PROXY) { + return true; // Always proxy if NO_PROXY is not set. + } + if (NO_PROXY === '*') { + return false; // Never proxy if wildcard is set. + } + + return NO_PROXY.split(/[,\s]/).every(function(proxy) { + if (!proxy) { + return true; // Skip zero-length hosts. + } + var parsedProxy = proxy.match(/^(.+):(\d+)$/); + var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy; + var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0; + if (parsedProxyPort && parsedProxyPort !== port) { + return true; // Skip if ports don't match. + } + + if (!/^[.*]/.test(parsedProxyHostname)) { + // No wildcards, so stop proxying if there is an exact match. + return hostname !== parsedProxyHostname; + } + + if (parsedProxyHostname.charAt(0) === '*') { + // Remove leading wildcard. + parsedProxyHostname = parsedProxyHostname.slice(1); + } + // Stop proxying if the hostname ends with the no_proxy host. + return !stringEndsWith.call(hostname, parsedProxyHostname); + }); +} + +/** + * Get the value for an environment variable. + * + * @param {string} key - The name of the environment variable. + * @return {string} The value of the environment variable. + * @private + */ +function getEnv(key) { + return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || ''; +} + +exports.j = getProxyForUrl; + + +/***/ }), + +/***/ 47742: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * raw-body + * Copyright(c) 2013-2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var bytes = __nccwpck_require__(86966) +var createError = __nccwpck_require__(95193) +var iconv = __nccwpck_require__(19032) +var unpipe = __nccwpck_require__(3124) + +/** + * Module exports. + * @public + */ + +module.exports = getRawBody + +/** + * Module variables. + * @private + */ + +var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: / + +/** + * Get the decoder for a given encoding. + * + * @param {string} encoding + * @private + */ + +function getDecoder (encoding) { + if (!encoding) return null + + try { + return iconv.getDecoder(encoding) + } catch (e) { + // error getting decoder + if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e + + // the encoding was not found + throw createError(415, 'specified encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } +} + +/** + * Get the raw body of a stream (typically HTTP). + * + * @param {object} stream + * @param {object|string|function} [options] + * @param {function} [callback] + * @public + */ + +function getRawBody (stream, options, callback) { + var done = callback + var opts = options || {} + + if (options === true || typeof options === 'string') { + // short cut for encoding + opts = { + encoding: options + } + } + + if (typeof options === 'function') { + done = options + opts = {} + } + + // validate callback is a function, if provided + if (done !== undefined && typeof done !== 'function') { + throw new TypeError('argument callback must be a function') + } + + // require the callback without promises + if (!done && !global.Promise) { + throw new TypeError('argument callback is required') + } + + // get encoding + var encoding = opts.encoding !== true + ? opts.encoding + : 'utf-8' + + // convert the limit to an integer + var limit = bytes.parse(opts.limit) + + // convert the expected length to an integer + var length = opts.length != null && !isNaN(opts.length) + ? parseInt(opts.length, 10) + : null + + if (done) { + // classic callback style + return readStream(stream, encoding, length, limit, done) + } + + return new Promise(function executor (resolve, reject) { + readStream(stream, encoding, length, limit, function onRead (err, buf) { + if (err) return reject(err) + resolve(buf) + }) + }) +} + +/** + * Halt a stream. + * + * @param {Object} stream + * @private + */ + +function halt (stream) { + // unpipe everything from the stream + unpipe(stream) + + // pause stream + if (typeof stream.pause === 'function') { + stream.pause() + } +} + +/** + * Read the data from the stream. + * + * @param {object} stream + * @param {string} encoding + * @param {number} length + * @param {number} limit + * @param {function} callback + * @public + */ + +function readStream (stream, encoding, length, limit, callback) { + var complete = false + var sync = true + + // check the length and limit options. + // note: we intentionally leave the stream paused, + // so users should handle the stream themselves. + if (limit !== null && length !== null && length > limit) { + return done(createError(413, 'request entity too large', { + expected: length, + length: length, + limit: limit, + type: 'entity.too.large' + })) + } + + // streams1: assert request encoding is buffer. + // streams2+: assert the stream encoding is buffer. + // stream._decoder: streams1 + // state.encoding: streams2 + // state.decoder: streams2, specifically < 0.10.6 + var state = stream._readableState + if (stream._decoder || (state && (state.encoding || state.decoder))) { + // developer error + return done(createError(500, 'stream encoding should not be set', { + type: 'stream.encoding.set' + })) + } + + var received = 0 + var decoder + + try { + decoder = getDecoder(encoding) + } catch (err) { + return done(err) + } + + var buffer = decoder + ? '' + : [] + + // attach listeners + stream.on('aborted', onAborted) + stream.on('close', cleanup) + stream.on('data', onData) + stream.on('end', onEnd) + stream.on('error', onEnd) + + // mark sync section complete + sync = false + + function done () { + var args = new Array(arguments.length) + + // copy arguments + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + // mark complete + complete = true + + if (sync) { + process.nextTick(invokeCallback) + } else { + invokeCallback() + } + + function invokeCallback () { + cleanup() + + if (args[0]) { + // halt the stream on error + halt(stream) + } + + callback.apply(null, args) + } + } + + function onAborted () { + if (complete) return + + done(createError(400, 'request aborted', { + code: 'ECONNABORTED', + expected: length, + length: length, + received: received, + type: 'request.aborted' + })) + } + + function onData (chunk) { + if (complete) return + + received += chunk.length + + if (limit !== null && received > limit) { + done(createError(413, 'request entity too large', { + limit: limit, + received: received, + type: 'entity.too.large' + })) + } else if (decoder) { + buffer += decoder.write(chunk) + } else { + buffer.push(chunk) + } + } + + function onEnd (err) { + if (complete) return + if (err) return done(err) + + if (length !== null && received !== length) { + done(createError(400, 'request size did not match content length', { + expected: length, + length: length, + received: received, + type: 'request.size.invalid' + })) + } else { + var string = decoder + ? buffer + (decoder.end() || '') + : Buffer.concat(buffer) + done(null, string) + } + } + + function cleanup () { + buffer = null + + stream.removeListener('aborted', onAborted) + stream.removeListener('data', onData) + stream.removeListener('end', onEnd) + stream.removeListener('error', onEnd) + stream.removeListener('close', cleanup) + } +} + + +/***/ }), + +/***/ 41359: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/**/ + + +/**/ +var util = __nccwpck_require__(95898); +util.inherits = __nccwpck_require__(44124); +/**/ + +var Readable = __nccwpck_require__(51433); +var Writable = __nccwpck_require__(26993); + +util.inherits(Duplex, Readable); + +forEach(objectKeys(Writable.prototype), function(method) { + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +}); + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(this.end.bind(this)); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + + +/***/ }), + +/***/ 81542: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = __nccwpck_require__(34415); + +/**/ +var util = __nccwpck_require__(95898); +util.inherits = __nccwpck_require__(44124); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; + + +/***/ }), + +/***/ 51433: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Readable; + +/**/ +var isArray = __nccwpck_require__(20893); +/**/ + + +/**/ +var Buffer = __nccwpck_require__(64293).Buffer; +/**/ + +Readable.ReadableState = ReadableState; + +var EE = __nccwpck_require__(28614).EventEmitter; + +/**/ +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +var Stream = __nccwpck_require__(92413); + +/**/ +var util = __nccwpck_require__(95898); +util.inherits = __nccwpck_require__(44124); +/**/ + +var StringDecoder; + + +/**/ +var debug = __nccwpck_require__(31669); +if (debug && debug.debuglog) { + debug = debug.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + + +util.inherits(Readable, Stream); + +function ReadableState(options, stream) { + var Duplex = __nccwpck_require__(41359); + + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = __nccwpck_require__(60674)/* .StringDecoder */ .s; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + var Duplex = __nccwpck_require__(41359); + + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (util.isString(chunk) && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (util.isNullOrUndefined(chunk)) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + if (!addToFront) + state.reading = false; + + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + + if (state.needReadable) + emitReadable(stream); + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = __nccwpck_require__(60674)/* .StringDecoder */ .s; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (isNaN(n) || util.isNull(n)) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + debug('read', n); + var state = this._readableState; + var nOrig = n; + + if (!util.isNumber(n) || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } + + if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (util.isNull(ret)) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended && state.length === 0) + endReadable(this); + + if (!util.isNull(ret)) + this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && + !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && + (!dest._writableState || dest._writableState.needDrain)) + ondrain(); + } + + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + if (false === ret) { + debug('false write response, pause', + src._readableState.awaitDrain); + src._readableState.awaitDrain++; + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + // If listening to data, and it has not explicitly been paused, + // then call resume to start the flow of data on the next tick. + if (ev === 'data' && false !== this._readableState.flowing) { + this.resume(); + } + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + var self = this; + process.nextTick(function() { + debug('readable nexttick read 0'); + self.read(0); + }); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + if (!state.reading) { + debug('resume read 0'); + this.read(0); + } + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(function() { + resume_(stream, state); + }); + } +} + +function resume_(stream, state) { + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); +} + +Readable.prototype.pause = function() { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + if (state.flowing) { + do { + var chunk = stream.read(); + } while (null !== chunk && state.flowing); + } +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + debug('wrapped data'); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (!chunk || !state.objectMode && !chunk.length) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + + +/***/ }), + +/***/ 34415: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = __nccwpck_require__(41359); + +/**/ +var util = __nccwpck_require__(95898); +util.inherits = __nccwpck_require__(44124); +/**/ + +util.inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (!util.isNullOrUndefined(data)) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('prefinish', function() { + if (util.isFunction(this._flush)) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} + + +/***/ }), + +/***/ 26993: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; + +/**/ +var Buffer = __nccwpck_require__(64293).Buffer; +/**/ + +Writable.WritableState = WritableState; + + +/**/ +var util = __nccwpck_require__(95898); +util.inherits = __nccwpck_require__(44124); +/**/ + +var Stream = __nccwpck_require__(92413); + +util.inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + var Duplex = __nccwpck_require__(41359); + + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +function Writable(options) { + var Duplex = __nccwpck_require__(41359); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (util.isFunction(encoding)) { + cb = encoding; + encoding = null; + } + + if (util.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (!util.isFunction(cb)) + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function() { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function() { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && + !state.corked && + !state.finished && + !state.bufferProcessing && + state.buffer.length) + clearBuffer(this, state); + } +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + util.isString(chunk)) { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + if (util.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing || state.corked) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, false, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + process.nextTick(function() { + state.pendingcb--; + cb(er); + }); + else { + state.pendingcb--; + cb(er); + } + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && + !state.corked && + !state.bufferProcessing && + state.buffer.length) { + clearBuffer(stream, state); + } + + if (sync) { + process.nextTick(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + if (stream._writev && state.buffer.length > 1) { + // Fast case, write everything using _writev() + var cbs = []; + for (var c = 0; c < state.buffer.length; c++) + cbs.push(state.buffer[c].callback); + + // count the one we are adding, as well. + // TODO(isaacs) clean this up + state.pendingcb++; + doWrite(stream, state, true, state.length, state.buffer, '', function(err) { + for (var i = 0; i < cbs.length; i++) { + state.pendingcb--; + cbs[i](err); + } + }); + + // Clear buffer + state.buffer = []; + } else { + // Slow case, write chunks one-by-one + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; + } + + state.bufferProcessing = false; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); + +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (util.isFunction(chunk)) { + cb = chunk; + chunk = null; + encoding = null; + } else if (util.isFunction(encoding)) { + cb = encoding; + encoding = null; + } + + if (!util.isNullOrUndefined(chunk)) + this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else + prefinish(stream, state); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} + + +/***/ }), + +/***/ 51642: +/***/ ((module, exports, __nccwpck_require__) => { + +exports = module.exports = __nccwpck_require__(51433); +exports.Stream = __nccwpck_require__(92413); +exports.Readable = exports; +exports.Writable = __nccwpck_require__(26993); +exports.Duplex = __nccwpck_require__(41359); +exports.Transform = __nccwpck_require__(34415); +exports.PassThrough = __nccwpck_require__(81542); +if (!process.browser && process.env.READABLE_STREAM === 'disable') { + module.exports = __nccwpck_require__(92413); +} + + +/***/ }), + +/***/ 15118: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/* eslint-disable node/no-deprecated-api */ + + + +var buffer = __nccwpck_require__(64293) +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer + + +/***/ }), + +/***/ 40414: +/***/ ((module) => { + +"use strict"; + +/* eslint no-proto: 0 */ +module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties) + +function setProtoOf (obj, proto) { + obj.__proto__ = proto + return obj +} + +function mixinProperties (obj, proto) { + for (var prop in proto) { + if (!Object.prototype.hasOwnProperty.call(obj, prop)) { + obj[prop] = proto[prop] + } + } + return obj +} + + +/***/ }), + +/***/ 71062: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils_1 = __nccwpck_require__(98132); +// The default Buffer size if one is not provided. +const DEFAULT_SMARTBUFFER_SIZE = 4096; +// The default string encoding to use for reading/writing strings. +const DEFAULT_SMARTBUFFER_ENCODING = 'utf8'; +class SmartBuffer { + /** + * Creates a new SmartBuffer instance. + * + * @param options { SmartBufferOptions } The SmartBufferOptions to apply to this instance. + */ + constructor(options) { + this.length = 0; + this._encoding = DEFAULT_SMARTBUFFER_ENCODING; + this._writeOffset = 0; + this._readOffset = 0; + if (SmartBuffer.isSmartBufferOptions(options)) { + // Checks for encoding + if (options.encoding) { + utils_1.checkEncoding(options.encoding); + this._encoding = options.encoding; + } + // Checks for initial size length + if (options.size) { + if (utils_1.isFiniteInteger(options.size) && options.size > 0) { + this._buff = Buffer.allocUnsafe(options.size); + } + else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_SIZE); + } + // Check for initial Buffer + } + else if (options.buff) { + if (Buffer.isBuffer(options.buff)) { + this._buff = options.buff; + this.length = options.buff.length; + } + else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_BUFFER); + } + } + else { + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } + } + else { + // If something was passed but it's not a SmartBufferOptions object + if (typeof options !== 'undefined') { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_OBJECT); + } + // Otherwise default to sane options + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } + } + /** + * Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding. + * + * @param size { Number } The size of the internal Buffer. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } + */ + static fromSize(size, encoding) { + return new this({ + size: size, + encoding: encoding + }); + } + /** + * Creates a new SmartBuffer instance with the provided Buffer and optional encoding. + * + * @param buffer { Buffer } The Buffer to use as the internal Buffer value. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } + */ + static fromBuffer(buff, encoding) { + return new this({ + buff: buff, + encoding: encoding + }); + } + /** + * Creates a new SmartBuffer instance with the provided SmartBufferOptions options. + * + * @param options { SmartBufferOptions } The options to use when creating the SmartBuffer instance. + */ + static fromOptions(options) { + return new this(options); + } + /** + * Type checking function that determines if an object is a SmartBufferOptions object. + */ + static isSmartBufferOptions(options) { + const castOptions = options; + return (castOptions && + (castOptions.encoding !== undefined || castOptions.size !== undefined || castOptions.buff !== undefined)); + } + // Signed integers + /** + * Reads an Int8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt8(offset) { + return this._readNumberValue(Buffer.prototype.readInt8, 1, offset); + } + /** + * Reads an Int16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16BE, 2, offset); + } + /** + * Reads an Int16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16LE, 2, offset); + } + /** + * Reads an Int32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32BE, 4, offset); + } + /** + * Reads an Int32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32LE, 4, offset); + } + /** + * Reads a BigInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigInt64BE'); + return this._readNumberValue(Buffer.prototype.readBigInt64BE, 8, offset); + } + /** + * Reads a BigInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigInt64LE'); + return this._readNumberValue(Buffer.prototype.readBigInt64LE, 8, offset); + } + /** + * Writes an Int8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt8(value, offset) { + this._writeNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + return this; + } + /** + * Inserts an Int8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + } + /** + * Writes an Int16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + } + /** + * Inserts an Int16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + } + /** + * Writes an Int16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + } + /** + * Inserts an Int16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + } + /** + * Writes an Int32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + } + /** + * Inserts an Int32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + } + /** + * Writes an Int32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + } + /** + * Inserts an Int32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + } + /** + * Writes a BigInt64BE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64BE'); + return this._writeNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + } + /** + * Inserts a BigInt64BE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64BE'); + return this._insertNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + } + /** + * Writes a BigInt64LE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64LE'); + return this._writeNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + } + /** + * Inserts a Int64LE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64LE'); + return this._insertNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + } + // Unsigned Integers + /** + * Reads an UInt8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt8(offset) { + return this._readNumberValue(Buffer.prototype.readUInt8, 1, offset); + } + /** + * Reads an UInt16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16BE, 2, offset); + } + /** + * Reads an UInt16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16LE, 2, offset); + } + /** + * Reads an UInt32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32BE, 4, offset); + } + /** + * Reads an UInt32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32LE, 4, offset); + } + /** + * Reads a BigUInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigUInt64BE'); + return this._readNumberValue(Buffer.prototype.readBigUInt64BE, 8, offset); + } + /** + * Reads a BigUInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigUInt64LE'); + return this._readNumberValue(Buffer.prototype.readBigUInt64LE, 8, offset); + } + /** + * Writes an UInt8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt8(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + } + /** + * Inserts an UInt8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + } + /** + * Writes an UInt16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + } + /** + * Inserts an UInt16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + } + /** + * Writes an UInt16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + } + /** + * Inserts an UInt16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + } + /** + * Writes an UInt32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + } + /** + * Inserts an UInt32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + } + /** + * Writes an UInt32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + } + /** + * Inserts an UInt32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + } + /** + * Writes a BigUInt64BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64BE'); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + } + /** + * Inserts a BigUInt64BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64BE'); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + } + /** + * Writes a BigUInt64LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64LE'); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + } + /** + * Inserts a BigUInt64LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64LE'); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + } + // Floating Point + /** + * Reads an FloatBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatBE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatBE, 4, offset); + } + /** + * Reads an FloatLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatLE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatLE, 4, offset); + } + /** + * Writes a FloatBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + } + /** + * Inserts a FloatBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + } + /** + * Writes a FloatLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + } + /** + * Inserts a FloatLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + } + // Double Floating Point + /** + * Reads an DoublEBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleBE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleBE, 8, offset); + } + /** + * Reads an DoubleLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleLE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleLE, 8, offset); + } + /** + * Writes a DoubleBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + } + /** + * Inserts a DoubleBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertDoubleBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + } + /** + * Writes a DoubleLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + } + /** + * Inserts a DoubleLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertDoubleLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + } + // Strings + /** + * Reads a String from the current read position. + * + * @param arg1 { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for + * the string (Defaults to instance level encoding). + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readString(arg1, encoding) { + let lengthVal; + // Length provided + if (typeof arg1 === 'number') { + utils_1.checkLengthValue(arg1); + lengthVal = Math.min(arg1, this.length - this._readOffset); + } + else { + encoding = arg1; + lengthVal = this.length - this._readOffset; + } + // Check encoding + if (typeof encoding !== 'undefined') { + utils_1.checkEncoding(encoding); + } + const value = this._buff.slice(this._readOffset, this._readOffset + lengthVal).toString(encoding || this._encoding); + this._readOffset += lengthVal; + return value; + } + /** + * Inserts a String + * + * @param value { String } The String value to insert. + * @param offset { Number } The offset to insert the string at. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertString(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + return this._handleString(value, true, offset, encoding); + } + /** + * Writes a String + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + writeString(value, arg2, encoding) { + return this._handleString(value, false, arg2, encoding); + } + /** + * Reads a null-terminated String from the current read position. + * + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readStringNT(encoding) { + if (typeof encoding !== 'undefined') { + utils_1.checkEncoding(encoding); + } + // Set null character position to the end SmartBuffer instance. + let nullPos = this.length; + // Find next null character (if one is not found, default from above is used) + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0x00) { + nullPos = i; + break; + } + } + // Read string value + const value = this._buff.slice(this._readOffset, nullPos); + // Increment internal Buffer read offset + this._readOffset = nullPos + 1; + return value.toString(encoding || this._encoding); + } + /** + * Inserts a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertStringNT(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + // Write Values + this.insertString(value, offset, encoding); + this.insertUInt8(0x00, offset + value.length); + return this; + } + /** + * Writes a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + writeStringNT(value, arg2, encoding) { + // Write Values + this.writeString(value, arg2, encoding); + this.writeUInt8(0x00, typeof arg2 === 'number' ? arg2 + value.length : this.writeOffset); + return this; + } + // Buffers + /** + * Reads a Buffer from the internal read position. + * + * @param length { Number } The length of data to read as a Buffer. + * + * @return { Buffer } + */ + readBuffer(length) { + if (typeof length !== 'undefined') { + utils_1.checkLengthValue(length); + } + const lengthVal = typeof length === 'number' ? length : this.length; + const endPoint = Math.min(this.length, this._readOffset + lengthVal); + // Read buffer value + const value = this._buff.slice(this._readOffset, endPoint); + // Increment internal Buffer read offset + this._readOffset = endPoint; + return value; + } + /** + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBuffer(value, offset) { + utils_1.checkOffsetValue(offset); + return this._handleBuffer(value, true, offset); + } + /** + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBuffer(value, offset) { + return this._handleBuffer(value, false, offset); + } + /** + * Reads a null-terminated Buffer from the current read poisiton. + * + * @return { Buffer } + */ + readBufferNT() { + // Set null character position to the end SmartBuffer instance. + let nullPos = this.length; + // Find next null character (if one is not found, default from above is used) + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0x00) { + nullPos = i; + break; + } + } + // Read value + const value = this._buff.slice(this._readOffset, nullPos); + // Increment internal Buffer read offset + this._readOffset = nullPos + 1; + return value; + } + /** + * Inserts a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBufferNT(value, offset) { + utils_1.checkOffsetValue(offset); + // Write Values + this.insertBuffer(value, offset); + this.insertUInt8(0x00, offset + value.length); + return this; + } + /** + * Writes a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBufferNT(value, offset) { + // Checks for valid numberic value; + if (typeof offset !== 'undefined') { + utils_1.checkOffsetValue(offset); + } + // Write Values + this.writeBuffer(value, offset); + this.writeUInt8(0x00, typeof offset === 'number' ? offset + value.length : this._writeOffset); + return this; + } + /** + * Clears the SmartBuffer instance to its original empty state. + */ + clear() { + this._writeOffset = 0; + this._readOffset = 0; + this.length = 0; + return this; + } + /** + * Gets the remaining data left to be read from the SmartBuffer instance. + * + * @return { Number } + */ + remaining() { + return this.length - this._readOffset; + } + /** + * Gets the current read offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get readOffset() { + return this._readOffset; + } + /** + * Sets the read offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set readOffset(offset) { + utils_1.checkOffsetValue(offset); + // Check for bounds. + utils_1.checkTargetOffset(offset, this); + this._readOffset = offset; + } + /** + * Gets the current write offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get writeOffset() { + return this._writeOffset; + } + /** + * Sets the write offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set writeOffset(offset) { + utils_1.checkOffsetValue(offset); + // Check for bounds. + utils_1.checkTargetOffset(offset, this); + this._writeOffset = offset; + } + /** + * Gets the currently set string encoding of the SmartBuffer instance. + * + * @return { BufferEncoding } The string Buffer encoding currently set. + */ + get encoding() { + return this._encoding; + } + /** + * Sets the string encoding of the SmartBuffer instance. + * + * @param encoding { BufferEncoding } The string Buffer encoding to set. + */ + set encoding(encoding) { + utils_1.checkEncoding(encoding); + this._encoding = encoding; + } + /** + * Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer) + * + * @return { Buffer } The Buffer value. + */ + get internalBuffer() { + return this._buff; + } + /** + * Gets the value of the internal managed Buffer (Includes managed data only) + * + * @param { Buffer } + */ + toBuffer() { + return this._buff.slice(0, this.length); + } + /** + * Gets the String value of the internal managed Buffer + * + * @param encoding { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding). + */ + toString(encoding) { + const encodingVal = typeof encoding === 'string' ? encoding : this._encoding; + // Check for invalid encoding. + utils_1.checkEncoding(encodingVal); + return this._buff.toString(encodingVal, 0, this.length); + } + /** + * Destroys the SmartBuffer instance. + */ + destroy() { + this.clear(); + return this; + } + /** + * Handles inserting and writing strings. + * + * @param value { String } The String value to insert. + * @param isInsert { Boolean } True if inserting a string, false if writing. + * @param arg2 { Number | String } The offset to insert the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + */ + _handleString(value, isInsert, arg3, encoding) { + let offsetVal = this._writeOffset; + let encodingVal = this._encoding; + // Check for offset + if (typeof arg3 === 'number') { + offsetVal = arg3; + // Check for encoding + } + else if (typeof arg3 === 'string') { + utils_1.checkEncoding(arg3); + encodingVal = arg3; + } + // Check for encoding (third param) + if (typeof encoding === 'string') { + utils_1.checkEncoding(encoding); + encodingVal = encoding; + } + // Calculate bytelength of string. + const byteLength = Buffer.byteLength(value, encodingVal); + // Ensure there is enough internal Buffer capacity. + if (isInsert) { + this.ensureInsertable(byteLength, offsetVal); + } + else { + this._ensureWriteable(byteLength, offsetVal); + } + // Write value + this._buff.write(value, offsetVal, byteLength, encodingVal); + // Increment internal Buffer write offset; + if (isInsert) { + this._writeOffset += byteLength; + } + else { + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof arg3 === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteLength); + } + else { + // If no offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += byteLength; + } + } + return this; + } + /** + * Handles writing or insert of a Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + */ + _handleBuffer(value, isInsert, offset) { + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure there is enough internal Buffer capacity. + if (isInsert) { + this.ensureInsertable(value.length, offsetVal); + } + else { + this._ensureWriteable(value.length, offsetVal); + } + // Write buffer value + value.copy(this._buff, offsetVal); + // Increment internal Buffer write offset; + if (isInsert) { + this._writeOffset += value.length; + } + else { + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof offset === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + value.length); + } + else { + // If no offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += value.length; + } + } + return this; + } + /** + * Ensures that the internal Buffer is large enough to read data. + * + * @param length { Number } The length of the data that needs to be read. + * @param offset { Number } The offset of the data that needs to be read. + */ + ensureReadable(length, offset) { + // Offset value defaults to managed read offset. + let offsetVal = this._readOffset; + // If an offset was provided, use it. + if (typeof offset !== 'undefined') { + // Checks for valid numberic value; + utils_1.checkOffsetValue(offset); + // Overide with custom offset. + offsetVal = offset; + } + // Checks if offset is below zero, or the offset+length offset is beyond the total length of the managed data. + if (offsetVal < 0 || offsetVal + length > this.length) { + throw new Error(utils_1.ERRORS.INVALID_READ_BEYOND_BOUNDS); + } + } + /** + * Ensures that the internal Buffer is large enough to insert data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written. + */ + ensureInsertable(dataLength, offset) { + // Checks for valid numberic value; + utils_1.checkOffsetValue(offset); + // Ensure there is enough internal Buffer capacity. + this._ensureCapacity(this.length + dataLength); + // If an offset was provided and its not the very end of the buffer, copy data into appropriate location in regards to the offset. + if (offset < this.length) { + this._buff.copy(this._buff, offset + dataLength, offset, this._buff.length); + } + // Adjust tracked smart buffer length + if (offset + dataLength > this.length) { + this.length = offset + dataLength; + } + else { + this.length += dataLength; + } + } + /** + * Ensures that the internal Buffer is large enough to write data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written (defaults to writeOffset). + */ + _ensureWriteable(dataLength, offset) { + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure enough capacity to write data. + this._ensureCapacity(offsetVal + dataLength); + // Adjust SmartBuffer length (if offset + length is larger than managed length, adjust length) + if (offsetVal + dataLength > this.length) { + this.length = offsetVal + dataLength; + } + } + /** + * Ensures that the internal Buffer is large enough to write at least the given amount of data. + * + * @param minLength { Number } The minimum length of the data needs to be written. + */ + _ensureCapacity(minLength) { + const oldLength = this._buff.length; + if (minLength > oldLength) { + let data = this._buff; + let newLength = (oldLength * 3) / 2 + 1; + if (newLength < minLength) { + newLength = minLength; + } + this._buff = Buffer.allocUnsafe(newLength); + data.copy(this._buff, 0, 0, oldLength); + } + } + /** + * Reads a numeric number value using the provided function. + * + * @typeparam T { number | bigint } The type of the value to be read + * + * @param func { Function(offset: number) => number } The function to read data on the internal Buffer with. + * @param byteSize { Number } The number of bytes read. + * @param offset { Number } The offset to read from (optional). When this is not provided, the managed readOffset is used instead. + * + * @returns { T } the number value + */ + _readNumberValue(func, byteSize, offset) { + this.ensureReadable(byteSize, offset); + // Call Buffer.readXXXX(); + const value = func.call(this._buff, typeof offset === 'number' ? offset : this._readOffset); + // Adjust internal read offset if an optional read offset was not provided. + if (typeof offset === 'undefined') { + this._readOffset += byteSize; + } + return value; + } + /** + * Inserts a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer + */ + _insertNumberValue(func, byteSize, value, offset) { + // Check for invalid offset values. + utils_1.checkOffsetValue(offset); + // Ensure there is enough internal Buffer capacity. (raw offset is passed) + this.ensureInsertable(byteSize, offset); + // Call buffer.writeXXXX(); + func.call(this._buff, value, offset); + // Adjusts internally managed write offset. + this._writeOffset += byteSize; + return this; + } + /** + * Writes a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer + */ + _writeNumberValue(func, byteSize, value, offset) { + // If an offset was provided, validate it. + if (typeof offset === 'number') { + // Check if we're writing beyond the bounds of the managed data. + if (offset < 0) { + throw new Error(utils_1.ERRORS.INVALID_WRITE_BEYOND_BOUNDS); + } + utils_1.checkOffsetValue(offset); + } + // Default to writeOffset if no offset value was given. + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure there is enough internal Buffer capacity. (raw offset is passed) + this._ensureWriteable(byteSize, offsetVal); + func.call(this._buff, value, offsetVal); + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof offset === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteSize); + } + else { + // If no numeric offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += byteSize; + } + return this; + } +} +exports.SmartBuffer = SmartBuffer; +//# sourceMappingURL=smartbuffer.js.map + +/***/ }), + +/***/ 98132: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const buffer_1 = __nccwpck_require__(64293); +/** + * Error strings + */ +const ERRORS = { + INVALID_ENCODING: 'Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.', + INVALID_SMARTBUFFER_SIZE: 'Invalid size provided. Size must be a valid integer greater than zero.', + INVALID_SMARTBUFFER_BUFFER: 'Invalid Buffer provided in SmartBufferOptions.', + INVALID_SMARTBUFFER_OBJECT: 'Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.', + INVALID_OFFSET: 'An invalid offset value was provided.', + INVALID_OFFSET_NON_NUMBER: 'An invalid offset value was provided. A numeric value is required.', + INVALID_LENGTH: 'An invalid length value was provided.', + INVALID_LENGTH_NON_NUMBER: 'An invalid length value was provived. A numeric value is required.', + INVALID_TARGET_OFFSET: 'Target offset is beyond the bounds of the internal SmartBuffer data.', + INVALID_TARGET_LENGTH: 'Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.', + INVALID_READ_BEYOND_BOUNDS: 'Attempted to read beyond the bounds of the managed data.', + INVALID_WRITE_BEYOND_BOUNDS: 'Attempted to write beyond the bounds of the managed data.' +}; +exports.ERRORS = ERRORS; +/** + * Checks if a given encoding is a valid Buffer encoding. (Throws an exception if check fails) + * + * @param { String } encoding The encoding string to check. + */ +function checkEncoding(encoding) { + if (!buffer_1.Buffer.isEncoding(encoding)) { + throw new Error(ERRORS.INVALID_ENCODING); + } +} +exports.checkEncoding = checkEncoding; +/** + * Checks if a given number is a finite integer. (Throws an exception if check fails) + * + * @param { Number } value The number value to check. + */ +function isFiniteInteger(value) { + return typeof value === 'number' && isFinite(value) && isInteger(value); +} +exports.isFiniteInteger = isFiniteInteger; +/** + * Checks if an offset/length value is valid. (Throws an exception if check fails) + * + * @param value The value to check. + * @param offset True if checking an offset, false if checking a length. + */ +function checkOffsetOrLengthValue(value, offset) { + if (typeof value === 'number') { + // Check for non finite/non integers + if (!isFiniteInteger(value) || value < 0) { + throw new Error(offset ? ERRORS.INVALID_OFFSET : ERRORS.INVALID_LENGTH); + } + } + else { + throw new Error(offset ? ERRORS.INVALID_OFFSET_NON_NUMBER : ERRORS.INVALID_LENGTH_NON_NUMBER); + } +} +/** + * Checks if a length value is valid. (Throws an exception if check fails) + * + * @param { Number } length The value to check. + */ +function checkLengthValue(length) { + checkOffsetOrLengthValue(length, false); +} +exports.checkLengthValue = checkLengthValue; +/** + * Checks if a offset value is valid. (Throws an exception if check fails) + * + * @param { Number } offset The value to check. + */ +function checkOffsetValue(offset) { + checkOffsetOrLengthValue(offset, true); +} +exports.checkOffsetValue = checkOffsetValue; +/** + * Checks if a target offset value is out of bounds. (Throws an exception if check fails) + * + * @param { Number } offset The offset value to check. + * @param { SmartBuffer } buff The SmartBuffer instance to check against. + */ +function checkTargetOffset(offset, buff) { + if (offset < 0 || offset > buff.length) { + throw new Error(ERRORS.INVALID_TARGET_OFFSET); + } +} +exports.checkTargetOffset = checkTargetOffset; +/** + * Determines whether a given number is a integer. + * @param value The number to check. + */ +function isInteger(value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; +} +/** + * Throws if Node.js version is too low to support bigint + */ +function bigIntAndBufferInt64Check(bufferMethod) { + if (typeof BigInt === 'undefined') { + throw new Error('Platform does not support JS BigInt type.'); + } + if (typeof buffer_1.Buffer.prototype[bufferMethod] === 'undefined') { + throw new Error(`Platform does not support Buffer.prototype.${bufferMethod}.`); + } +} +exports.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 32938: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const dns_1 = __importDefault(__nccwpck_require__(40881)); +const tls_1 = __importDefault(__nccwpck_require__(4016)); +const url_1 = __importDefault(__nccwpck_require__(78835)); +const debug_1 = __importDefault(__nccwpck_require__(38237)); +const agent_base_1 = __nccwpck_require__(49690); +const socks_1 = __nccwpck_require__(54754); +const debug = debug_1.default('socks-proxy-agent'); +function dnsLookup(host) { + return new Promise((resolve, reject) => { + dns_1.default.lookup(host, (err, res) => { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + }); +} +function parseSocksProxy(opts) { + let port = 0; + let lookup = false; + let type = 5; + // Prefer `hostname` over `host`, because of `url.parse()` + const host = opts.hostname || opts.host; + if (!host) { + throw new TypeError('No "host"'); + } + if (typeof opts.port === 'number') { + port = opts.port; + } + else if (typeof opts.port === 'string') { + port = parseInt(opts.port, 10); + } + // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 + // "The SOCKS service is conventionally located on TCP port 1080" + if (!port) { + port = 1080; + } + // figure out if we want socks v4 or v5, based on the "protocol" used. + // Defaults to 5. + if (opts.protocol) { + switch (opts.protocol.replace(':', '')) { + case 'socks4': + lookup = true; + // pass through + case 'socks4a': + type = 4; + break; + case 'socks5': + lookup = true; + // pass through + case 'socks': // no version specified, default to 5h + case 'socks5h': + type = 5; + break; + default: + throw new TypeError(`A "socks" protocol must be specified! Got: ${opts.protocol}`); + } + } + if (typeof opts.type !== 'undefined') { + if (opts.type === 4 || opts.type === 5) { + type = opts.type; + } + else { + throw new TypeError(`"type" must be 4 or 5, got: ${opts.type}`); + } + } + const proxy = { + host, + port, + type + }; + let userId = opts.userId || opts.username; + let password = opts.password; + if (opts.auth) { + const auth = opts.auth.split(':'); + userId = auth[0]; + password = auth[1]; + } + if (userId) { + Object.defineProperty(proxy, 'userId', { + value: userId, + enumerable: false + }); + } + if (password) { + Object.defineProperty(proxy, 'password', { + value: password, + enumerable: false + }); + } + return { lookup, proxy }; +} +/** + * The `SocksProxyAgent`. + * + * @api public + */ +class SocksProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!'); + } + super(opts); + const parsedProxy = parseSocksProxy(opts); + this.lookup = parsedProxy.lookup; + this.proxy = parsedProxy.proxy; + } + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { lookup, proxy } = this; + let { host, port, timeout } = opts; + if (!host) { + throw new Error('No `host` defined!'); + } + if (lookup) { + // Client-side DNS resolution for "4" and "5" socks proxy versions. + host = yield dnsLookup(host); + } + const socksOpts = { + proxy, + destination: { host, port }, + command: 'connect', + timeout + }; + debug('Creating socks proxy connection: %o', socksOpts); + const { socket } = yield socks_1.SocksClient.createConnection(socksOpts); + debug('Successfully created socks proxy connection'); + if (opts.secureEndpoint) { + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + const servername = opts.servername || host; + return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername })); + } + return socket; + }); + } +} +exports.default = SocksProxyAgent; +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; +} +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 25038: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(__nccwpck_require__(32938)); +function createSocksProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createSocksProxyAgent) { + createSocksProxyAgent.SocksProxyAgent = agent_1.default; + createSocksProxyAgent.prototype = agent_1.default.prototype; +})(createSocksProxyAgent || (createSocksProxyAgent = {})); +module.exports = createSocksProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 36127: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SocksClientError = exports.SocksClient = void 0; +const events_1 = __nccwpck_require__(28614); +const net = __nccwpck_require__(11631); +const ip = __nccwpck_require__(87547); +const smart_buffer_1 = __nccwpck_require__(71062); +const constants_1 = __nccwpck_require__(49647); +const helpers_1 = __nccwpck_require__(74324); +const receivebuffer_1 = __nccwpck_require__(39740); +const util_1 = __nccwpck_require__(75523); +Object.defineProperty(exports, "SocksClientError", ({ enumerable: true, get: function () { return util_1.SocksClientError; } })); +class SocksClient extends events_1.EventEmitter { + constructor(options) { + super(); + this.options = Object.assign({}, options); + // Validate SocksClientOptions + (0, helpers_1.validateSocksClientOptions)(options); + // Default state + this.setState(constants_1.SocksClientState.Created); + } + /** + * Creates a new SOCKS connection. + * + * Note: Supports callbacks and promises. Only supports the connect command. + * @param options { SocksClientOptions } Options. + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnection(options, callback) { + return new Promise((resolve, reject) => { + // Validate SocksClientOptions + try { + (0, helpers_1.validateSocksClientOptions)(options, ['connect']); + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + return resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + return reject(err); + } + } + const client = new SocksClient(options); + client.connect(options.existing_socket); + client.once('established', (info) => { + client.removeAllListeners(); + if (typeof callback === 'function') { + callback(null, info); + resolve(info); // Resolves pending promise (prevents memory leaks). + } + else { + resolve(info); + } + }); + // Error occurred, failed to establish connection. + client.once('error', (err) => { + client.removeAllListeners(); + if (typeof callback === 'function') { + callback(err); + resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + reject(err); + } + }); + }); + } + /** + * Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies. + * + * Note: Supports callbacks and promises. Only supports the connect method. + * Note: Implemented via createConnection() factory function. + * @param options { SocksClientChainOptions } Options + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnectionChain(options, callback) { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + // Validate SocksClientChainOptions + try { + (0, helpers_1.validateSocksClientChainOptions)(options); + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + return resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + return reject(err); + } + } + let sock; + // Shuffle proxies + if (options.randomizeChain) { + (0, util_1.shuffleArray)(options.proxies); + } + try { + // tslint:disable-next-line:no-increment-decrement + for (let i = 0; i < options.proxies.length; i++) { + const nextProxy = options.proxies[i]; + // If we've reached the last proxy in the chain, the destination is the actual destination, otherwise it's the next proxy. + const nextDestination = i === options.proxies.length - 1 + ? options.destination + : { + host: options.proxies[i + 1].host || + options.proxies[i + 1].ipaddress, + port: options.proxies[i + 1].port, + }; + // Creates the next connection in the chain. + const result = yield SocksClient.createConnection({ + command: 'connect', + proxy: nextProxy, + destination: nextDestination, + // Initial connection ignores this as sock is undefined. Subsequent connections re-use the first proxy socket to form a chain. + }); + // If sock is undefined, assign it here. + if (!sock) { + sock = result.socket; + } + } + if (typeof callback === 'function') { + callback(null, { socket: sock }); + resolve({ socket: sock }); // Resolves pending promise (prevents memory leaks). + } + else { + resolve({ socket: sock }); + } + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + reject(err); + } + } + })); + } + /** + * Creates a SOCKS UDP Frame. + * @param options + */ + static createUDPFrame(options) { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt16BE(0); + buff.writeUInt8(options.frameNumber || 0); + // IPv4/IPv6/Hostname + if (net.isIPv4(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeUInt32BE(ip.toLong(options.remoteHost.host)); + } + else if (net.isIPv6(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer(ip.toBuffer(options.remoteHost.host)); + } + else { + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(Buffer.byteLength(options.remoteHost.host)); + buff.writeString(options.remoteHost.host); + } + // Port + buff.writeUInt16BE(options.remoteHost.port); + // Data + buff.writeBuffer(options.data); + return buff.toBuffer(); + } + /** + * Parses a SOCKS UDP frame. + * @param data + */ + static parseUDPFrame(data) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const frameNumber = buff.readUInt8(); + const hostType = buff.readUInt8(); + let remoteHost; + if (hostType === constants_1.Socks5HostType.IPv4) { + remoteHost = ip.fromLong(buff.readUInt32BE()); + } + else if (hostType === constants_1.Socks5HostType.IPv6) { + remoteHost = ip.toString(buff.readBuffer(16)); + } + else { + remoteHost = buff.readString(buff.readUInt8()); + } + const remotePort = buff.readUInt16BE(); + return { + frameNumber, + remoteHost: { + host: remoteHost, + port: remotePort, + }, + data: buff.readBuffer(), + }; + } + /** + * Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state. + */ + setState(newState) { + if (this.state !== constants_1.SocksClientState.Error) { + this.state = newState; + } + } + /** + * Starts the connection establishment to the proxy and destination. + * @param existingSocket Connected socket to use instead of creating a new one (internal use). + */ + connect(existingSocket) { + this.onDataReceived = (data) => this.onDataReceivedHandler(data); + this.onClose = () => this.onCloseHandler(); + this.onError = (err) => this.onErrorHandler(err); + this.onConnect = () => this.onConnectHandler(); + // Start timeout timer (defaults to 30 seconds) + const timer = setTimeout(() => this.onEstablishedTimeout(), this.options.timeout || constants_1.DEFAULT_TIMEOUT); + // check whether unref is available as it differs from browser to NodeJS (#33) + if (timer.unref && typeof timer.unref === 'function') { + timer.unref(); + } + // If an existing socket is provided, use it to negotiate SOCKS handshake. Otherwise create a new Socket. + if (existingSocket) { + this.socket = existingSocket; + } + else { + this.socket = new net.Socket(); + } + // Attach Socket error handlers. + this.socket.once('close', this.onClose); + this.socket.once('error', this.onError); + this.socket.once('connect', this.onConnect); + this.socket.on('data', this.onDataReceived); + this.setState(constants_1.SocksClientState.Connecting); + this.receiveBuffer = new receivebuffer_1.ReceiveBuffer(); + if (existingSocket) { + this.socket.emit('connect'); + } + else { + this.socket.connect(this.getSocketOptions()); + if (this.options.set_tcp_nodelay !== undefined && + this.options.set_tcp_nodelay !== null) { + this.socket.setNoDelay(!!this.options.set_tcp_nodelay); + } + } + // Listen for established event so we can re-emit any excess data received during handshakes. + this.prependOnceListener('established', (info) => { + setImmediate(() => { + if (this.receiveBuffer.length > 0) { + const excessData = this.receiveBuffer.get(this.receiveBuffer.length); + info.socket.emit('data', excessData); + } + info.socket.resume(); + }); + }); + } + // Socket options (defaults host/port to options.proxy.host/options.proxy.port) + getSocketOptions() { + return Object.assign(Object.assign({}, this.options.socket_options), { host: this.options.proxy.host || this.options.proxy.ipaddress, port: this.options.proxy.port }); + } + /** + * Handles internal Socks timeout callback. + * Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed. + */ + onEstablishedTimeout() { + if (this.state !== constants_1.SocksClientState.Established && + this.state !== constants_1.SocksClientState.BoundWaitingForConnection) { + this.closeSocket(constants_1.ERRORS.ProxyConnectionTimedOut); + } + } + /** + * Handles Socket connect event. + */ + onConnectHandler() { + this.setState(constants_1.SocksClientState.Connected); + // Send initial handshake. + if (this.options.proxy.type === 4) { + this.sendSocks4InitialHandshake(); + } + else { + this.sendSocks5InitialHandshake(); + } + this.setState(constants_1.SocksClientState.SentInitialHandshake); + } + /** + * Handles Socket data event. + * @param data + */ + onDataReceivedHandler(data) { + /* + All received data is appended to a ReceiveBuffer. + This makes sure that all the data we need is received before we attempt to process it. + */ + this.receiveBuffer.append(data); + // Process data that we have. + this.processData(); + } + /** + * Handles processing of the data we have received. + */ + processData() { + // If we have enough data to process the next step in the SOCKS handshake, proceed. + while (this.state !== constants_1.SocksClientState.Established && + this.state !== constants_1.SocksClientState.Error && + this.receiveBuffer.length >= this.nextRequiredPacketBufferSize) { + // Sent initial handshake, waiting for response. + if (this.state === constants_1.SocksClientState.SentInitialHandshake) { + if (this.options.proxy.type === 4) { + // Socks v4 only has one handshake response. + this.handleSocks4FinalHandshakeResponse(); + } + else { + // Socks v5 has two handshakes, handle initial one here. + this.handleInitialSocks5HandshakeResponse(); + } + // Sent auth request for Socks v5, waiting for response. + } + else if (this.state === constants_1.SocksClientState.SentAuthentication) { + this.handleInitialSocks5AuthenticationHandshakeResponse(); + // Sent final Socks v5 handshake, waiting for final response. + } + else if (this.state === constants_1.SocksClientState.SentFinalHandshake) { + this.handleSocks5FinalHandshakeResponse(); + // Socks BIND established. Waiting for remote connection via proxy. + } + else if (this.state === constants_1.SocksClientState.BoundWaitingForConnection) { + if (this.options.proxy.type === 4) { + this.handleSocks4IncomingConnectionResponse(); + } + else { + this.handleSocks5IncomingConnectionResponse(); + } + } + else { + this.closeSocket(constants_1.ERRORS.InternalError); + break; + } + } + } + /** + * Handles Socket close event. + * @param had_error + */ + onCloseHandler() { + this.closeSocket(constants_1.ERRORS.SocketClosed); + } + /** + * Handles Socket error event. + * @param err + */ + onErrorHandler(err) { + this.closeSocket(err.message); + } + /** + * Removes internal event listeners on the underlying Socket. + */ + removeInternalSocketHandlers() { + // Pauses data flow of the socket (this is internally resumed after 'established' is emitted) + this.socket.pause(); + this.socket.removeListener('data', this.onDataReceived); + this.socket.removeListener('close', this.onClose); + this.socket.removeListener('error', this.onError); + this.socket.removeListener('connect', this.onConnect); + } + /** + * Closes and destroys the underlying Socket. Emits an error event. + * @param err { String } An error string to include in error event. + */ + closeSocket(err) { + // Make sure only one 'error' event is fired for the lifetime of this SocksClient instance. + if (this.state !== constants_1.SocksClientState.Error) { + // Set internal state to Error. + this.setState(constants_1.SocksClientState.Error); + // Destroy Socket + this.socket.destroy(); + // Remove internal listeners + this.removeInternalSocketHandlers(); + // Fire 'error' event. + this.emit('error', new util_1.SocksClientError(err, this.options)); + } + } + /** + * Sends initial Socks v4 handshake request. + */ + sendSocks4InitialHandshake() { + const userId = this.options.proxy.userId || ''; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x04); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt16BE(this.options.destination.port); + // Socks 4 (IPv4) + if (net.isIPv4(this.options.destination.host)) { + buff.writeBuffer(ip.toBuffer(this.options.destination.host)); + buff.writeStringNT(userId); + // Socks 4a (hostname) + } + else { + buff.writeUInt8(0x00); + buff.writeUInt8(0x00); + buff.writeUInt8(0x00); + buff.writeUInt8(0x01); + buff.writeStringNT(userId); + buff.writeStringNT(this.options.destination.host); + } + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks4Response; + this.socket.write(buff.toBuffer()); + } + /** + * Handles Socks v4 handshake response. + * @param data + */ + handleSocks4FinalHandshakeResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedConnection} - (${constants_1.Socks4Response[data[1]]})`); + } + else { + // Bind response + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: ip.fromLong(buff.readUInt32BE()), + }; + // If host is 0.0.0.0, set to proxy host. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.emit('bound', { remoteHost, socket: this.socket }); + // Connect response + } + else { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { socket: this.socket }); + } + } + } + /** + * Handles Socks v4 incoming connection request (BIND) + * @param data + */ + handleSocks4IncomingConnectionResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${constants_1.Socks4Response[data[1]]})`); + } + else { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: ip.fromLong(buff.readUInt32BE()), + }; + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + } + /** + * Sends initial Socks v5 handshake request. + */ + sendSocks5InitialHandshake() { + const buff = new smart_buffer_1.SmartBuffer(); + // By default we always support no auth. + const supportedAuthMethods = [constants_1.Socks5Auth.NoAuth]; + // We should only tell the proxy we support user/pass auth if auth info is actually provided. + // Note: As of Tor v0.3.5.7+, if user/pass auth is an option from the client, by default it will always take priority. + if (this.options.proxy.userId || this.options.proxy.password) { + supportedAuthMethods.push(constants_1.Socks5Auth.UserPass); + } + // Custom auth method? + if (this.options.proxy.custom_auth_method !== undefined) { + supportedAuthMethods.push(this.options.proxy.custom_auth_method); + } + // Build handshake packet + buff.writeUInt8(0x05); + buff.writeUInt8(supportedAuthMethods.length); + for (const authMethod of supportedAuthMethods) { + buff.writeUInt8(authMethod); + } + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentInitialHandshake); + } + /** + * Handles initial Socks v5 handshake response. + * @param data + */ + handleInitialSocks5HandshakeResponse() { + const data = this.receiveBuffer.get(2); + if (data[0] !== 0x05) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion); + } + else if (data[1] === constants_1.SOCKS5_NO_ACCEPTABLE_AUTH) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType); + } + else { + // If selected Socks v5 auth method is no auth, send final handshake request. + if (data[1] === constants_1.Socks5Auth.NoAuth) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.NoAuth; + this.sendSocks5CommandRequest(); + // If selected Socks v5 auth method is user/password, send auth handshake. + } + else if (data[1] === constants_1.Socks5Auth.UserPass) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.UserPass; + this.sendSocks5UserPassAuthentication(); + // If selected Socks v5 auth method is the custom_auth_method, send custom handshake. + } + else if (data[1] === this.options.proxy.custom_auth_method) { + this.socks5ChosenAuthType = this.options.proxy.custom_auth_method; + this.sendSocks5CustomAuthentication(); + } + else { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType); + } + } + } + /** + * Sends Socks v5 user & password auth handshake. + * + * Note: No auth and user/pass are currently supported. + */ + sendSocks5UserPassAuthentication() { + const userId = this.options.proxy.userId || ''; + const password = this.options.proxy.password || ''; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x01); + buff.writeUInt8(Buffer.byteLength(userId)); + buff.writeString(userId); + buff.writeUInt8(Buffer.byteLength(password)); + buff.writeString(password); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentAuthentication); + } + sendSocks5CustomAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + this.nextRequiredPacketBufferSize = + this.options.proxy.custom_auth_response_size; + this.socket.write(yield this.options.proxy.custom_auth_request_handler()); + this.setState(constants_1.SocksClientState.SentAuthentication); + }); + } + handleSocks5CustomAuthHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.options.proxy.custom_auth_response_handler(data); + }); + } + handleSocks5AuthenticationNoAuthHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return data[1] === 0x00; + }); + } + handleSocks5AuthenticationUserPassHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return data[1] === 0x00; + }); + } + /** + * Handles Socks v5 auth handshake response. + * @param data + */ + handleInitialSocks5AuthenticationHandshakeResponse() { + return __awaiter(this, void 0, void 0, function* () { + this.setState(constants_1.SocksClientState.ReceivedAuthenticationResponse); + let authResult = false; + if (this.socks5ChosenAuthType === constants_1.Socks5Auth.NoAuth) { + authResult = yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)); + } + else if (this.socks5ChosenAuthType === constants_1.Socks5Auth.UserPass) { + authResult = + yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)); + } + else if (this.socks5ChosenAuthType === this.options.proxy.custom_auth_method) { + authResult = yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size)); + } + if (!authResult) { + this.closeSocket(constants_1.ERRORS.Socks5AuthenticationFailed); + } + else { + this.sendSocks5CommandRequest(); + } + }); + } + /** + * Sends Socks v5 final handshake request. + */ + sendSocks5CommandRequest() { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x05); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt8(0x00); + // ipv4, ipv6, domain? + if (net.isIPv4(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeBuffer(ip.toBuffer(this.options.destination.host)); + } + else if (net.isIPv6(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer(ip.toBuffer(this.options.destination.host)); + } + else { + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(this.options.destination.host.length); + buff.writeString(this.options.destination.host); + } + buff.writeUInt16BE(this.options.destination.port); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentFinalHandshake); + } + /** + * Handles Socks v5 final handshake response. + * @param data + */ + handleSocks5FinalHandshakeResponse() { + // Peek at available data (we need at least 5 bytes to get the hostname length) + const header = this.receiveBuffer.peek(5); + if (header[0] !== 0x05 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${constants_1.Socks5Response[header[1]]}`); + } + else { + // Read address type + const addressType = header[3]; + let remoteHost; + let buff; + // IPv4 + if (addressType === constants_1.Socks5HostType.IPv4) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip.fromLong(buff.readUInt32BE()), + port: buff.readUInt16BE(), + }; + // If given host is 0.0.0.0, assume remote proxy ip instead. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + // Hostname + } + else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); // header + host length + host + port + // Check if data is available. + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE(), + }; + // IPv6 + } + else if (addressType === constants_1.Socks5HostType.IPv6) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip.toString(buff.readBuffer(16)), + port: buff.readUInt16BE(), + }; + } + // We have everything we need + this.setState(constants_1.SocksClientState.ReceivedFinalResponse); + // If using CONNECT, the client is now in the established state. + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.connect) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + /* If using BIND, the Socks client is now in BoundWaitingForConnection state. + This means that the remote proxy server is waiting for a remote connection to the bound port. */ + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.emit('bound', { remoteHost, socket: this.socket }); + /* + If using Associate, the Socks client is now Established. And the proxy server is now accepting UDP packets at the + given bound port. This initial Socks TCP connection must remain open for the UDP relay to continue to work. + */ + } + else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.associate) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { + remoteHost, + socket: this.socket, + }); + } + } + } + /** + * Handles Socks v5 incoming connection request (BIND). + */ + handleSocks5IncomingConnectionResponse() { + // Peek at available data (we need at least 5 bytes to get the hostname length) + const header = this.receiveBuffer.peek(5); + if (header[0] !== 0x05 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${constants_1.Socks5Response[header[1]]}`); + } + else { + // Read address type + const addressType = header[3]; + let remoteHost; + let buff; + // IPv4 + if (addressType === constants_1.Socks5HostType.IPv4) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip.fromLong(buff.readUInt32BE()), + port: buff.readUInt16BE(), + }; + // If given host is 0.0.0.0, assume remote proxy ip instead. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + // Hostname + } + else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); // header + host length + port + // Check if data is available. + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE(), + }; + // IPv6 + } + else if (addressType === constants_1.Socks5HostType.IPv6) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip.toString(buff.readBuffer(16)), + port: buff.readUInt16BE(), + }; + } + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + } + get socksClientOptions() { + return Object.assign({}, this.options); + } +} +exports.SocksClient = SocksClient; +//# sourceMappingURL=socksclient.js.map + +/***/ }), + +/***/ 49647: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SOCKS5_NO_ACCEPTABLE_AUTH = exports.SOCKS5_CUSTOM_AUTH_END = exports.SOCKS5_CUSTOM_AUTH_START = exports.SOCKS_INCOMING_PACKET_SIZES = exports.SocksClientState = exports.Socks5Response = exports.Socks5HostType = exports.Socks5Auth = exports.Socks4Response = exports.SocksCommand = exports.ERRORS = exports.DEFAULT_TIMEOUT = void 0; +const DEFAULT_TIMEOUT = 30000; +exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; +// prettier-ignore +const ERRORS = { + InvalidSocksCommand: 'An invalid SOCKS command was provided. Valid options are connect, bind, and associate.', + InvalidSocksCommandForOperation: 'An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.', + InvalidSocksCommandChain: 'An invalid SOCKS command was provided. Chaining currently only supports the connect command.', + InvalidSocksClientOptionsDestination: 'An invalid destination host was provided.', + InvalidSocksClientOptionsExistingSocket: 'An invalid existing socket was provided. This should be an instance of stream.Duplex.', + InvalidSocksClientOptionsProxy: 'Invalid SOCKS proxy details were provided.', + InvalidSocksClientOptionsTimeout: 'An invalid timeout value was provided. Please enter a value above 0 (in ms).', + InvalidSocksClientOptionsProxiesLength: 'At least two socks proxies must be provided for chaining.', + InvalidSocksClientOptionsCustomAuthRange: 'Custom auth must be a value between 0x80 and 0xFE.', + InvalidSocksClientOptionsCustomAuthOptions: 'When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.', + NegotiationError: 'Negotiation error', + SocketClosed: 'Socket closed', + ProxyConnectionTimedOut: 'Proxy connection timed out', + InternalError: 'SocksClient internal error (this should not happen)', + InvalidSocks4HandshakeResponse: 'Received invalid Socks4 handshake response', + Socks4ProxyRejectedConnection: 'Socks4 Proxy rejected connection', + InvalidSocks4IncomingConnectionResponse: 'Socks4 invalid incoming connection response', + Socks4ProxyRejectedIncomingBoundConnection: 'Socks4 Proxy rejected incoming bound connection', + InvalidSocks5InitialHandshakeResponse: 'Received invalid Socks5 initial handshake response', + InvalidSocks5IntiailHandshakeSocksVersion: 'Received invalid Socks5 initial handshake (invalid socks version)', + InvalidSocks5InitialHandshakeNoAcceptedAuthType: 'Received invalid Socks5 initial handshake (no accepted authentication type)', + InvalidSocks5InitialHandshakeUnknownAuthType: 'Received invalid Socks5 initial handshake (unknown authentication type)', + Socks5AuthenticationFailed: 'Socks5 Authentication failed', + InvalidSocks5FinalHandshake: 'Received invalid Socks5 final handshake response', + InvalidSocks5FinalHandshakeRejected: 'Socks5 proxy rejected connection', + InvalidSocks5IncomingConnectionResponse: 'Received invalid Socks5 incoming connection response', + Socks5ProxyRejectedIncomingBoundConnection: 'Socks5 Proxy rejected incoming bound connection', +}; +exports.ERRORS = ERRORS; +const SOCKS_INCOMING_PACKET_SIZES = { + Socks5InitialHandshakeResponse: 2, + Socks5UserPassAuthenticationResponse: 2, + // Command response + incoming connection (bind) + Socks5ResponseHeader: 5, + Socks5ResponseIPv4: 10, + Socks5ResponseIPv6: 22, + Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, + // Command response + incoming connection (bind) + Socks4Response: 8, // 2 header + 2 port + 4 ip +}; +exports.SOCKS_INCOMING_PACKET_SIZES = SOCKS_INCOMING_PACKET_SIZES; +var SocksCommand; +(function (SocksCommand) { + SocksCommand[SocksCommand["connect"] = 1] = "connect"; + SocksCommand[SocksCommand["bind"] = 2] = "bind"; + SocksCommand[SocksCommand["associate"] = 3] = "associate"; +})(SocksCommand || (SocksCommand = {})); +exports.SocksCommand = SocksCommand; +var Socks4Response; +(function (Socks4Response) { + Socks4Response[Socks4Response["Granted"] = 90] = "Granted"; + Socks4Response[Socks4Response["Failed"] = 91] = "Failed"; + Socks4Response[Socks4Response["Rejected"] = 92] = "Rejected"; + Socks4Response[Socks4Response["RejectedIdent"] = 93] = "RejectedIdent"; +})(Socks4Response || (Socks4Response = {})); +exports.Socks4Response = Socks4Response; +var Socks5Auth; +(function (Socks5Auth) { + Socks5Auth[Socks5Auth["NoAuth"] = 0] = "NoAuth"; + Socks5Auth[Socks5Auth["GSSApi"] = 1] = "GSSApi"; + Socks5Auth[Socks5Auth["UserPass"] = 2] = "UserPass"; +})(Socks5Auth || (Socks5Auth = {})); +exports.Socks5Auth = Socks5Auth; +const SOCKS5_CUSTOM_AUTH_START = 0x80; +exports.SOCKS5_CUSTOM_AUTH_START = SOCKS5_CUSTOM_AUTH_START; +const SOCKS5_CUSTOM_AUTH_END = 0xfe; +exports.SOCKS5_CUSTOM_AUTH_END = SOCKS5_CUSTOM_AUTH_END; +const SOCKS5_NO_ACCEPTABLE_AUTH = 0xff; +exports.SOCKS5_NO_ACCEPTABLE_AUTH = SOCKS5_NO_ACCEPTABLE_AUTH; +var Socks5Response; +(function (Socks5Response) { + Socks5Response[Socks5Response["Granted"] = 0] = "Granted"; + Socks5Response[Socks5Response["Failure"] = 1] = "Failure"; + Socks5Response[Socks5Response["NotAllowed"] = 2] = "NotAllowed"; + Socks5Response[Socks5Response["NetworkUnreachable"] = 3] = "NetworkUnreachable"; + Socks5Response[Socks5Response["HostUnreachable"] = 4] = "HostUnreachable"; + Socks5Response[Socks5Response["ConnectionRefused"] = 5] = "ConnectionRefused"; + Socks5Response[Socks5Response["TTLExpired"] = 6] = "TTLExpired"; + Socks5Response[Socks5Response["CommandNotSupported"] = 7] = "CommandNotSupported"; + Socks5Response[Socks5Response["AddressNotSupported"] = 8] = "AddressNotSupported"; +})(Socks5Response || (Socks5Response = {})); +exports.Socks5Response = Socks5Response; +var Socks5HostType; +(function (Socks5HostType) { + Socks5HostType[Socks5HostType["IPv4"] = 1] = "IPv4"; + Socks5HostType[Socks5HostType["Hostname"] = 3] = "Hostname"; + Socks5HostType[Socks5HostType["IPv6"] = 4] = "IPv6"; +})(Socks5HostType || (Socks5HostType = {})); +exports.Socks5HostType = Socks5HostType; +var SocksClientState; +(function (SocksClientState) { + SocksClientState[SocksClientState["Created"] = 0] = "Created"; + SocksClientState[SocksClientState["Connecting"] = 1] = "Connecting"; + SocksClientState[SocksClientState["Connected"] = 2] = "Connected"; + SocksClientState[SocksClientState["SentInitialHandshake"] = 3] = "SentInitialHandshake"; + SocksClientState[SocksClientState["ReceivedInitialHandshakeResponse"] = 4] = "ReceivedInitialHandshakeResponse"; + SocksClientState[SocksClientState["SentAuthentication"] = 5] = "SentAuthentication"; + SocksClientState[SocksClientState["ReceivedAuthenticationResponse"] = 6] = "ReceivedAuthenticationResponse"; + SocksClientState[SocksClientState["SentFinalHandshake"] = 7] = "SentFinalHandshake"; + SocksClientState[SocksClientState["ReceivedFinalResponse"] = 8] = "ReceivedFinalResponse"; + SocksClientState[SocksClientState["BoundWaitingForConnection"] = 9] = "BoundWaitingForConnection"; + SocksClientState[SocksClientState["Established"] = 10] = "Established"; + SocksClientState[SocksClientState["Disconnected"] = 11] = "Disconnected"; + SocksClientState[SocksClientState["Error"] = 99] = "Error"; +})(SocksClientState || (SocksClientState = {})); +exports.SocksClientState = SocksClientState; +//# sourceMappingURL=constants.js.map + +/***/ }), + +/***/ 74324: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0; +const util_1 = __nccwpck_require__(75523); +const constants_1 = __nccwpck_require__(49647); +const stream = __nccwpck_require__(92413); +/** + * Validates the provided SocksClientOptions + * @param options { SocksClientOptions } + * @param acceptedCommands { string[] } A list of accepted SocksProxy commands. + */ +function validateSocksClientOptions(options, acceptedCommands = ['connect', 'bind', 'associate']) { + // Check SOCKs command option. + if (!constants_1.SocksCommand[options.command]) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommand, options); + } + // Check SocksCommand for acceptable command. + if (acceptedCommands.indexOf(options.command) === -1) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandForOperation, options); + } + // Check destination + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + } + // Check SOCKS proxy to use + if (!isValidSocksProxy(options.proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + } + // Validate custom auth (if set) + validateCustomProxyAuth(options.proxy, options); + // Check timeout + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + } + // Check existing_socket (if provided) + if (options.existing_socket && + !(options.existing_socket instanceof stream.Duplex)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsExistingSocket, options); + } +} +exports.validateSocksClientOptions = validateSocksClientOptions; +/** + * Validates the SocksClientChainOptions + * @param options { SocksClientChainOptions } + */ +function validateSocksClientChainOptions(options) { + // Only connect is supported when chaining. + if (options.command !== 'connect') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandChain, options); + } + // Check destination + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + } + // Validate proxies (length) + if (!(options.proxies && + Array.isArray(options.proxies) && + options.proxies.length >= 2)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxiesLength, options); + } + // Validate proxies + options.proxies.forEach((proxy) => { + if (!isValidSocksProxy(proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + } + // Validate custom auth (if set) + validateCustomProxyAuth(proxy, options); + }); + // Check timeout + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + } +} +exports.validateSocksClientChainOptions = validateSocksClientChainOptions; +function validateCustomProxyAuth(proxy, options) { + if (proxy.custom_auth_method !== undefined) { + // Invalid auth method range + if (proxy.custom_auth_method < constants_1.SOCKS5_CUSTOM_AUTH_START || + proxy.custom_auth_method > constants_1.SOCKS5_CUSTOM_AUTH_END) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthRange, options); + } + // Missing custom_auth_request_handler + if (proxy.custom_auth_request_handler === undefined || + typeof proxy.custom_auth_request_handler !== 'function') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + // Missing custom_auth_response_size + if (proxy.custom_auth_response_size === undefined) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + // Missing/invalid custom_auth_response_handler + if (proxy.custom_auth_response_handler === undefined || + typeof proxy.custom_auth_response_handler !== 'function') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + } +} +/** + * Validates a SocksRemoteHost + * @param remoteHost { SocksRemoteHost } + */ +function isValidSocksRemoteHost(remoteHost) { + return (remoteHost && + typeof remoteHost.host === 'string' && + typeof remoteHost.port === 'number' && + remoteHost.port >= 0 && + remoteHost.port <= 65535); +} +/** + * Validates a SocksProxy + * @param proxy { SocksProxy } + */ +function isValidSocksProxy(proxy) { + return (proxy && + (typeof proxy.host === 'string' || typeof proxy.ipaddress === 'string') && + typeof proxy.port === 'number' && + proxy.port >= 0 && + proxy.port <= 65535 && + (proxy.type === 4 || proxy.type === 5)); +} +/** + * Validates a timeout value. + * @param value { Number } + */ +function isValidTimeoutValue(value) { + return typeof value === 'number' && value > 0; +} +//# sourceMappingURL=helpers.js.map + +/***/ }), + +/***/ 39740: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ReceiveBuffer = void 0; +class ReceiveBuffer { + constructor(size = 4096) { + this.buffer = Buffer.allocUnsafe(size); + this.offset = 0; + this.originalSize = size; + } + get length() { + return this.offset; + } + append(data) { + if (!Buffer.isBuffer(data)) { + throw new Error('Attempted to append a non-buffer instance to ReceiveBuffer.'); + } + if (this.offset + data.length >= this.buffer.length) { + const tmp = this.buffer; + this.buffer = Buffer.allocUnsafe(Math.max(this.buffer.length + this.originalSize, this.buffer.length + data.length)); + tmp.copy(this.buffer); + } + data.copy(this.buffer, this.offset); + return (this.offset += data.length); + } + peek(length) { + if (length > this.offset) { + throw new Error('Attempted to read beyond the bounds of the managed internal data.'); + } + return this.buffer.slice(0, length); + } + get(length) { + if (length > this.offset) { + throw new Error('Attempted to read beyond the bounds of the managed internal data.'); + } + const value = Buffer.allocUnsafe(length); + this.buffer.slice(0, length).copy(value); + this.buffer.copyWithin(0, length, length + this.offset - length); + this.offset -= length; + return value; + } +} +exports.ReceiveBuffer = ReceiveBuffer; +//# sourceMappingURL=receivebuffer.js.map + +/***/ }), + +/***/ 75523: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.shuffleArray = exports.SocksClientError = void 0; +/** + * Error wrapper for SocksClient + */ +class SocksClientError extends Error { + constructor(message, options) { + super(message); + this.options = options; + } +} +exports.SocksClientError = SocksClientError; +/** + * Shuffles a given array. + * @param array The array to shuffle. + */ +function shuffleArray(array) { + // tslint:disable-next-line:no-increment-decrement + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } +} +exports.shuffleArray = shuffleArray; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 54754: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(36127), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 26375: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __nccwpck_require__(12344); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.I = ArraySet; + + +/***/ }), + +/***/ 10975: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = __nccwpck_require__(6156); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; + + +/***/ }), + +/***/ 6156: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; + + +/***/ }), + +/***/ 33600: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; + + +/***/ }), + +/***/ 86817: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __nccwpck_require__(12344); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.H = MappingList; + + +/***/ }), + +/***/ 73254: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.U = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; + + +/***/ }), + +/***/ 75155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +var __webpack_unused_export__; +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __nccwpck_require__(12344); +var binarySearch = __nccwpck_require__(33600); +var ArraySet = __nccwpck_require__(26375)/* .ArraySet */ .I; +var base64VLQ = __nccwpck_require__(10975); +var quickSort = __nccwpck_require__(73254)/* .quickSort */ .U; + +function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +__webpack_unused_export__ = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ +BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; +}; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +__webpack_unused_export__ = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +__webpack_unused_export__ = IndexedSourceMapConsumer; + + +/***/ }), + +/***/ 69425: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = __nccwpck_require__(10975); +var util = __nccwpck_require__(12344); +var ArraySet = __nccwpck_require__(26375)/* .ArraySet */ .I; +var MappingList = __nccwpck_require__(86817)/* .MappingList */ .H; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.h = SourceMapGenerator; + + +/***/ }), + +/***/ 92616: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = __nccwpck_require__(69425)/* .SourceMapGenerator */ .h; +var util = __nccwpck_require__(12344); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +exports.SourceNode = SourceNode; + + +/***/ }), + +/***/ 12344: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; + + +/***/ }), + +/***/ 56594: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +/* unused reexport */ __nccwpck_require__(69425)/* .SourceMapGenerator */ .h; +/* unused reexport */ __nccwpck_require__(75155); +exports.SourceNode = __nccwpck_require__(92616).SourceNode; + + +/***/ }), + +/***/ 57415: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var codes = __nccwpck_require__(67799) + +/** + * Module exports. + * @public + */ + +module.exports = status + +// status code to message map +status.STATUS_CODES = codes + +// array of status codes +status.codes = populateStatusesMap(status, codes) + +// status codes for redirects +status.redirect = { + 300: true, + 301: true, + 302: true, + 303: true, + 305: true, + 307: true, + 308: true +} + +// status codes for empty bodies +status.empty = { + 204: true, + 205: true, + 304: true +} + +// status codes for when you should retry the request +status.retry = { + 502: true, + 503: true, + 504: true +} + +/** + * Populate the statuses map for given codes. + * @private + */ + +function populateStatusesMap (statuses, codes) { + var arr = [] + + Object.keys(codes).forEach(function forEachCode (code) { + var message = codes[code] + var status = Number(code) + + // Populate properties + statuses[status] = message + statuses[message] = status + statuses[message.toLowerCase()] = status + + // Add to array + arr.push(status) + }) + + return arr +} + +/** + * Get the status code. + * + * Given a number, this will throw if it is not a known status + * code, otherwise the code will be returned. Given a string, + * the string will be parsed for a number and return the code + * if valid, otherwise will lookup the code assuming this is + * the status message. + * + * @param {string|number} code + * @returns {number} + * @public + */ + +function status (code) { + if (typeof code === 'number') { + if (!status[code]) throw new Error('invalid status code: ' + code) + return code + } + + if (typeof code !== 'string') { + throw new TypeError('code must be a number or string') + } + + // '403' + var n = parseInt(code, 10) + if (!isNaN(n)) { + if (!status[n]) throw new Error('invalid status code: ' + n) + return n + } + + n = status[code.toLowerCase()] + if (!n) throw new Error('invalid status message: "' + code + '"') + return n +} + + +/***/ }), + +/***/ 60674: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var Buffer = __nccwpck_require__(64293).Buffer; + +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + 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': return true; + default: return false; + } + } + + +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.s = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; + + +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; + } + + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + this.charReceived = i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} + +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; +} + + +/***/ }), + +/***/ 59318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const os = __nccwpck_require__(12087); +const tty = __nccwpck_require__(33867); +const hasFlag = __nccwpck_require__(31621); + +const {env} = process; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} + +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; + + +/***/ }), + +/***/ 46399: +/***/ ((module) => { + +"use strict"; +/*! + * toidentifier + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = toIdentifier + +/** + * Trasform the given string into a JavaScript identifier + * + * @param {string} str + * @returns {string} + * @public + */ + +function toIdentifier (str) { + return str + .split(' ') + .map(function (token) { + return token.slice(0, 1).toUpperCase() + token.slice(1) + }) + .join('') + .replace(/[^ _0-9a-z]/gi, '') +} + + +/***/ }), + +/***/ 4351: +/***/ ((module) => { + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; var __param; var __metadata; var __awaiter; @@ -30284,1007 +68721,14004 @@ var __createBinding; }); -/***/ }), +/***/ }), + +/***/ 74294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(54219); + + +/***/ }), + +/***/ 54219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var net = __nccwpck_require__(11631); +var tls = __nccwpck_require__(4016); +var http = __nccwpck_require__(98605); +var https = __nccwpck_require__(57211); +var events = __nccwpck_require__(28614); +var assert = __nccwpck_require__(42357); +var util = __nccwpck_require__(31669); + + +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + + +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; + + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; + } + } + socket.destroy(); + self.removeSocket(socket); + }); +} +util.inherits(TunnelingAgent, events.EventEmitter); + +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; + } + + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); + + function onFree() { + self.emit('free', socket, options); + } + + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); + } + }); +}; + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); + + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; + } + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); + } + + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); + + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); + } + + function onError(cause) { + connectReq.removeAllListeners(); + + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + } +}; + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; + } + this.sockets.splice(pos, 1); + + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); + } +}; + +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); + + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); +} + + +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; + } + return host; // for v0.11 or later +} + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } + } + } + } + return target; +} + + +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); + } + console.error.apply(console, args); + } +} else { + debug = function() {}; +} +exports.debug = debug; // for test + + +/***/ }), + +/***/ 9046: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +exports.E = function (fn) { + return Object.defineProperty(function () { + if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments) + else { + return new Promise((resolve, reject) => { + arguments[arguments.length] = (err, res) => { + if (err) return reject(err) + resolve(res) + } + arguments.length++ + fn.apply(this, arguments) + }) + } + }, 'name', { value: fn.name }) +} + +exports.p = function (fn) { + return Object.defineProperty(function () { + const cb = arguments[arguments.length - 1] + if (typeof cb !== 'function') return fn.apply(this, arguments) + else fn.apply(this, arguments).then(r => cb(null, r), cb) + }, 'name', { value: fn.name }) +} + + +/***/ }), + +/***/ 3124: +/***/ ((module) => { + +"use strict"; +/*! + * unpipe + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = unpipe + +/** + * Determine if there are Node.js pipe-like data listeners. + * @private + */ + +function hasPipeDataListeners(stream) { + var listeners = stream.listeners('data') + + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].name === 'ondata') { + return true + } + } + + return false +} + +/** + * Unpipe a stream from all destinations. + * + * @param {object} stream + * @public + */ + +function unpipe(stream) { + if (!stream) { + throw new TypeError('argument stream is required') + } + + if (typeof stream.unpipe === 'function') { + // new-style + stream.unpipe() + return + } + + // Node.js 0.8 hack + if (!hasPipeDataListeners(stream)) { + return + } + + var listener + var listeners = stream.listeners('close') + + for (var i = 0; i < listeners.length; i++) { + listener = listeners[i] + + if (listener.name !== 'cleanup' && listener.name !== 'onclose') { + continue + } + + // invoke the listener + listener.call(stream) + } +} + + +/***/ }), + +/***/ 75840: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); + +var _v = _interopRequireDefault(__nccwpck_require__(78628)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(86409)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(85122)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(79120)); + +var _nil = _interopRequireDefault(__nccwpck_require__(25332)); + +var _version = _interopRequireDefault(__nccwpck_require__(32414)); + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(62746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/***/ }), + +/***/ 4569: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports.default = _default; + +/***/ }), + +/***/ 25332: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; + +/***/ }), + +/***/ 62746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports.default = _default; + +/***/ }), + +/***/ 40814: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports.default = _default; + +/***/ }), + +/***/ 50807: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = rng; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} + +/***/ }), + +/***/ 85274: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports.default = _default; + +/***/ }), + +/***/ 18950: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports.default = _default; + +/***/ }), + +/***/ 78628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(50807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.default)(b); +} + +var _default = v1; +exports.default = _default; + +/***/ }), + +/***/ 86409: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(65998)); + +var _md = _interopRequireDefault(__nccwpck_require__(4569)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports.default = _default; + +/***/ }), + +/***/ 65998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = _default; +exports.URL = exports.DNS = void 0; + +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(62746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} + +/***/ }), + +/***/ 85122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(50807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(18950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.default)(rnds); +} + +var _default = v4; +exports.default = _default; + +/***/ }), + +/***/ 79120: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(65998)); + +var _sha = _interopRequireDefault(__nccwpck_require__(85274)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports.default = _default; + +/***/ }), + +/***/ 66900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _regex = _interopRequireDefault(__nccwpck_require__(40814)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports.default = _default; + +/***/ }), + +/***/ 32414: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(66900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.substr(14, 1), 16); +} + +var _default = version; +exports.default = _default; + +/***/ }), + +/***/ 69440: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +if (parseInt(process.versions.node.split('.')[0]) < 6) throw new Error('vm2 requires Node.js version 6 or newer.'); + +module.exports = __nccwpck_require__(74357); + + +/***/ }), + +/***/ 82989: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +/** + * __ ___ ____ _ _ ___ _ _ ____ + * \ \ / / \ | _ \| \ | |_ _| \ | |/ ___| + * \ \ /\ / / _ \ | |_) | \| || || \| | | _ + * \ V V / ___ \| _ <| |\ || || |\ | |_| | + * \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| + * + * This file is critical for vm2. It implements the bridge between the host and the sandbox. + * If you do not know exactly what you are doing, you should NOT edit this file. + * + * The file is loaded in the host and sandbox to handle objects in both directions. + * This is done to ensure that RangeErrors are from the correct context. + * The boundary between the sandbox and host might throw RangeErrors from both contexts. + * Therefore, thisFromOther and friends can handle objects from both domains. + * + * Method parameters have comments to tell from which context they came. + * + */ + +const globalsList = [ + 'Number', + 'String', + 'Boolean', + 'Date', + 'RegExp', + 'Map', + 'WeakMap', + 'Set', + 'WeakSet', + 'Promise', + 'Function' +]; + +const errorsList = [ + 'RangeError', + 'ReferenceError', + 'SyntaxError', + 'TypeError', + 'EvalError', + 'URIError', + 'Error' +]; + +const OPNA = 'Operation not allowed on contextified object.'; + +const thisGlobalPrototypes = { + __proto__: null, + Object: Object.prototype, + Array: Array.prototype +}; + +for (let i = 0; i < globalsList.length; i++) { + const key = globalsList[i]; + const g = global[key]; + if (g) thisGlobalPrototypes[key] = g.prototype; +} + +for (let i = 0; i < errorsList.length; i++) { + const key = errorsList[i]; + const g = global[key]; + if (g) thisGlobalPrototypes[key] = g.prototype; +} + +const { + getPrototypeOf: thisReflectGetPrototypeOf, + setPrototypeOf: thisReflectSetPrototypeOf, + defineProperty: thisReflectDefineProperty, + deleteProperty: thisReflectDeleteProperty, + getOwnPropertyDescriptor: thisReflectGetOwnPropertyDescriptor, + isExtensible: thisReflectIsExtensible, + preventExtensions: thisReflectPreventExtensions, + apply: thisReflectApply, + construct: thisReflectConstruct, + set: thisReflectSet, + get: thisReflectGet, + has: thisReflectHas, + ownKeys: thisReflectOwnKeys, + enumerate: thisReflectEnumerate, +} = Reflect; + +const thisObject = Object; +const { + freeze: thisObjectFreeze, + prototype: thisObjectPrototype +} = thisObject; +const thisObjectHasOwnProperty = thisObjectPrototype.hasOwnProperty; +const ThisProxy = Proxy; +const ThisWeakMap = WeakMap; +const { + get: thisWeakMapGet, + set: thisWeakMapSet +} = ThisWeakMap.prototype; +const ThisMap = Map; +const thisMapGet = ThisMap.prototype.get; +const thisMapSet = ThisMap.prototype.set; +const thisFunction = Function; +const thisFunctionBind = thisFunction.prototype.bind; +const thisArrayIsArray = Array.isArray; +const thisErrorCaptureStackTrace = Error.captureStackTrace; + +const thisSymbolToString = Symbol.prototype.toString; +const thisSymbolToStringTag = Symbol.toStringTag; + +/** + * VMError. + * + * @public + * @extends {Error} + */ +class VMError extends Error { + + /** + * Create VMError instance. + * + * @public + * @param {string} message - Error message. + * @param {string} code - Error code. + */ + constructor(message, code) { + super(message); + + this.name = 'VMError'; + this.code = code; + + thisErrorCaptureStackTrace(this, this.constructor); + } +} + +thisGlobalPrototypes['VMError'] = VMError.prototype; + +function thisUnexpected() { + return new VMError('Unexpected'); +} + +if (!thisReflectSetPrototypeOf(exports, null)) throw thisUnexpected(); + +function thisSafeGetOwnPropertyDescriptor(obj, key) { + const desc = thisReflectGetOwnPropertyDescriptor(obj, key); + if (!desc) return desc; + if (!thisReflectSetPrototypeOf(desc, null)) throw thisUnexpected(); + return desc; +} + +function thisThrowCallerCalleeArgumentsAccess(key) { + 'use strict'; + thisThrowCallerCalleeArgumentsAccess[key]; + return thisUnexpected(); +} + +function thisIdMapping(factory, other) { + return other; +} + +const thisThrowOnKeyAccessHandler = thisObjectFreeze({ + __proto__: null, + get(target, key, receiver) { + if (typeof key === 'symbol') { + key = thisReflectApply(thisSymbolToString, key, []); + } + throw new VMError(`Unexpected access to key '${key}'`); + } +}); + +const emptyForzenObject = thisObjectFreeze({ + __proto__: null +}); + +const thisThrowOnKeyAccess = new ThisProxy(emptyForzenObject, thisThrowOnKeyAccessHandler); + +function SafeBase() {} + +if (!thisReflectDefineProperty(SafeBase, 'prototype', { + __proto__: null, + value: thisThrowOnKeyAccess +})) throw thisUnexpected(); + +function SHARED_FUNCTION() {} + +const TEST_PROXY_HANDLER = thisObjectFreeze({ + __proto__: thisThrowOnKeyAccess, + construct() { + return this; + } +}); + +function thisIsConstructor(obj) { + // Note: obj@any(unsafe) + const Func = new ThisProxy(obj, TEST_PROXY_HANDLER); + try { + // eslint-disable-next-line no-new + new Func(); + return true; + } catch (e) { + return false; + } +} + +function thisCreateTargetObject(obj, proto) { + // Note: obj@any(unsafe) proto@any(unsafe) returns@this(unsafe) throws@this(unsafe) + let base; + if (typeof obj === 'function') { + if (thisIsConstructor(obj)) { + // Bind the function since bound functions do not have a prototype property. + base = thisReflectApply(thisFunctionBind, SHARED_FUNCTION, [null]); + } else { + base = () => {}; + } + } else if (thisArrayIsArray(obj)) { + base = []; + } else { + return {__proto__: proto}; + } + if (!thisReflectSetPrototypeOf(base, proto)) throw thisUnexpected(); + return base; +} + +function createBridge(otherInit, registerProxy) { + + const mappingOtherToThis = new ThisWeakMap(); + const protoMappings = new ThisMap(); + const protoName = new ThisMap(); + + function thisAddProtoMapping(proto, other, name) { + // Note: proto@this(unsafe) other@other(unsafe) name@this(unsafe) throws@this(unsafe) + thisReflectApply(thisMapSet, protoMappings, [proto, thisIdMapping]); + thisReflectApply(thisMapSet, protoMappings, [other, + (factory, object) => thisProxyOther(factory, object, proto)]); + if (name) thisReflectApply(thisMapSet, protoName, [proto, name]); + } + + function thisAddProtoMappingFactory(protoFactory, other, name) { + // Note: protoFactory@this(unsafe) other@other(unsafe) name@this(unsafe) throws@this(unsafe) + let proto; + thisReflectApply(thisMapSet, protoMappings, [other, + (factory, object) => { + if (!proto) { + proto = protoFactory(); + thisReflectApply(thisMapSet, protoMappings, [proto, thisIdMapping]); + if (name) thisReflectApply(thisMapSet, protoName, [proto, name]); + } + return thisProxyOther(factory, object, proto); + }]); + } + + const result = { + __proto__: null, + globalPrototypes: thisGlobalPrototypes, + safeGetOwnPropertyDescriptor: thisSafeGetOwnPropertyDescriptor, + fromArguments: thisFromOtherArguments, + from: thisFromOther, + fromWithFactory: thisFromOtherWithFactory, + ensureThis: thisEnsureThis, + mapping: mappingOtherToThis, + connect: thisConnect, + reflectSet: thisReflectSet, + reflectGet: thisReflectGet, + reflectDefineProperty: thisReflectDefineProperty, + reflectDeleteProperty: thisReflectDeleteProperty, + reflectApply: thisReflectApply, + reflectConstruct: thisReflectConstruct, + reflectHas: thisReflectHas, + reflectOwnKeys: thisReflectOwnKeys, + reflectEnumerate: thisReflectEnumerate, + reflectGetPrototypeOf: thisReflectGetPrototypeOf, + reflectIsExtensible: thisReflectIsExtensible, + reflectPreventExtensions: thisReflectPreventExtensions, + objectHasOwnProperty: thisObjectHasOwnProperty, + weakMapSet: thisWeakMapSet, + addProtoMapping: thisAddProtoMapping, + addProtoMappingFactory: thisAddProtoMappingFactory, + defaultFactory, + protectedFactory, + readonlyFactory, + VMError + }; + + const isHost = typeof otherInit !== 'object'; + + if (isHost) { + otherInit = otherInit(result, registerProxy); + } + + result.other = otherInit; + + const { + globalPrototypes: otherGlobalPrototypes, + safeGetOwnPropertyDescriptor: otherSafeGetOwnPropertyDescriptor, + fromArguments: otherFromThisArguments, + from: otherFromThis, + mapping: mappingThisToOther, + reflectSet: otherReflectSet, + reflectGet: otherReflectGet, + reflectDefineProperty: otherReflectDefineProperty, + reflectDeleteProperty: otherReflectDeleteProperty, + reflectApply: otherReflectApply, + reflectConstruct: otherReflectConstruct, + reflectHas: otherReflectHas, + reflectOwnKeys: otherReflectOwnKeys, + reflectEnumerate: otherReflectEnumerate, + reflectGetPrototypeOf: otherReflectGetPrototypeOf, + reflectIsExtensible: otherReflectIsExtensible, + reflectPreventExtensions: otherReflectPreventExtensions, + objectHasOwnProperty: otherObjectHasOwnProperty, + weakMapSet: otherWeakMapSet + } = otherInit; + + function thisOtherHasOwnProperty(object, key) { + // Note: object@other(safe) key@prim throws@this(unsafe) + try { + return otherReflectApply(otherObjectHasOwnProperty, object, [key]) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + function thisDefaultGet(handler, object, key, desc) { + // Note: object@other(unsafe) key@prim desc@other(safe) + let ret; // @other(unsafe) + if (desc.get || desc.set) { + const getter = desc.get; + if (!getter) return undefined; + try { + ret = otherReflectApply(getter, object, [key]); + } catch (e) { + throw thisFromOther(e); + } + } else { + ret = desc.value; + } + return handler.fromOtherWithContext(ret); + } + + function otherFromThisIfAvailable(to, from, key) { + // Note: to@other(safe) from@this(safe) key@prim throws@this(unsafe) + if (!thisReflectApply(thisObjectHasOwnProperty, from, [key])) return false; + try { + to[key] = otherFromThis(from[key]); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return true; + } + + class BaseHandler extends SafeBase { + + constructor(object) { + // Note: object@other(unsafe) throws@this(unsafe) + super(); + this.object = object; + } + + getFactory() { + return defaultFactory; + } + + fromOtherWithContext(other) { + // Note: other@other(unsafe) throws@this(unsafe) + return thisFromOtherWithFactory(this.getFactory(), other); + } + + doPreventExtensions(target, object, factory) { + // Note: target@this(unsafe) object@other(unsafe) throws@this(unsafe) + let keys; // @other(safe-array-of-prim) + try { + keys = otherReflectOwnKeys(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; // @prim + let desc; + try { + desc = otherSafeGetOwnPropertyDescriptor(object, key); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (!desc) continue; + if (!desc.configurable) { + const current = thisSafeGetOwnPropertyDescriptor(target, key); + if (current && !current.configurable) continue; + if (desc.get || desc.set) { + desc.get = this.fromOtherWithContext(desc.get); + desc.set = this.fromOtherWithContext(desc.set); + } else if (typeof object === 'function' && (key === 'caller' || key === 'callee' || key === 'arguments')) { + desc.value = null; + } else { + desc.value = this.fromOtherWithContext(desc.value); + } + } else { + if (desc.get || desc.set) { + desc = { + __proto__: null, + configurable: true, + enumerable: desc.enumerable, + writable: true, + value: null + }; + } else { + desc.value = null; + } + } + if (!thisReflectDefineProperty(target, key, desc)) throw thisUnexpected(); + } + if (!thisReflectPreventExtensions(target)) throw thisUnexpected(); + } + + get(target, key, receiver) { + // Note: target@this(unsafe) key@prim receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + switch (key) { + case 'constructor': { + const desc = otherSafeGetOwnPropertyDescriptor(object, key); + if (desc) return thisDefaultGet(this, object, key, desc); + const proto = thisReflectGetPrototypeOf(target); + return proto === null ? undefined : proto.constructor; + } + case '__proto__': { + const desc = otherSafeGetOwnPropertyDescriptor(object, key); + if (desc) return thisDefaultGet(this, object, key, desc); + return thisReflectGetPrototypeOf(target); + } + case thisSymbolToStringTag: + if (!thisOtherHasOwnProperty(object, thisSymbolToStringTag)) { + const proto = thisReflectGetPrototypeOf(target); + const name = thisReflectApply(thisMapGet, protoName, [proto]); + if (name) return name; + } + break; + case 'arguments': + case 'caller': + case 'callee': + if (thisOtherHasOwnProperty(object, key)) throw thisThrowCallerCalleeArgumentsAccess(key); + break; + } + let ret; // @other(unsafe) + try { + ret = otherReflectGet(object, key); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return this.fromOtherWithContext(ret); + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (key === '__proto__' && !thisOtherHasOwnProperty(object, key)) { + return this.setPrototypeOf(target, value); + } + try { + value = otherFromThis(value); + return otherReflectSet(object, key, value) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + getPrototypeOf(target) { + // Note: target@this(unsafe) + return thisReflectGetPrototypeOf(target); + } + + setPrototypeOf(target, value) { + // Note: target@this(unsafe) throws@this(unsafe) + throw new VMError(OPNA); + } + + apply(target, context, args) { + // Note: target@this(unsafe) context@this(unsafe) args@this(safe-array) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let ret; // @other(unsafe) + try { + context = otherFromThis(context); + args = otherFromThisArguments(args); + ret = otherReflectApply(object, context, args); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOther(ret); + } + + construct(target, args, newTarget) { + // Note: target@this(unsafe) args@this(safe-array) newTarget@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let ret; // @other(unsafe) + try { + args = otherFromThisArguments(args); + ret = otherReflectConstruct(object, args); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOtherWithFactory(this.getFactory(), ret, thisFromOther(object)); + } + + getOwnPropertyDescriptorDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@other{safe} throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (desc && typeof object === 'function' && (prop === 'arguments' || prop === 'caller' || prop === 'callee')) desc.value = null; + return desc; + } + + getOwnPropertyDescriptor(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + let desc; // @other(safe) + try { + desc = otherSafeGetOwnPropertyDescriptor(object, prop); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + + desc = this.getOwnPropertyDescriptorDesc(target, prop, desc); + + if (!desc) return undefined; + + let thisDesc; + if (desc.get || desc.set) { + thisDesc = { + __proto__: null, + get: this.fromOtherWithContext(desc.get), + set: this.fromOtherWithContext(desc.set), + enumerable: desc.enumerable === true, + configurable: desc.configurable === true + }; + } else { + thisDesc = { + __proto__: null, + value: this.fromOtherWithContext(desc.value), + writable: desc.writable === true, + enumerable: desc.enumerable === true, + configurable: desc.configurable === true + }; + } + if (!thisDesc.configurable) { + const oldDesc = thisSafeGetOwnPropertyDescriptor(target, prop); + if (!oldDesc || oldDesc.configurable || oldDesc.writable !== thisDesc.writable) { + if (!thisReflectDefineProperty(target, prop, thisDesc)) throw thisUnexpected(); + } + } + return thisDesc; + } + + definePropertyDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(safe) throws@this(unsafe) + return desc; + } + + defineProperty(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + if (!thisReflectSetPrototypeOf(desc, null)) throw thisUnexpected(); + + desc = this.definePropertyDesc(target, prop, desc); + + if (!desc) return false; + + let otherDesc = {__proto__: null}; + let hasFunc = true; + let hasValue = true; + let hasBasic = true; + hasFunc &= otherFromThisIfAvailable(otherDesc, desc, 'get'); + hasFunc &= otherFromThisIfAvailable(otherDesc, desc, 'set'); + hasValue &= otherFromThisIfAvailable(otherDesc, desc, 'value'); + hasValue &= otherFromThisIfAvailable(otherDesc, desc, 'writable'); + hasBasic &= otherFromThisIfAvailable(otherDesc, desc, 'enumerable'); + hasBasic &= otherFromThisIfAvailable(otherDesc, desc, 'configurable'); + + try { + if (!otherReflectDefineProperty(object, prop, otherDesc)) return false; + if (otherDesc.configurable !== true && (!hasBasic || !(hasFunc || hasValue))) { + otherDesc = otherSafeGetOwnPropertyDescriptor(object, prop); + } + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + + if (!otherDesc.configurable) { + let thisDesc; + if (otherDesc.get || otherDesc.set) { + thisDesc = { + __proto__: null, + get: this.fromOtherWithContext(otherDesc.get), + set: this.fromOtherWithContext(otherDesc.set), + enumerable: otherDesc.enumerable, + configurable: otherDesc.configurable + }; + } else { + thisDesc = { + __proto__: null, + value: this.fromOtherWithContext(otherDesc.value), + writable: otherDesc.writable, + enumerable: otherDesc.enumerable, + configurable: otherDesc.configurable + }; + } + if (!thisReflectDefineProperty(target, prop, thisDesc)) throw thisUnexpected(); + } + return true; + } + + deleteProperty(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + return otherReflectDeleteProperty(object, prop) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + has(target, key) { + // Note: target@this(unsafe) key@prim throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + return otherReflectHas(object, key) === true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + } + + isExtensible(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + if (otherReflectIsExtensible(object)) return true; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (thisReflectIsExtensible(target)) { + this.doPreventExtensions(target, object, this); + } + return false; + } + + ownKeys(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let res; // @other(unsafe) + try { + res = otherReflectOwnKeys(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return thisFromOther(res); + } + + preventExtensions(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + try { + if (!otherReflectPreventExtensions(object)) return false; + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + if (thisReflectIsExtensible(target)) { + this.doPreventExtensions(target, object, this); + } + return true; + } + + enumerate(target) { + // Note: target@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + let res; // @other(unsafe) + try { + res = otherReflectEnumerate(object); + } catch (e) { // @other(unsafe) + throw thisFromOther(e); + } + return this.fromOtherWithContext(res); + } + + } + + function defaultFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new BaseHandler(object); + } + + class ProtectedHandler extends BaseHandler { + + getFactory() { + return protectedFactory; + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + if (typeof value === 'function') { + return thisReflectDefineProperty(receiver, key, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }) === true; + } + return super.set(target, key, value, receiver); + } + + definePropertyDesc(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(safe) throws@this(unsafe) + if (desc && (desc.set || desc.get || typeof desc.value === 'function')) return undefined; + return desc; + } + + } + + function protectedFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new ProtectedHandler(object); + } + + class ReadOnlyHandler extends BaseHandler { + + getFactory() { + return readonlyFactory; + } + + set(target, key, value, receiver) { + // Note: target@this(unsafe) key@prim value@this(unsafe) receiver@this(unsafe) throws@this(unsafe) + return thisReflectDefineProperty(receiver, key, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }); + } + + setPrototypeOf(target, value) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + defineProperty(target, prop, desc) { + // Note: target@this(unsafe) prop@prim desc@this(unsafe) throws@this(unsafe) + return false; + } + + deleteProperty(target, prop) { + // Note: target@this(unsafe) prop@prim throws@this(unsafe) + return false; + } + + isExtensible(target) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + preventExtensions(target) { + // Note: target@this(unsafe) throws@this(unsafe) + return false; + } + + } + + function readonlyFactory(object) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return new ReadOnlyHandler(object); + } + + class ReadOnlyMockHandler extends ReadOnlyHandler { + + constructor(object, mock) { + // Note: object@other(unsafe) mock:this(unsafe) throws@this(unsafe) + super(object); + this.mock = mock; + } + + get(target, key, receiver) { + // Note: target@this(unsafe) key@prim receiver@this(unsafe) throws@this(unsafe) + const object = this.object; // @other(unsafe) + const mock = this.mock; + if (thisReflectApply(thisObjectHasOwnProperty, mock, key) && !thisOtherHasOwnProperty(object, key)) { + return mock[key]; + } + return super.get(target, key, receiver); + } + + } + + function thisFromOther(other) { + // Note: other@other(unsafe) returns@this(unsafe) throws@this(unsafe) + return thisFromOtherWithFactory(defaultFactory, other); + } + + function thisProxyOther(factory, other, proto) { + const target = thisCreateTargetObject(other, proto); + const handler = factory(other); + const proxy = new ThisProxy(target, handler); + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [proxy, other]); + registerProxy(proxy, handler); + } catch (e) { + throw new VMError('Unexpected error'); + } + if (!isHost) { + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, proxy]); + return proxy; + } + const proxy2 = new ThisProxy(proxy, emptyForzenObject); + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [proxy2, other]); + registerProxy(proxy2, handler); + } catch (e) { + throw new VMError('Unexpected error'); + } + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, proxy2]); + return proxy2; + } + + function thisEnsureThis(other) { + const type = typeof other; + switch (type) { + case 'object': + case 'function': + if (other === null) { + return null; + } else { + let proto = thisReflectGetPrototypeOf(other); + if (!proto) { + return other; + } + while (proto) { + const mapping = thisReflectApply(thisMapGet, protoMappings, [proto]); + if (mapping) { + const mapped = thisReflectApply(thisWeakMapGet, mappingOtherToThis, [other]); + if (mapped) return mapped; + return mapping(defaultFactory, other); + } + proto = thisReflectGetPrototypeOf(proto); + } + return other; + } + + case 'undefined': + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': + return other; + + default: // new, unknown types can be dangerous + throw new VMError(`Unknown type '${type}'`); + } + } + + function thisFromOtherWithFactory(factory, other, proto) { + for (let loop = 0; loop < 10; loop++) { + const type = typeof other; + switch (type) { + case 'object': + case 'function': + if (other === null) { + return null; + } else { + const mapped = thisReflectApply(thisWeakMapGet, mappingOtherToThis, [other]); + if (mapped) return mapped; + if (proto) { + return thisProxyOther(factory, other, proto); + } + try { + proto = otherReflectGetPrototypeOf(other); + } catch (e) { // @other(unsafe) + other = e; + break; + } + if (!proto) { + return thisProxyOther(factory, other, null); + } + while (proto) { + const mapping = thisReflectApply(thisMapGet, protoMappings, [proto]); + if (mapping) return mapping(factory, other); + try { + proto = otherReflectGetPrototypeOf(proto); + } catch (e) { // @other(unsafe) + other = e; + break; + } + } + return thisProxyOther(factory, other, thisObjectPrototype); + } + + case 'undefined': + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': + return other; + + default: // new, unknown types can be dangerous + throw new VMError(`Unknown type '${type}'`); + } + factory = defaultFactory; + proto = undefined; + } + throw new VMError('Exception recursion depth'); + } + + function thisFromOtherArguments(args) { + // Note: args@other(safe-array) returns@this(safe-array) throws@this(unsafe) + const arr = []; + for (let i = 0; i < args.length; i++) { + const value = thisFromOther(args[i]); + thisReflectDefineProperty(arr, i, { + __proto__: null, + value: value, + writable: true, + enumerable: true, + configurable: true + }); + } + return arr; + } + + function thisConnect(obj, other) { + // Note: obj@this(unsafe) other@other(unsafe) throws@this(unsafe) + try { + otherReflectApply(otherWeakMapSet, mappingThisToOther, [obj, other]); + } catch (e) { + throw new VMError('Unexpected error'); + } + thisReflectApply(thisWeakMapSet, mappingOtherToThis, [other, obj]); + } + + thisAddProtoMapping(thisGlobalPrototypes.Object, otherGlobalPrototypes.Object); + thisAddProtoMapping(thisGlobalPrototypes.Array, otherGlobalPrototypes.Array); + + for (let i = 0; i < globalsList.length; i++) { + const key = globalsList[i]; + const tp = thisGlobalPrototypes[key]; + const op = otherGlobalPrototypes[key]; + if (tp && op) thisAddProtoMapping(tp, op, key); + } + + for (let i = 0; i < errorsList.length; i++) { + const key = errorsList[i]; + const tp = thisGlobalPrototypes[key]; + const op = otherGlobalPrototypes[key]; + if (tp && op) thisAddProtoMapping(tp, op, 'Error'); + } + + thisAddProtoMapping(thisGlobalPrototypes.VMError, otherGlobalPrototypes.VMError, 'Error'); + + result.BaseHandler = BaseHandler; + result.ProtectedHandler = ProtectedHandler; + result.ReadOnlyHandler = ReadOnlyHandler; + result.ReadOnlyMockHandler = ReadOnlyMockHandler; + + return result; +} + +exports.createBridge = createBridge; +exports.VMError = VMError; + + +/***/ }), + +/***/ 56400: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const { + VMError +} = __nccwpck_require__(82989); + +let cacheCoffeeScriptCompiler; + +/** + * Returns the cached coffee script compiler or loads it + * if it is not found in the cache. + * + * @private + * @return {compileCallback} The coffee script compiler. + * @throws {VMError} If the coffee-script module can't be found. + */ +function getCoffeeScriptCompiler() { + if (!cacheCoffeeScriptCompiler) { + try { + // The warning generated by webpack can be disabled by setting: + // ignoreWarnings[].message = /Can't resolve 'coffee-script'/ + /* eslint-disable-next-line global-require */ + const coffeeScript = __nccwpck_require__(8188); + cacheCoffeeScriptCompiler = (code, filename) => { + return coffeeScript.compile(code, {header: false, bare: true}); + }; + } catch (e) { + throw new VMError('Coffee-Script compiler is not installed.'); + } + } + return cacheCoffeeScriptCompiler; +} + +/** + * Remove the shebang from source code. + * + * @private + * @param {string} code - Code from which to remove the shebang. + * @return {string} code without the shebang. + */ +function removeShebang(code) { + if (!code.startsWith('#!')) return code; + return '//' + code.substring(2); +} + + +/** + * The JavaScript compiler, just a identity function. + * + * @private + * @type {compileCallback} + * @param {string} code - The JavaScript code. + * @param {string} filename - Filename of this script. + * @return {string} The code. + */ +function jsCompiler(code, filename) { + return removeShebang(code); +} + +/** + * Look up the compiler for a specific name. + * + * @private + * @param {(string|compileCallback)} compiler - A compile callback or the name of the compiler. + * @return {compileCallback} The resolved compiler. + * @throws {VMError} If the compiler is unknown or the coffee script module was needed and couldn't be found. + */ +function lookupCompiler(compiler) { + if ('function' === typeof compiler) return compiler; + switch (compiler) { + case 'coffeescript': + case 'coffee-script': + case 'cs': + case 'text/coffeescript': + return getCoffeeScriptCompiler(); + case 'javascript': + case 'java-script': + case 'js': + case 'text/javascript': + return jsCompiler; + default: + throw new VMError(`Unsupported compiler '${compiler}'.`); + } +} + +exports.removeShebang = removeShebang; +exports.lookupCompiler = lookupCompiler; + + +/***/ }), + +/***/ 74357: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const { + VMError +} = __nccwpck_require__(82989); +const { + VMScript +} = __nccwpck_require__(98611); +const { + VM +} = __nccwpck_require__(93841); +const { + NodeVM +} = __nccwpck_require__(76461); + +exports.VMError = VMError; +exports.VMScript = VMScript; +exports.NodeVM = NodeVM; +exports.VM = VM; + + +/***/ }), + +/***/ 76461: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * This callback will be called to resolve a module if it couldn't be found. + * + * @callback resolveCallback + * @param {string} moduleName - Name of the module used to resolve. + * @param {string} dirname - Name of the current directory. + * @return {(string|undefined)} The file or directory to use to load the requested module. + */ + +/** + * This callback will be called to require a module instead of node's require. + * + * @callback customRequire + * @param {string} moduleName - Name of the module requested. + * @return {*} The required module object. + */ + +const fs = __nccwpck_require__(35747); +const pa = __nccwpck_require__(85622); +const { + Script +} = __nccwpck_require__(92184); +const { + VMError +} = __nccwpck_require__(82989); +const { + VMScript, + MODULE_PREFIX, + STRICT_MODULE_PREFIX, + MODULE_SUFFIX +} = __nccwpck_require__(98611); +const { + transformer +} = __nccwpck_require__(33342); +const { + VM +} = __nccwpck_require__(93841); +const { + resolverFromOptions +} = __nccwpck_require__(81909); + +const objectDefineProperty = Object.defineProperty; +const objectDefineProperties = Object.defineProperties; + +/** + * Host objects + * + * @private + */ +const HOST = Object.freeze({ + __proto__: null, + version: parseInt(process.versions.node.split('.')[0]), + process, + console, + setTimeout, + setInterval, + setImmediate, + clearTimeout, + clearInterval, + clearImmediate +}); + +/** + * Compile a script. + * + * @private + * @param {string} filename - Filename of the script. + * @param {string} script - Script. + * @return {vm.Script} The compiled script. + */ +function compileScript(filename, script) { + return new Script(script, { + __proto__: null, + filename, + displayErrors: false + }); +} + +let cacheSandboxScript = null; +let cacheMakeNestingScript = null; + +const NESTING_OVERRIDE = Object.freeze({ + __proto__: null, + vm2: vm2NestingLoader +}); + +/** + * Event caused by a console.debug call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.debug" + * @type {...*} + */ + +/** + * Event caused by a console.log call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.log" + * @type {...*} + */ + +/** + * Event caused by a console.info call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.info" + * @type {...*} + */ + +/** + * Event caused by a console.warn call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.warn" + * @type {...*} + */ + +/** + * Event caused by a console.error call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.error" + * @type {...*} + */ + +/** + * Event caused by a console.dir call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.dir" + * @type {...*} + */ + +/** + * Event caused by a console.trace call if options.console="redirect" is specified. + * + * @public + * @event NodeVM."console.trace" + * @type {...*} + */ + +/** + * Class NodeVM. + * + * @public + * @extends {VM} + * @extends {EventEmitter} + */ +class NodeVM extends VM { + + /** + * Create a new NodeVM instance.
+ * + * Unlike VM, NodeVM lets you use require same way like in regular node.
+ * + * However, it does not use the timeout. + * + * @public + * @param {Object} [options] - VM options. + * @param {Object} [options.sandbox] - Objects that will be copied into the global object of the sandbox. + * @param {(string|compileCallback)} [options.compiler="javascript"] - The compiler to use. + * @param {boolean} [options.eval=true] - Allow the dynamic evaluation of code via eval(code) or Function(code)().
+ * Only available for node v10+. + * @param {boolean} [options.wasm=true] - Allow to run wasm code.
+ * Only available for node v10+. + * @param {("inherit"|"redirect"|"off")} [options.console="inherit"] - Sets the behavior of the console in the sandbox. + * inherit to enable console, redirect to redirect to events, off to disable console. + * @param {Object|boolean} [options.require=false] - Allow require inside the sandbox. + * @param {(boolean|string[]|Object)} [options.require.external=false] - WARNING: When allowing require the option options.require.root + * should be set to restrict the script from requiring any module. Values can be true, an array of allowed external modules or an object. + * @param {(string[])} [options.require.external.modules] - Array of allowed external modules. Also supports wildcards, so specifying ['@scope/*-ver-??], + * for instance, will allow using all modules having a name of the form @scope/something-ver-aa, @scope/other-ver-11, etc. + * @param {boolean} [options.require.external.transitive=false] - Boolean which indicates if transitive dependencies of external modules are allowed. + * @param {string[]} [options.require.builtin=[]] - Array of allowed built-in modules, accepts ["*"] for all. + * @param {(string|string[])} [options.require.root] - Restricted path(s) where local modules can be required. If omitted every path is allowed. + * @param {Object} [options.require.mock] - Collection of mock modules (both external or built-in). + * @param {("host"|"sandbox")} [options.require.context="host"] - host to require modules in host and proxy them to sandbox. + * sandbox to load, compile and require modules in sandbox. + * Builtin modules except events always required in host and proxied to sandbox. + * @param {string[]} [options.require.import] - Array of modules to be loaded into NodeVM on start. + * @param {resolveCallback} [options.require.resolve] - An additional lookup function in case a module wasn't + * found in one of the traditional node lookup paths. + * @param {customRequire} [options.require.customRequire=require] - Custom require to require host and built-in modules. + * @param {boolean} [options.nesting=false] - + * WARNING: Allowing this is a security risk as scripts can create a NodeVM which can require any host module. + * Allow nesting of VMs. + * @param {("commonjs"|"none")} [options.wrapper="commonjs"] - commonjs to wrap script into CommonJS wrapper, + * none to retrieve value returned by the script. + * @param {string[]} [options.sourceExtensions=["js"]] - Array of file extensions to treat as source code. + * @param {string[]} [options.argv=[]] - Array of arguments passed to process.argv. + * This object will not be copied and the script can change this object. + * @param {Object} [options.env={}] - Environment map passed to process.env. + * This object will not be copied and the script can change this object. + * @param {boolean} [options.strict=false] - If modules should be loaded in strict mode. + * @throws {VMError} If the compiler is unknown. + */ + constructor(options = {}) { + const { + compiler, + eval: allowEval, + wasm, + console: consoleType = 'inherit', + require: requireOpts = false, + nesting = false, + wrapper = 'commonjs', + sourceExtensions = ['js'], + argv, + env, + strict = false, + sandbox + } = options; + + // Throw this early + if (sandbox && 'object' !== typeof sandbox) { + throw new VMError('Sandbox must be an object.'); + } + + super({__proto__: null, compiler: compiler, eval: allowEval, wasm}); + + // This is only here for backwards compatibility. + objectDefineProperty(this, 'options', {__proto__: null, value: { + console: consoleType, + require: requireOpts, + nesting, + wrapper, + sourceExtensions, + strict + }}); + + const resolver = resolverFromOptions(this, requireOpts, nesting && NESTING_OVERRIDE, this._compiler); + + objectDefineProperty(this, '_resolver', {__proto__: null, value: resolver}); + + if (!cacheSandboxScript) { + cacheSandboxScript = compileScript(__nccwpck_require__.ab + "setup-node-sandbox.js", + `(function (host, data) { ${fs.readFileSync(`${__dirname}/setup-node-sandbox.js`, 'utf8')}\n})`); + } + + const closure = this._runScript(cacheSandboxScript); + + const extensions = { + __proto__: null + }; + + const loadJS = (mod, filename) => resolver.loadJS(this, mod, filename); + + for (let i = 0; i < sourceExtensions.length; i++) { + extensions['.' + sourceExtensions[i]] = loadJS; + } + + if (!extensions['.json']) extensions['.json'] = (mod, filename) => resolver.loadJSON(this, mod, filename); + if (!extensions['.node']) extensions['.node'] = (mod, filename) => resolver.loadNode(this, mod, filename); + + + this.readonly(HOST); + this.readonly(resolver); + this.readonly(this); + + const { + Module, + jsonParse, + createRequireForModule + } = closure(HOST, { + __proto__: null, + argv, + env, + console: consoleType, + vm: this, + resolver, + extensions + }); + + objectDefineProperties(this, { + __proto__: null, + _Module: {__proto__: null, value: Module}, + _jsonParse: {__proto__: null, value: jsonParse}, + _createRequireForModule: {__proto__: null, value: createRequireForModule}, + _cacheRequireModule: {__proto__: null, value: null, writable: true} + }); + + + resolver.init(this, ()=>true); + + // prepare global sandbox + if (sandbox) { + this.setGlobals(sandbox); + } + + if (requireOpts && requireOpts.import) { + if (Array.isArray(requireOpts.import)) { + for (let i = 0, l = requireOpts.import.length; i < l; i++) { + this.require(requireOpts.import[i]); + } + } else { + this.require(requireOpts.import); + } + } + } + + /** + * @ignore + * @deprecated Just call the method yourself like method(args); + * @param {function} method - Function to invoke. + * @param {...*} args - Arguments to pass to the function. + * @return {*} Return value of the function. + * @todo Can we remove this function? It even had a bug that would use args as this parameter. + * @throws {*} Rethrows anything the method throws. + * @throws {VMError} If method is not a function. + * @throws {Error} If method is a class. + */ + call(method, ...args) { + if ('function' === typeof method) { + return method(...args); + } else { + throw new VMError('Unrecognized method type.'); + } + } + + /** + * Require a module in VM and return it's exports. + * + * @public + * @param {string} module - Module name. + * @return {*} Exported module. + * @throws {*} If the module couldn't be found or loading it threw an error. + */ + require(module) { + const path = this._resolver.pathResolve('.'); + let mod = this._cacheRequireModule; + if (!mod || mod.path !== path) { + mod = new (this._Module)(this._resolver.pathConcat(path, '/vm.js'), path); + this._cacheRequireModule = mod; + } + return mod.require(module); + } + + /** + * Run the code in NodeVM. + * + * First time you run this method, code is executed same way like in node's regular `require` - it's executed with + * `module`, `require`, `exports`, `__dirname`, `__filename` variables and expect result in `module.exports'. + * + * @param {(string|VMScript)} code - Code to run. + * @param {(string|Object)} [options] - Options map or filename. + * @param {string} [options.filename="vm.js"] - Filename that shows up in any stack traces produced from this script.
+ * This is only used if code is a String. + * @param {boolean} [options.strict] - If modules should be loaded in strict mode. Defaults to NodeVM options. + * @param {("commonjs"|"none")} [options.wrapper] - commonjs to wrap script into CommonJS wrapper, + * none to retrieve value returned by the script. Defaults to NodeVM options. + * @return {*} Result of executed code. + * @throws {SyntaxError} If there is a syntax error in the script. + * @throws {*} If the script execution terminated with an exception it is propagated. + * @fires NodeVM."console.debug" + * @fires NodeVM."console.log" + * @fires NodeVM."console.info" + * @fires NodeVM."console.warn" + * @fires NodeVM."console.error" + * @fires NodeVM."console.dir" + * @fires NodeVM."console.trace" + */ + run(code, options) { + let script; + let filename; + + if (typeof options === 'object') { + filename = options.filename; + } else { + filename = options; + options = {__proto__: null}; + } + + const { + strict = this.options.strict, + wrapper = this.options.wrapper, + module: customModule, + require: customRequire, + dirname: customDirname = null + } = options; + + let sandboxModule = customModule; + let dirname = customDirname; + + if (code instanceof VMScript) { + script = strict ? code._compileNodeVMStrict() : code._compileNodeVM(); + if (!sandboxModule) { + const resolvedFilename = this._resolver.pathResolve(code.filename); + dirname = this._resolver.pathDirname(resolvedFilename); + sandboxModule = new (this._Module)(resolvedFilename, dirname); + this._resolver.registerModule(sandboxModule, resolvedFilename, dirname, null, false); + } + } else { + const unresolvedFilename = filename || 'vm.js'; + if (!sandboxModule) { + if (filename) { + const resolvedFilename = this._resolver.pathResolve(filename); + dirname = this._resolver.pathDirname(resolvedFilename); + sandboxModule = new (this._Module)(resolvedFilename, dirname); + this._resolver.registerModule(sandboxModule, resolvedFilename, dirname, null, false); + } else { + sandboxModule = new (this._Module)(null, null); + sandboxModule.id = unresolvedFilename; + } + } + const prefix = strict ? STRICT_MODULE_PREFIX : MODULE_PREFIX; + let scriptCode = prefix + this._compiler(code, unresolvedFilename) + MODULE_SUFFIX; + scriptCode = transformer(null, scriptCode, false, false).code; + script = new Script(scriptCode, { + __proto__: null, + filename: unresolvedFilename, + displayErrors: false + }); + } + + const closure = this._runScript(script); + + const usedRequire = customRequire || this._createRequireForModule(sandboxModule); + + const ret = Reflect.apply(closure, this.sandbox, [sandboxModule.exports, usedRequire, sandboxModule, filename, dirname]); + return wrapper === 'commonjs' ? sandboxModule.exports : ret; + } + + /** + * Create NodeVM and run code inside it. + * + * @public + * @static + * @param {string} script - Code to execute. + * @param {string} [filename] - File name (used in stack traces only). + * @param {Object} [options] - VM options. + * @param {string} [options.filename] - File name (used in stack traces only). Used if filename is omitted. + * @return {*} Result of executed code. + * @see {@link NodeVM} for the options. + * @throws {SyntaxError} If there is a syntax error in the script. + * @throws {*} If the script execution terminated with an exception it is propagated. + */ + static code(script, filename, options) { + let unresolvedFilename; + if (filename != null) { + if ('object' === typeof filename) { + options = filename; + unresolvedFilename = options.filename; + } else if ('string' === typeof filename) { + unresolvedFilename = filename; + } else { + throw new VMError('Invalid arguments.'); + } + } else if ('object' === typeof options) { + unresolvedFilename = options.filename; + } + + if (arguments.length > 3) { + throw new VMError('Invalid number of arguments.'); + } + + const resolvedFilename = typeof unresolvedFilename === 'string' ? pa.resolve(unresolvedFilename) : undefined; + + return new NodeVM(options).run(script, resolvedFilename); + } + + /** + * Create NodeVM and run script from file inside it. + * + * @public + * @static + * @param {string} filename - Filename of file to load and execute in a NodeVM. + * @param {Object} [options] - NodeVM options. + * @return {*} Result of executed code. + * @see {@link NodeVM} for the options. + * @throws {Error} If filename is not a valid filename. + * @throws {SyntaxError} If there is a syntax error in the script. + * @throws {*} If the script execution terminated with an exception it is propagated. + */ + static file(filename, options) { + const resolvedFilename = pa.resolve(filename); + + if (!fs.existsSync(resolvedFilename)) { + throw new VMError(`Script '${filename}' not found.`); + } + + if (fs.statSync(resolvedFilename).isDirectory()) { + throw new VMError('Script must be file, got directory.'); + } + + return new NodeVM(options).run(fs.readFileSync(resolvedFilename, 'utf8'), resolvedFilename); + } +} + +function vm2NestingLoader(resolver, vm, id) { + if (!cacheMakeNestingScript) { + cacheMakeNestingScript = compileScript('nesting.js', '(vm, nodevm) => ({VM: vm, NodeVM: nodevm})'); + } + const makeNesting = vm._runScript(cacheMakeNestingScript); + return makeNesting(vm.readonly(VM), vm.readonly(NodeVM)); +} + +exports.NodeVM = NodeVM; + + +/***/ }), + +/***/ 81909: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +// Translate the old options to the new Resolver functionality. + +const fs = __nccwpck_require__(35747); +const pa = __nccwpck_require__(85622); +const nmod = __nccwpck_require__(32282); +const {EventEmitter} = __nccwpck_require__(28614); +const util = __nccwpck_require__(31669); + +const { + Resolver, + DefaultResolver +} = __nccwpck_require__(18038); +const {VMScript} = __nccwpck_require__(98611); +const {VM} = __nccwpck_require__(93841); +const {VMError} = __nccwpck_require__(82989); + +/** + * Require wrapper to be able to annotate require with webpackIgnore. + * + * @private + * @param {string} moduleName - Name of module to load. + * @return {*} Module exports. + */ +function defaultRequire(moduleName) { + // Set module.parser.javascript.commonjsMagicComments=true in your webpack config. + // eslint-disable-next-line global-require + return require(/* webpackIgnore: true */ moduleName); +} + +// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping +function escapeRegExp(string) { + return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} + +function makeExternalMatcherRegex(obj) { + return escapeRegExp(obj).replace(/\\\\|\//g, '[\\\\/]') + .replace(/\\\*\\\*/g, '.*').replace(/\\\*/g, '[^\\\\/]*').replace(/\\\?/g, '[^\\\\/]'); +} + +function makeExternalMatcher(obj) { + const regexString = makeExternalMatcherRegex(obj); + return new RegExp(`[\\\\/]node_modules[\\\\/]${regexString}(?:[\\\\/](?!(?:.*[\\\\/])?node_modules[\\\\/]).*)?$`); +} + +class LegacyResolver extends DefaultResolver { + + constructor(builtinModules, checkPath, globalPaths, pathContext, customResolver, hostRequire, compiler, externals, allowTransitive) { + super(builtinModules, checkPath, globalPaths, pathContext, customResolver, hostRequire, compiler); + this.externals = externals; + this.currMod = undefined; + this.trustedMods = new WeakMap(); + this.allowTransitive = allowTransitive; + } + + isPathAllowed(path) { + return this.isPathAllowedForModule(path, this.currMod); + } + + isPathAllowedForModule(path, mod) { + if (!super.isPathAllowed(path)) return false; + if (mod) { + if (mod.allowTransitive) return true; + if (path.startsWith(mod.path)) { + const rem = path.slice(mod.path.length); + if (!/(?:^|[\\\\/])node_modules(?:$|[\\\\/])/.test(rem)) return true; + } + } + return this.externals.some(regex => regex.test(path)); + } + + registerModule(mod, filename, path, parent, direct) { + const trustedParent = this.trustedMods.get(parent); + this.trustedMods.set(mod, { + filename, + path, + paths: this.genLookupPaths(path), + allowTransitive: this.allowTransitive && + ((direct && trustedParent && trustedParent.allowTransitive) || this.externals.some(regex => regex.test(filename))) + }); + } + + resolveFull(mod, x, options, ext, direct) { + this.currMod = undefined; + if (!direct) return super.resolveFull(mod, x, options, ext, false); + const trustedMod = this.trustedMods.get(mod); + if (!trustedMod || mod.path !== trustedMod.path) return super.resolveFull(mod, x, options, ext, false); + const paths = [...mod.paths]; + if (paths.length === trustedMod.length) { + for (let i = 0; i < paths.length; i++) { + if (paths[i] !== trustedMod.paths[i]) { + return super.resolveFull(mod, x, options, ext, false); + } + } + } + const extCopy = Object.assign({__proto__: null}, ext); + try { + this.currMod = trustedMod; + return super.resolveFull(trustedMod, x, undefined, extCopy, true); + } finally { + this.currMod = undefined; + } + } + + checkAccess(mod, filename) { + const trustedMod = this.trustedMods.get(mod); + if ((!trustedMod || trustedMod.filename !== filename) && !this.isPathAllowedForModule(filename, undefined)) { + throw new VMError(`Module '${filename}' is not allowed to be required. The path is outside the border!`, 'EDENIED'); + } + } + + loadJS(vm, mod, filename) { + filename = this.pathResolve(filename); + this.checkAccess(mod, filename); + if (this.pathContext(filename, 'js') === 'sandbox') { + const trustedMod = this.trustedMods.get(mod); + const script = this.readScript(filename); + vm.run(script, {filename, strict: true, module: mod, wrapper: 'none', dirname: trustedMod ? trustedMod.path : mod.path}); + } else { + const m = this.hostRequire(filename); + mod.exports = vm.readonly(m); + } + } + +} + +function defaultBuiltinLoader(resolver, vm, id) { + const mod = resolver.hostRequire(id); + return vm.readonly(mod); +} + +const eventsModules = new WeakMap(); + +function defaultBuiltinLoaderEvents(resolver, vm, id) { + return eventsModules.get(vm); +} + +let cacheBufferScript; + +function defaultBuiltinLoaderBuffer(resolver, vm, id) { + if (!cacheBufferScript) { + cacheBufferScript = new VMScript('return buffer=>({Buffer: buffer});', {__proto__: null, filename: 'buffer.js'}); + } + const makeBuffer = vm.run(cacheBufferScript, {__proto__: null, strict: true, wrapper: 'none'}); + return makeBuffer(Buffer); +} + +let cacheUtilScript; + +function defaultBuiltinLoaderUtil(resolver, vm, id) { + if (!cacheUtilScript) { + cacheUtilScript = new VMScript(`return function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + Object.setPrototypeOf(ctor.prototype, superCtor.prototype); + }`, {__proto__: null, filename: 'util.js'}); + } + const inherits = vm.run(cacheUtilScript, {__proto__: null, strict: true, wrapper: 'none'}); + const copy = Object.assign({}, util); + copy.inherits = inherits; + return vm.readonly(copy); +} + +const BUILTIN_MODULES = (nmod.builtinModules || Object.getOwnPropertyNames(process.binding('natives'))).filter(s=>!s.startsWith('internal/')); + +let EventEmitterReferencingAsyncResourceClass = null; +if (EventEmitter.EventEmitterAsyncResource) { + // eslint-disable-next-line global-require + const {AsyncResource} = __nccwpck_require__(77303); + const kEventEmitter = Symbol('kEventEmitter'); + class EventEmitterReferencingAsyncResource extends AsyncResource { + constructor(ee, type, options) { + super(type, options); + this[kEventEmitter] = ee; + } + get eventEmitter() { + return this[kEventEmitter]; + } + } + EventEmitterReferencingAsyncResourceClass = EventEmitterReferencingAsyncResource; +} + +let cacheEventsScript; + +const SPECIAL_MODULES = { + events(vm) { + if (!cacheEventsScript) { + const eventsSource = fs.readFileSync(__nccwpck_require__.ab + "events.js", 'utf8'); + cacheEventsScript = new VMScript(`(function (fromhost) { const module = {}; module.exports={};{ ${eventsSource} +} return module.exports;})`, {filename: 'events.js'}); + } + const closure = VM.prototype.run.call(vm, cacheEventsScript); + const eventsInstance = closure(vm.readonly({ + kErrorMonitor: EventEmitter.errorMonitor, + once: EventEmitter.once, + on: EventEmitter.on, + getEventListeners: EventEmitter.getEventListeners, + EventEmitterReferencingAsyncResource: EventEmitterReferencingAsyncResourceClass + })); + eventsModules.set(vm, eventsInstance); + vm._addProtoMapping(EventEmitter.prototype, eventsInstance.EventEmitter.prototype); + return defaultBuiltinLoaderEvents; + }, + buffer(vm) { + return defaultBuiltinLoaderBuffer; + }, + util(vm) { + return defaultBuiltinLoaderUtil; + } +}; + +function addDefaultBuiltin(builtins, key, vm) { + if (builtins[key]) return; + const special = SPECIAL_MODULES[key]; + builtins[key] = special ? special(vm) : defaultBuiltinLoader; +} + + +function genBuiltinsFromOptions(vm, builtinOpt, mockOpt, override) { + const builtins = {__proto__: null}; + if (mockOpt) { + const keys = Object.getOwnPropertyNames(mockOpt); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + builtins[key] = (resolver, tvm, id) => tvm.readonly(mockOpt[key]); + } + } + if (override) { + const keys = Object.getOwnPropertyNames(override); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + builtins[key] = override[key]; + } + } + if (Array.isArray(builtinOpt)) { + const def = builtinOpt.indexOf('*') >= 0; + if (def) { + for (let i = 0; i < BUILTIN_MODULES.length; i++) { + const name = BUILTIN_MODULES[i]; + if (builtinOpt.indexOf(`-${name}`) === -1) { + addDefaultBuiltin(builtins, name, vm); + } + } + } else { + for (let i = 0; i < BUILTIN_MODULES.length; i++) { + const name = BUILTIN_MODULES[i]; + if (builtinOpt.indexOf(name) !== -1) { + addDefaultBuiltin(builtins, name, vm); + } + } + } + } else if (builtinOpt) { + for (let i = 0; i < BUILTIN_MODULES.length; i++) { + const name = BUILTIN_MODULES[i]; + if (builtinOpt[name]) { + addDefaultBuiltin(builtins, name, vm); + } + } + } + return builtins; +} + +function defaultCustomResolver() { + return undefined; +} + +const DENY_RESOLVER = new Resolver({__proto__: null}, [], id => { + throw new VMError(`Access denied to require '${id}'`, 'EDENIED'); +}); + +function resolverFromOptions(vm, options, override, compiler) { + if (!options) { + if (!override) return DENY_RESOLVER; + const builtins = genBuiltinsFromOptions(vm, undefined, undefined, override); + return new Resolver(builtins, [], defaultRequire); + } + + const { + builtin: builtinOpt, + mock: mockOpt, + external: externalOpt, + root: rootPaths, + resolve: customResolver, + customRequire: hostRequire = defaultRequire, + context = 'host' + } = options; + + const builtins = genBuiltinsFromOptions(vm, builtinOpt, mockOpt, override); + + if (!externalOpt) return new Resolver(builtins, [], hostRequire); + + let checkPath; + if (rootPaths) { + const checkedRootPaths = (Array.isArray(rootPaths) ? rootPaths : [rootPaths]).map(f => pa.resolve(f)); + checkPath = (filename) => { + return checkedRootPaths.some(path => { + if (!filename.startsWith(path)) return false; + const len = path.length; + if (filename.length === len) return true; + const sep = filename[len]; + return sep === '/' || sep === pa.sep; + }); + }; + } else { + checkPath = () => true; + } + + let newCustomResolver = defaultCustomResolver; + let externals = undefined; + let external = undefined; + if (customResolver) { + let externalCache; + newCustomResolver = (resolver, x, path, extList) => { + if (external && !(resolver.pathIsAbsolute(x) || resolver.pathIsRelative(x))) { + if (!externalCache) { + externalCache = external.map(ext => new RegExp(makeExternalMatcherRegex(ext))); + } + if (!externalCache.some(regex => regex.test(x))) return undefined; + } + const resolved = customResolver(x, path); + if (!resolved) return undefined; + if (externals) externals.push(new RegExp('^' + escapeRegExp(resolved))); + return resolver.loadAsFileOrDirecotry(resolved, extList); + }; + } + + if (typeof externalOpt !== 'object') { + return new DefaultResolver(builtins, checkPath, [], () => context, newCustomResolver, hostRequire, compiler); + } + + let transitive = false; + if (Array.isArray(externalOpt)) { + external = externalOpt; + } else { + external = externalOpt.modules; + transitive = context === 'sandbox' && externalOpt.transitive; + } + externals = external.map(makeExternalMatcher); + return new LegacyResolver(builtins, checkPath, [], () => context, newCustomResolver, hostRequire, compiler, externals, transitive); +} + +exports.resolverFromOptions = resolverFromOptions; + + +/***/ }), + +/***/ 18038: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +// The Resolver is currently experimental and might be exposed to users in the future. + +const pa = __nccwpck_require__(85622); +const fs = __nccwpck_require__(35747); + +const { + VMError +} = __nccwpck_require__(82989); +const { VMScript } = __nccwpck_require__(98611); + +// This should match. Note that '\', '%' are invalid characters +// 1. name/.* +// 2. @scope/name/.* +const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^/\\%]+)(\/.*)?$/; + +// See https://tc39.es/ecma262/#integer-index +function isArrayIndex(key) { + const keyNum = +key; + if (`${keyNum}` !== key) return false; + return keyNum >= 0 && keyNum < 0xFFFFFFFF; +} + +class Resolver { + + constructor(builtinModules, globalPaths, hostRequire) { + this.builtinModules = builtinModules; + this.globalPaths = globalPaths; + this.hostRequire = hostRequire; + } + + init(vm) { + + } + + pathResolve(path) { + return pa.resolve(path); + } + + pathIsRelative(path) { + if (path === '' || path[0] !== '.') return false; + if (path.length === 1) return true; + const idx = path[1] === '.' ? 2 : 1; + if (path.length <= idx) return false; + return path[idx] === '/' || path[idx] === pa.sep; + } + + pathIsAbsolute(path) { + return pa.isAbsolute(path); + } + + pathConcat(...paths) { + return pa.join(...paths); + } + + pathBasename(path) { + return pa.basename(path); + } + + pathDirname(path) { + return pa.dirname(path); + } + + lookupPaths(mod, id) { + if (typeof id === 'string') throw new Error('Id is not a string'); + if (this.pathIsRelative(id)) return [mod.path || '.']; + return [...mod.paths, ...this.globalPaths]; + } + + getBuiltinModulesList() { + return Object.getOwnPropertyNames(this.builtinModules); + } + + loadBuiltinModule(vm, id) { + const handler = this.builtinModules[id]; + return handler && handler(this, vm, id); + } + + loadJS(vm, mod, filename) { + throw new VMError(`Access denied to require '${filename}'`, 'EDENIED'); + } + + loadJSON(vm, mod, filename) { + throw new VMError(`Access denied to require '${filename}'`, 'EDENIED'); + } + + loadNode(vm, mod, filename) { + throw new VMError(`Access denied to require '${filename}'`, 'EDENIED'); + } + + registerModule(mod, filename, path, parent, direct) { + + } + + resolve(mod, x, options, ext, direct) { + if (typeof x !== 'string') throw new Error('Id is not a string'); + + if (x.startsWith('node:') || this.builtinModules[x]) { + // a. return the core module + // b. STOP + return x; + } + + return this.resolveFull(mod, x, options, ext, direct); + } + + resolveFull(mod, x, options, ext, direct) { + // 7. THROW "not found" + throw new VMError(`Cannot find module '${x}'`, 'ENOTFOUND'); + } + + // NODE_MODULES_PATHS(START) + genLookupPaths(path) { + // 1. let PARTS = path split(START) + // 2. let I = count of PARTS - 1 + // 3. let DIRS = [] + const dirs = []; + // 4. while I >= 0, + while (true) { + const name = this.pathBasename(path); + // a. if PARTS[I] = "node_modules" CONTINUE + if (name !== 'node_modules') { + // b. DIR = path join(PARTS[0 .. I] + "node_modules") + // c. DIRS = DIR + DIRS // Note: this seems wrong. Should be DIRS + DIR + dirs.push(this.pathConcat(path, 'node_modules')); + } + const dir = this.pathDirname(path); + if (dir == path) break; + // d. let I = I - 1 + path = dir; + } + + return dirs; + // This is done later on + // 5. return DIRS + GLOBAL_FOLDERS + } + +} + +class DefaultResolver extends Resolver { + + constructor(builtinModules, checkPath, globalPaths, pathContext, customResolver, hostRequire, compiler) { + super(builtinModules, globalPaths, hostRequire); + this.checkPath = checkPath; + this.pathContext = pathContext; + this.customResolver = customResolver; + this.compiler = compiler; + this.packageCache = {__proto__: null}; + this.scriptCache = {__proto__: null}; + } + + isPathAllowed(path) { + return this.checkPath(path); + } + + pathTestIsDirectory(path) { + try { + const stat = fs.statSync(path, {__proto__: null, throwIfNoEntry: false}); + return stat && stat.isDirectory(); + } catch (e) { + return false; + } + } + + pathTestIsFile(path) { + try { + const stat = fs.statSync(path, {__proto__: null, throwIfNoEntry: false}); + return stat && stat.isFile(); + } catch (e) { + return false; + } + } + + readFile(path) { + return fs.readFileSync(path, {encoding: 'utf8'}); + } + + readFileWhenExists(path) { + return this.pathTestIsFile(path) ? this.readFile(path) : undefined; + } + + readScript(filename) { + let script = this.scriptCache[filename]; + if (!script) { + script = new VMScript(this.readFile(filename), {filename, compiler: this.compiler}); + this.scriptCache[filename] = script; + } + return script; + } + + checkAccess(mod, filename) { + if (!this.isPathAllowed(filename)) { + throw new VMError(`Module '${filename}' is not allowed to be required. The path is outside the border!`, 'EDENIED'); + } + } + + loadJS(vm, mod, filename) { + filename = this.pathResolve(filename); + this.checkAccess(mod, filename); + if (this.pathContext(filename, 'js') === 'sandbox') { + const script = this.readScript(filename); + vm.run(script, {filename, strict: true, module: mod, wrapper: 'none', dirname: mod.path}); + } else { + const m = this.hostRequire(filename); + mod.exports = vm.readonly(m); + } + } + + loadJSON(vm, mod, filename) { + filename = this.pathResolve(filename); + this.checkAccess(mod, filename); + const json = this.readFile(filename); + mod.exports = vm._jsonParse(json); + } + + loadNode(vm, mod, filename) { + filename = this.pathResolve(filename); + this.checkAccess(mod, filename); + if (this.pathContext(filename, 'node') === 'sandbox') throw new VMError('Native modules can be required only with context set to \'host\'.'); + const m = this.hostRequire(filename); + mod.exports = vm.readonly(m); + } + + // require(X) from module at path Y + resolveFull(mod, x, options, ext, direct) { + // Note: core module handled by caller + + const extList = Object.getOwnPropertyNames(ext); + const path = mod.path || '.'; + + // 5. LOAD_PACKAGE_SELF(X, dirname(Y)) + let f = this.loadPackageSelf(x, path, extList); + if (f) return f; + + // 4. If X begins with '#' + if (x[0] === '#') { + // a. LOAD_PACKAGE_IMPORTS(X, dirname(Y)) + f = this.loadPackageImports(x, path, extList); + if (f) return f; + } + + // 2. If X begins with '/' + if (this.pathIsAbsolute(x)) { + // a. set Y to be the filesystem root + f = this.loadAsFileOrDirecotry(x, extList); + if (f) return f; + + // c. THROW "not found" + throw new VMError(`Cannot find module '${x}'`, 'ENOTFOUND'); + + // 3. If X begins with './' or '/' or '../' + } else if (this.pathIsRelative(x)) { + if (typeof options === 'object' && options !== null) { + const paths = options.paths; + if (Array.isArray(paths)) { + for (let i = 0; i < paths.length; i++) { + // a. LOAD_AS_FILE(Y + X) + // b. LOAD_AS_DIRECTORY(Y + X) + f = this.loadAsFileOrDirecotry(this.pathConcat(paths[i], x), extList); + if (f) return f; + } + } else if (paths === undefined) { + // a. LOAD_AS_FILE(Y + X) + // b. LOAD_AS_DIRECTORY(Y + X) + f = this.loadAsFileOrDirecotry(this.pathConcat(path, x), extList); + if (f) return f; + } else { + throw new VMError('Invalid options.paths option.'); + } + } else { + // a. LOAD_AS_FILE(Y + X) + // b. LOAD_AS_DIRECTORY(Y + X) + f = this.loadAsFileOrDirecotry(this.pathConcat(path, x), extList); + if (f) return f; + } + + // c. THROW "not found" + throw new VMError(`Cannot find module '${x}'`, 'ENOTFOUND'); + } + + let dirs; + if (typeof options === 'object' && options !== null) { + const paths = options.paths; + if (Array.isArray(paths)) { + dirs = []; + + for (let i = 0; i < paths.length; i++) { + const lookups = this.genLookupPaths(paths[i]); + for (let j = 0; j < lookups.length; j++) { + if (!dirs.includes(lookups[j])) dirs.push(lookups[j]); + } + if (i === 0) { + const globalPaths = this.globalPaths; + for (let j = 0; j < globalPaths.length; j++) { + if (!dirs.includes(globalPaths[j])) dirs.push(globalPaths[j]); + } + } + } + } else if (paths === undefined) { + dirs = [...mod.paths, ...this.globalPaths]; + } else { + throw new VMError('Invalid options.paths option.'); + } + } else { + dirs = [...mod.paths, ...this.globalPaths]; + } + + // 6. LOAD_NODE_MODULES(X, dirname(Y)) + f = this.loadNodeModules(x, dirs, extList); + if (f) return f; + + f = this.customResolver(this, x, path, extList); + if (f) return f; + + return super.resolveFull(mod, x, options, ext, direct); + } + + loadAsFileOrDirecotry(x, extList) { + // a. LOAD_AS_FILE(X) + const f = this.loadAsFile(x, extList); + if (f) return f; + // b. LOAD_AS_DIRECTORY(X) + return this.loadAsDirectory(x, extList); + } + + tryFile(x) { + x = this.pathResolve(x); + return this.isPathAllowed(x) && this.pathTestIsFile(x) ? x : undefined; + } + + tryWithExtension(x, extList) { + for (let i = 0; i < extList.length; i++) { + const ext = extList[i]; + if (ext !== this.pathBasename(ext)) continue; + const f = this.tryFile(x + ext); + if (f) return f; + } + return undefined; + } + + readPackage(path) { + const packagePath = this.pathResolve(this.pathConcat(path, 'package.json')); + + const cache = this.packageCache[packagePath]; + if (cache !== undefined) return cache; + + if (!this.isPathAllowed(packagePath)) return undefined; + const content = this.readFileWhenExists(packagePath); + if (!content) { + this.packageCache[packagePath] = false; + return false; + } + + let parsed; + try { + parsed = JSON.parse(content); + } catch (e) { + e.path = packagePath; + e.message = 'Error parsing ' + packagePath + ': ' + e.message; + throw e; + } + + const filtered = { + name: parsed.name, + main: parsed.main, + exports: parsed.exports, + imports: parsed.imports, + type: parsed.type + }; + this.packageCache[packagePath] = filtered; + return filtered; + } + + readPackageScope(path) { + while (true) { + const dir = this.pathDirname(path); + if (dir === path) break; + const basename = this.pathBasename(dir); + if (basename === 'node_modules') break; + const pack = this.readPackage(dir); + if (pack) return {data: pack, scope: dir}; + path = dir; + } + return {data: undefined, scope: undefined}; + } + + // LOAD_AS_FILE(X) + loadAsFile(x, extList) { + // 1. If X is a file, load X as its file extension format. STOP + const f = this.tryFile(x); + if (f) return f; + // 2. If X.js is a file, load X.js as JavaScript text. STOP + // 3. If X.json is a file, parse X.json to a JavaScript Object. STOP + // 4. If X.node is a file, load X.node as binary addon. STOP + return this.tryWithExtension(x, extList); + } + + // LOAD_INDEX(X) + loadIndex(x, extList) { + // 1. If X/index.js is a file, load X/index.js as JavaScript text. STOP + // 2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP + // 3. If X/index.node is a file, load X/index.node as binary addon. STOP + return this.tryWithExtension(this.pathConcat(x, 'index'), extList); + } + + // LOAD_AS_DIRECTORY(X) + loadAsPackage(x, pack, extList) { + // 1. If X/package.json is a file, + // already done. + if (pack) { + // a. Parse X/package.json, and look for "main" field. + // b. If "main" is a falsy value, GOTO 2. + if (typeof pack.main === 'string') { + // c. let M = X + (json main field) + const m = this.pathConcat(x, pack.main); + // d. LOAD_AS_FILE(M) + let f = this.loadAsFile(m, extList); + if (f) return f; + // e. LOAD_INDEX(M) + f = this.loadIndex(m, extList); + if (f) return f; + // f. LOAD_INDEX(X) DEPRECATED + f = this.loadIndex(x, extList); + if (f) return f; + // g. THROW "not found" + throw new VMError(`Cannot find module '${x}'`, 'ENOTFOUND'); + } + } + + // 2. LOAD_INDEX(X) + return this.loadIndex(x, extList); + } + + // LOAD_AS_DIRECTORY(X) + loadAsDirectory(x, extList) { + // 1. If X/package.json is a file, + const pack = this.readPackage(x); + return this.loadAsPackage(x, pack, extList); + } + + // LOAD_NODE_MODULES(X, START) + loadNodeModules(x, dirs, extList) { + // 1. let DIRS = NODE_MODULES_PATHS(START) + // This step is already done. + + // 2. for each DIR in DIRS: + for (let i = 0; i < dirs.length; i++) { + const dir = dirs[i]; + // a. LOAD_PACKAGE_EXPORTS(X, DIR) + let f = this.loadPackageExports(x, dir, extList); + if (f) return f; + // b. LOAD_AS_FILE(DIR/X) + f = this.loadAsFile(dir + '/' + x, extList); + if (f) return f; + // c. LOAD_AS_DIRECTORY(DIR/X) + f = this.loadAsDirectory(dir + '/' + x, extList); + if (f) return f; + } + + return undefined; + } + + // LOAD_PACKAGE_IMPORTS(X, DIR) + loadPackageImports(x, dir, extList) { + // 1. Find the closest package scope SCOPE to DIR. + const {data, scope} = this.readPackageScope(dir); + // 2. If no scope was found, return. + if (!data) return undefined; + // 3. If the SCOPE/package.json "imports" is null or undefined, return. + if (typeof data.imports !== 'object' || data.imports === null || Array.isArray(data.imports)) return undefined; + // 4. let MATCH = PACKAGE_IMPORTS_RESOLVE(X, pathToFileURL(SCOPE), + // ["node", "require"]) defined in the ESM resolver. + + // PACKAGE_IMPORTS_RESOLVE(specifier, parentURL, conditions) + // 1. Assert: specifier begins with "#". + // 2. If specifier is exactly equal to "#" or starts with "#/", then + if (x === '#' || x.startsWith('#/')) { + // a. Throw an Invalid Module Specifier error. + throw new VMError(`Invalid module specifier '${x}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // 3. Let packageURL be the result of LOOKUP_PACKAGE_SCOPE(parentURL). + // Note: packageURL === parentURL === scope + // 4. If packageURL is not null, then + // Always true + // a. Let pjson be the result of READ_PACKAGE_JSON(packageURL). + // pjson === data + // b. If pjson.imports is a non-null Object, then + // Already tested + // x. Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE( specifier, pjson.imports, packageURL, true, conditions). + const match = this.packageImportsExportsResolve(x, data.imports, scope, true, ['node', 'require'], extList); + // y. If resolved is not null or undefined, return resolved. + if (!match) { + // 5. Throw a Package Import Not Defined error. + throw new VMError(`Package import not defined for '${x}'`, 'ERR_PACKAGE_IMPORT_NOT_DEFINED'); + } + // END PACKAGE_IMPORTS_RESOLVE + + // 5. RESOLVE_ESM_MATCH(MATCH). + return this.resolveEsmMatch(match, x, extList); + } + + // LOAD_PACKAGE_EXPORTS(X, DIR) + loadPackageExports(x, dir, extList) { + // 1. Try to interpret X as a combination of NAME and SUBPATH where the name + // may have a @scope/ prefix and the subpath begins with a slash (`/`). + const res = x.match(EXPORTS_PATTERN); + // 2. If X does not match this pattern or DIR/NAME/package.json is not a file, + // return. + if (!res) return undefined; + const scope = this.pathConcat(dir, res[1]); + const pack = this.readPackage(scope); + if (!pack) return undefined; + // 3. Parse DIR/NAME/package.json, and look for "exports" field. + // 4. If "exports" is null or undefined, return. + if (!pack.exports) return undefined; + // 5. let MATCH = PACKAGE_EXPORTS_RESOLVE(pathToFileURL(DIR/NAME), "." + SUBPATH, + // `package.json` "exports", ["node", "require"]) defined in the ESM resolver. + const match = this.packageExportsResolve(scope, '.' + (res[2] || ''), pack.exports, ['node', 'require'], extList); + // 6. RESOLVE_ESM_MATCH(MATCH) + return this.resolveEsmMatch(match, x, extList); + } + + // LOAD_PACKAGE_SELF(X, DIR) + loadPackageSelf(x, dir, extList) { + // 1. Find the closest package scope SCOPE to DIR. + const {data, scope} = this.readPackageScope(dir); + // 2. If no scope was found, return. + if (!data) return undefined; + // 3. If the SCOPE/package.json "exports" is null or undefined, return. + if (!data.exports) return undefined; + // 4. If the SCOPE/package.json "name" is not the first segment of X, return. + if (x !== data.name && !x.startsWith(data.name + '/')) return undefined; + // 5. let MATCH = PACKAGE_EXPORTS_RESOLVE(pathToFileURL(SCOPE), + // "." + X.slice("name".length), `package.json` "exports", ["node", "require"]) + // defined in the ESM resolver. + const match = this.packageExportsResolve(scope, '.' + x.slice(data.name.length), data.exports, ['node', 'require'], extList); + // 6. RESOLVE_ESM_MATCH(MATCH) + return this.resolveEsmMatch(match, x, extList); + } + + // RESOLVE_ESM_MATCH(MATCH) + resolveEsmMatch(match, x, extList) { + // 1. let { RESOLVED, EXACT } = MATCH + const resolved = match; + const exact = true; + // 2. let RESOLVED_PATH = fileURLToPath(RESOLVED) + const resolvedPath = resolved; + let f; + // 3. If EXACT is true, + if (exact) { + // a. If the file at RESOLVED_PATH exists, load RESOLVED_PATH as its extension + // format. STOP + f = this.tryFile(resolvedPath); + // 4. Otherwise, if EXACT is false, + } else { + // a. LOAD_AS_FILE(RESOLVED_PATH) + // b. LOAD_AS_DIRECTORY(RESOLVED_PATH) + f = this.loadAsFileOrDirecotry(resolvedPath, extList); + } + if (f) return f; + // 5. THROW "not found" + throw new VMError(`Cannot find module '${x}'`, 'ENOTFOUND'); + } + + // PACKAGE_EXPORTS_RESOLVE(packageURL, subpath, exports, conditions) + packageExportsResolve(packageURL, subpath, rexports, conditions, extList) { + // 1. If exports is an Object with both a key starting with "." and a key not starting with ".", throw an Invalid Package Configuration error. + let hasDots = false; + if (typeof rexports === 'object' && !Array.isArray(rexports)) { + const keys = Object.getOwnPropertyNames(rexports); + if (keys.length > 0) { + hasDots = keys[0][0] === '.'; + for (let i = 0; i < keys.length; i++) { + if (hasDots !== (keys[i][0] === '.')) { + throw new VMError('Invalid package configuration', 'ERR_INVALID_PACKAGE_CONFIGURATION'); + } + } + } + } + // 2. If subpath is equal to ".", then + if (subpath === '.') { + // a. Let mainExport be undefined. + let mainExport = undefined; + // b. If exports is a String or Array, or an Object containing no keys starting with ".", then + if (typeof rexports === 'string' || Array.isArray(rexports) || !hasDots) { + // x. Set mainExport to exports. + mainExport = rexports; + // c. Otherwise if exports is an Object containing a "." property, then + } else if (hasDots) { + // x. Set mainExport to exports["."]. + mainExport = rexports['.']; + } + // d. If mainExport is not undefined, then + if (mainExport) { + // x. Let resolved be the result of PACKAGE_TARGET_RESOLVE( packageURL, mainExport, "", false, false, conditions). + const resolved = this.packageTargetResolve(packageURL, mainExport, '', false, false, conditions, extList); + // y. If resolved is not null or undefined, return resolved. + if (resolved) return resolved; + } + // 3. Otherwise, if exports is an Object and all keys of exports start with ".", then + } else if (hasDots) { + // a. Let matchKey be the string "./" concatenated with subpath. + // Note: Here subpath starts already with './' + // b. Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE( matchKey, exports, packageURL, false, conditions). + const resolved = this.packageImportsExportsResolve(subpath, rexports, packageURL, false, conditions, extList); + // c. If resolved is not null or undefined, return resolved. + if (resolved) return resolved; + } + // 4. Throw a Package Path Not Exported error. + throw new VMError(`Package path '${subpath}' is not exported`, 'ERR_PACKAGE_PATH_NOT_EXPORTED'); + } + + // PACKAGE_IMPORTS_EXPORTS_RESOLVE(matchKey, matchObj, packageURL, isImports, conditions) + packageImportsExportsResolve(matchKey, matchObj, packageURL, isImports, conditions, extList) { + // 1. If matchKey is a key of matchObj and does not contain "*", then + let target = matchObj[matchKey]; + if (target && matchKey.indexOf('*') === -1) { + // a. Let target be the value of matchObj[matchKey]. + // b. Return the result of PACKAGE_TARGET_RESOLVE(packageURL, target, "", false, isImports, conditions). + return this.packageTargetResolve(packageURL, target, '', false, isImports, conditions, extList); + } + // 2. Let expansionKeys be the list of keys of matchObj containing only a single "*", + // sorted by the sorting function PATTERN_KEY_COMPARE which orders in descending order of specificity. + const expansionKeys = Object.getOwnPropertyNames(matchObj); + let bestKey = ''; + let bestSubpath; + // 3. For each key expansionKey in expansionKeys, do + for (let i = 0; i < expansionKeys.length; i++) { + const expansionKey = expansionKeys[i]; + if (matchKey.length < expansionKey.length) continue; + // a. Let patternBase be the substring of expansionKey up to but excluding the first "*" character. + const star = expansionKey.indexOf('*'); + if (star === -1) continue; // Note: expansionKeys was not filtered + const patternBase = expansionKey.slice(0, star); + // b. If matchKey starts with but is not equal to patternBase, then + if (matchKey.startsWith(patternBase) && expansionKey.indexOf('*', star + 1) === -1) { // Note: expansionKeys was not filtered + // 1. Let patternTrailer be the substring of expansionKey from the index after the first "*" character. + const patternTrailer = expansionKey.slice(star + 1); + // 2. If patternTrailer has zero length, or if matchKey ends with patternTrailer and the length of matchKey is greater than or + // equal to the length of expansionKey, then + if (matchKey.endsWith(patternTrailer) && this.patternKeyCompare(bestKey, expansionKey) === 1) { // Note: expansionKeys was not sorted + // a. Let target be the value of matchObj[expansionKey]. + target = matchObj[expansionKey]; + // b. Let subpath be the substring of matchKey starting at the index of the length of patternBase up to the length of + // matchKey minus the length of patternTrailer. + bestKey = expansionKey; + bestSubpath = matchKey.slice(patternBase.length, matchKey.length - patternTrailer.length); + } + } + } + if (bestSubpath) { // Note: expansionKeys was not sorted + // c. Return the result of PACKAGE_TARGET_RESOLVE(packageURL, target, subpath, true, isImports, conditions). + return this.packageTargetResolve(packageURL, target, bestSubpath, true, isImports, conditions, extList); + } + // 4. Return null. + return null; + } + + // PATTERN_KEY_COMPARE(keyA, keyB) + patternKeyCompare(keyA, keyB) { + // 1. Assert: keyA ends with "/" or contains only a single "*". + // 2. Assert: keyB ends with "/" or contains only a single "*". + // 3. Let baseLengthA be the index of "*" in keyA plus one, if keyA contains "*", or the length of keyA otherwise. + const baseAStar = keyA.indexOf('*'); + const baseLengthA = baseAStar === -1 ? keyA.length : baseAStar + 1; + // 4. Let baseLengthB be the index of "*" in keyB plus one, if keyB contains "*", or the length of keyB otherwise. + const baseBStar = keyB.indexOf('*'); + const baseLengthB = baseBStar === -1 ? keyB.length : baseBStar + 1; + // 5. If baseLengthA is greater than baseLengthB, return -1. + if (baseLengthA > baseLengthB) return -1; + // 6. If baseLengthB is greater than baseLengthA, return 1. + if (baseLengthB > baseLengthA) return 1; + // 7. If keyA does not contain "*", return 1. + if (baseAStar === -1) return 1; + // 8. If keyB does not contain "*", return -1. + if (baseBStar === -1) return -1; + // 9. If the length of keyA is greater than the length of keyB, return -1. + if (keyA.length > keyB.length) return -1; + // 10. If the length of keyB is greater than the length of keyA, return 1. + if (keyB.length > keyA.length) return 1; + // 11. Return 0. + return 0; + } + + // PACKAGE_TARGET_RESOLVE(packageURL, target, subpath, pattern, internal, conditions) + packageTargetResolve(packageURL, target, subpath, pattern, internal, conditions, extList) { + // 1. If target is a String, then + if (typeof target === 'string') { + // a. If pattern is false, subpath has non-zero length and target does not end with "/", throw an Invalid Module Specifier error. + if (!pattern && subpath.length > 0 && !target.endsWith('/')) { + throw new VMError(`Invalid package specifier '${subpath}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // b. If target does not start with "./", then + if (!target.startsWith('./')) { + // 1. If internal is true and target does not start with "../" or "/" and is not a valid URL, then + if (internal && !target.startsWith('../') && !target.startsWith('/')) { + let isURL = false; + try { + // eslint-disable-next-line no-new + new URL(target); + isURL = true; + } catch (e) {} + if (!isURL) { + // a. If pattern is true, then + if (pattern) { + // 1. Return PACKAGE_RESOLVE(target with every instance of "*" replaced by subpath, packageURL + "/"). + return this.packageResolve(target.replace(/\*/g, subpath), packageURL, conditions, extList); + } + // b. Return PACKAGE_RESOLVE(target + subpath, packageURL + "/"). + return this.packageResolve(this.pathConcat(target, subpath), packageURL, conditions, extList); + } + } + // Otherwise, throw an Invalid Package Target error. + throw new VMError(`Invalid package target for '${subpath}'`, 'ERR_INVALID_PACKAGE_TARGET'); + } + target = decodeURI(target); + // c. If target split on "/" or "\" contains any ".", ".." or "node_modules" segments after the first segment, case insensitive + // and including percent encoded variants, throw an Invalid Package Target error. + if (target.split(/[/\\]/).slice(1).findIndex(x => x === '.' || x === '..' || x.toLowerCase() === 'node_modules') !== -1) { + throw new VMError(`Invalid package target for '${subpath}'`, 'ERR_INVALID_PACKAGE_TARGET'); + } + // d. Let resolvedTarget be the URL resolution of the concatenation of packageURL and target. + const resolvedTarget = this.pathConcat(packageURL, target); + // e. Assert: resolvedTarget is contained in packageURL. + subpath = decodeURI(subpath); + // f. If subpath split on "/" or "\" contains any ".", ".." or "node_modules" segments, case insensitive and including percent + // encoded variants, throw an Invalid Module Specifier error. + if (subpath.split(/[/\\]/).findIndex(x => x === '.' || x === '..' || x.toLowerCase() === 'node_modules') !== -1) { + throw new VMError(`Invalid package specifier '${subpath}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // g. If pattern is true, then + if (pattern) { + // 1. Return the URL resolution of resolvedTarget with every instance of "*" replaced with subpath. + return resolvedTarget.replace(/\*/g, subpath); + } + // h. Otherwise, + // 1. Return the URL resolution of the concatenation of subpath and resolvedTarget. + return this.pathConcat(resolvedTarget, subpath); + // 3. Otherwise, if target is an Array, then + } else if (Array.isArray(target)) { + // a. If target.length is zero, return null. + if (target.length === 0) return null; + let lastException = undefined; + // b. For each item targetValue in target, do + for (let i = 0; i < target.length; i++) { + const targetValue = target[i]; + // 1. Let resolved be the result of PACKAGE_TARGET_RESOLVE( packageURL, targetValue, subpath, pattern, internal, conditions), + // continuing the loop on any Invalid Package Target error. + let resolved; + try { + resolved = this.packageTargetResolve(packageURL, targetValue, subpath, pattern, internal, conditions, extList); + } catch (e) { + if (e.code !== 'ERR_INVALID_PACKAGE_TARGET') throw e; + lastException = e; + continue; + } + // 2. If resolved is undefined, continue the loop. + // 3. Return resolved. + if (resolved !== undefined) return resolved; + if (resolved === null) { + lastException = null; + } + } + // c. Return or throw the last fallback resolution null return or error. + if (lastException === undefined || lastException === null) return lastException; + throw lastException; + // 2. Otherwise, if target is a non-null Object, then + } else if (typeof target === 'object' && target !== null) { + const keys = Object.getOwnPropertyNames(target); + // a. If exports contains any index property keys, as defined in ECMA-262 6.1.7 Array Index, throw an Invalid Package Configuration error. + for (let i = 0; i < keys.length; i++) { + const p = keys[i]; + if (isArrayIndex(p)) throw new VMError(`Invalid package configuration for '${subpath}'`, 'ERR_INVALID_PACKAGE_CONFIGURATION'); + } + // b. For each property p of target, in object insertion order as, + for (let i = 0; i < keys.length; i++) { + const p = keys[i]; + // 1. If p equals "default" or conditions contains an entry for p, then + if (p === 'default' || conditions.includes(p)) { + // a. Let targetValue be the value of the p property in target. + const targetValue = target[p]; + // b. Let resolved be the result of PACKAGE_TARGET_RESOLVE( packageURL, targetValue, subpath, pattern, internal, conditions). + const resolved = this.packageTargetResolve(packageURL, targetValue, subpath, pattern, internal, conditions, extList); + // c. If resolved is equal to undefined, continue the loop. + // d. Return resolved. + if (resolved !== undefined) return resolved; + } + } + // c. Return undefined. + return undefined; + // 4. Otherwise, if target is null, return null. + } else if (target == null) { + return null; + } + // Otherwise throw an Invalid Package Target error. + throw new VMError(`Invalid package target for '${subpath}'`, 'ERR_INVALID_PACKAGE_TARGET'); + } + + // PACKAGE_RESOLVE(packageSpecifier, parentURL) + packageResolve(packageSpecifier, parentURL, conditions, extList) { + // 1. Let packageName be undefined. + let packageName = undefined; + // 2. If packageSpecifier is an empty string, then + if (packageSpecifier === '') { + // a. Throw an Invalid Module Specifier error. + throw new VMError(`Invalid package specifier '${packageSpecifier}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // 3. If packageSpecifier is a Node.js builtin module name, then + if (this.builtinModules[packageSpecifier]) { + // a. Return the string "node:" concatenated with packageSpecifier. + return 'node:' + packageSpecifier; + } + let idx = packageSpecifier.indexOf('/'); + // 5. Otherwise, + if (packageSpecifier[0] === '@') { + // a. If packageSpecifier does not contain a "/" separator, then + if (idx === -1) { + // x. Throw an Invalid Module Specifier error. + throw new VMError(`Invalid package specifier '${packageSpecifier}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // b. Set packageName to the substring of packageSpecifier until the second "/" separator or the end of the string. + idx = packageSpecifier.indexOf('/', idx + 1); + } + // else + // 4. If packageSpecifier does not start with "@", then + // a. Set packageName to the substring of packageSpecifier until the first "/" separator or the end of the string. + packageName = idx === -1 ? packageSpecifier : packageSpecifier.slice(0, idx); + // 6. If packageName starts with "." or contains "\" or "%", then + if (idx !== 0 && (packageName[0] === '.' || packageName.indexOf('\\') >= 0 || packageName.indexOf('%') >= 0)) { + // a. Throw an Invalid Module Specifier error. + throw new VMError(`Invalid package specifier '${packageSpecifier}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // 7. Let packageSubpath be "." concatenated with the substring of packageSpecifier from the position at the length of packageName. + const packageSubpath = '.' + packageSpecifier.slice(packageName.length); + // 8. If packageSubpath ends in "/", then + if (packageSubpath[packageSubpath.length - 1] === '/') { + // a. Throw an Invalid Module Specifier error. + throw new VMError(`Invalid package specifier '${packageSpecifier}'`, 'ERR_INVALID_MODULE_SPECIFIER'); + } + // 9. Let selfUrl be the result of PACKAGE_SELF_RESOLVE(packageName, packageSubpath, parentURL). + const selfUrl = this.packageSelfResolve(packageName, packageSubpath, parentURL); + // 10. If selfUrl is not undefined, return selfUrl. + if (selfUrl) return selfUrl; + // 11. While parentURL is not the file system root, + let packageURL; + while (true) { + // a. Let packageURL be the URL resolution of "node_modules/" concatenated with packageSpecifier, relative to parentURL. + packageURL = this.pathResolve(this.pathConcat(parentURL, 'node_modules', packageSpecifier)); + // b. Set parentURL to the parent folder URL of parentURL. + const parentParentURL = this.pathDirname(parentURL); + // c. If the folder at packageURL does not exist, then + if (this.isPathAllowed(packageURL) && this.pathTestIsDirectory(packageURL)) break; + // 1. Continue the next loop iteration. + if (parentParentURL === parentURL) { + // 12. Throw a Module Not Found error. + throw new VMError(`Cannot find module '${packageSpecifier}'`, 'ENOTFOUND'); + } + parentURL = parentParentURL; + } + // d. Let pjson be the result of READ_PACKAGE_JSON(packageURL). + const pack = this.readPackage(packageURL); + // e. If pjson is not null and pjson.exports is not null or undefined, then + if (pack && pack.exports) { + // 1. Return the result of PACKAGE_EXPORTS_RESOLVE(packageURL, packageSubpath, pjson.exports, defaultConditions). + return this.packageExportsResolve(packageURL, packageSubpath, pack.exports, conditions, extList); + } + // f. Otherwise, if packageSubpath is equal to ".", then + if (packageSubpath === '.') { + // 1. If pjson.main is a string, then + // a. Return the URL resolution of main in packageURL. + return this.loadAsPackage(packageSubpath, pack, extList); + } + // g. Otherwise, + // 1. Return the URL resolution of packageSubpath in packageURL. + return this.pathConcat(packageURL, packageSubpath); + } + +} + +exports.Resolver = Resolver; +exports.DefaultResolver = DefaultResolver; + + +/***/ }), + +/***/ 98611: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +const {Script} = __nccwpck_require__(92184); +const { + lookupCompiler, + removeShebang +} = __nccwpck_require__(56400); +const { + transformer +} = __nccwpck_require__(33342); + +const objectDefineProperties = Object.defineProperties; + +const MODULE_PREFIX = '(function (exports, require, module, __filename, __dirname) { '; +const STRICT_MODULE_PREFIX = MODULE_PREFIX + '"use strict"; '; +const MODULE_SUFFIX = '\n});'; + +/** + * Class Script + * + * @public + */ +class VMScript { + + /** + * The script code with wrapping. If set will invalidate the cache.
+ * Writable only for backwards compatibility. + * + * @public + * @readonly + * @member {string} code + * @memberOf VMScript# + */ + + /** + * The filename used for this script. + * + * @public + * @readonly + * @since v3.9.0 + * @member {string} filename + * @memberOf VMScript# + */ + + /** + * The line offset use for stack traces. + * + * @public + * @readonly + * @since v3.9.0 + * @member {number} lineOffset + * @memberOf VMScript# + */ + + /** + * The column offset use for stack traces. + * + * @public + * @readonly + * @since v3.9.0 + * @member {number} columnOffset + * @memberOf VMScript# + */ + + /** + * The compiler to use to get the JavaScript code. + * + * @public + * @readonly + * @since v3.9.0 + * @member {(string|compileCallback)} compiler + * @memberOf VMScript# + */ + + /** + * The prefix for the script. + * + * @private + * @member {string} _prefix + * @memberOf VMScript# + */ + + /** + * The suffix for the script. + * + * @private + * @member {string} _suffix + * @memberOf VMScript# + */ + + /** + * The compiled vm.Script for the VM or if not compiled null. + * + * @private + * @member {?vm.Script} _compiledVM + * @memberOf VMScript# + */ + + /** + * The compiled vm.Script for the NodeVM or if not compiled null. + * + * @private + * @member {?vm.Script} _compiledNodeVM + * @memberOf VMScript# + */ + + /** + * The compiled vm.Script for the NodeVM in strict mode or if not compiled null. + * + * @private + * @member {?vm.Script} _compiledNodeVMStrict + * @memberOf VMScript# + */ + + /** + * The resolved compiler to use to get the JavaScript code. + * + * @private + * @readonly + * @member {compileCallback} _compiler + * @memberOf VMScript# + */ + + /** + * The script to run without wrapping. + * + * @private + * @member {string} _code + * @memberOf VMScript# + */ + + /** + * Whether or not the script contains async functions. + * + * @private + * @member {boolean} _hasAsync + * @memberOf VMScript# + */ + + /** + * Create VMScript instance. + * + * @public + * @param {string} code - Code to run. + * @param {(string|Object)} [options] - Options map or filename. + * @param {string} [options.filename="vm.js"] - Filename that shows up in any stack traces produced from this script. + * @param {number} [options.lineOffset=0] - Passed to vm.Script options. + * @param {number} [options.columnOffset=0] - Passed to vm.Script options. + * @param {(string|compileCallback)} [options.compiler="javascript"] - The compiler to use. + * @throws {VMError} If the compiler is unknown or if coffee-script was requested but the module not found. + */ + constructor(code, options) { + const sCode = `${code}`; + let useFileName; + let useOptions; + if (arguments.length === 2) { + if (typeof options === 'object') { + useOptions = options || {__proto__: null}; + useFileName = useOptions.filename; + } else { + useOptions = {__proto__: null}; + useFileName = options; + } + } else if (arguments.length > 2) { + // We do it this way so that there are no more arguments in the function. + // eslint-disable-next-line prefer-rest-params + useOptions = arguments[2] || {__proto__: null}; + useFileName = options || useOptions.filename; + } else { + useOptions = {__proto__: null}; + } + + const { + compiler = 'javascript', + lineOffset = 0, + columnOffset = 0 + } = useOptions; + + // Throw if the compiler is unknown. + const resolvedCompiler = lookupCompiler(compiler); + + objectDefineProperties(this, { + __proto__: null, + code: { + __proto__: null, + // Put this here so that it is enumerable, and looks like a property. + get() { + return this._prefix + this._code + this._suffix; + }, + set(value) { + const strNewCode = String(value); + if (strNewCode === this._code && this._prefix === '' && this._suffix === '') return; + this._code = strNewCode; + this._prefix = ''; + this._suffix = ''; + this._compiledVM = null; + this._compiledNodeVM = null; + this._compiledCode = null; + }, + enumerable: true + }, + filename: { + __proto__: null, + value: useFileName || 'vm.js', + enumerable: true + }, + lineOffset: { + __proto__: null, + value: lineOffset, + enumerable: true + }, + columnOffset: { + __proto__: null, + value: columnOffset, + enumerable: true + }, + compiler: { + __proto__: null, + value: compiler, + enumerable: true + }, + _code: { + __proto__: null, + value: sCode, + writable: true + }, + _prefix: { + __proto__: null, + value: '', + writable: true + }, + _suffix: { + __proto__: null, + value: '', + writable: true + }, + _compiledVM: { + __proto__: null, + value: null, + writable: true + }, + _compiledNodeVM: { + __proto__: null, + value: null, + writable: true + }, + _compiledNodeVMStrict: { + __proto__: null, + value: null, + writable: true + }, + _compiledCode: { + __proto__: null, + value: null, + writable: true + }, + _hasAsync: { + __proto__: null, + value: false, + writable: true + }, + _compiler: {__proto__: null, value: resolvedCompiler} + }); + } + + /** + * Wraps the code.
+ * This will replace the old wrapping.
+ * Will invalidate the code cache. + * + * @public + * @deprecated Since v3.9.0. Wrap your code before passing it into the VMScript object. + * @param {string} prefix - String that will be appended before the script code. + * @param {script} suffix - String that will be appended behind the script code. + * @return {this} This for chaining. + * @throws {TypeError} If prefix or suffix is a Symbol. + */ + wrap(prefix, suffix) { + const strPrefix = `${prefix}`; + const strSuffix = `${suffix}`; + if (this._prefix === strPrefix && this._suffix === strSuffix) return this; + this._prefix = strPrefix; + this._suffix = strSuffix; + this._compiledVM = null; + this._compiledNodeVM = null; + this._compiledNodeVMStrict = null; + return this; + } + + /** + * Compile this script.
+ * This is useful to detect syntax errors in the script. + * + * @public + * @return {this} This for chaining. + * @throws {SyntaxError} If there is a syntax error in the script. + */ + compile() { + this._compileVM(); + return this; + } + + /** + * Get the compiled code. + * + * @private + * @return {string} The code. + */ + getCompiledCode() { + if (!this._compiledCode) { + const comp = this._compiler(this._prefix + removeShebang(this._code) + this._suffix, this.filename); + const res = transformer(null, comp, false, false); + this._compiledCode = res.code; + this._hasAsync = res.hasAsync; + } + return this._compiledCode; + } + + /** + * Compiles this script to a vm.Script. + * + * @private + * @param {string} prefix - JavaScript code that will be used as prefix. + * @param {string} suffix - JavaScript code that will be used as suffix. + * @return {vm.Script} The compiled vm.Script. + * @throws {SyntaxError} If there is a syntax error in the script. + */ + _compile(prefix, suffix) { + return new Script(prefix + this.getCompiledCode() + suffix, { + __proto__: null, + filename: this.filename, + displayErrors: false, + lineOffset: this.lineOffset, + columnOffset: this.columnOffset + }); + } + + /** + * Will return the cached version of the script intended for VM or compile it. + * + * @private + * @return {vm.Script} The compiled script + * @throws {SyntaxError} If there is a syntax error in the script. + */ + _compileVM() { + let script = this._compiledVM; + if (!script) { + this._compiledVM = script = this._compile('', ''); + } + return script; + } + + /** + * Will return the cached version of the script intended for NodeVM or compile it. + * + * @private + * @return {vm.Script} The compiled script + * @throws {SyntaxError} If there is a syntax error in the script. + */ + _compileNodeVM() { + let script = this._compiledNodeVM; + if (!script) { + this._compiledNodeVM = script = this._compile(MODULE_PREFIX, MODULE_SUFFIX); + } + return script; + } + + /** + * Will return the cached version of the script intended for NodeVM in strict mode or compile it. + * + * @private + * @return {vm.Script} The compiled script + * @throws {SyntaxError} If there is a syntax error in the script. + */ + _compileNodeVMStrict() { + let script = this._compiledNodeVMStrict; + if (!script) { + this._compiledNodeVMStrict = script = this._compile(STRICT_MODULE_PREFIX, MODULE_SUFFIX); + } + return script; + } + +} + +exports.MODULE_PREFIX = MODULE_PREFIX; +exports.STRICT_MODULE_PREFIX = STRICT_MODULE_PREFIX; +exports.MODULE_SUFFIX = MODULE_SUFFIX; +exports.VMScript = VMScript; + + +/***/ }), + +/***/ 33342: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +const {parse: acornParse} = __nccwpck_require__(35594); +const {full: acornWalkFull} = __nccwpck_require__(15000); + +const INTERNAL_STATE_NAME = 'VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL'; + +function assertType(node, type) { + if (!node) throw new Error(`None existent node expected '${type}'`); + if (node.type !== type) throw new Error(`Invalid node type '${node.type}' expected '${type}'`); + return node; +} + +function transformer(args, body, isAsync, isGenerator) { + let code; + let argsOffset; + if (args === null) { + code = body; + } else { + code = isAsync ? '(async function' : '(function'; + if (isGenerator) code += '*'; + code += ' anonymous('; + code += args; + argsOffset = code.length; + code += '\n) {\n'; + code += body; + code += '\n})'; + } + + const ast = acornParse(code, { + __proto__: null, + ecmaVersion: 2020, + allowAwaitOutsideFunction: args === null && isAsync, + allowReturnOutsideFunction: args === null + }); + + if (args !== null) { + const pBody = assertType(ast, 'Program').body; + if (pBody.length !== 1) throw new Error('Invalid arguments'); + const expr = pBody[0]; + if (expr.type !== 'ExpressionStatement') throw new Error('Invalid arguments'); + const func = expr.expression; + if (func.type !== 'FunctionExpression') throw new Error('Invalid arguments'); + if (func.body.start !== argsOffset + 3) throw new Error('Invalid arguments'); + } + + const insertions = []; + let hasAsync = false; + + const RIGHT = -100; + const LEFT = 100; + + acornWalkFull(ast, (node, state, type) => { + if (type === 'CatchClause') { + const param = node.param; + if (param) { + const name = assertType(param, 'Identifier').name; + const cBody = assertType(node.body, 'BlockStatement'); + if (cBody.body.length > 0) { + insertions.push({ + __proto__: null, + pos: cBody.body[0].start, + order: RIGHT, + code: `${name}=${INTERNAL_STATE_NAME}.handleException(${name});` + }); + } + } + } else if (type === 'WithStatement') { + insertions.push({ + __proto__: null, + pos: node.object.start, + order: RIGHT, + code: INTERNAL_STATE_NAME + '.wrapWith(' + }); + insertions.push({ + __proto__: null, + pos: node.object.end, + order: LEFT, + code: ')' + }); + } else if (type === 'Identifier') { + if (node.name === INTERNAL_STATE_NAME) { + throw new Error('Use of internal vm2 state variable'); + } + } else if (type === 'ImportExpression') { + insertions.push({ + __proto__: null, + pos: node.start, + order: LEFT, + code: INTERNAL_STATE_NAME + '.' + }); + } else if (type === 'Function') { + if (node.async) hasAsync = true; + } + }); + + if (insertions.length === 0) return {__proto__: null, code, hasAsync}; + + insertions.sort((a, b) => (a.pos == b.pos ? a.order - b.order : a.pos - b.pos)); + + let ncode = ''; + let curr = 0; + for (let i = 0; i < insertions.length; i++) { + const change = insertions[i]; + ncode += code.substring(curr, change.pos) + change.code; + curr = change.pos; + } + ncode += code.substring(curr); + + return {__proto__: null, code: ncode, hasAsync}; +} + +exports.INTERNAL_STATE_NAME = INTERNAL_STATE_NAME; +exports.transformer = transformer; + + +/***/ }), + +/***/ 93841: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * This callback will be called to transform a script to JavaScript. + * + * @callback compileCallback + * @param {string} code - Script code to transform to JavaScript. + * @param {string} filename - Filename of this script. + * @return {string} JavaScript code that represents the script code. + */ + +/** + * This callback will be called to resolve a module if it couldn't be found. + * + * @callback resolveCallback + * @param {string} moduleName - Name of the modulusedRequiree to resolve. + * @param {string} dirname - Name of the current directory. + * @return {(string|undefined)} The file or directory to use to load the requested module. + */ + +const fs = __nccwpck_require__(35747); +const pa = __nccwpck_require__(85622); +const { + Script, + createContext +} = __nccwpck_require__(92184); +const { + EventEmitter +} = __nccwpck_require__(28614); +const { + INSPECT_MAX_BYTES +} = __nccwpck_require__(64293); +const { + createBridge, + VMError +} = __nccwpck_require__(82989); +const { + transformer, + INTERNAL_STATE_NAME +} = __nccwpck_require__(33342); +const { + lookupCompiler +} = __nccwpck_require__(56400); +const { + VMScript +} = __nccwpck_require__(98611); + +const objectDefineProperties = Object.defineProperties; + +/** + * Host objects + * + * @private + */ +const HOST = Object.freeze({ + Buffer, + Function, + Object, + transformAndCheck, + INSPECT_MAX_BYTES, + INTERNAL_STATE_NAME +}); + +/** + * Compile a script. + * + * @private + * @param {string} filename - Filename of the script. + * @param {string} script - Script. + * @return {vm.Script} The compiled script. + */ +function compileScript(filename, script) { + return new Script(script, { + __proto__: null, + filename, + displayErrors: false + }); +} + +/** + * Default run options for vm.Script.runInContext + * + * @private + */ +const DEFAULT_RUN_OPTIONS = Object.freeze({__proto__: null, displayErrors: false}); + +function checkAsync(allow) { + if (!allow) throw new VMError('Async not available'); +} + +function transformAndCheck(args, code, isAsync, isGenerator, allowAsync) { + const ret = transformer(args, code, isAsync, isGenerator); + checkAsync(allowAsync || !ret.hasAsync); + return ret.code; +} + +/** + * + * This callback will be called and has a specific time to finish.
+ * No parameters will be supplied.
+ * If parameters are required, use a closure. + * + * @private + * @callback runWithTimeout + * @return {*} + * + */ + +let cacheTimeoutContext = null; +let cacheTimeoutScript = null; + +/** + * Run a function with a specific timeout. + * + * @private + * @param {runWithTimeout} fn - Function to run with the specific timeout. + * @param {number} timeout - The amount of time to give the function to finish. + * @return {*} The value returned by the function. + * @throws {Error} If the function took to long. + */ +function doWithTimeout(fn, timeout) { + if (!cacheTimeoutContext) { + cacheTimeoutContext = createContext(); + cacheTimeoutScript = new Script('fn()', { + __proto__: null, + filename: 'timeout_bridge.js', + displayErrors: false + }); + } + cacheTimeoutContext.fn = fn; + try { + return cacheTimeoutScript.runInContext(cacheTimeoutContext, { + __proto__: null, + displayErrors: false, + timeout + }); + } finally { + cacheTimeoutContext.fn = null; + } +} + +const bridgeScript = compileScript(__nccwpck_require__.ab + "bridge.js", + `(function(global) {"use strict"; const exports = {};${fs.readFileSync(`${__dirname}/bridge.js`, 'utf8')}\nreturn exports;})`); +const setupSandboxScript = compileScript(__nccwpck_require__.ab + "setup-sandbox.js", + `(function(global, host, bridge, data, context) { ${fs.readFileSync(`${__dirname}/setup-sandbox.js`, 'utf8')}\n})`); +const getGlobalScript = compileScript('get_global.js', 'this'); + +let getGeneratorFunctionScript = null; +let getAsyncFunctionScript = null; +let getAsyncGeneratorFunctionScript = null; +try { + getGeneratorFunctionScript = compileScript('get_generator_function.js', '(function*(){}).constructor'); +} catch (ex) {} +try { + getAsyncFunctionScript = compileScript('get_async_function.js', '(async function(){}).constructor'); +} catch (ex) {} +try { + getAsyncGeneratorFunctionScript = compileScript('get_async_generator_function.js', '(async function*(){}).constructor'); +} catch (ex) {} + +/** + * Class VM. + * + * @public + */ +class VM extends EventEmitter { + + /** + * The timeout for {@link VM#run} calls. + * + * @public + * @since v3.9.0 + * @member {number} timeout + * @memberOf VM# + */ + + /** + * Get the global sandbox object. + * + * @public + * @readonly + * @since v3.9.0 + * @member {Object} sandbox + * @memberOf VM# + */ + + /** + * The compiler to use to get the JavaScript code. + * + * @public + * @readonly + * @since v3.9.0 + * @member {(string|compileCallback)} compiler + * @memberOf VM# + */ + + /** + * The resolved compiler to use to get the JavaScript code. + * + * @private + * @readonly + * @member {compileCallback} _compiler + * @memberOf VM# + */ + + /** + * Create a new VM instance. + * + * @public + * @param {Object} [options] - VM options. + * @param {number} [options.timeout] - The amount of time until a call to {@link VM#run} will timeout. + * @param {Object} [options.sandbox] - Objects that will be copied into the global object of the sandbox. + * @param {(string|compileCallback)} [options.compiler="javascript"] - The compiler to use. + * @param {boolean} [options.eval=true] - Allow the dynamic evaluation of code via eval(code) or Function(code)().
+ * Only available for node v10+. + * @param {boolean} [options.wasm=true] - Allow to run wasm code.
+ * Only available for node v10+. + * @param {boolean} [options.allowAsync=true] - Allows for async functions. + * @throws {VMError} If the compiler is unknown. + */ + constructor(options = {}) { + super(); + + // Read all options + const { + timeout, + sandbox, + compiler = 'javascript', + allowAsync: optAllowAsync = true + } = options; + const allowEval = options.eval !== false; + const allowWasm = options.wasm !== false; + const allowAsync = optAllowAsync && !options.fixAsync; + + // Early error if sandbox is not an object. + if (sandbox && 'object' !== typeof sandbox) { + throw new VMError('Sandbox must be object.'); + } + + // Early error if compiler can't be found. + const resolvedCompiler = lookupCompiler(compiler); + + // Create a new context for this vm. + const _context = createContext(undefined, { + __proto__: null, + codeGeneration: { + __proto__: null, + strings: allowEval, + wasm: allowWasm + } + }); + + const sandboxGlobal = getGlobalScript.runInContext(_context, DEFAULT_RUN_OPTIONS); + + // Initialize the sandbox bridge + const { + createBridge: sandboxCreateBridge + } = bridgeScript.runInContext(_context, DEFAULT_RUN_OPTIONS)(sandboxGlobal); + + // Initialize the bridge + const bridge = createBridge(sandboxCreateBridge, () => {}); + + const data = { + __proto__: null, + allowAsync + }; + + if (getGeneratorFunctionScript) { + data.GeneratorFunction = getGeneratorFunctionScript.runInContext(_context, DEFAULT_RUN_OPTIONS); + } + if (getAsyncFunctionScript) { + data.AsyncFunction = getAsyncFunctionScript.runInContext(_context, DEFAULT_RUN_OPTIONS); + } + if (getAsyncGeneratorFunctionScript) { + data.AsyncGeneratorFunction = getAsyncGeneratorFunctionScript.runInContext(_context, DEFAULT_RUN_OPTIONS); + } + + // Create the bridge between the host and the sandbox. + const internal = setupSandboxScript.runInContext(_context, DEFAULT_RUN_OPTIONS)(sandboxGlobal, HOST, bridge.other, data, _context); + + const runScript = (script) => { + // This closure is intentional to hide _context and bridge since the allow to access the sandbox directly which is unsafe. + let ret; + try { + ret = script.runInContext(_context, DEFAULT_RUN_OPTIONS); + } catch (e) { + throw bridge.from(e); + } + return bridge.from(ret); + }; + + const makeReadonly = (value, mock) => { + try { + internal.readonly(value, mock); + } catch (e) { + throw bridge.from(e); + } + return value; + }; + + const makeProtected = (value) => { + const sandboxBridge = bridge.other; + try { + sandboxBridge.fromWithFactory(sandboxBridge.protectedFactory, value); + } catch (e) { + throw bridge.from(e); + } + return value; + }; + + const addProtoMapping = (hostProto, sandboxProto) => { + const sandboxBridge = bridge.other; + let otherProto; + try { + otherProto = sandboxBridge.from(sandboxProto); + sandboxBridge.addProtoMapping(otherProto, hostProto); + } catch (e) { + throw bridge.from(e); + } + bridge.addProtoMapping(hostProto, otherProto); + }; + + const addProtoMappingFactory = (hostProto, sandboxProtoFactory) => { + const sandboxBridge = bridge.other; + const factory = () => { + const proto = sandboxProtoFactory(this); + bridge.addProtoMapping(hostProto, proto); + return proto; + }; + try { + const otherProtoFactory = sandboxBridge.from(factory); + sandboxBridge.addProtoMappingFactory(otherProtoFactory, hostProto); + } catch (e) { + throw bridge.from(e); + } + }; + + // Define the properties of this object. + // Use Object.defineProperties here to be able to + // hide and set properties read-only. + objectDefineProperties(this, { + __proto__: null, + timeout: { + __proto__: null, + value: timeout, + writable: true, + enumerable: true + }, + compiler: { + __proto__: null, + value: compiler, + enumerable: true + }, + sandbox: { + __proto__: null, + value: bridge.from(sandboxGlobal), + enumerable: true + }, + _runScript: {__proto__: null, value: runScript}, + _makeReadonly: {__proto__: null, value: makeReadonly}, + _makeProtected: {__proto__: null, value: makeProtected}, + _addProtoMapping: {__proto__: null, value: addProtoMapping}, + _addProtoMappingFactory: {__proto__: null, value: addProtoMappingFactory}, + _compiler: {__proto__: null, value: resolvedCompiler}, + _allowAsync: {__proto__: null, value: allowAsync} + }); + + // prepare global sandbox + if (sandbox) { + this.setGlobals(sandbox); + } + } + + /** + * Adds all the values to the globals. + * + * @public + * @since v3.9.0 + * @param {Object} values - All values that will be added to the globals. + * @return {this} This for chaining. + * @throws {*} If the setter of a global throws an exception it is propagated. And the remaining globals will not be written. + */ + setGlobals(values) { + for (const name in values) { + if (Object.prototype.hasOwnProperty.call(values, name)) { + this.sandbox[name] = values[name]; + } + } + return this; + } + + /** + * Set a global value. + * + * @public + * @since v3.9.0 + * @param {string} name - The name of the global. + * @param {*} value - The value of the global. + * @return {this} This for chaining. + * @throws {*} If the setter of the global throws an exception it is propagated. + */ + setGlobal(name, value) { + this.sandbox[name] = value; + return this; + } + + /** + * Get a global value. + * + * @public + * @since v3.9.0 + * @param {string} name - The name of the global. + * @return {*} The value of the global. + * @throws {*} If the getter of the global throws an exception it is propagated. + */ + getGlobal(name) { + return this.sandbox[name]; + } + + /** + * Freezes the object inside VM making it read-only. Not available for primitive values. + * + * @public + * @param {*} value - Object to freeze. + * @param {string} [globalName] - Whether to add the object to global. + * @return {*} Object to freeze. + * @throws {*} If the setter of the global throws an exception it is propagated. + */ + freeze(value, globalName) { + this.readonly(value); + if (globalName) this.sandbox[globalName] = value; + return value; + } + + /** + * Freezes the object inside VM making it read-only. Not available for primitive values. + * + * @public + * @param {*} value - Object to freeze. + * @param {*} [mock] - When the object does not have a property the mock is used before prototype lookup. + * @return {*} Object to freeze. + */ + readonly(value, mock) { + return this._makeReadonly(value, mock); + } + + /** + * Protects the object inside VM making impossible to set functions as it's properties. Not available for primitive values. + * + * @public + * @param {*} value - Object to protect. + * @param {string} [globalName] - Whether to add the object to global. + * @return {*} Object to protect. + * @throws {*} If the setter of the global throws an exception it is propagated. + */ + protect(value, globalName) { + this._makeProtected(value); + if (globalName) this.sandbox[globalName] = value; + return value; + } + + /** + * Run the code in VM. + * + * @public + * @param {(string|VMScript)} code - Code to run. + * @param {(string|Object)} [options] - Options map or filename. + * @param {string} [options.filename="vm.js"] - Filename that shows up in any stack traces produced from this script.
+ * This is only used if code is a String. + * @return {*} Result of executed code. + * @throws {SyntaxError} If there is a syntax error in the script. + * @throws {Error} An error is thrown when the script took to long and there is a timeout. + * @throws {*} If the script execution terminated with an exception it is propagated. + */ + run(code, options) { + let script; + let filename; + + if (typeof options === 'object') { + filename = options.filename; + } else { + filename = options; + } + + if (code instanceof VMScript) { + script = code._compileVM(); + checkAsync(this._allowAsync || !code._hasAsync); + } else { + const useFileName = filename || 'vm.js'; + let scriptCode = this._compiler(code, useFileName); + const ret = transformer(null, scriptCode, false, false); + scriptCode = ret.code; + checkAsync(this._allowAsync || !ret.hasAsync); + // Compile the script here so that we don't need to create a instance of VMScript. + script = new Script(scriptCode, { + __proto__: null, + filename: useFileName, + displayErrors: false + }); + } + + if (!this.timeout) { + return this._runScript(script); + } + + return doWithTimeout(() => { + return this._runScript(script); + }, this.timeout); + } + + /** + * Run the code in VM. + * + * @public + * @since v3.9.0 + * @param {string} filename - Filename of file to load and execute in a NodeVM. + * @return {*} Result of executed code. + * @throws {Error} If filename is not a valid filename. + * @throws {SyntaxError} If there is a syntax error in the script. + * @throws {Error} An error is thrown when the script took to long and there is a timeout. + * @throws {*} If the script execution terminated with an exception it is propagated. + */ + runFile(filename) { + const resolvedFilename = pa.resolve(filename); + + if (!fs.existsSync(resolvedFilename)) { + throw new VMError(`Script '${filename}' not found.`); + } + + if (fs.statSync(resolvedFilename).isDirectory()) { + throw new VMError('Script must be file, got directory.'); + } + + return this.run(fs.readFileSync(resolvedFilename, 'utf8'), resolvedFilename); + } + +} + +exports.VM = VM; + + +/***/ }), + +/***/ 15000: +/***/ (function(__unused_webpack_module, exports) { + +(function (global, factory) { + true ? factory(exports) : + 0; +}(this, (function (exports) { 'use strict'; + + // AST walker module for Mozilla Parser API compatible trees + + // A simple walk is one where you simply specify callbacks to be + // called on specific nodes. The last two arguments are optional. A + // simple use would be + // + // walk.simple(myTree, { + // Expression: function(node) { ... } + // }); + // + // to do something with all expressions. All Parser API node types + // can be used to identify node types, as well as Expression and + // Statement, which denote categories of nodes. + // + // The base argument can be used to pass a custom (recursive) + // walker, and state can be used to give this walked an initial + // state. + + function simple(node, visitors, baseVisitor, state, override) { + if (!baseVisitor) { baseVisitor = base + ; }(function c(node, st, override) { + var type = override || node.type, found = visitors[type]; + baseVisitor[type](node, st, c); + if (found) { found(node, st); } + })(node, state, override); + } + + // An ancestor walk keeps an array of ancestor nodes (including the + // current node) and passes them to the callback as third parameter + // (and also as state parameter when no other state is present). + function ancestor(node, visitors, baseVisitor, state, override) { + var ancestors = []; + if (!baseVisitor) { baseVisitor = base + ; }(function c(node, st, override) { + var type = override || node.type, found = visitors[type]; + var isNew = node !== ancestors[ancestors.length - 1]; + if (isNew) { ancestors.push(node); } + baseVisitor[type](node, st, c); + if (found) { found(node, st || ancestors, ancestors); } + if (isNew) { ancestors.pop(); } + })(node, state, override); + } + + // A recursive walk is one where your functions override the default + // walkers. They can modify and replace the state parameter that's + // threaded through the walk, and can opt how and whether to walk + // their child nodes (by calling their third argument on these + // nodes). + function recursive(node, state, funcs, baseVisitor, override) { + var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor + ;(function c(node, st, override) { + visitor[override || node.type](node, st, c); + })(node, state, override); + } + + function makeTest(test) { + if (typeof test === "string") + { return function (type) { return type === test; } } + else if (!test) + { return function () { return true; } } + else + { return test } + } + + var Found = function Found(node, state) { this.node = node; this.state = state; }; + + // A full walk triggers the callback on each node + function full(node, callback, baseVisitor, state, override) { + if (!baseVisitor) { baseVisitor = base; } + var last + ;(function c(node, st, override) { + var type = override || node.type; + baseVisitor[type](node, st, c); + if (last !== node) { + callback(node, st, type); + last = node; + } + })(node, state, override); + } + + // An fullAncestor walk is like an ancestor walk, but triggers + // the callback on each node + function fullAncestor(node, callback, baseVisitor, state) { + if (!baseVisitor) { baseVisitor = base; } + var ancestors = [], last + ;(function c(node, st, override) { + var type = override || node.type; + var isNew = node !== ancestors[ancestors.length - 1]; + if (isNew) { ancestors.push(node); } + baseVisitor[type](node, st, c); + if (last !== node) { + callback(node, st || ancestors, ancestors, type); + last = node; + } + if (isNew) { ancestors.pop(); } + })(node, state); + } + + // Find a node with a given start, end, and type (all are optional, + // null can be used as wildcard). Returns a {node, state} object, or + // undefined when it doesn't find a matching node. + function findNodeAt(node, start, end, test, baseVisitor, state) { + if (!baseVisitor) { baseVisitor = base; } + test = makeTest(test); + try { + (function c(node, st, override) { + var type = override || node.type; + if ((start == null || node.start <= start) && + (end == null || node.end >= end)) + { baseVisitor[type](node, st, c); } + if ((start == null || node.start === start) && + (end == null || node.end === end) && + test(type, node)) + { throw new Found(node, st) } + })(node, state); + } catch (e) { + if (e instanceof Found) { return e } + throw e + } + } + + // Find the innermost node of a given type that contains the given + // position. Interface similar to findNodeAt. + function findNodeAround(node, pos, test, baseVisitor, state) { + test = makeTest(test); + if (!baseVisitor) { baseVisitor = base; } + try { + (function c(node, st, override) { + var type = override || node.type; + if (node.start > pos || node.end < pos) { return } + baseVisitor[type](node, st, c); + if (test(type, node)) { throw new Found(node, st) } + })(node, state); + } catch (e) { + if (e instanceof Found) { return e } + throw e + } + } + + // Find the outermost matching node after a given position. + function findNodeAfter(node, pos, test, baseVisitor, state) { + test = makeTest(test); + if (!baseVisitor) { baseVisitor = base; } + try { + (function c(node, st, override) { + if (node.end < pos) { return } + var type = override || node.type; + if (node.start >= pos && test(type, node)) { throw new Found(node, st) } + baseVisitor[type](node, st, c); + })(node, state); + } catch (e) { + if (e instanceof Found) { return e } + throw e + } + } + + // Find the outermost matching node before a given position. + function findNodeBefore(node, pos, test, baseVisitor, state) { + test = makeTest(test); + if (!baseVisitor) { baseVisitor = base; } + var max + ;(function c(node, st, override) { + if (node.start > pos) { return } + var type = override || node.type; + if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) + { max = new Found(node, st); } + baseVisitor[type](node, st, c); + })(node, state); + return max + } + + // Used to create a custom walker. Will fill in all missing node + // type properties with the defaults. + function make(funcs, baseVisitor) { + var visitor = Object.create(baseVisitor || base); + for (var type in funcs) { visitor[type] = funcs[type]; } + return visitor + } + + function skipThrough(node, st, c) { c(node, st); } + function ignore(_node, _st, _c) {} + + // Node walkers. + + var base = {}; + + base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) { + for (var i = 0, list = node.body; i < list.length; i += 1) + { + var stmt = list[i]; + + c(stmt, st, "Statement"); + } + }; + base.Statement = skipThrough; + base.EmptyStatement = ignore; + base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = + function (node, st, c) { return c(node.expression, st, "Expression"); }; + base.IfStatement = function (node, st, c) { + c(node.test, st, "Expression"); + c(node.consequent, st, "Statement"); + if (node.alternate) { c(node.alternate, st, "Statement"); } + }; + base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); }; + base.BreakStatement = base.ContinueStatement = ignore; + base.WithStatement = function (node, st, c) { + c(node.object, st, "Expression"); + c(node.body, st, "Statement"); + }; + base.SwitchStatement = function (node, st, c) { + c(node.discriminant, st, "Expression"); + for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) { + var cs = list$1[i$1]; + + if (cs.test) { c(cs.test, st, "Expression"); } + for (var i = 0, list = cs.consequent; i < list.length; i += 1) + { + var cons = list[i]; + + c(cons, st, "Statement"); + } + } + }; + base.SwitchCase = function (node, st, c) { + if (node.test) { c(node.test, st, "Expression"); } + for (var i = 0, list = node.consequent; i < list.length; i += 1) + { + var cons = list[i]; + + c(cons, st, "Statement"); + } + }; + base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { + if (node.argument) { c(node.argument, st, "Expression"); } + }; + base.ThrowStatement = base.SpreadElement = + function (node, st, c) { return c(node.argument, st, "Expression"); }; + base.TryStatement = function (node, st, c) { + c(node.block, st, "Statement"); + if (node.handler) { c(node.handler, st); } + if (node.finalizer) { c(node.finalizer, st, "Statement"); } + }; + base.CatchClause = function (node, st, c) { + if (node.param) { c(node.param, st, "Pattern"); } + c(node.body, st, "Statement"); + }; + base.WhileStatement = base.DoWhileStatement = function (node, st, c) { + c(node.test, st, "Expression"); + c(node.body, st, "Statement"); + }; + base.ForStatement = function (node, st, c) { + if (node.init) { c(node.init, st, "ForInit"); } + if (node.test) { c(node.test, st, "Expression"); } + if (node.update) { c(node.update, st, "Expression"); } + c(node.body, st, "Statement"); + }; + base.ForInStatement = base.ForOfStatement = function (node, st, c) { + c(node.left, st, "ForInit"); + c(node.right, st, "Expression"); + c(node.body, st, "Statement"); + }; + base.ForInit = function (node, st, c) { + if (node.type === "VariableDeclaration") { c(node, st); } + else { c(node, st, "Expression"); } + }; + base.DebuggerStatement = ignore; + + base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); }; + base.VariableDeclaration = function (node, st, c) { + for (var i = 0, list = node.declarations; i < list.length; i += 1) + { + var decl = list[i]; + + c(decl, st); + } + }; + base.VariableDeclarator = function (node, st, c) { + c(node.id, st, "Pattern"); + if (node.init) { c(node.init, st, "Expression"); } + }; + + base.Function = function (node, st, c) { + if (node.id) { c(node.id, st, "Pattern"); } + for (var i = 0, list = node.params; i < list.length; i += 1) + { + var param = list[i]; + + c(param, st, "Pattern"); + } + c(node.body, st, node.expression ? "Expression" : "Statement"); + }; + + base.Pattern = function (node, st, c) { + if (node.type === "Identifier") + { c(node, st, "VariablePattern"); } + else if (node.type === "MemberExpression") + { c(node, st, "MemberPattern"); } + else + { c(node, st); } + }; + base.VariablePattern = ignore; + base.MemberPattern = skipThrough; + base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); }; + base.ArrayPattern = function (node, st, c) { + for (var i = 0, list = node.elements; i < list.length; i += 1) { + var elt = list[i]; + + if (elt) { c(elt, st, "Pattern"); } + } + }; + base.ObjectPattern = function (node, st, c) { + for (var i = 0, list = node.properties; i < list.length; i += 1) { + var prop = list[i]; + + if (prop.type === "Property") { + if (prop.computed) { c(prop.key, st, "Expression"); } + c(prop.value, st, "Pattern"); + } else if (prop.type === "RestElement") { + c(prop.argument, st, "Pattern"); + } + } + }; + + base.Expression = skipThrough; + base.ThisExpression = base.Super = base.MetaProperty = ignore; + base.ArrayExpression = function (node, st, c) { + for (var i = 0, list = node.elements; i < list.length; i += 1) { + var elt = list[i]; + + if (elt) { c(elt, st, "Expression"); } + } + }; + base.ObjectExpression = function (node, st, c) { + for (var i = 0, list = node.properties; i < list.length; i += 1) + { + var prop = list[i]; + + c(prop, st); + } + }; + base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; + base.SequenceExpression = function (node, st, c) { + for (var i = 0, list = node.expressions; i < list.length; i += 1) + { + var expr = list[i]; + + c(expr, st, "Expression"); + } + }; + base.TemplateLiteral = function (node, st, c) { + for (var i = 0, list = node.quasis; i < list.length; i += 1) + { + var quasi = list[i]; + + c(quasi, st); + } + + for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) + { + var expr = list$1[i$1]; + + c(expr, st, "Expression"); + } + }; + base.TemplateElement = ignore; + base.UnaryExpression = base.UpdateExpression = function (node, st, c) { + c(node.argument, st, "Expression"); + }; + base.BinaryExpression = base.LogicalExpression = function (node, st, c) { + c(node.left, st, "Expression"); + c(node.right, st, "Expression"); + }; + base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { + c(node.left, st, "Pattern"); + c(node.right, st, "Expression"); + }; + base.ConditionalExpression = function (node, st, c) { + c(node.test, st, "Expression"); + c(node.consequent, st, "Expression"); + c(node.alternate, st, "Expression"); + }; + base.NewExpression = base.CallExpression = function (node, st, c) { + c(node.callee, st, "Expression"); + if (node.arguments) + { for (var i = 0, list = node.arguments; i < list.length; i += 1) + { + var arg = list[i]; + + c(arg, st, "Expression"); + } } + }; + base.MemberExpression = function (node, st, c) { + c(node.object, st, "Expression"); + if (node.computed) { c(node.property, st, "Expression"); } + }; + base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { + if (node.declaration) + { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } + if (node.source) { c(node.source, st, "Expression"); } + }; + base.ExportAllDeclaration = function (node, st, c) { + if (node.exported) + { c(node.exported, st); } + c(node.source, st, "Expression"); + }; + base.ImportDeclaration = function (node, st, c) { + for (var i = 0, list = node.specifiers; i < list.length; i += 1) + { + var spec = list[i]; + + c(spec, st); + } + c(node.source, st, "Expression"); + }; + base.ImportExpression = function (node, st, c) { + c(node.source, st, "Expression"); + }; + base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore; + + base.TaggedTemplateExpression = function (node, st, c) { + c(node.tag, st, "Expression"); + c(node.quasi, st, "Expression"); + }; + base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; + base.Class = function (node, st, c) { + if (node.id) { c(node.id, st, "Pattern"); } + if (node.superClass) { c(node.superClass, st, "Expression"); } + c(node.body, st); + }; + base.ClassBody = function (node, st, c) { + for (var i = 0, list = node.body; i < list.length; i += 1) + { + var elt = list[i]; + + c(elt, st); + } + }; + base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) { + if (node.computed) { c(node.key, st, "Expression"); } + if (node.value) { c(node.value, st, "Expression"); } + }; + + exports.ancestor = ancestor; + exports.base = base; + exports.findNodeAfter = findNodeAfter; + exports.findNodeAround = findNodeAround; + exports.findNodeAt = findNodeAt; + exports.findNodeBefore = findNodeBefore; + exports.full = full; + exports.fullAncestor = fullAncestor; + exports.make = make; + exports.recursive = recursive; + exports.simple = simple; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); + + +/***/ }), + +/***/ 35594: +/***/ (function(__unused_webpack_module, exports) { + +(function (global, factory) { + true ? factory(exports) : + 0; +})(this, (function (exports) { 'use strict'; + + // Reserved word lists for various dialects of the language + + var reservedWords = { + 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", + 5: "class enum extends super const export import", + 6: "enum", + strict: "implements interface let package private protected public static yield", + strictBind: "eval arguments" + }; + + // And the keywords + + 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"; + + var keywords$1 = { + 5: ecma5AndLessKeywords, + "5module": ecma5AndLessKeywords + " export import", + 6: ecma5AndLessKeywords + " const class extends export import super" + }; + + var keywordRelationalOperator = /^in(stanceof)?$/; + + // ## Character categories + + // Big ugly regular expressions that match characters in the + // whitespace, identifier, and identifier-start categories. These + // are only applied when a character is found to actually have a + // code point above 128. + // Generated by `bin/generate-identifier-regex.js`. + 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\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\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-\u1711\u171f-\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-\u1b4c\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-\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-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\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-\uab69\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"; + 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\u0898-\u089f\u08ca-\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\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\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\u0d81-\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\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-\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\ua82c\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"; + + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + + nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; + + // These are a run-length and offset encoded representation of the + // >0xffff code points that are a valid part of identifiers. The + // offset starts at 0x10000, and each pair of numbers represents an + // offset to the next range, and then a size of the range. They were + // generated by bin/generate-identifier-regex.js + + // eslint-disable-next-line comma-spacing + 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,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,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,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,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,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,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,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,46,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,1845,30,482,44,11,6,17,0,322,29,19,43,1269,6,2,3,2,1,2,14,2,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,42719,33,4152,8,221,3,5761,15,7472,3104,541,1507,4938]; + + // eslint-disable-next-line comma-spacing + 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,370,1,154,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,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,71,5,2,1,3,3,2,0,2,1,13,9,120,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,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,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,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239]; + + // This has a complexity linear to the value of the code. The + // assumption is that looking up astral identifier characters is + // rare. + function isInAstralSet(code, set) { + var pos = 0x10000; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code) { return false } + pos += set[i + 1]; + if (pos >= code) { return true } + } + } + + // Test whether a given character code starts an identifier. + + function isIdentifierStart(code, astral) { + if (code < 65) { return code === 36 } + if (code < 91) { return true } + if (code < 97) { return code === 95 } + if (code < 123) { return true } + if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) } + if (astral === false) { return false } + return isInAstralSet(code, astralIdentifierStartCodes) + } + + // Test whether a given character is part of an identifier. + + function isIdentifierChar(code, astral) { + if (code < 48) { return code === 36 } + if (code < 58) { return true } + if (code < 65) { return false } + if (code < 91) { return true } + if (code < 97) { return code === 95 } + if (code < 123) { return true } + if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) } + if (astral === false) { return false } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes) + } + + // ## Token types + + // The assignment of fine-grained, information-carrying type objects + // allows the tokenizer to store the information it has about a + // token in a way that is very cheap for the parser to look up. + + // All token type variables start with an underscore, to make them + // easy to recognize. + + // The `beforeExpr` property is used to disambiguate between regular + // expressions and divisions. It is set on all token types that can + // be followed by an expression (thus, a slash after them would be a + // regular expression). + // + // The `startsExpr` property is used to check if the token ends a + // `yield` expression. It is set on all token types that either can + // directly start an expression (like a quotation mark) or can + // continue an expression (like the body of a string). + // + // `isLoop` marks a keyword as starting a loop, which is important + // to know when parsing a label, in order to allow or disallow + // continue jumps to that label. + + var TokenType = function TokenType(label, conf) { + if ( conf === void 0 ) conf = {}; + + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; + }; + + function binop(name, prec) { + return new TokenType(name, {beforeExpr: true, binop: prec}) + } + var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}; + + // Map keyword names to token types. + + var keywords = {}; + + // Succinct definitions of keyword token types + function kw(name, options) { + if ( options === void 0 ) options = {}; + + options.keyword = name; + return keywords[name] = new TokenType(name, options) + } + + var types$1 = { + num: new TokenType("num", startsExpr), + regexp: new TokenType("regexp", startsExpr), + string: new TokenType("string", startsExpr), + name: new TokenType("name", startsExpr), + privateId: new TokenType("privateId", startsExpr), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}), + bracketR: new TokenType("]"), + braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}), + braceR: new TokenType("}"), + parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}), + parenR: new TokenType(")"), + comma: new TokenType(",", beforeExpr), + semi: new TokenType(";", beforeExpr), + colon: new TokenType(":", beforeExpr), + dot: new TokenType("."), + question: new TokenType("?", beforeExpr), + questionDot: new TokenType("?."), + arrow: new TokenType("=>", beforeExpr), + template: new TokenType("template"), + invalidTemplate: new TokenType("invalidTemplate"), + ellipsis: new TokenType("...", beforeExpr), + backQuote: new TokenType("`", startsExpr), + dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", {beforeExpr: true, isAssign: true}), + assign: new TokenType("_=", {beforeExpr: true, isAssign: true}), + incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}), + prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}), + logicalOR: binop("||", 1), + logicalAND: binop("&&", 2), + bitwiseOR: binop("|", 3), + bitwiseXOR: binop("^", 4), + bitwiseAND: binop("&", 5), + equality: binop("==/!=/===/!==", 6), + relational: binop("/<=/>=", 7), + bitShift: binop("<>/>>>", 8), + plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}), + modulo: binop("%", 10), + star: binop("*", 10), + slash: binop("/", 10), + starstar: new TokenType("**", {beforeExpr: true}), + coalesce: binop("??", 1), + + // Keyword token types. + _break: kw("break"), + _case: kw("case", beforeExpr), + _catch: kw("catch"), + _continue: kw("continue"), + _debugger: kw("debugger"), + _default: kw("default", beforeExpr), + _do: kw("do", {isLoop: true, beforeExpr: true}), + _else: kw("else", beforeExpr), + _finally: kw("finally"), + _for: kw("for", {isLoop: true}), + _function: kw("function", startsExpr), + _if: kw("if"), + _return: kw("return", beforeExpr), + _switch: kw("switch"), + _throw: kw("throw", beforeExpr), + _try: kw("try"), + _var: kw("var"), + _const: kw("const"), + _while: kw("while", {isLoop: true}), + _with: kw("with"), + _new: kw("new", {beforeExpr: true, startsExpr: true}), + _this: kw("this", startsExpr), + _super: kw("super", startsExpr), + _class: kw("class", startsExpr), + _extends: kw("extends", beforeExpr), + _export: kw("export"), + _import: kw("import", startsExpr), + _null: kw("null", startsExpr), + _true: kw("true", startsExpr), + _false: kw("false", startsExpr), + _in: kw("in", {beforeExpr: true, binop: 7}), + _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}), + _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}), + _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}), + _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true}) + }; + + // Matches a whole line break (where CRLF is considered a single + // line break). Used to count lines. + + var lineBreak = /\r\n?|\n|\u2028|\u2029/; + var lineBreakG = new RegExp(lineBreak.source, "g"); + + function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029 + } + + function nextLineBreak(code, from, end) { + if ( end === void 0 ) end = code.length; + + for (var i = from; i < end; i++) { + var next = code.charCodeAt(i); + if (isNewLine(next)) + { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 } + } + return -1 + } + + var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + + var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; + + var ref = Object.prototype; + var hasOwnProperty = ref.hasOwnProperty; + var toString = ref.toString; + + var hasOwn = Object.hasOwn || (function (obj, propName) { return ( + hasOwnProperty.call(obj, propName) + ); }); + + var isArray = Array.isArray || (function (obj) { return ( + toString.call(obj) === "[object Array]" + ); }); + + function wordsRegexp(words) { + return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$") + } + + var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; + + // These are used when `options.locations` is on, for the + // `startLoc` and `endLoc` properties. + + var Position = function Position(line, col) { + this.line = line; + this.column = col; + }; + + Position.prototype.offset = function offset (n) { + return new Position(this.line, this.column + n) + }; + + var SourceLocation = function SourceLocation(p, start, end) { + this.start = start; + this.end = end; + if (p.sourceFile !== null) { this.source = p.sourceFile; } + }; + + // The `getLineInfo` function is mostly useful when the + // `locations` option is off (for performance reasons) and you + // want to find the line/column position for a given character + // offset. `input` should be the code string that the offset refers + // into. + + function getLineInfo(input, offset) { + for (var line = 1, cur = 0;;) { + var nextBreak = nextLineBreak(input, cur, offset); + if (nextBreak < 0) { return new Position(line, offset - cur) } + ++line; + cur = nextBreak; + } + } + + // A second argument must be given to configure the parser process. + // These options are recognized (only `ecmaVersion` is required): + + var defaultOptions = { + // `ecmaVersion` indicates the ECMAScript version to parse. Must be + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the + // latest version the library supports). This influences support + // for strict mode, the set of reserved words, and support for + // new syntax features. + ecmaVersion: null, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"` or `"module"`. This influences global + // strict mode and parsing of `import` and `export` declarations. + sourceType: "script", + // `onInsertedSemicolon` can be a callback that will be called + // when a semicolon is automatically inserted. It will be passed + // the position of the comma as an offset, and if `locations` is + // enabled, it is given the location as a `{line, column}` object + // as second argument. + onInsertedSemicolon: null, + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for + // trailing commas. + onTrailingComma: null, + // By default, reserved words are only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. + allowReserved: null, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. + allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. + // When enabled, await identifiers are allowed to appear at the top-level scope, + // but they are still not allowed in non-async functions. + allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. + allowSuperOutsideMethod: null, + // When enabled, hashbang directive in the beginning of file + // is allowed and treated as a line comment. + allowHashBang: false, + // When `locations` is on, `loc` properties holding objects with + // `start` and `end` properties in `{line, column}` form (with + // line being 1-based and column 0-based) will be attached to the + // nodes. + locations: false, + // A function can be passed as `onToken` option, which will + // cause Acorn to call that function with object in the same + // format as tokens returned from `tokenizer().getToken()`. Note + // that you are not allowed to call the parser from the + // callback—that will corrupt its internal state. + onToken: null, + // A function can be passed as `onComment` option, which will + // cause Acorn to call that function with `(block, text, start, + // end)` parameters whenever a comment is skipped. `block` is a + // boolean indicating whether this is a block (`/* */`) comment, + // `text` is the content of the comment, and `start` and `end` are + // character offsets that denote the start and end of the comment. + // When the `locations` option is on, two more parameters are + // passed, the full `{line, column}` locations of the start and + // end of the comments. Note that you are not allowed to call the + // parser from the callback—that will corrupt its internal state. + onComment: null, + // Nodes have their start and end characters offsets recorded in + // `start` and `end` properties (directly on the node, rather than + // the `loc` object, which holds line/column data. To also add a + // [semi-standardized][range] `range` property holding a `[start, + // end]` array with the same numbers, set the `ranges` option to + // `true`. + // + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 + ranges: false, + // It is possible to parse multiple files into a single AST by + // passing the tree produced by parsing the first file as + // `program` option in subsequent parses. This will add the + // toplevel forms of the parsed file to the `Program` (top) node + // of an existing parse tree. + program: null, + // When `locations` is on, you can pass this to record the source + // file in every node's `loc` object. + sourceFile: null, + // This value, if given, is stored in every node, whether + // `locations` is on or off. + directSourceFile: null, + // When enabled, parenthesized expressions are represented by + // (non-standard) ParenthesizedExpression nodes + preserveParens: false + }; + + // Interpret and default an options object + + var warnedAboutEcmaVersion = false; + + function getOptions(opts) { + var options = {}; + + for (var opt in defaultOptions) + { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; } + + if (options.ecmaVersion === "latest") { + options.ecmaVersion = 1e8; + } else if (options.ecmaVersion == null) { + if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { + warnedAboutEcmaVersion = true; + console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); + } + options.ecmaVersion = 11; + } else if (options.ecmaVersion >= 2015) { + options.ecmaVersion -= 2009; + } + + if (options.allowReserved == null) + { options.allowReserved = options.ecmaVersion < 5; } + + if (isArray(options.onToken)) { + var tokens = options.onToken; + options.onToken = function (token) { return tokens.push(token); }; + } + if (isArray(options.onComment)) + { options.onComment = pushComment(options, options.onComment); } + + return options + } + + function pushComment(options, array) { + return function(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "Block" : "Line", + value: text, + start: start, + end: end + }; + if (options.locations) + { comment.loc = new SourceLocation(this, startLoc, endLoc); } + if (options.ranges) + { comment.range = [start, end]; } + array.push(comment); + } + } + + // Each scope gets a bitset that may contain these flags + var + SCOPE_TOP = 1, + SCOPE_FUNCTION = 2, + SCOPE_ASYNC = 4, + SCOPE_GENERATOR = 8, + SCOPE_ARROW = 16, + SCOPE_SIMPLE_CATCH = 32, + SCOPE_SUPER = 64, + SCOPE_DIRECT_SUPER = 128, + SCOPE_CLASS_STATIC_BLOCK = 256, + SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; + + function functionFlags(async, generator) { + return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0) + } + + // Used in checkLVal* and declareName to determine the type of a binding + var + BIND_NONE = 0, // Not a binding + BIND_VAR = 1, // Var-style binding + BIND_LEXICAL = 2, // Let- or const-style binding + BIND_FUNCTION = 3, // Function declaration + BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding + BIND_OUTSIDE = 5; // Special case for function names as bound inside the function + + var Parser = function Parser(options, input, startPos) { + this.options = options = getOptions(options); + this.sourceFile = options.sourceFile; + this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); + var reserved = ""; + if (options.allowReserved !== true) { + reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; + if (options.sourceType === "module") { reserved += " await"; } + } + this.reservedWords = wordsRegexp(reserved); + var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; + this.reservedWordsStrict = wordsRegexp(reservedStrict); + this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); + this.input = String(input); + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + this.containsEsc = false; + + // Set up token state + + // The current position of the tokenizer in the input. + if (startPos) { + this.pos = startPos; + this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1; + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; + } else { + this.pos = this.lineStart = 0; + this.curLine = 1; + } + + // Properties of the current token: + // Its type + this.type = types$1.eof; + // For tokens that include more information than their type, the value + this.value = null; + // Its start and end offset + this.start = this.end = this.pos; + // And, if locations are used, the {line, column} object + // corresponding to those offsets + this.startLoc = this.endLoc = this.curPosition(); + + // Position information for the previous token + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + + // The context stack is used to superficially track syntactic + // context to predict whether a regular expression is allowed in a + // given position. + this.context = this.initialContext(); + this.exprAllowed = true; + + // Figure out if it's a module code. + this.inModule = options.sourceType === "module"; + this.strict = this.inModule || this.strictDirective(this.pos); + + // Used to signify the start of a potential arrow function + this.potentialArrowAt = -1; + this.potentialArrowInForAwait = false; + + // Positions to delayed-check that yield/await does not exist in default parameters. + this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; + // Labels in scope. + this.labels = []; + // Thus-far undefined exports. + this.undefinedExports = Object.create(null); + + // If enabled, skip leading hashbang line. + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") + { this.skipLineComment(2); } + + // Scope tracking for duplicate variable names (see scope.js) + this.scopeStack = []; + this.enterScope(SCOPE_TOP); + + // For RegExp validation + this.regexpState = null; + + // The stack of private names. + // Each element has two properties: 'declared' and 'used'. + // When it exited from the outermost class definition, all used private names must be declared. + this.privateNameStack = []; + }; + + var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } }; + + Parser.prototype.parse = function parse () { + var node = this.options.program || this.startNode(); + this.nextToken(); + return this.parseTopLevel(node) + }; + + prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 }; + + prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit }; + + prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit }; + + prototypeAccessors.canAwait.get = function () { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var scope = this.scopeStack[i]; + if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false } + if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 } + } + return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction + }; + + prototypeAccessors.allowSuper.get = function () { + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod + }; + + prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 }; + + prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) }; + + prototypeAccessors.allowNewDotTarget.get = function () { + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit + }; + + prototypeAccessors.inClassStaticBlock.get = function () { + return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0 + }; + + Parser.extend = function extend () { + var plugins = [], len = arguments.length; + while ( len-- ) plugins[ len ] = arguments[ len ]; + + var cls = this; + for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); } + return cls + }; + + Parser.parse = function parse (input, options) { + return new this(options, input).parse() + }; + + Parser.parseExpressionAt = function parseExpressionAt (input, pos, options) { + var parser = new this(options, input, pos); + parser.nextToken(); + return parser.parseExpression() + }; + + Parser.tokenizer = function tokenizer (input, options) { + return new this(options, input) + }; + + Object.defineProperties( Parser.prototype, prototypeAccessors ); + + var pp$9 = Parser.prototype; + + // ## Parser utilities + + var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; + pp$9.strictDirective = function(start) { + for (;;) { + // Try to find string literal. + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + var match = literal.exec(this.input.slice(start)); + if (!match) { return false } + if ((match[1] || match[2]) === "use strict") { + skipWhiteSpace.lastIndex = start + match[0].length; + var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; + var next = this.input.charAt(end); + return next === ";" || next === "}" || + (lineBreak.test(spaceAfter[0]) && + !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=")) + } + start += match[0].length; + + // Skip semicolon, if any. + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + if (this.input[start] === ";") + { start++; } + } + }; + + // Predicate that tests whether the next token is of the given + // type, and if yes, consumes it as a side effect. + + pp$9.eat = function(type) { + if (this.type === type) { + this.next(); + return true + } else { + return false + } + }; + + // Tests whether parsed token is a contextual keyword. + + pp$9.isContextual = function(name) { + return this.type === types$1.name && this.value === name && !this.containsEsc + }; + + // Consumes contextual keyword if possible. + + pp$9.eatContextual = function(name) { + if (!this.isContextual(name)) { return false } + this.next(); + return true + }; + + // Asserts that following token is given contextual keyword. + + pp$9.expectContextual = function(name) { + if (!this.eatContextual(name)) { this.unexpected(); } + }; + + // Test whether a semicolon can be inserted at the current position. + + pp$9.canInsertSemicolon = function() { + return this.type === types$1.eof || + this.type === types$1.braceR || + lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) + }; + + pp$9.insertSemicolon = function() { + if (this.canInsertSemicolon()) { + if (this.options.onInsertedSemicolon) + { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); } + return true + } + }; + + // Consume a semicolon, or, failing that, see if we are allowed to + // pretend that there is a semicolon at this position. + + pp$9.semicolon = function() { + if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); } + }; + + pp$9.afterTrailingComma = function(tokType, notNext) { + if (this.type === tokType) { + if (this.options.onTrailingComma) + { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); } + if (!notNext) + { this.next(); } + return true + } + }; + + // Expect a token of a given type. If found, consume it, otherwise, + // raise an unexpected token error. + + pp$9.expect = function(type) { + this.eat(type) || this.unexpected(); + }; + + // Raise an unexpected token error. + + pp$9.unexpected = function(pos) { + this.raise(pos != null ? pos : this.start, "Unexpected token"); + }; + + function DestructuringErrors() { + this.shorthandAssign = + this.trailingComma = + this.parenthesizedAssign = + this.parenthesizedBind = + this.doubleProto = + -1; + } + + pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { + if (!refDestructuringErrors) { return } + if (refDestructuringErrors.trailingComma > -1) + { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); } + var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; + if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); } + }; + + pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { + if (!refDestructuringErrors) { return false } + var shorthandAssign = refDestructuringErrors.shorthandAssign; + var doubleProto = refDestructuringErrors.doubleProto; + if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 } + if (shorthandAssign >= 0) + { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); } + if (doubleProto >= 0) + { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); } + }; + + pp$9.checkYieldAwaitInDefaultParams = function() { + if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) + { this.raise(this.yieldPos, "Yield expression cannot be a default value"); } + if (this.awaitPos) + { this.raise(this.awaitPos, "Await expression cannot be a default value"); } + }; + + pp$9.isSimpleAssignTarget = function(expr) { + if (expr.type === "ParenthesizedExpression") + { return this.isSimpleAssignTarget(expr.expression) } + return expr.type === "Identifier" || expr.type === "MemberExpression" + }; + + var pp$8 = Parser.prototype; + + // ### Statement parsing + + // Parse a program. Initializes the parser, reads any number of + // statements, and wraps them in a Program node. Optionally takes a + // `program` argument. If present, the statements will be appended + // to its body instead of creating a new node. + + pp$8.parseTopLevel = function(node) { + var exports = Object.create(null); + if (!node.body) { node.body = []; } + while (this.type !== types$1.eof) { + var stmt = this.parseStatement(null, true, exports); + node.body.push(stmt); + } + if (this.inModule) + { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) + { + var name = list[i]; + + this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined")); + } } + this.adaptDirectivePrologue(node.body); + this.next(); + node.sourceType = this.options.sourceType; + return this.finishNode(node, "Program") + }; + + var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}; + + pp$8.isLet = function(context) { + if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + // For ambiguous cases, determine if a LexicalDeclaration (or only a + // Statement) is allowed here. If context is not empty then only a Statement + // is allowed. However, `let [` is an explicit negative lookahead for + // ExpressionStatement, so special-case it first. + if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '[', '/', astral + if (context) { return false } + + if (nextCh === 123) { return true } // '{' + if (isIdentifierStart(nextCh, true)) { + var pos = next + 1; + while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; } + if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } + var ident = this.input.slice(next, pos); + if (!keywordRelationalOperator.test(ident)) { return true } + } + return false + }; + + // check 'async [no LineTerminator here] function' + // - 'async /*foo*/ function' is OK. + // - 'async /*\n*/ function' is invalid. + pp$8.isAsyncFunction = function() { + if (this.options.ecmaVersion < 8 || !this.isContextual("async")) + { return false } + + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, after; + return !lineBreak.test(this.input.slice(this.pos, next)) && + this.input.slice(next, next + 8) === "function" && + (next + 8 === this.input.length || + !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)) + }; + + // Parse a single statement. + // + // If expecting a statement and finding a slash operator, parse a + // regular expression literal. This is to handle cases like + // `if (foo) /blah/.exec(foo)`, where looking at the previous token + // does not help. + + pp$8.parseStatement = function(context, topLevel, exports) { + var starttype = this.type, node = this.startNode(), kind; + + if (this.isLet(context)) { + starttype = types$1._var; + kind = "let"; + } + + // Most types of statements are recognized by the keyword they + // start with. Many are trivial to parse, some require a bit of + // complexity. + + switch (starttype) { + case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword) + case types$1._debugger: return this.parseDebuggerStatement(node) + case types$1._do: return this.parseDoStatement(node) + case types$1._for: return this.parseForStatement(node) + case types$1._function: + // Function as sole body of either an if statement or a labeled statement + // works, but not when it is part of a labeled statement that is the sole + // body of an if statement. + if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); } + return this.parseFunctionStatement(node, false, !context) + case types$1._class: + if (context) { this.unexpected(); } + return this.parseClass(node, true) + case types$1._if: return this.parseIfStatement(node) + case types$1._return: return this.parseReturnStatement(node) + case types$1._switch: return this.parseSwitchStatement(node) + case types$1._throw: return this.parseThrowStatement(node) + case types$1._try: return this.parseTryStatement(node) + case types$1._const: case types$1._var: + kind = kind || this.value; + if (context && kind !== "var") { this.unexpected(); } + return this.parseVarStatement(node, kind) + case types$1._while: return this.parseWhileStatement(node) + case types$1._with: return this.parseWithStatement(node) + case types$1.braceL: return this.parseBlock(true, node) + case types$1.semi: return this.parseEmptyStatement(node) + case types$1._export: + case types$1._import: + if (this.options.ecmaVersion > 10 && starttype === types$1._import) { + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + if (nextCh === 40 || nextCh === 46) // '(' or '.' + { return this.parseExpressionStatement(node, this.parseExpression()) } + } + + if (!this.options.allowImportExportEverywhere) { + if (!topLevel) + { this.raise(this.start, "'import' and 'export' may only appear at the top level"); } + if (!this.inModule) + { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); } + } + return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports) + + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + default: + if (this.isAsyncFunction()) { + if (context) { this.unexpected(); } + this.next(); + return this.parseFunctionStatement(node, true, !context) + } + + var maybeName = this.value, expr = this.parseExpression(); + if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) + { return this.parseLabeledStatement(node, maybeName, expr, context) } + else { return this.parseExpressionStatement(node, expr) } + } + }; + + pp$8.parseBreakContinueStatement = function(node, keyword) { + var isBreak = keyword === "break"; + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; } + else if (this.type !== types$1.name) { this.unexpected(); } + else { + node.label = this.parseIdent(); + this.semicolon(); + } + + // Verify that there is an actual destination to break or + // continue to. + var i = 0; + for (; i < this.labels.length; ++i) { + var lab = this.labels[i]; + if (node.label == null || lab.name === node.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) { break } + if (node.label && isBreak) { break } + } + } + if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); } + return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement") + }; + + pp$8.parseDebuggerStatement = function(node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement") + }; + + pp$8.parseDoStatement = function(node) { + this.next(); + this.labels.push(loopLabel); + node.body = this.parseStatement("do"); + this.labels.pop(); + this.expect(types$1._while); + node.test = this.parseParenExpression(); + if (this.options.ecmaVersion >= 6) + { this.eat(types$1.semi); } + else + { this.semicolon(); } + return this.finishNode(node, "DoWhileStatement") + }; + + // Disambiguating between a `for` and a `for`/`in` or `for`/`of` + // loop is non-trivial. Basically, we have to parse the init `var` + // statement or expression, disallowing the `in` operator (see + // the second parameter to `parseExpression`), and then check + // whether the next token is `in` or `of`. When there is no init + // part (semicolon immediately after the opening parenthesis), it + // is a regular `for` loop. + + pp$8.parseForStatement = function(node) { + this.next(); + var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1; + this.labels.push(loopLabel); + this.enterScope(0); + this.expect(types$1.parenL); + if (this.type === types$1.semi) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, null) + } + var isLet = this.isLet(); + if (this.type === types$1._var || this.type === types$1._const || isLet) { + var init$1 = this.startNode(), kind = isLet ? "let" : this.value; + this.next(); + this.parseVar(init$1, true, kind); + this.finishNode(init$1, "VariableDeclaration"); + if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + } else { node.await = awaitAt > -1; } + } + return this.parseForIn(node, init$1) + } + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, init$1) + } + var startsWithLet = this.isContextual("let"), isForOf = false; + var refDestructuringErrors = new DestructuringErrors; + var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); + if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + if (this.options.ecmaVersion >= 9) { + if (this.type === types$1._in) { + if (awaitAt > -1) { this.unexpected(awaitAt); } + } else { node.await = awaitAt > -1; } + } + if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); } + this.toAssignable(init, false, refDestructuringErrors); + this.checkLValPattern(init); + return this.parseForIn(node, init) + } else { + this.checkExpressionErrors(refDestructuringErrors, true); + } + if (awaitAt > -1) { this.unexpected(awaitAt); } + return this.parseFor(node, init) + }; + + pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { + this.next(); + return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync) + }; + + pp$8.parseIfStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + // allow function declarations in branches, but only in non-strict mode + node.consequent = this.parseStatement("if"); + node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; + return this.finishNode(node, "IfStatement") + }; + + pp$8.parseReturnStatement = function(node) { + if (!this.inFunction && !this.options.allowReturnOutsideFunction) + { this.raise(this.start, "'return' outside of function"); } + this.next(); + + // In `return` (and `break`/`continue`), the keywords with + // optional arguments, we eagerly look for a semicolon or the + // possibility to insert one. + + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; } + else { node.argument = this.parseExpression(); this.semicolon(); } + return this.finishNode(node, "ReturnStatement") + }; + + pp$8.parseSwitchStatement = function(node) { + this.next(); + node.discriminant = this.parseParenExpression(); + node.cases = []; + this.expect(types$1.braceL); + this.labels.push(switchLabel); + this.enterScope(0); + + // Statements under must be grouped (by label) in SwitchCase + // nodes. `cur` is used to keep the node that we are currently + // adding statements to. + + var cur; + for (var sawDefault = false; this.type !== types$1.braceR;) { + if (this.type === types$1._case || this.type === types$1._default) { + var isCase = this.type === types$1._case; + if (cur) { this.finishNode(cur, "SwitchCase"); } + node.cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); } + sawDefault = true; + cur.test = null; + } + this.expect(types$1.colon); + } else { + if (!cur) { this.unexpected(); } + cur.consequent.push(this.parseStatement(null)); + } + } + this.exitScope(); + if (cur) { this.finishNode(cur, "SwitchCase"); } + this.next(); // Closing brace + this.labels.pop(); + return this.finishNode(node, "SwitchStatement") + }; + + pp$8.parseThrowStatement = function(node) { + this.next(); + if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) + { this.raise(this.lastTokEnd, "Illegal newline after throw"); } + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement") + }; + + // Reused empty array added for node fields that are always empty. + + var empty$1 = []; + + pp$8.parseTryStatement = function(node) { + this.next(); + node.block = this.parseBlock(); + node.handler = null; + if (this.type === types$1._catch) { + var clause = this.startNode(); + this.next(); + if (this.eat(types$1.parenL)) { + clause.param = this.parseBindingAtom(); + var simple = clause.param.type === "Identifier"; + this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); + this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); + this.expect(types$1.parenR); + } else { + if (this.options.ecmaVersion < 10) { this.unexpected(); } + clause.param = null; + this.enterScope(0); + } + clause.body = this.parseBlock(false); + this.exitScope(); + node.handler = this.finishNode(clause, "CatchClause"); + } + node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; + if (!node.handler && !node.finalizer) + { this.raise(node.start, "Missing catch or finally clause"); } + return this.finishNode(node, "TryStatement") + }; + + pp$8.parseVarStatement = function(node, kind) { + this.next(); + this.parseVar(node, false, kind); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration") + }; + + pp$8.parseWhileStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + this.labels.push(loopLabel); + node.body = this.parseStatement("while"); + this.labels.pop(); + return this.finishNode(node, "WhileStatement") + }; + + pp$8.parseWithStatement = function(node) { + if (this.strict) { this.raise(this.start, "'with' in strict mode"); } + this.next(); + node.object = this.parseParenExpression(); + node.body = this.parseStatement("with"); + return this.finishNode(node, "WithStatement") + }; + + pp$8.parseEmptyStatement = function(node) { + this.next(); + return this.finishNode(node, "EmptyStatement") + }; + + pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { + for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) + { + var label = list[i$1]; + + if (label.name === maybeName) + { this.raise(expr.start, "Label '" + maybeName + "' is already declared"); + } } + var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; + for (var i = this.labels.length - 1; i >= 0; i--) { + var label$1 = this.labels[i]; + if (label$1.statementStart === node.start) { + // Update information about previous labels on this node + label$1.statementStart = this.start; + label$1.kind = kind; + } else { break } + } + this.labels.push({name: maybeName, kind: kind, statementStart: this.start}); + node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + this.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement") + }; + + pp$8.parseExpressionStatement = function(node, expr) { + node.expression = expr; + this.semicolon(); + return this.finishNode(node, "ExpressionStatement") + }; + + // Parse a semicolon-enclosed block of statements, handling `"use + // strict"` declarations when `allowStrict` is true (used for + // function bodies). + + pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { + if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true; + if ( node === void 0 ) node = this.startNode(); + + node.body = []; + this.expect(types$1.braceL); + if (createNewLexicalScope) { this.enterScope(0); } + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + if (exitStrict) { this.strict = false; } + this.next(); + if (createNewLexicalScope) { this.exitScope(); } + return this.finishNode(node, "BlockStatement") + }; + + // Parse a regular `for` loop. The disambiguation code in + // `parseStatement` will already have parsed the init statement or + // expression. + + pp$8.parseFor = function(node, init) { + node.init = init; + this.expect(types$1.semi); + node.test = this.type === types$1.semi ? null : this.parseExpression(); + this.expect(types$1.semi); + node.update = this.type === types$1.parenR ? null : this.parseExpression(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, "ForStatement") + }; + + // Parse a `for`/`in` and `for`/`of` loop, which are almost + // same from parser's perspective. + + pp$8.parseForIn = function(node, init) { + var isForIn = this.type === types$1._in; + this.next(); + + if ( + init.type === "VariableDeclaration" && + init.declarations[0].init != null && + ( + !isForIn || + this.options.ecmaVersion < 8 || + this.strict || + init.kind !== "var" || + init.declarations[0].id.type !== "Identifier" + ) + ) { + this.raise( + init.start, + ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer") + ); + } + node.left = init; + node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement") + }; + + // Parse a list of variable declarations. + + pp$8.parseVar = function(node, isFor, kind) { + node.declarations = []; + node.kind = kind; + for (;;) { + var decl = this.startNode(); + this.parseVarId(decl, kind); + if (this.eat(types$1.eq)) { + decl.init = this.parseMaybeAssign(isFor); + } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) { + this.unexpected(); + } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { + this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); + } else { + decl.init = null; + } + node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(types$1.comma)) { break } + } + return node + }; + + pp$8.parseVarId = function(decl, kind) { + decl.id = this.parseBindingAtom(); + this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); + }; + + var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4; + + // Parse a function declaration or literal (depending on the + // `statement & FUNC_STATEMENT`). + + // Remove `allowExpressionBody` for 7.0.0, as it is only called with false + pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node); + if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { + if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT)) + { this.unexpected(); } + node.generator = this.eat(types$1.star); + } + if (this.options.ecmaVersion >= 8) + { node.async = !!isAsync; } + + if (statement & FUNC_STATEMENT) { + node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent(); + if (node.id && !(statement & FUNC_HANGING_STATEMENT)) + // If it is a regular function declaration in sloppy mode, then it is + // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding + // mode depends on properties of the current scope (see + // treatFunctionsAsVar). + { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); } + } + + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(node.async, node.generator)); + + if (!(statement & FUNC_STATEMENT)) + { node.id = this.type === types$1.name ? this.parseIdent() : null; } + + this.parseFunctionParams(node); + this.parseFunctionBody(node, allowExpressionBody, false, forInit); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression") + }; + + pp$8.parseFunctionParams = function(node) { + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + }; + + // Parse a class declaration or literal (depending on the + // `isStatement` parameter). + + pp$8.parseClass = function(node, isStatement) { + this.next(); + + // ecma-262 14.6 Class Definitions + // A class definition is always strict mode code. + var oldStrict = this.strict; + this.strict = true; + + this.parseClassId(node, isStatement); + this.parseClassSuper(node); + var privateNameMap = this.enterClassBody(); + var classBody = this.startNode(); + var hadConstructor = false; + classBody.body = []; + this.expect(types$1.braceL); + while (this.type !== types$1.braceR) { + var element = this.parseClassElement(node.superClass !== null); + if (element) { + classBody.body.push(element); + if (element.type === "MethodDefinition" && element.kind === "constructor") { + if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); } + hadConstructor = true; + } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { + this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared")); + } + } + } + this.strict = oldStrict; + this.next(); + node.body = this.finishNode(classBody, "ClassBody"); + this.exitClassBody(); + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression") + }; + + pp$8.parseClassElement = function(constructorAllowsSuper) { + if (this.eat(types$1.semi)) { return null } + + var ecmaVersion = this.options.ecmaVersion; + var node = this.startNode(); + var keyName = ""; + var isGenerator = false; + var isAsync = false; + var kind = "method"; + var isStatic = false; + + if (this.eatContextual("static")) { + // Parse static init block + if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { + this.parseClassStaticBlock(node); + return node + } + if (this.isClassElementNameStart() || this.type === types$1.star) { + isStatic = true; + } else { + keyName = "static"; + } + } + node.static = isStatic; + if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { + if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { + isAsync = true; + } else { + keyName = "async"; + } + } + if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { + isGenerator = true; + } + if (!keyName && !isAsync && !isGenerator) { + var lastValue = this.value; + if (this.eatContextual("get") || this.eatContextual("set")) { + if (this.isClassElementNameStart()) { + kind = lastValue; + } else { + keyName = lastValue; + } + } + } + + // Parse element name + if (keyName) { + // 'async', 'get', 'set', or 'static' were not a keyword contextually. + // The last token is any of those. Make it the element name. + node.computed = false; + node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node.key.name = keyName; + this.finishNode(node.key, "Identifier"); + } else { + this.parseClassElementName(node); + } + + // Parse element value + if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { + var isConstructor = !node.static && checkKeyName(node, "constructor"); + var allowsDirectSuper = isConstructor && constructorAllowsSuper; + // Couldn't move this check into the 'parseClassMethod' method for backward compatibility. + if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); } + node.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + } else { + this.parseClassField(node); + } + + return node + }; + + pp$8.isClassElementNameStart = function() { + return ( + this.type === types$1.name || + this.type === types$1.privateId || + this.type === types$1.num || + this.type === types$1.string || + this.type === types$1.bracketL || + this.type.keyword + ) + }; + + pp$8.parseClassElementName = function(element) { + if (this.type === types$1.privateId) { + if (this.value === "constructor") { + this.raise(this.start, "Classes can't have an element named '#constructor'"); + } + element.computed = false; + element.key = this.parsePrivateIdent(); + } else { + this.parsePropertyName(element); + } + }; + + pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { + // Check key and flags + var key = method.key; + if (method.kind === "constructor") { + if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); } + if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); } + } else if (method.static && checkKeyName(method, "prototype")) { + this.raise(key.start, "Classes may not have a static property named prototype"); + } + + // Parse value + var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); + + // Check value + if (method.kind === "get" && value.params.length !== 0) + { this.raiseRecoverable(value.start, "getter should have no params"); } + if (method.kind === "set" && value.params.length !== 1) + { this.raiseRecoverable(value.start, "setter should have exactly one param"); } + if (method.kind === "set" && value.params[0].type === "RestElement") + { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); } + + return this.finishNode(method, "MethodDefinition") + }; + + pp$8.parseClassField = function(field) { + if (checkKeyName(field, "constructor")) { + this.raise(field.key.start, "Classes can't have a field named 'constructor'"); + } else if (field.static && checkKeyName(field, "prototype")) { + this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); + } + + if (this.eat(types$1.eq)) { + // To raise SyntaxError if 'arguments' exists in the initializer. + var scope = this.currentThisScope(); + var inClassFieldInit = scope.inClassFieldInit; + scope.inClassFieldInit = true; + field.value = this.parseMaybeAssign(); + scope.inClassFieldInit = inClassFieldInit; + } else { + field.value = null; + } + this.semicolon(); + + return this.finishNode(field, "PropertyDefinition") + }; + + pp$8.parseClassStaticBlock = function(node) { + node.body = []; + + var oldLabels = this.labels; + this.labels = []; + this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + this.next(); + this.exitScope(); + this.labels = oldLabels; + + return this.finishNode(node, "StaticBlock") + }; + + pp$8.parseClassId = function(node, isStatement) { + if (this.type === types$1.name) { + node.id = this.parseIdent(); + if (isStatement) + { this.checkLValSimple(node.id, BIND_LEXICAL, false); } + } else { + if (isStatement === true) + { this.unexpected(); } + node.id = null; + } + }; + + pp$8.parseClassSuper = function(node) { + node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; + }; + + pp$8.enterClassBody = function() { + var element = {declared: Object.create(null), used: []}; + this.privateNameStack.push(element); + return element.declared + }; + + pp$8.exitClassBody = function() { + var ref = this.privateNameStack.pop(); + var declared = ref.declared; + var used = ref.used; + var len = this.privateNameStack.length; + var parent = len === 0 ? null : this.privateNameStack[len - 1]; + for (var i = 0; i < used.length; ++i) { + var id = used[i]; + if (!hasOwn(declared, id.name)) { + if (parent) { + parent.used.push(id); + } else { + this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class")); + } + } + } + }; + + function isPrivateNameConflicted(privateNameMap, element) { + var name = element.key.name; + var curr = privateNameMap[name]; + + var next = "true"; + if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { + next = (element.static ? "s" : "i") + element.kind; + } + + // `class { get #a(){}; static set #a(_){} }` is also conflict. + if ( + curr === "iget" && next === "iset" || + curr === "iset" && next === "iget" || + curr === "sget" && next === "sset" || + curr === "sset" && next === "sget" + ) { + privateNameMap[name] = "true"; + return false + } else if (!curr) { + privateNameMap[name] = next; + return false + } else { + return true + } + } + + function checkKeyName(node, name) { + var computed = node.computed; + var key = node.key; + return !computed && ( + key.type === "Identifier" && key.name === name || + key.type === "Literal" && key.value === name + ) + } + + // Parses module export declaration. + + pp$8.parseExport = function(node, exports) { + this.next(); + // export * from '...' + if (this.eat(types$1.star)) { + if (this.options.ecmaVersion >= 11) { + if (this.eatContextual("as")) { + node.exported = this.parseModuleExportName(); + this.checkExport(exports, node.exported.name, this.lastTokStart); + } else { + node.exported = null; + } + } + this.expectContextual("from"); + if (this.type !== types$1.string) { this.unexpected(); } + node.source = this.parseExprAtom(); + this.semicolon(); + return this.finishNode(node, "ExportAllDeclaration") + } + if (this.eat(types$1._default)) { // export default ... + this.checkExport(exports, "default", this.lastTokStart); + var isAsync; + if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode(); + this.next(); + if (isAsync) { this.next(); } + node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); + } else if (this.type === types$1._class) { + var cNode = this.startNode(); + node.declaration = this.parseClass(cNode, "nullableID"); + } else { + node.declaration = this.parseMaybeAssign(); + this.semicolon(); + } + return this.finishNode(node, "ExportDefaultDeclaration") + } + // export var|const|let|function|class ... + if (this.shouldParseExportStatement()) { + node.declaration = this.parseStatement(null); + if (node.declaration.type === "VariableDeclaration") + { this.checkVariableExport(exports, node.declaration.declarations); } + else + { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); } + node.specifiers = []; + node.source = null; + } else { // export { x, y as z } [from '...'] + node.declaration = null; + node.specifiers = this.parseExportSpecifiers(exports); + if (this.eatContextual("from")) { + if (this.type !== types$1.string) { this.unexpected(); } + node.source = this.parseExprAtom(); + } else { + for (var i = 0, list = node.specifiers; i < list.length; i += 1) { + // check for keywords used as local names + var spec = list[i]; + + this.checkUnreserved(spec.local); + // check if export is defined + this.checkLocalExport(spec.local); + + if (spec.local.type === "Literal") { + this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); + } + } + + node.source = null; + } + this.semicolon(); + } + return this.finishNode(node, "ExportNamedDeclaration") + }; + + pp$8.checkExport = function(exports, name, pos) { + if (!exports) { return } + if (hasOwn(exports, name)) + { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); } + exports[name] = true; + }; + + pp$8.checkPatternExport = function(exports, pat) { + var type = pat.type; + if (type === "Identifier") + { this.checkExport(exports, pat.name, pat.start); } + else if (type === "ObjectPattern") + { for (var i = 0, list = pat.properties; i < list.length; i += 1) + { + var prop = list[i]; + + this.checkPatternExport(exports, prop); + } } + else if (type === "ArrayPattern") + { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { + var elt = list$1[i$1]; + + if (elt) { this.checkPatternExport(exports, elt); } + } } + else if (type === "Property") + { this.checkPatternExport(exports, pat.value); } + else if (type === "AssignmentPattern") + { this.checkPatternExport(exports, pat.left); } + else if (type === "RestElement") + { this.checkPatternExport(exports, pat.argument); } + else if (type === "ParenthesizedExpression") + { this.checkPatternExport(exports, pat.expression); } + }; + + pp$8.checkVariableExport = function(exports, decls) { + if (!exports) { return } + for (var i = 0, list = decls; i < list.length; i += 1) + { + var decl = list[i]; + + this.checkPatternExport(exports, decl.id); + } + }; + + pp$8.shouldParseExportStatement = function() { + return this.type.keyword === "var" || + this.type.keyword === "const" || + this.type.keyword === "class" || + this.type.keyword === "function" || + this.isLet() || + this.isAsyncFunction() + }; + + // Parses a comma-separated list of module exports. + + pp$8.parseExportSpecifiers = function(exports) { + var nodes = [], first = true; + // export { x, y as z } [from '...'] + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var node = this.startNode(); + node.local = this.parseModuleExportName(); + node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; + this.checkExport( + exports, + node.exported[node.exported.type === "Identifier" ? "name" : "value"], + node.exported.start + ); + nodes.push(this.finishNode(node, "ExportSpecifier")); + } + return nodes + }; + + // Parses import declaration. + + pp$8.parseImport = function(node) { + this.next(); + // import '...' + if (this.type === types$1.string) { + node.specifiers = empty$1; + node.source = this.parseExprAtom(); + } else { + node.specifiers = this.parseImportSpecifiers(); + this.expectContextual("from"); + node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); + } + this.semicolon(); + return this.finishNode(node, "ImportDeclaration") + }; + + // Parses a comma-separated list of module imports. + + pp$8.parseImportSpecifiers = function() { + var nodes = [], first = true; + if (this.type === types$1.name) { + // import defaultObj, { x, y as z } from '...' + var node = this.startNode(); + node.local = this.parseIdent(); + this.checkLValSimple(node.local, BIND_LEXICAL); + nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); + if (!this.eat(types$1.comma)) { return nodes } + } + if (this.type === types$1.star) { + var node$1 = this.startNode(); + this.next(); + this.expectContextual("as"); + node$1.local = this.parseIdent(); + this.checkLValSimple(node$1.local, BIND_LEXICAL); + nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); + return nodes + } + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var node$2 = this.startNode(); + node$2.imported = this.parseModuleExportName(); + if (this.eatContextual("as")) { + node$2.local = this.parseIdent(); + } else { + this.checkUnreserved(node$2.imported); + node$2.local = node$2.imported; + } + this.checkLValSimple(node$2.local, BIND_LEXICAL); + nodes.push(this.finishNode(node$2, "ImportSpecifier")); + } + return nodes + }; + + pp$8.parseModuleExportName = function() { + if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { + var stringLiteral = this.parseLiteral(this.value); + if (loneSurrogate.test(stringLiteral.value)) { + this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); + } + return stringLiteral + } + return this.parseIdent(true) + }; + + // Set `ExpressionStatement#directive` property for directive prologues. + pp$8.adaptDirectivePrologue = function(statements) { + for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { + statements[i].directive = statements[i].expression.raw.slice(1, -1); + } + }; + pp$8.isDirectiveCandidate = function(statement) { + return ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" && + typeof statement.expression.value === "string" && + // Reject parenthesized strings. + (this.input[statement.start] === "\"" || this.input[statement.start] === "'") + ) + }; + + var pp$7 = Parser.prototype; + + // Convert existing expression atom to assignable pattern + // if possible. + + pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node) { + switch (node.type) { + case "Identifier": + if (this.inAsync && node.name === "await") + { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); } + break + + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + break + + case "ObjectExpression": + node.type = "ObjectPattern"; + if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + for (var i = 0, list = node.properties; i < list.length; i += 1) { + var prop = list[i]; + + this.toAssignable(prop, isBinding); + // Early error: + // AssignmentRestProperty[Yield, Await] : + // `...` DestructuringAssignmentTarget[Yield, Await] + // + // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|. + if ( + prop.type === "RestElement" && + (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern") + ) { + this.raise(prop.argument.start, "Unexpected token"); + } + } + break + + case "Property": + // AssignmentProperty has type === "Property" + if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); } + this.toAssignable(node.value, isBinding); + break + + case "ArrayExpression": + node.type = "ArrayPattern"; + if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + this.toAssignableList(node.elements, isBinding); + break + + case "SpreadElement": + node.type = "RestElement"; + this.toAssignable(node.argument, isBinding); + if (node.argument.type === "AssignmentPattern") + { this.raise(node.argument.start, "Rest elements cannot have a default value"); } + break + + case "AssignmentExpression": + if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); } + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isBinding); + break + + case "ParenthesizedExpression": + this.toAssignable(node.expression, isBinding, refDestructuringErrors); + break + + case "ChainExpression": + this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); + break + + case "MemberExpression": + if (!isBinding) { break } + + default: + this.raise(node.start, "Assigning to rvalue"); + } + } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } + return node + }; + + // Convert list of expression atoms to binding list. + + pp$7.toAssignableList = function(exprList, isBinding) { + var end = exprList.length; + for (var i = 0; i < end; i++) { + var elt = exprList[i]; + if (elt) { this.toAssignable(elt, isBinding); } + } + if (end) { + var last = exprList[end - 1]; + if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") + { this.unexpected(last.argument.start); } + } + return exprList + }; + + // Parses spread element. + + pp$7.parseSpread = function(refDestructuringErrors) { + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node, "SpreadElement") + }; + + pp$7.parseRestBinding = function() { + var node = this.startNode(); + this.next(); + + // RestElement inside of a function parameter must be an identifier + if (this.options.ecmaVersion === 6 && this.type !== types$1.name) + { this.unexpected(); } + + node.argument = this.parseBindingAtom(); + + return this.finishNode(node, "RestElement") + }; + + // Parses lvalue (assignable) atom. + + pp$7.parseBindingAtom = function() { + if (this.options.ecmaVersion >= 6) { + switch (this.type) { + case types$1.bracketL: + var node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(types$1.bracketR, true, true); + return this.finishNode(node, "ArrayPattern") + + case types$1.braceL: + return this.parseObj(true) + } + } + return this.parseIdent() + }; + + pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) { + var elts = [], first = true; + while (!this.eat(close)) { + if (first) { first = false; } + else { this.expect(types$1.comma); } + if (allowEmpty && this.type === types$1.comma) { + elts.push(null); + } else if (allowTrailingComma && this.afterTrailingComma(close)) { + break + } else if (this.type === types$1.ellipsis) { + var rest = this.parseRestBinding(); + this.parseBindingListItem(rest); + elts.push(rest); + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } + this.expect(close); + break + } else { + var elem = this.parseMaybeDefault(this.start, this.startLoc); + this.parseBindingListItem(elem); + elts.push(elem); + } + } + return elts + }; + + pp$7.parseBindingListItem = function(param) { + return param + }; + + // Parses assignment pattern around given atom if possible. + + pp$7.parseMaybeDefault = function(startPos, startLoc, left) { + left = left || this.parseBindingAtom(); + if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.right = this.parseMaybeAssign(); + return this.finishNode(node, "AssignmentPattern") + }; + + // The following three functions all verify that a node is an lvalue — + // something that can be bound, or assigned to. In order to do so, they perform + // a variety of checks: + // + // - Check that none of the bound/assigned-to identifiers are reserved words. + // - Record name declarations for bindings in the appropriate scope. + // - Check duplicate argument names, if checkClashes is set. + // + // If a complex binding pattern is encountered (e.g., object and array + // destructuring), the entire pattern is recursively checked. + // + // There are three versions of checkLVal*() appropriate for different + // circumstances: + // + // - checkLValSimple() shall be used if the syntactic construct supports + // nothing other than identifiers and member expressions. Parenthesized + // expressions are also correctly handled. This is generally appropriate for + // constructs for which the spec says + // + // > It is a Syntax Error if AssignmentTargetType of [the production] is not + // > simple. + // + // It is also appropriate for checking if an identifier is valid and not + // defined elsewhere, like import declarations or function/class identifiers. + // + // Examples where this is used include: + // a += …; + // import a from '…'; + // where a is the node to be checked. + // + // - checkLValPattern() shall be used if the syntactic construct supports + // anything checkLValSimple() supports, as well as object and array + // destructuring patterns. This is generally appropriate for constructs for + // which the spec says + // + // > It is a Syntax Error if [the production] is neither an ObjectLiteral nor + // > an ArrayLiteral and AssignmentTargetType of [the production] is not + // > simple. + // + // Examples where this is used include: + // (a = …); + // const a = …; + // try { … } catch (a) { … } + // where a is the node to be checked. + // + // - checkLValInnerPattern() shall be used if the syntactic construct supports + // anything checkLValPattern() supports, as well as default assignment + // patterns, rest elements, and other constructs that may appear within an + // object or array destructuring pattern. + // + // As a special case, function parameters also use checkLValInnerPattern(), + // as they also support defaults and rest constructs. + // + // These functions deliberately support both assignment and binding constructs, + // as the logic for both is exceedingly similar. If the node is the target of + // an assignment, then bindingType should be set to BIND_NONE. Otherwise, it + // should be set to the appropriate BIND_* constant, like BIND_VAR or + // BIND_LEXICAL. + // + // If the function is called with a non-BIND_NONE bindingType, then + // additionally a checkClashes object may be specified to allow checking for + // duplicate argument names. checkClashes is ignored if the provided construct + // is an assignment (i.e., bindingType is BIND_NONE). + + pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + var isBind = bindingType !== BIND_NONE; + + switch (expr.type) { + case "Identifier": + if (this.strict && this.reservedWordsStrictBind.test(expr.name)) + { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); } + if (isBind) { + if (bindingType === BIND_LEXICAL && expr.name === "let") + { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); } + if (checkClashes) { + if (hasOwn(checkClashes, expr.name)) + { this.raiseRecoverable(expr.start, "Argument name clash"); } + checkClashes[expr.name] = true; + } + if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); } + } + break + + case "ChainExpression": + this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); + break + + case "MemberExpression": + if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); } + break + + case "ParenthesizedExpression": + if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); } + return this.checkLValSimple(expr.expression, bindingType, checkClashes) + + default: + this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); + } + }; + + pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + switch (expr.type) { + case "ObjectPattern": + for (var i = 0, list = expr.properties; i < list.length; i += 1) { + var prop = list[i]; + + this.checkLValInnerPattern(prop, bindingType, checkClashes); + } + break + + case "ArrayPattern": + for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { + var elem = list$1[i$1]; + + if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); } + } + break + + default: + this.checkLValSimple(expr, bindingType, checkClashes); + } + }; + + pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { + if ( bindingType === void 0 ) bindingType = BIND_NONE; + + switch (expr.type) { + case "Property": + // AssignmentProperty has type === "Property" + this.checkLValInnerPattern(expr.value, bindingType, checkClashes); + break + + case "AssignmentPattern": + this.checkLValPattern(expr.left, bindingType, checkClashes); + break + + case "RestElement": + this.checkLValPattern(expr.argument, bindingType, checkClashes); + break + + default: + this.checkLValPattern(expr, bindingType, checkClashes); + } + }; + + // The algorithm used to determine whether a regexp can appear at a + + var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + this.generator = !!generator; + }; + + var types = { + b_stat: new TokContext("{", false), + b_expr: new TokContext("{", true), + b_tmpl: new TokContext("${", false), + p_stat: new TokContext("(", false), + p_expr: new TokContext("(", true), + q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }), + f_stat: new TokContext("function", false), + f_expr: new TokContext("function", true), + f_expr_gen: new TokContext("function", true, false, null, true), + f_gen: new TokContext("function", false, false, null, true) + }; + + var pp$6 = Parser.prototype; + + pp$6.initialContext = function() { + return [types.b_stat] + }; + + pp$6.curContext = function() { + return this.context[this.context.length - 1] + }; + + pp$6.braceIsBlock = function(prevType) { + var parent = this.curContext(); + if (parent === types.f_expr || parent === types.f_stat) + { return true } + if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) + { return !parent.isExpr } + + // The check for `tt.name && exprAllowed` detects whether we are + // after a `yield` or `of` construct. See the `updateContext` for + // `tt.name`. + if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) + { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) } + if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) + { return true } + if (prevType === types$1.braceL) + { return parent === types.b_stat } + if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) + { return false } + return !this.exprAllowed + }; + + pp$6.inGeneratorContext = function() { + for (var i = this.context.length - 1; i >= 1; i--) { + var context = this.context[i]; + if (context.token === "function") + { return context.generator } + } + return false + }; + + pp$6.updateContext = function(prevType) { + var update, type = this.type; + if (type.keyword && prevType === types$1.dot) + { this.exprAllowed = false; } + else if (update = type.updateContext) + { update.call(this, prevType); } + else + { this.exprAllowed = type.beforeExpr; } + }; + + // Used to handle egde case when token context could not be inferred correctly in tokenize phase + pp$6.overrideContext = function(tokenCtx) { + if (this.curContext() !== tokenCtx) { + this.context[this.context.length - 1] = tokenCtx; + } + }; + + // Token-specific context update code + + types$1.parenR.updateContext = types$1.braceR.updateContext = function() { + if (this.context.length === 1) { + this.exprAllowed = true; + return + } + var out = this.context.pop(); + if (out === types.b_stat && this.curContext().token === "function") { + out = this.context.pop(); + } + this.exprAllowed = !out.isExpr; + }; + + types$1.braceL.updateContext = function(prevType) { + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); + this.exprAllowed = true; + }; + + types$1.dollarBraceL.updateContext = function() { + this.context.push(types.b_tmpl); + this.exprAllowed = true; + }; + + types$1.parenL.updateContext = function(prevType) { + var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; + this.context.push(statementParens ? types.p_stat : types.p_expr); + this.exprAllowed = true; + }; + + types$1.incDec.updateContext = function() { + // tokExprAllowed stays unchanged + }; + + types$1._function.updateContext = types$1._class.updateContext = function(prevType) { + if (prevType.beforeExpr && prevType !== types$1._else && + !(prevType === types$1.semi && this.curContext() !== types.p_stat) && + !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && + !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) + { this.context.push(types.f_expr); } + else + { this.context.push(types.f_stat); } + this.exprAllowed = false; + }; + + types$1.backQuote.updateContext = function() { + if (this.curContext() === types.q_tmpl) + { this.context.pop(); } + else + { this.context.push(types.q_tmpl); } + this.exprAllowed = false; + }; + + types$1.star.updateContext = function(prevType) { + if (prevType === types$1._function) { + var index = this.context.length - 1; + if (this.context[index] === types.f_expr) + { this.context[index] = types.f_expr_gen; } + else + { this.context[index] = types.f_gen; } + } + this.exprAllowed = true; + }; + + types$1.name.updateContext = function(prevType) { + var allowed = false; + if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { + if (this.value === "of" && !this.exprAllowed || + this.value === "yield" && this.inGeneratorContext()) + { allowed = true; } + } + this.exprAllowed = allowed; + }; + + // A recursive descent parser operates by defining functions for all + + var pp$5 = Parser.prototype; + + // Check if property name clashes with already added. + // Object/class getters and setters are not allowed to clash — + // either with each other or with an init property — and in + // strict mode, init properties are also not allowed to be repeated. + + pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { + if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") + { return } + if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) + { return } + var key = prop.key; + var name; + switch (key.type) { + case "Identifier": name = key.name; break + case "Literal": name = String(key.value); break + default: return + } + var kind = prop.kind; + if (this.options.ecmaVersion >= 6) { + if (name === "__proto__" && kind === "init") { + if (propHash.proto) { + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) { + refDestructuringErrors.doubleProto = key.start; + } + } else { + this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); + } + } + propHash.proto = true; + } + return + } + name = "$" + name; + var other = propHash[name]; + if (other) { + var redefinition; + if (kind === "init") { + redefinition = this.strict && other.init || other.get || other.set; + } else { + redefinition = other.init || other[kind]; + } + if (redefinition) + { this.raiseRecoverable(key.start, "Redefinition of property"); } + } else { + other = propHash[name] = { + init: false, + get: false, + set: false + }; + } + other[kind] = true; + }; + + // ### Expression parsing + + // These nest, from the most general expression type at the top to + // 'atomic', nondivisible expression types at the bottom. Most of + // the functions will simply let the function(s) below them parse, + // and, *if* the syntactic construct they handle is present, wrap + // the AST node that the inner parser gave them in another node. + + // Parse a full expression. The optional arguments are used to + // forbid the `in` operator (in for loops initalization expressions) + // and provide reference for storing '=' operator inside shorthand + // property assignment in contexts where both object expression + // and object pattern might appear (so it's possible to raise + // delayed syntax error at correct position). + + pp$5.parseExpression = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); + if (this.type === types$1.comma) { + var node = this.startNodeAt(startPos, startLoc); + node.expressions = [expr]; + while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } + return this.finishNode(node, "SequenceExpression") + } + return expr + }; + + // Parse an assignment expression. This includes applications of + // operators like `+=`. + + pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { + if (this.isContextual("yield")) { + if (this.inGenerator) { return this.parseYield(forInit) } + // The tokenizer will assume an expression is allowed after + // `yield`, but this isn't that kind of yield + else { this.exprAllowed = false; } + } + + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; + if (refDestructuringErrors) { + oldParenAssign = refDestructuringErrors.parenthesizedAssign; + oldTrailingComma = refDestructuringErrors.trailingComma; + oldDoubleProto = refDestructuringErrors.doubleProto; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; + } else { + refDestructuringErrors = new DestructuringErrors; + ownDestructuringErrors = true; + } + + var startPos = this.start, startLoc = this.startLoc; + if (this.type === types$1.parenL || this.type === types$1.name) { + this.potentialArrowAt = this.start; + this.potentialArrowInForAwait = forInit === "await"; + } + var left = this.parseMaybeConditional(forInit, refDestructuringErrors); + if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); } + if (this.type.isAssign) { + var node = this.startNodeAt(startPos, startLoc); + node.operator = this.value; + if (this.type === types$1.eq) + { left = this.toAssignable(left, false, refDestructuringErrors); } + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= left.start) + { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly + if (this.type === types$1.eq) + { this.checkLValPattern(left); } + else + { this.checkLValSimple(left); } + node.left = left; + this.next(); + node.right = this.parseMaybeAssign(forInit); + if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; } + return this.finishNode(node, "AssignmentExpression") + } else { + if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); } + } + if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; } + if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; } + return left + }; + + // Parse a ternary conditional (`?:`) operator. + + pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprOps(forInit, refDestructuringErrors); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + if (this.eat(types$1.question)) { + var node = this.startNodeAt(startPos, startLoc); + node.test = expr; + node.consequent = this.parseMaybeAssign(); + this.expect(types$1.colon); + node.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node, "ConditionalExpression") + } + return expr + }; + + // Start the precedence parser. + + pp$5.parseExprOps = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit) + }; + + // Parse binary operators with the operator precedence parsing + // algorithm. `left` is the left-hand side of the operator. + // `minPrec` provides context that allows the function to stop and + // defer further parser to one of its callers when it encounters an + // operator that has a lower precedence than the set it is parsing. + + pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { + var prec = this.type.binop; + if (prec != null && (!forInit || this.type !== types$1._in)) { + if (prec > minPrec) { + var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; + var coalesce = this.type === types$1.coalesce; + if (coalesce) { + // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. + // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. + prec = types$1.logicalAND.binop; + } + var op = this.value; + this.next(); + var startPos = this.start, startLoc = this.startLoc; + var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); + var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) { + this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); + } + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit) + } + } + return left + }; + + pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { + if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.operator = op; + node.right = right; + return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression") + }; + + // Parse unary operators, both prefix and postfix. + + pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { + var startPos = this.start, startLoc = this.startLoc, expr; + if (this.isContextual("await") && this.canAwait) { + expr = this.parseAwait(forInit); + sawUnary = true; + } else if (this.type.prefix) { + var node = this.startNode(), update = this.type === types$1.incDec; + node.operator = this.value; + node.prefix = true; + this.next(); + node.argument = this.parseMaybeUnary(null, true, update, forInit); + this.checkExpressionErrors(refDestructuringErrors, true); + if (update) { this.checkLValSimple(node.argument); } + else if (this.strict && node.operator === "delete" && + node.argument.type === "Identifier") + { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); } + else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) + { this.raiseRecoverable(node.start, "Private fields can not be deleted"); } + else { sawUnary = true; } + expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + } else if (!sawUnary && this.type === types$1.privateId) { + if (forInit || this.privateNameStack.length === 0) { this.unexpected(); } + expr = this.parsePrivateIdent(); + // only could be private fields in 'in', such as #x in obj + if (this.type !== types$1._in) { this.unexpected(); } + } else { + expr = this.parseExprSubscripts(refDestructuringErrors, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { return expr } + while (this.type.postfix && !this.canInsertSemicolon()) { + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.operator = this.value; + node$1.prefix = false; + node$1.argument = expr; + this.checkLValSimple(expr); + this.next(); + expr = this.finishNode(node$1, "UpdateExpression"); + } + } + + if (!incDec && this.eat(types$1.starstar)) { + if (sawUnary) + { this.unexpected(this.lastTokStart); } + else + { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) } + } else { + return expr + } + }; + + function isPrivateFieldAccess(node) { + return ( + node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || + node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) + ) + } + + // Parse call, dot, and `[]`-subscript expressions. + + pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprAtom(refDestructuringErrors, forInit); + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") + { return expr } + var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); + if (refDestructuringErrors && result.type === "MemberExpression") { + if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; } + if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; } + if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; } + } + return result + }; + + pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && + this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && + this.potentialArrowAt === base.start; + var optionalChained = false; + + while (true) { + var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + + if (element.optional) { optionalChained = true; } + if (element === base || element.type === "ArrowFunctionExpression") { + if (optionalChained) { + var chainNode = this.startNodeAt(startPos, startLoc); + chainNode.expression = element; + element = this.finishNode(chainNode, "ChainExpression"); + } + return element + } + + base = element; + } + }; + + pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { + var optionalSupported = this.options.ecmaVersion >= 11; + var optional = optionalSupported && this.eat(types$1.questionDot); + if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); } + + var computed = this.eat(types$1.bracketL); + if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) { + var node = this.startNodeAt(startPos, startLoc); + node.object = base; + if (computed) { + node.property = this.parseExpression(); + this.expect(types$1.bracketR); + } else if (this.type === types$1.privateId && base.type !== "Super") { + node.property = this.parsePrivateIdent(); + } else { + node.property = this.parseIdent(this.options.allowReserved !== "never"); + } + node.computed = !!computed; + if (optionalSupported) { + node.optional = optional; + } + base = this.finishNode(node, "MemberExpression"); + } else if (!noCalls && this.eat(types$1.parenL)) { + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + if (this.awaitIdentPos > 0) + { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); } + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit) + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.callee = base; + node$1.arguments = exprList; + if (optionalSupported) { + node$1.optional = optional; + } + base = this.finishNode(node$1, "CallExpression"); + } else if (this.type === types$1.backQuote) { + if (optional || optionalChained) { + this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); + } + var node$2 = this.startNodeAt(startPos, startLoc); + node$2.tag = base; + node$2.quasi = this.parseTemplate({isTagged: true}); + base = this.finishNode(node$2, "TaggedTemplateExpression"); + } + return base + }; + + // Parse an atomic expression — either a single token that is an + // expression, an expression started by a keyword like `function` or + // `new`, or an expression wrapped in punctuation like `()`, `[]`, + // or `{}`. + + pp$5.parseExprAtom = function(refDestructuringErrors, forInit) { + // If a division operator appears in an expression position, the + // tokenizer got confused, and we force it to read a regexp instead. + if (this.type === types$1.slash) { this.readRegexp(); } + + var node, canBeArrow = this.potentialArrowAt === this.start; + switch (this.type) { + case types$1._super: + if (!this.allowSuper) + { this.raise(this.start, "'super' keyword outside a method"); } + node = this.startNode(); + this.next(); + if (this.type === types$1.parenL && !this.allowDirectSuper) + { this.raise(node.start, "super() call outside constructor of a subclass"); } + // The `super` keyword can appear at below: + // SuperProperty: + // super [ Expression ] + // super . IdentifierName + // SuperCall: + // super ( Arguments ) + if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) + { this.unexpected(); } + return this.finishNode(node, "Super") + + case types$1._this: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression") + + case types$1.name: + var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; + var id = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + this.overrideContext(types.f_expr); + return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit) + } + if (canBeArrow && !this.canInsertSemicolon()) { + if (this.eat(types$1.arrow)) + { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) } + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && + (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { + id = this.parseIdent(false); + if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) + { this.unexpected(); } + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit) + } + } + return id + + case types$1.regexp: + var value = this.value; + node = this.parseLiteral(value.value); + node.regex = {pattern: value.pattern, flags: value.flags}; + return node + + case types$1.num: case types$1.string: + return this.parseLiteral(this.value) + + case types$1._null: case types$1._true: case types$1._false: + node = this.startNode(); + node.value = this.type === types$1._null ? null : this.type === types$1._true; + node.raw = this.type.keyword; + this.next(); + return this.finishNode(node, "Literal") + + case types$1.parenL: + var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); + if (refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) + { refDestructuringErrors.parenthesizedAssign = start; } + if (refDestructuringErrors.parenthesizedBind < 0) + { refDestructuringErrors.parenthesizedBind = start; } + } + return expr + + case types$1.bracketL: + node = this.startNode(); + this.next(); + node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node, "ArrayExpression") + + case types$1.braceL: + this.overrideContext(types.b_expr); + return this.parseObj(false, refDestructuringErrors) + + case types$1._function: + node = this.startNode(); + this.next(); + return this.parseFunction(node, 0) + + case types$1._class: + return this.parseClass(this.startNode(), false) + + case types$1._new: + return this.parseNew() + + case types$1.backQuote: + return this.parseTemplate() + + case types$1._import: + if (this.options.ecmaVersion >= 11) { + return this.parseExprImport() + } else { + return this.unexpected() + } + + default: + this.unexpected(); + } + }; + + pp$5.parseExprImport = function() { + var node = this.startNode(); + + // Consume `import` as an identifier for `import.meta`. + // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } + var meta = this.parseIdent(true); + + switch (this.type) { + case types$1.parenL: + return this.parseDynamicImport(node) + case types$1.dot: + node.meta = meta; + return this.parseImportMeta(node) + default: + this.unexpected(); + } + }; + + pp$5.parseDynamicImport = function(node) { + this.next(); // skip `(` + + // Parse node.source. + node.source = this.parseMaybeAssign(); + + // Verify ending. + if (!this.eat(types$1.parenR)) { + var errorPos = this.start; + if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { + this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); + } else { + this.unexpected(errorPos); + } + } + + return this.finishNode(node, "ImportExpression") + }; + + pp$5.parseImportMeta = function(node) { + this.next(); // skip `.` + + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + + if (node.property.name !== "meta") + { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); } + if (containsEsc) + { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); } + if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) + { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); } + + return this.finishNode(node, "MetaProperty") + }; + + pp$5.parseLiteral = function(value) { + var node = this.startNode(); + node.value = value; + node.raw = this.input.slice(this.start, this.end); + if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); } + this.next(); + return this.finishNode(node, "Literal") + }; + + pp$5.parseParenExpression = function() { + this.expect(types$1.parenL); + var val = this.parseExpression(); + this.expect(types$1.parenR); + return val + }; + + pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { + var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; + if (this.options.ecmaVersion >= 6) { + this.next(); + + var innerStartPos = this.start, innerStartLoc = this.startLoc; + var exprList = [], first = true, lastIsComma = false; + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; + this.yieldPos = 0; + this.awaitPos = 0; + // Do not save awaitIdentPos to allow checking awaits nested in parameters + while (this.type !== types$1.parenR) { + first ? first = false : this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { + lastIsComma = true; + break + } else if (this.type === types$1.ellipsis) { + spreadStart = this.start; + exprList.push(this.parseParenItem(this.parseRestBinding())); + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } + break + } else { + exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); + } + } + var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; + this.expect(types$1.parenR); + + if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + return this.parseParenArrowList(startPos, startLoc, exprList, forInit) + } + + if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); } + if (spreadStart) { this.unexpected(spreadStart); } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + } else { + val = this.parseParenExpression(); + } + + if (this.options.preserveParens) { + var par = this.startNodeAt(startPos, startLoc); + par.expression = val; + return this.finishNode(par, "ParenthesizedExpression") + } else { + return val + } + }; + + pp$5.parseParenItem = function(item) { + return item + }; + + pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit) + }; + + // New's precedence is slightly tricky. It must allow its argument to + // be a `[]` or dot subscript expression, but not a call — at least, + // not without wrapping it in parentheses. Thus, it uses the noCalls + // argument to parseSubscripts to prevent it from consuming the + // argument list. + + var empty = []; + + pp$5.parseNew = function() { + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } + var node = this.startNode(); + var meta = this.parseIdent(true); + if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { + node.meta = meta; + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + if (node.property.name !== "target") + { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); } + if (containsEsc) + { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); } + if (!this.allowNewDotTarget) + { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); } + return this.finishNode(node, "MetaProperty") + } + var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import; + node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); + if (isImport && node.callee.type === "ImportExpression") { + this.raise(startPos, "Cannot use new with import()"); + } + if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); } + else { node.arguments = empty; } + return this.finishNode(node, "NewExpression") + }; + + // Parse template expression. + + pp$5.parseTemplateElement = function(ref) { + var isTagged = ref.isTagged; + + var elem = this.startNode(); + if (this.type === types$1.invalidTemplate) { + if (!isTagged) { + this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); + } + elem.value = { + raw: this.value, + cooked: null + }; + } else { + elem.value = { + raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"), + cooked: this.value + }; + } + this.next(); + elem.tail = this.type === types$1.backQuote; + return this.finishNode(elem, "TemplateElement") + }; + + pp$5.parseTemplate = function(ref) { + if ( ref === void 0 ) ref = {}; + var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false; + + var node = this.startNode(); + this.next(); + node.expressions = []; + var curElt = this.parseTemplateElement({isTagged: isTagged}); + node.quasis = [curElt]; + while (!curElt.tail) { + if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); } + this.expect(types$1.dollarBraceL); + node.expressions.push(this.parseExpression()); + this.expect(types$1.braceR); + node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged})); + } + this.next(); + return this.finishNode(node, "TemplateLiteral") + }; + + pp$5.isAsyncProp = function(prop) { + return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && + (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) && + !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) + }; + + // Parse an object literal or binding pattern. + + pp$5.parseObj = function(isPattern, refDestructuringErrors) { + var node = this.startNode(), first = true, propHash = {}; + node.properties = []; + this.next(); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break } + } else { first = false; } + + var prop = this.parseProperty(isPattern, refDestructuringErrors); + if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); } + node.properties.push(prop); + } + return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression") + }; + + pp$5.parseProperty = function(isPattern, refDestructuringErrors) { + var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; + if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { + if (isPattern) { + prop.argument = this.parseIdent(false); + if (this.type === types$1.comma) { + this.raise(this.start, "Comma is not permitted after the rest element"); + } + return this.finishNode(prop, "RestElement") + } + // To disallow parenthesized identifier via `this.toAssignable()`. + if (this.type === types$1.parenL && refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0) { + refDestructuringErrors.parenthesizedAssign = this.start; + } + if (refDestructuringErrors.parenthesizedBind < 0) { + refDestructuringErrors.parenthesizedBind = this.start; + } + } + // Parse argument. + prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); + // To disallow trailing comma via `this.toAssignable()`. + if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + // Finish + return this.finishNode(prop, "SpreadElement") + } + if (this.options.ecmaVersion >= 6) { + prop.method = false; + prop.shorthand = false; + if (isPattern || refDestructuringErrors) { + startPos = this.start; + startLoc = this.startLoc; + } + if (!isPattern) + { isGenerator = this.eat(types$1.star); } + } + var containsEsc = this.containsEsc; + this.parsePropertyName(prop); + if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { + isAsync = true; + isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); + this.parsePropertyName(prop, refDestructuringErrors); + } else { + isAsync = false; + } + this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); + return this.finishNode(prop, "Property") + }; + + pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { + if ((isGenerator || isAsync) && this.type === types$1.colon) + { this.unexpected(); } + + if (this.eat(types$1.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); + prop.kind = "init"; + } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { + if (isPattern) { this.unexpected(); } + prop.kind = "init"; + prop.method = true; + prop.value = this.parseMethod(isGenerator, isAsync); + } else if (!isPattern && !containsEsc && + this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && + (prop.key.name === "get" || prop.key.name === "set") && + (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { + if (isGenerator || isAsync) { this.unexpected(); } + prop.kind = prop.key.name; + this.parsePropertyName(prop); + prop.value = this.parseMethod(false); + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start = prop.value.start; + if (prop.kind === "get") + { this.raiseRecoverable(start, "getter should have no params"); } + else + { this.raiseRecoverable(start, "setter should have exactly one param"); } + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") + { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); } + } + } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (isGenerator || isAsync) { this.unexpected(); } + this.checkUnreserved(prop.key); + if (prop.key.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = startPos; } + prop.kind = "init"; + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else if (this.type === types$1.eq && refDestructuringErrors) { + if (refDestructuringErrors.shorthandAssign < 0) + { refDestructuringErrors.shorthandAssign = this.start; } + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else { + prop.value = this.copyNode(prop.key); + } + prop.shorthand = true; + } else { this.unexpected(); } + }; + + pp$5.parsePropertyName = function(prop) { + if (this.options.ecmaVersion >= 6) { + if (this.eat(types$1.bracketL)) { + prop.computed = true; + prop.key = this.parseMaybeAssign(); + this.expect(types$1.bracketR); + return prop.key + } else { + prop.computed = false; + } + } + return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never") + }; + + // Initialize empty function node. + + pp$5.initFunction = function(node) { + node.id = null; + if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; } + if (this.options.ecmaVersion >= 8) { node.async = false; } + }; + + // Parse object or class method. + + pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { + var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + + this.initFunction(node); + if (this.options.ecmaVersion >= 6) + { node.generator = isGenerator; } + if (this.options.ecmaVersion >= 8) + { node.async = !!isAsync; } + + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + this.parseFunctionBody(node, false, true, false); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "FunctionExpression") + }; + + // Parse arrow function expression with given parameters. + + pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + + this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); + this.initFunction(node); + if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; } + + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + + node.params = this.toAssignableList(params, true); + this.parseFunctionBody(node, true, false, forInit); + + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "ArrowFunctionExpression") + }; + + // Parse function body and check parameters. + + pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { + var isExpression = isArrowFunction && this.type !== types$1.braceL; + var oldStrict = this.strict, useStrict = false; + + if (isExpression) { + node.body = this.parseMaybeAssign(forInit); + node.expression = true; + this.checkParams(node, false); + } else { + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); + if (!oldStrict || nonSimple) { + useStrict = this.strictDirective(this.end); + // If this is a strict mode function, verify that argument names + // are not repeated, and it does not try to bind the words `eval` + // or `arguments`. + if (useStrict && nonSimple) + { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); } + } + // Start a new scope with regard to labels and the `inFunction` + // flag (restore them to their old value afterwards). + var oldLabels = this.labels; + this.labels = []; + if (useStrict) { this.strict = true; } + + // Add the params to varDeclaredNames to ensure that an error is thrown + // if a let/const declaration in the function clashes with one of the params. + this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); + // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' + if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); } + node.body = this.parseBlock(false, undefined, useStrict && !oldStrict); + node.expression = false; + this.adaptDirectivePrologue(node.body.body); + this.labels = oldLabels; + } + this.exitScope(); + }; + + pp$5.isSimpleParamList = function(params) { + for (var i = 0, list = params; i < list.length; i += 1) + { + var param = list[i]; + + if (param.type !== "Identifier") { return false + } } + return true + }; + + // Checks function params for various disallowed patterns such as using "eval" + // or "arguments" and duplicate parameters. + + pp$5.checkParams = function(node, allowDuplicates) { + var nameHash = Object.create(null); + for (var i = 0, list = node.params; i < list.length; i += 1) + { + var param = list[i]; + + this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); + } + }; + + // Parses a comma-separated list of expressions, and returns them as + // an array. `close` is the token type that ends the list, and + // `allowEmpty` can be turned on to allow subsequent commas with + // nothing in between them to be parsed as `null` (which is needed + // for array literals). + + pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + var elts = [], first = true; + while (!this.eat(close)) { + if (!first) { + this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(close)) { break } + } else { first = false; } + + var elt = (void 0); + if (allowEmpty && this.type === types$1.comma) + { elt = null; } + else if (this.type === types$1.ellipsis) { + elt = this.parseSpread(refDestructuringErrors); + if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) + { refDestructuringErrors.trailingComma = this.start; } + } else { + elt = this.parseMaybeAssign(false, refDestructuringErrors); + } + elts.push(elt); + } + return elts + }; + + pp$5.checkUnreserved = function(ref) { + var start = ref.start; + var end = ref.end; + var name = ref.name; + + if (this.inGenerator && name === "yield") + { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); } + if (this.inAsync && name === "await") + { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); } + if (this.currentThisScope().inClassFieldInit && name === "arguments") + { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); } + if (this.inClassStaticBlock && (name === "arguments" || name === "await")) + { this.raise(start, ("Cannot use " + name + " in class static initialization block")); } + if (this.keywords.test(name)) + { this.raise(start, ("Unexpected keyword '" + name + "'")); } + if (this.options.ecmaVersion < 6 && + this.input.slice(start, end).indexOf("\\") !== -1) { return } + var re = this.strict ? this.reservedWordsStrict : this.reservedWords; + if (re.test(name)) { + if (!this.inAsync && name === "await") + { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); } + this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved")); + } + }; + + // Parse the next token as an identifier. If `liberal` is true (used + // when parsing properties), it will also convert keywords into + // identifiers. + + pp$5.parseIdent = function(liberal, isBinding) { + var node = this.startNode(); + if (this.type === types$1.name) { + node.name = this.value; + } else if (this.type.keyword) { + node.name = this.type.keyword; + + // To fix https://github.com/acornjs/acorn/issues/575 + // `class` and `function` keywords push new context into this.context. + // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name. + // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword + if ((node.name === "class" || node.name === "function") && + (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + this.context.pop(); + } + } else { + this.unexpected(); + } + this.next(!!liberal); + this.finishNode(node, "Identifier"); + if (!liberal) { + this.checkUnreserved(node); + if (node.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = node.start; } + } + return node + }; + + pp$5.parsePrivateIdent = function() { + var node = this.startNode(); + if (this.type === types$1.privateId) { + node.name = this.value; + } else { + this.unexpected(); + } + this.next(); + this.finishNode(node, "PrivateIdentifier"); + + // For validating existence + if (this.privateNameStack.length === 0) { + this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class")); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + } + + return node + }; + + // Parses yield expression inside generator. + + pp$5.parseYield = function(forInit) { + if (!this.yieldPos) { this.yieldPos = this.start; } + + var node = this.startNode(); + this.next(); + if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) { + node.delegate = false; + node.argument = null; + } else { + node.delegate = this.eat(types$1.star); + node.argument = this.parseMaybeAssign(forInit); + } + return this.finishNode(node, "YieldExpression") + }; + + pp$5.parseAwait = function(forInit) { + if (!this.awaitPos) { this.awaitPos = this.start; } + + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node, "AwaitExpression") + }; -/***/ 4294: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + var pp$4 = Parser.prototype; -module.exports = __nccwpck_require__(4219); + // This function is used to raise exceptions on parse errors. It + // takes an offset integer (into the current `input`) to indicate + // the location of the error, attaches the position to the end + // of the error message, and then raises a `SyntaxError` with that + // message. + pp$4.raise = function(pos, message) { + var loc = getLineInfo(this.input, pos); + message += " (" + loc.line + ":" + loc.column + ")"; + var err = new SyntaxError(message); + err.pos = pos; err.loc = loc; err.raisedAt = this.pos; + throw err + }; -/***/ }), + pp$4.raiseRecoverable = pp$4.raise; -/***/ 4219: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + pp$4.curPosition = function() { + if (this.options.locations) { + return new Position(this.curLine, this.pos - this.lineStart) + } + }; -"use strict"; + var pp$3 = Parser.prototype; + + var Scope = function Scope(flags) { + this.flags = flags; + // A list of var-declared names in the current lexical scope + this.var = []; + // A list of lexically-declared names in the current lexical scope + this.lexical = []; + // A list of lexically-declared FunctionDeclaration names in the current lexical scope + this.functions = []; + // A switch to disallow the identifier reference 'arguments' + this.inClassFieldInit = false; + }; + // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. -var net = __nccwpck_require__(1631); -var tls = __nccwpck_require__(4016); -var http = __nccwpck_require__(8605); -var https = __nccwpck_require__(7211); -var events = __nccwpck_require__(8614); -var assert = __nccwpck_require__(2357); -var util = __nccwpck_require__(1669); + pp$3.enterScope = function(flags) { + this.scopeStack.push(new Scope(flags)); + }; + pp$3.exitScope = function() { + this.scopeStack.pop(); + }; -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; + // The spec says: + // > At the top level of a function, or script, function declarations are + // > treated like var declarations rather than like lexical declarations. + pp$3.treatFunctionsAsVarInScope = function(scope) { + return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP) + }; + pp$3.declareName = function(name, bindingType, pos) { + var redeclared = false; + if (bindingType === BIND_LEXICAL) { + var scope = this.currentScope(); + redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; + scope.lexical.push(name); + if (this.inModule && (scope.flags & SCOPE_TOP)) + { delete this.undefinedExports[name]; } + } else if (bindingType === BIND_SIMPLE_CATCH) { + var scope$1 = this.currentScope(); + scope$1.lexical.push(name); + } else if (bindingType === BIND_FUNCTION) { + var scope$2 = this.currentScope(); + if (this.treatFunctionsAsVar) + { redeclared = scope$2.lexical.indexOf(name) > -1; } + else + { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; } + scope$2.functions.push(name); + } else { + for (var i = this.scopeStack.length - 1; i >= 0; --i) { + var scope$3 = this.scopeStack[i]; + if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) || + !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { + redeclared = true; + break + } + scope$3.var.push(name); + if (this.inModule && (scope$3.flags & SCOPE_TOP)) + { delete this.undefinedExports[name]; } + if (scope$3.flags & SCOPE_VAR) { break } + } + } + if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); } + }; -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} + pp$3.checkLocalExport = function(id) { + // scope.functions must be empty as Module code is always strict. + if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && + this.scopeStack[0].var.indexOf(id.name) === -1) { + this.undefinedExports[id.name] = id; + } + }; -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + pp$3.currentScope = function() { + return this.scopeStack[this.scopeStack.length - 1] + }; -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} + pp$3.currentVarScope = function() { + for (var i = this.scopeStack.length - 1;; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR) { return scope } + } + }; -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. + pp$3.currentThisScope = function() { + for (var i = this.scopeStack.length - 1;; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope } + } + }; + var Node = function Node(parser, pos, loc) { + this.type = ""; + this.start = pos; + this.end = 0; + if (parser.options.locations) + { this.loc = new SourceLocation(parser, loc); } + if (parser.options.directSourceFile) + { this.sourceFile = parser.options.directSourceFile; } + if (parser.options.ranges) + { this.range = [pos, 0]; } + }; -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; + // Start an AST node, attaching a start offset. - self.on('free', function onFree(socket, host, port, localAddress) { - var options = toOptions(host, port, localAddress); - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === options.host && pending.port === options.port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; + var pp$2 = Parser.prototype; + + pp$2.startNode = function() { + return new Node(this, this.start, this.startLoc) + }; + + pp$2.startNodeAt = function(pos, loc) { + return new Node(this, pos, loc) + }; + + // Finish an AST node, adding `type` and `end` properties. + + function finishNodeAt(node, type, pos, loc) { + node.type = type; + node.end = pos; + if (this.options.locations) + { node.loc.end = loc; } + if (this.options.ranges) + { node.range[1] = pos; } + return node + } + + pp$2.finishNode = function(node, type) { + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc) + }; + + // Finish node at given position + + pp$2.finishNodeAt = function(node, type, pos, loc) { + return finishNodeAt.call(this, node, type, pos, loc) + }; + + pp$2.copyNode = function(node) { + var newNode = new Node(this, node.start, this.startLoc); + for (var prop in node) { newNode[prop] = node[prop]; } + return newNode + }; + + // This file contains Unicode properties extracted from the ECMAScript + // specification. The lists are extracted like so: + // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) + + // #table-binary-unicode-properties + 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"; + var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; + var ecma11BinaryProperties = ecma10BinaryProperties; + var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; + var ecma13BinaryProperties = ecma12BinaryProperties; + var unicodeBinaryProperties = { + 9: ecma9BinaryProperties, + 10: ecma10BinaryProperties, + 11: ecma11BinaryProperties, + 12: ecma12BinaryProperties, + 13: ecma13BinaryProperties + }; + + // #table-unicode-general-category-values + 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"; + + // #table-unicode-script-values + var ecma9ScriptValues = "Adlam Adlm 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 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"; + var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; + var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; + var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; + var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; + var unicodeScriptValues = { + 9: ecma9ScriptValues, + 10: ecma10ScriptValues, + 11: ecma11ScriptValues, + 12: ecma12ScriptValues, + 13: ecma13ScriptValues + }; + + var data = {}; + function buildUnicodeData(ecmaVersion) { + var d = data[ecmaVersion] = { + binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), + nonBinary: { + General_Category: wordsRegexp(unicodeGeneralCategoryValues), + Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); + }; + d.nonBinary.Script_Extensions = d.nonBinary.Script; -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { - var self = this; - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + d.nonBinary.gc = d.nonBinary.General_Category; + d.nonBinary.sc = d.nonBinary.Script; + d.nonBinary.scx = d.nonBinary.Script_Extensions; + } - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push(options); - return; + for (var i = 0, list = [9, 10, 11, 12, 13]; i < list.length; i += 1) { + var ecmaVersion = list[i]; + + buildUnicodeData(ecmaVersion); } - // If we are under maxSockets create a new one. - self.createSocket(options, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); + var pp$1 = Parser.prototype; + + var RegExpValidationState = function RegExpValidationState(parser) { + this.parser = parser; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 13 ? 13 : parser.options.ecmaVersion]; + this.source = ""; + this.flags = ""; + this.start = 0; + this.switchU = false; + this.switchN = false; + this.pos = 0; + this.lastIntValue = 0; + this.lastStringValue = ""; + this.lastAssertionIsQuantifiable = false; + this.numCapturingParens = 0; + this.maxBackReference = 0; + this.groupNames = []; + this.backReferenceNames = []; + }; - function onFree() { - self.emit('free', socket, options); + RegExpValidationState.prototype.reset = function reset (start, pattern, flags) { + var unicode = flags.indexOf("u") !== -1; + this.start = start | 0; + this.source = pattern + ""; + this.flags = flags; + this.switchU = unicode && this.parser.options.ecmaVersion >= 6; + this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + }; + + RegExpValidationState.prototype.raise = function raise (message) { + this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message)); + }; + + // If u flag is given, this returns the code point at the index (it combines a surrogate pair). + // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair). + RegExpValidationState.prototype.at = function at (i, forceU) { + if ( forceU === void 0 ) forceU = false; + + var s = this.source; + var l = s.length; + if (i >= l) { + return -1 + } + var c = s.charCodeAt(i); + if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { + return c } + var next = s.charCodeAt(i + 1); + return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c + }; - function onCloseOrRemove(err) { - self.removeSocket(socket); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); + RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) { + if ( forceU === void 0 ) forceU = false; + + var s = this.source; + var l = s.length; + if (i >= l) { + return l } - }); -}; + var c = s.charCodeAt(i), next; + if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || + (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { + return i + 1 + } + return i + 2 + }; -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); + RegExpValidationState.prototype.current = function current (forceU) { + if ( forceU === void 0 ) forceU = false; - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false, - headers: { - host: options.host + ':' + options.port + return this.at(this.pos, forceU) + }; + + RegExpValidationState.prototype.lookahead = function lookahead (forceU) { + if ( forceU === void 0 ) forceU = false; + + return this.at(this.nextIndex(this.pos, forceU), forceU) + }; + + RegExpValidationState.prototype.advance = function advance (forceU) { + if ( forceU === void 0 ) forceU = false; + + this.pos = this.nextIndex(this.pos, forceU); + }; + + RegExpValidationState.prototype.eat = function eat (ch, forceU) { + if ( forceU === void 0 ) forceU = false; + + if (this.current(forceU) === ch) { + this.advance(forceU); + return true } - }); - if (options.localAddress) { - connectOptions.localAddress = options.localAddress; + return false + }; + + function codePointToString$1(ch) { + if (ch <= 0xFFFF) { return String.fromCharCode(ch) } + ch -= 0x10000; + return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00) } - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); + + /** + * Validate the flags part of a given RegExpLiteral. + * + * @param {RegExpValidationState} state The state to validate RegExp. + * @returns {void} + */ + pp$1.validateRegExpFlags = function(state) { + var validFlags = state.validFlags; + var flags = state.flags; + + for (var i = 0; i < flags.length; i++) { + var flag = flags.charAt(i); + if (validFlags.indexOf(flag) === -1) { + this.raise(state.start, "Invalid regular expression flag"); + } + if (flags.indexOf(flag, i + 1) > -1) { + this.raise(state.start, "Duplicate regular expression flag"); + } + } + }; + + /** + * Validate the pattern part of a given RegExpLiteral. + * + * @param {RegExpValidationState} state The state to validate RegExp. + * @returns {void} + */ + pp$1.validateRegExpPattern = function(state) { + this.regexp_pattern(state); + + // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of + // parsing contains a |GroupName|, reparse with the goal symbol + // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError* + // exception if _P_ did not conform to the grammar, if any elements of _P_ + // were not matched by the parse, or if any Early Error conditions exist. + if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) { + state.switchN = true; + this.regexp_pattern(state); + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern + pp$1.regexp_pattern = function(state) { + state.pos = 0; + state.lastIntValue = 0; + state.lastStringValue = ""; + state.lastAssertionIsQuantifiable = false; + state.numCapturingParens = 0; + state.maxBackReference = 0; + state.groupNames.length = 0; + state.backReferenceNames.length = 0; + + this.regexp_disjunction(state); + + if (state.pos !== state.source.length) { + // Make the same messages as V8. + if (state.eat(0x29 /* ) */)) { + state.raise("Unmatched ')'"); + } + if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) { + state.raise("Lone quantifier brackets"); + } + } + if (state.maxBackReference > state.numCapturingParens) { + state.raise("Invalid escape"); + } + for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) { + var name = list[i]; + + if (state.groupNames.indexOf(name) === -1) { + state.raise("Invalid named capture referenced"); + } + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction + pp$1.regexp_disjunction = function(state) { + this.regexp_alternative(state); + while (state.eat(0x7C /* | */)) { + this.regexp_alternative(state); + } + + // Make the same message as V8. + if (this.regexp_eatQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + if (state.eat(0x7B /* { */)) { + state.raise("Lone quantifier brackets"); + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative + pp$1.regexp_alternative = function(state) { + while (state.pos < state.source.length && this.regexp_eatTerm(state)) + { } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term + pp$1.regexp_eatTerm = function(state) { + if (this.regexp_eatAssertion(state)) { + // Handle `QuantifiableAssertion Quantifier` alternative. + // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion + // is a QuantifiableAssertion. + if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { + // Make the same message as V8. + if (state.switchU) { + state.raise("Invalid quantifier"); + } + } + return true + } + + if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { + this.regexp_eatQuantifier(state); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion + pp$1.regexp_eatAssertion = function(state) { + var start = state.pos; + state.lastAssertionIsQuantifiable = false; + + // ^, $ + if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) { + return true + } + + // \b \B + if (state.eat(0x5C /* \ */)) { + if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) { + return true + } + state.pos = start; + } + + // Lookahead / Lookbehind + if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) { + var lookbehind = false; + if (this.options.ecmaVersion >= 9) { + lookbehind = state.eat(0x3C /* < */); + } + if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) { + this.regexp_disjunction(state); + if (!state.eat(0x29 /* ) */)) { + state.raise("Unterminated group"); + } + state.lastAssertionIsQuantifiable = !lookbehind; + return true + } + } + + state.pos = start; + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier + pp$1.regexp_eatQuantifier = function(state, noError) { + if ( noError === void 0 ) noError = false; + + if (this.regexp_eatQuantifierPrefix(state, noError)) { + state.eat(0x3F /* ? */); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix + pp$1.regexp_eatQuantifierPrefix = function(state, noError) { + return ( + state.eat(0x2A /* * */) || + state.eat(0x2B /* + */) || + state.eat(0x3F /* ? */) || + this.regexp_eatBracedQuantifier(state, noError) + ) + }; + pp$1.regexp_eatBracedQuantifier = function(state, noError) { + var start = state.pos; + if (state.eat(0x7B /* { */)) { + var min = 0, max = -1; + if (this.regexp_eatDecimalDigits(state)) { + min = state.lastIntValue; + if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) { + max = state.lastIntValue; + } + if (state.eat(0x7D /* } */)) { + // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term + if (max !== -1 && max < min && !noError) { + state.raise("numbers out of order in {} quantifier"); + } + return true + } + } + if (state.switchU && !noError) { + state.raise("Incomplete quantifier"); + } + state.pos = start; + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom + pp$1.regexp_eatAtom = function(state) { + return ( + this.regexp_eatPatternCharacters(state) || + state.eat(0x2E /* . */) || + this.regexp_eatReverseSolidusAtomEscape(state) || + this.regexp_eatCharacterClass(state) || + this.regexp_eatUncapturingGroup(state) || + this.regexp_eatCapturingGroup(state) + ) + }; + pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { + var start = state.pos; + if (state.eat(0x5C /* \ */)) { + if (this.regexp_eatAtomEscape(state)) { + return true + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatUncapturingGroup = function(state) { + var start = state.pos; + if (state.eat(0x28 /* ( */)) { + if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) { + this.regexp_disjunction(state); + if (state.eat(0x29 /* ) */)) { + return true + } + state.raise("Unterminated group"); + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatCapturingGroup = function(state) { + if (state.eat(0x28 /* ( */)) { + if (this.options.ecmaVersion >= 9) { + this.regexp_groupSpecifier(state); + } else if (state.current() === 0x3F /* ? */) { + state.raise("Invalid group"); + } + this.regexp_disjunction(state); + if (state.eat(0x29 /* ) */)) { + state.numCapturingParens += 1; + return true + } + state.raise("Unterminated group"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom + pp$1.regexp_eatExtendedAtom = function(state) { + return ( + state.eat(0x2E /* . */) || + this.regexp_eatReverseSolidusAtomEscape(state) || + this.regexp_eatCharacterClass(state) || + this.regexp_eatUncapturingGroup(state) || + this.regexp_eatCapturingGroup(state) || + this.regexp_eatInvalidBracedQuantifier(state) || + this.regexp_eatExtendedPatternCharacter(state) + ) + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier + pp$1.regexp_eatInvalidBracedQuantifier = function(state) { + if (this.regexp_eatBracedQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter + pp$1.regexp_eatSyntaxCharacter = function(state) { + var ch = state.current(); + if (isSyntaxCharacter(ch)) { + state.lastIntValue = ch; + state.advance(); + return true + } + return false + }; + function isSyntaxCharacter(ch) { + return ( + ch === 0x24 /* $ */ || + ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ || + ch === 0x2E /* . */ || + ch === 0x3F /* ? */ || + ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ || + ch >= 0x7B /* { */ && ch <= 0x7D /* } */ + ) } - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); + // https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter + // But eat eager. + pp$1.regexp_eatPatternCharacters = function(state) { + var start = state.pos; + var ch = 0; + while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { + state.advance(); + } + return state.pos !== start + }; - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter + pp$1.regexp_eatExtendedPatternCharacter = function(state) { + var ch = state.current(); + if ( + ch !== -1 && + ch !== 0x24 /* $ */ && + !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) && + ch !== 0x2E /* . */ && + ch !== 0x3F /* ? */ && + ch !== 0x5B /* [ */ && + ch !== 0x5E /* ^ */ && + ch !== 0x7C /* | */ + ) { + state.advance(); + return true + } + return false + }; + + // GroupSpecifier :: + // [empty] + // `?` GroupName + pp$1.regexp_groupSpecifier = function(state) { + if (state.eat(0x3F /* ? */)) { + if (this.regexp_eatGroupName(state)) { + if (state.groupNames.indexOf(state.lastStringValue) !== -1) { + state.raise("Duplicate capture group name"); + } + state.groupNames.push(state.lastStringValue); + return + } + state.raise("Invalid group"); + } + }; + + // GroupName :: + // `<` RegExpIdentifierName `>` + // Note: this updates `state.lastStringValue` property with the eaten name. + pp$1.regexp_eatGroupName = function(state) { + state.lastStringValue = ""; + if (state.eat(0x3C /* < */)) { + if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) { + return true + } + state.raise("Invalid capture group name"); + } + return false + }; + + // RegExpIdentifierName :: + // RegExpIdentifierStart + // RegExpIdentifierName RegExpIdentifierPart + // Note: this updates `state.lastStringValue` property with the eaten name. + pp$1.regexp_eatRegExpIdentifierName = function(state) { + state.lastStringValue = ""; + if (this.regexp_eatRegExpIdentifierStart(state)) { + state.lastStringValue += codePointToString$1(state.lastIntValue); + while (this.regexp_eatRegExpIdentifierPart(state)) { + state.lastStringValue += codePointToString$1(state.lastIntValue); + } + return true + } + return false + }; + + // RegExpIdentifierStart :: + // UnicodeIDStart + // `$` + // `_` + // `\` RegExpUnicodeEscapeSequence[+U] + pp$1.regexp_eatRegExpIdentifierStart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + + if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierStart(ch)) { + state.lastIntValue = ch; + return true + } + + state.pos = start; + return false + }; + function isRegExpIdentifierStart(ch) { + return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ } - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); + // RegExpIdentifierPart :: + // UnicodeIDContinue + // `$` + // `_` + // `\` RegExpUnicodeEscapeSequence[+U] + // + // + pp$1.regexp_eatRegExpIdentifierPart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + + if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierPart(ch)) { + state.lastIntValue = ch; + return true + } + + state.pos = start; + return false + }; + function isRegExpIdentifierPart(ch) { + return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* */ || ch === 0x200D /* */ } - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape + pp$1.regexp_eatAtomEscape = function(state) { + if ( + this.regexp_eatBackReference(state) || + this.regexp_eatCharacterClassEscape(state) || + this.regexp_eatCharacterEscape(state) || + (state.switchN && this.regexp_eatKGroupName(state)) + ) { + return true + } + if (state.switchU) { + // Make the same message as V8. + if (state.current() === 0x63 /* c */) { + state.raise("Invalid unicode escape"); + } + state.raise("Invalid escape"); + } + return false + }; + pp$1.regexp_eatBackReference = function(state) { + var start = state.pos; + if (this.regexp_eatDecimalEscape(state)) { + var n = state.lastIntValue; + if (state.switchU) { + // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape + if (n > state.maxBackReference) { + state.maxBackReference = n; + } + return true + } + if (n <= state.numCapturingParens) { + return true + } + state.pos = start; + } + return false + }; + pp$1.regexp_eatKGroupName = function(state) { + if (state.eat(0x6B /* k */)) { + if (this.regexp_eatGroupName(state)) { + state.backReferenceNames.push(state.lastStringValue); + return true + } + state.raise("Invalid named reference"); + } + return false + }; - if (res.statusCode !== 200) { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - socket.destroy(); - var error = new Error('tunneling socket could not be established, ' + - 'statusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape + pp$1.regexp_eatCharacterEscape = function(state) { + return ( + this.regexp_eatControlEscape(state) || + this.regexp_eatCControlLetter(state) || + this.regexp_eatZero(state) || + this.regexp_eatHexEscapeSequence(state) || + this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || + (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) || + this.regexp_eatIdentityEscape(state) + ) + }; + pp$1.regexp_eatCControlLetter = function(state) { + var start = state.pos; + if (state.eat(0x63 /* c */)) { + if (this.regexp_eatControlLetter(state)) { + return true + } + state.pos = start; } - if (head.length > 0) { - debug('got illegal response body from proxy'); - socket.destroy(); - var error = new Error('got illegal response body from proxy'); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; + return false + }; + pp$1.regexp_eatZero = function(state) { + if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) { + state.lastIntValue = 0; + state.advance(); + return true } - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - return cb(socket); + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape + pp$1.regexp_eatControlEscape = function(state) { + var ch = state.current(); + if (ch === 0x74 /* t */) { + state.lastIntValue = 0x09; /* \t */ + state.advance(); + return true + } + if (ch === 0x6E /* n */) { + state.lastIntValue = 0x0A; /* \n */ + state.advance(); + return true + } + if (ch === 0x76 /* v */) { + state.lastIntValue = 0x0B; /* \v */ + state.advance(); + return true + } + if (ch === 0x66 /* f */) { + state.lastIntValue = 0x0C; /* \f */ + state.advance(); + return true + } + if (ch === 0x72 /* r */) { + state.lastIntValue = 0x0D; /* \r */ + state.advance(); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter + pp$1.regexp_eatControlLetter = function(state) { + var ch = state.current(); + if (isControlLetter(ch)) { + state.lastIntValue = ch % 0x20; + state.advance(); + return true + } + return false + }; + function isControlLetter(ch) { + return ( + (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) || + (ch >= 0x61 /* a */ && ch <= 0x7A /* z */) + ) } - function onError(cause) { - connectReq.removeAllListeners(); + // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence + pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { + if ( forceU === void 0 ) forceU = false; + + var start = state.pos; + var switchU = forceU || state.switchU; + + if (state.eat(0x75 /* u */)) { + if (this.regexp_eatFixedHexDigits(state, 4)) { + var lead = state.lastIntValue; + if (switchU && lead >= 0xD800 && lead <= 0xDBFF) { + var leadSurrogateEnd = state.pos; + if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) { + var trail = state.lastIntValue; + if (trail >= 0xDC00 && trail <= 0xDFFF) { + state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + return true + } + } + state.pos = leadSurrogateEnd; + state.lastIntValue = lead; + } + return true + } + if ( + switchU && + state.eat(0x7B /* { */) && + this.regexp_eatHexDigits(state) && + state.eat(0x7D /* } */) && + isValidUnicode(state.lastIntValue) + ) { + return true + } + if (switchU) { + state.raise("Invalid unicode escape"); + } + state.pos = start; + } - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); + return false + }; + function isValidUnicode(ch) { + return ch >= 0 && ch <= 0x10FFFF } -}; -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape + pp$1.regexp_eatIdentityEscape = function(state) { + if (state.switchU) { + if (this.regexp_eatSyntaxCharacter(state)) { + return true + } + if (state.eat(0x2F /* / */)) { + state.lastIntValue = 0x2F; /* / */ + return true + } + return false + } + + var ch = state.current(); + if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) { + state.lastIntValue = ch; + state.advance(); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape + pp$1.regexp_eatDecimalEscape = function(state) { + state.lastIntValue = 0; + var ch = state.current(); + if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) { + do { + state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */); + state.advance(); + } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape + pp$1.regexp_eatCharacterClassEscape = function(state) { + var ch = state.current(); + + if (isCharacterClassEscape(ch)) { + state.lastIntValue = -1; + state.advance(); + return true + } + + if ( + state.switchU && + this.options.ecmaVersion >= 9 && + (ch === 0x50 /* P */ || ch === 0x70 /* p */) + ) { + state.lastIntValue = -1; + state.advance(); + if ( + state.eat(0x7B /* { */) && + this.regexp_eatUnicodePropertyValueExpression(state) && + state.eat(0x7D /* } */) + ) { + return true + } + state.raise("Invalid property name"); + } + + return false + }; + function isCharacterClassEscape(ch) { + return ( + ch === 0x64 /* d */ || + ch === 0x44 /* D */ || + ch === 0x73 /* s */ || + ch === 0x53 /* S */ || + ch === 0x77 /* w */ || + ch === 0x57 /* W */ + ) } - this.sockets.splice(pos, 1); - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); + // UnicodePropertyValueExpression :: + // UnicodePropertyName `=` UnicodePropertyValue + // LoneUnicodePropertyNameOrValue + pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { + var start = state.pos; + + // UnicodePropertyName `=` UnicodePropertyValue + if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) { + var name = state.lastStringValue; + if (this.regexp_eatUnicodePropertyValue(state)) { + var value = state.lastStringValue; + this.regexp_validateUnicodePropertyNameAndValue(state, name, value); + return true + } + } + state.pos = start; + + // LoneUnicodePropertyNameOrValue + if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { + var nameOrValue = state.lastStringValue; + this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); + return true + } + return false + }; + pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { + if (!hasOwn(state.unicodeProperties.nonBinary, name)) + { state.raise("Invalid property name"); } + if (!state.unicodeProperties.nonBinary[name].test(value)) + { state.raise("Invalid property value"); } + }; + pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { + if (!state.unicodeProperties.binary.test(nameOrValue)) + { state.raise("Invalid property name"); } + }; + + // UnicodePropertyName :: + // UnicodePropertyNameCharacters + pp$1.regexp_eatUnicodePropertyName = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyNameCharacter(ch = state.current())) { + state.lastStringValue += codePointToString$1(ch); + state.advance(); + } + return state.lastStringValue !== "" + }; + function isUnicodePropertyNameCharacter(ch) { + return isControlLetter(ch) || ch === 0x5F /* _ */ } -}; -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - var hostHeader = options.request.getHeader('host'); - var tlsOptions = mergeOptions({}, self.options, { - socket: socket, - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host - }); + // UnicodePropertyValue :: + // UnicodePropertyValueCharacters + pp$1.regexp_eatUnicodePropertyValue = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyValueCharacter(ch = state.current())) { + state.lastStringValue += codePointToString$1(ch); + state.advance(); + } + return state.lastStringValue !== "" + }; + function isUnicodePropertyValueCharacter(ch) { + return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch) + } - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, tlsOptions); - self.sockets[self.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); - }); -} + // LoneUnicodePropertyNameOrValue :: + // UnicodePropertyValueCharacters + pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { + return this.regexp_eatUnicodePropertyValue(state) + }; + // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass + pp$1.regexp_eatCharacterClass = function(state) { + if (state.eat(0x5B /* [ */)) { + state.eat(0x5E /* ^ */); + this.regexp_classRanges(state); + if (state.eat(0x5D /* ] */)) { + return true + } + // Unreachable since it threw "unterminated regular expression" error before. + state.raise("Unterminated character class"); + } + return false + }; -function toOptions(host, port, localAddress) { - if (typeof host === 'string') { // since v0.10 - return { - host: host, - port: port, - localAddress: localAddress - }; + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges + // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges + // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash + pp$1.regexp_classRanges = function(state) { + while (this.regexp_eatClassAtom(state)) { + var left = state.lastIntValue; + if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) { + var right = state.lastIntValue; + if (state.switchU && (left === -1 || right === -1)) { + state.raise("Invalid character class"); + } + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + } + } + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom + // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash + pp$1.regexp_eatClassAtom = function(state) { + var start = state.pos; + + if (state.eat(0x5C /* \ */)) { + if (this.regexp_eatClassEscape(state)) { + return true + } + if (state.switchU) { + // Make the same message as V8. + var ch$1 = state.current(); + if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) { + state.raise("Invalid class escape"); + } + state.raise("Invalid escape"); + } + state.pos = start; + } + + var ch = state.current(); + if (ch !== 0x5D /* ] */) { + state.lastIntValue = ch; + state.advance(); + return true + } + + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape + pp$1.regexp_eatClassEscape = function(state) { + var start = state.pos; + + if (state.eat(0x62 /* b */)) { + state.lastIntValue = 0x08; /* */ + return true + } + + if (state.switchU && state.eat(0x2D /* - */)) { + state.lastIntValue = 0x2D; /* - */ + return true + } + + if (!state.switchU && state.eat(0x63 /* c */)) { + if (this.regexp_eatClassControlLetter(state)) { + return true + } + state.pos = start; + } + + return ( + this.regexp_eatCharacterClassEscape(state) || + this.regexp_eatCharacterEscape(state) + ) + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter + pp$1.regexp_eatClassControlLetter = function(state) { + var ch = state.current(); + if (isDecimalDigit(ch) || ch === 0x5F /* _ */) { + state.lastIntValue = ch % 0x20; + state.advance(); + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence + pp$1.regexp_eatHexEscapeSequence = function(state) { + var start = state.pos; + if (state.eat(0x78 /* x */)) { + if (this.regexp_eatFixedHexDigits(state, 2)) { + return true + } + if (state.switchU) { + state.raise("Invalid escape"); + } + state.pos = start; + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits + pp$1.regexp_eatDecimalDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isDecimalDigit(ch = state.current())) { + state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */); + state.advance(); + } + return state.pos !== start + }; + function isDecimalDigit(ch) { + return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */ } - return host; // for v0.11 or later -} -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits + pp$1.regexp_eatHexDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isHexDigit(ch = state.current())) { + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return state.pos !== start + }; + function isHexDigit(ch) { + return ( + (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) || + (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) || + (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) + ) + } + function hexToInt(ch) { + if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) { + return 10 + (ch - 0x41 /* A */) + } + if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) { + return 10 + (ch - 0x61 /* a */) + } + return ch - 0x30 /* 0 */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence + // Allows only 0-377(octal) i.e. 0-255(decimal). + pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { + if (this.regexp_eatOctalDigit(state)) { + var n1 = state.lastIntValue; + if (this.regexp_eatOctalDigit(state)) { + var n2 = state.lastIntValue; + if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { + state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; + } else { + state.lastIntValue = n1 * 8 + n2; + } + } else { + state.lastIntValue = n1; + } + return true + } + return false + }; + + // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit + pp$1.regexp_eatOctalDigit = function(state) { + var ch = state.current(); + if (isOctalDigit(ch)) { + state.lastIntValue = ch - 0x30; /* 0 */ + state.advance(); + return true + } + state.lastIntValue = 0; + return false + }; + function isOctalDigit(ch) { + return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */ + } + + // https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits + // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit + // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence + pp$1.regexp_eatFixedHexDigits = function(state, length) { + var start = state.pos; + state.lastIntValue = 0; + for (var i = 0; i < length; ++i) { + var ch = state.current(); + if (!isHexDigit(ch)) { + state.pos = start; + return false + } + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return true + }; + + // Object type used to represent tokens. Note that normally, tokens + // simply exist as properties on the parser object. This is only + // used for the onToken callback and the external tokenizer. + + var Token = function Token(p) { + this.type = p.type; + this.value = p.value; + this.start = p.start; + this.end = p.end; + if (p.options.locations) + { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); } + if (p.options.ranges) + { this.range = [p.start, p.end]; } + }; + + // ## Tokenizer + + var pp = Parser.prototype; + + // Move to the next token + + pp.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) + { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } + if (this.options.onToken) + { this.options.onToken(new Token(this)); } + + this.lastTokEnd = this.end; + this.lastTokStart = this.start; + this.lastTokEndLoc = this.endLoc; + this.lastTokStartLoc = this.startLoc; + this.nextToken(); + }; + + pp.getToken = function() { + this.next(); + return new Token(this) + }; + + // If we're in an ES6 environment, make parsers iterable + if (typeof Symbol !== "undefined") + { pp[Symbol.iterator] = function() { + var this$1$1 = this; + + return { + next: function () { + var token = this$1$1.getToken(); + return { + done: token.type === types$1.eof, + value: token + } + } + } + }; } + + // Toggle strict mode. Re-reads the next number or string to please + // pedantic tests (`"use strict"; 010;` should fail). + + // Read a single token, updating the parser object's token-related + // properties. + + pp.nextToken = function() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) { this.skipSpace(); } + + this.start = this.pos; + if (this.options.locations) { this.startLoc = this.curPosition(); } + if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) } + + if (curContext.override) { return curContext.override(this) } + else { this.readToken(this.fullCharCodeAtPos()); } + }; + + pp.readToken = function(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) + { return this.readWord() } + + return this.getTokenFromCode(code) + }; + + pp.fullCharCodeAtPos = function() { + var code = this.input.charCodeAt(this.pos); + if (code <= 0xd7ff || code >= 0xdc00) { return code } + var next = this.input.charCodeAt(this.pos + 1); + return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00 + }; + + pp.skipBlockComment = function() { + var startLoc = this.options.onComment && this.curPosition(); + var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); + if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); } + this.pos = end + 2; + if (this.options.locations) { + for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) { + ++this.curLine; + pos = this.lineStart = nextBreak; + } + } + if (this.options.onComment) + { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, + startLoc, this.curPosition()); } + }; + + pp.skipLineComment = function(startSkip) { + var start = this.pos; + var startLoc = this.options.onComment && this.curPosition(); + var ch = this.input.charCodeAt(this.pos += startSkip); + while (this.pos < this.input.length && !isNewLine(ch)) { + ch = this.input.charCodeAt(++this.pos); + } + if (this.options.onComment) + { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, + startLoc, this.curPosition()); } + }; + + // Called at the start of the parse and after every token. Skips + // whitespace and comments, and. + + pp.skipSpace = function() { + loop: while (this.pos < this.input.length) { + var ch = this.input.charCodeAt(this.pos); + switch (ch) { + case 32: case 160: // ' ' + ++this.pos; + break + case 13: + if (this.input.charCodeAt(this.pos + 1) === 10) { + ++this.pos; + } + case 10: case 8232: case 8233: + ++this.pos; + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + break + case 47: // '/' + switch (this.input.charCodeAt(this.pos + 1)) { + case 42: // '*' + this.skipBlockComment(); + break + case 47: + this.skipLineComment(2); + break + default: + break loop + } + break + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.pos; + } else { + break loop } } } - } - return target; -} + }; + // Called at the end of every token. Sets `end`, `val`, and + // maintains `context` and `exprAllowed`, and skips the space after + // the token, so that the next one's `start` will point at the + // right position. -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; + pp.finishToken = function(type, val) { + this.end = this.pos; + if (this.options.locations) { this.endLoc = this.curPosition(); } + var prevType = this.type; + this.type = type; + this.value = val; + + this.updateContext(prevType); + }; + + // ### Token reading + + // This is the function that is called to fetch the next token. It + // is somewhat obscure, because it works in character codes rather + // than characters, and because operator parsing has been inlined + // into it. + // + // All in the name of speed. + // + pp.readToken_dot = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next >= 48 && next <= 57) { return this.readNumber(true) } + var next2 = this.input.charCodeAt(this.pos + 2); + if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.' + this.pos += 3; + return this.finishToken(types$1.ellipsis) } else { - args.unshift('TUNNEL:'); + ++this.pos; + return this.finishToken(types$1.dot) } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test + }; + pp.readToken_slash = function() { // '/' + var next = this.input.charCodeAt(this.pos + 1); + if (this.exprAllowed) { ++this.pos; return this.readRegexp() } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.slash, 1) + }; -/***/ }), + pp.readToken_mult_modulo_exp = function(code) { // '%*' + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + var tokentype = code === 42 ? types$1.star : types$1.modulo; -/***/ 5840: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // exponentiation operator ** and **= + if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { + ++size; + tokentype = types$1.starstar; + next = this.input.charCodeAt(this.pos + 2); + } -"use strict"; + if (next === 61) { return this.finishOp(types$1.assign, size + 1) } + return this.finishOp(tokentype, size) + }; + pp.readToken_pipe_amp = function(code) { // '|&' + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { return this.finishOp(types$1.assign, 3) } + } + return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2) + } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1) + }; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -Object.defineProperty(exports, "v1", ({ - enumerable: true, - get: function () { - return _v.default; - } -})); -Object.defineProperty(exports, "v3", ({ - enumerable: true, - get: function () { - return _v2.default; - } -})); -Object.defineProperty(exports, "v4", ({ - enumerable: true, - get: function () { - return _v3.default; - } -})); -Object.defineProperty(exports, "v5", ({ - enumerable: true, - get: function () { - return _v4.default; - } -})); -Object.defineProperty(exports, "NIL", ({ - enumerable: true, - get: function () { - return _nil.default; - } -})); -Object.defineProperty(exports, "version", ({ - enumerable: true, - get: function () { - return _version.default; - } -})); -Object.defineProperty(exports, "validate", ({ - enumerable: true, - get: function () { - return _validate.default; - } -})); -Object.defineProperty(exports, "stringify", ({ - enumerable: true, - get: function () { - return _stringify.default; - } -})); -Object.defineProperty(exports, "parse", ({ - enumerable: true, - get: function () { - return _parse.default; - } -})); + pp.readToken_caret = function() { // '^' + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.bitwiseXOR, 1) + }; -var _v = _interopRequireDefault(__nccwpck_require__(8628)); + pp.readToken_plus_min = function(code) { // '+-' + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && + (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { + // A `-->` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken() + } + return this.finishOp(types$1.incDec, 2) + } + if (next === 61) { return this.finishOp(types$1.assign, 2) } + return this.finishOp(types$1.plusMin, 1) + }; -var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); + pp.readToken_lt_gt = function(code) { // '<>' + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) } + return this.finishOp(types$1.bitShift, size) + } + if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && + this.input.charCodeAt(this.pos + 3) === 45) { + // `