UNPKG

@browsery/util

Version:

Browser compatible NodeJS util module

1,670 lines (1,386 loc) 86.8 kB
import process from 'process'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var util$1 = {}; var types = {}; var shams$1; var hasRequiredShams$1; function requireShams$1 () { if (hasRequiredShams$1) return shams$1; hasRequiredShams$1 = 1; /** @type {import('./shams')} */ /* eslint complexity: [2, 18], max-statements: [2, 33] */ shams$1 = function hasSymbols() { if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } if (typeof Symbol.iterator === 'symbol') { return true; } /** @type {{ [k in symbol]?: unknown }} */ var obj = {}; var sym = Symbol('test'); var symObj = Object(sym); if (typeof sym === 'string') { return false; } if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } // temp disabled per https://github.com/ljharb/object.assign/issues/17 // if (sym instanceof Symbol) { return false; } // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 // if (!(symObj instanceof Symbol)) { return false; } // if (typeof Symbol.prototype.toString !== 'function') { return false; } // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } var symVal = 42; obj[sym] = symVal; for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } var syms = Object.getOwnPropertySymbols(obj); if (syms.length !== 1 || syms[0] !== sym) { return false; } if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } if (typeof Object.getOwnPropertyDescriptor === 'function') { // eslint-disable-next-line no-extra-parens var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } } return true; }; return shams$1; } var shams; var hasRequiredShams; function requireShams () { if (hasRequiredShams) return shams; hasRequiredShams = 1; var hasSymbols = requireShams$1(); /** @type {import('.')} */ shams = function hasToStringTagShams() { return hasSymbols() && !!Symbol.toStringTag; }; return shams; } var esObjectAtoms; var hasRequiredEsObjectAtoms; function requireEsObjectAtoms () { if (hasRequiredEsObjectAtoms) return esObjectAtoms; hasRequiredEsObjectAtoms = 1; /** @type {import('.')} */ esObjectAtoms = Object; return esObjectAtoms; } var esErrors; var hasRequiredEsErrors; function requireEsErrors () { if (hasRequiredEsErrors) return esErrors; hasRequiredEsErrors = 1; /** @type {import('.')} */ esErrors = Error; return esErrors; } var _eval; var hasRequired_eval; function require_eval () { if (hasRequired_eval) return _eval; hasRequired_eval = 1; /** @type {import('./eval')} */ _eval = EvalError; return _eval; } var range; var hasRequiredRange; function requireRange () { if (hasRequiredRange) return range; hasRequiredRange = 1; /** @type {import('./range')} */ range = RangeError; return range; } var ref; var hasRequiredRef; function requireRef () { if (hasRequiredRef) return ref; hasRequiredRef = 1; /** @type {import('./ref')} */ ref = ReferenceError; return ref; } var syntax; var hasRequiredSyntax; function requireSyntax () { if (hasRequiredSyntax) return syntax; hasRequiredSyntax = 1; /** @type {import('./syntax')} */ syntax = SyntaxError; return syntax; } var type; var hasRequiredType; function requireType () { if (hasRequiredType) return type; hasRequiredType = 1; /** @type {import('./type')} */ type = TypeError; return type; } var uri; var hasRequiredUri; function requireUri () { if (hasRequiredUri) return uri; hasRequiredUri = 1; /** @type {import('./uri')} */ uri = URIError; return uri; } var abs; var hasRequiredAbs; function requireAbs () { if (hasRequiredAbs) return abs; hasRequiredAbs = 1; /** @type {import('./abs')} */ abs = Math.abs; return abs; } var floor; var hasRequiredFloor; function requireFloor () { if (hasRequiredFloor) return floor; hasRequiredFloor = 1; /** @type {import('./floor')} */ floor = Math.floor; return floor; } var max; var hasRequiredMax; function requireMax () { if (hasRequiredMax) return max; hasRequiredMax = 1; /** @type {import('./max')} */ max = Math.max; return max; } var min; var hasRequiredMin; function requireMin () { if (hasRequiredMin) return min; hasRequiredMin = 1; /** @type {import('./min')} */ min = Math.min; return min; } var pow; var hasRequiredPow; function requirePow () { if (hasRequiredPow) return pow; hasRequiredPow = 1; /** @type {import('./pow')} */ pow = Math.pow; return pow; } var round; var hasRequiredRound; function requireRound () { if (hasRequiredRound) return round; hasRequiredRound = 1; /** @type {import('./round')} */ round = Math.round; return round; } var _isNaN; var hasRequired_isNaN; function require_isNaN () { if (hasRequired_isNaN) return _isNaN; hasRequired_isNaN = 1; /** @type {import('./isNaN')} */ _isNaN = Number.isNaN || function isNaN(a) { return a !== a; }; return _isNaN; } var sign; var hasRequiredSign; function requireSign () { if (hasRequiredSign) return sign; hasRequiredSign = 1; var $isNaN = /*@__PURE__*/ require_isNaN(); /** @type {import('./sign')} */ sign = function sign(number) { if ($isNaN(number) || number === 0) { return number; } return number < 0 ? -1 : 1; }; return sign; } var gOPD; var hasRequiredGOPD; function requireGOPD () { if (hasRequiredGOPD) return gOPD; hasRequiredGOPD = 1; /** @type {import('./gOPD')} */ gOPD = Object.getOwnPropertyDescriptor; return gOPD; } var gopd; var hasRequiredGopd; function requireGopd () { if (hasRequiredGopd) return gopd; hasRequiredGopd = 1; /** @type {import('.')} */ var $gOPD = /*@__PURE__*/ requireGOPD(); if ($gOPD) { try { $gOPD([], 'length'); } catch (e) { // IE 8 has a broken gOPD $gOPD = null; } } gopd = $gOPD; return gopd; } var esDefineProperty; var hasRequiredEsDefineProperty; function requireEsDefineProperty () { if (hasRequiredEsDefineProperty) return esDefineProperty; hasRequiredEsDefineProperty = 1; /** @type {import('.')} */ var $defineProperty = Object.defineProperty || false; if ($defineProperty) { try { $defineProperty({}, 'a', { value: 1 }); } catch (e) { // IE 8 has a broken defineProperty $defineProperty = false; } } esDefineProperty = $defineProperty; return esDefineProperty; } var hasSymbols; var hasRequiredHasSymbols; function requireHasSymbols () { if (hasRequiredHasSymbols) return hasSymbols; hasRequiredHasSymbols = 1; var origSymbol = typeof Symbol !== 'undefined' && Symbol; var hasSymbolSham = requireShams$1(); /** @type {import('.')} */ hasSymbols = function hasNativeSymbols() { if (typeof origSymbol !== 'function') { return false; } if (typeof Symbol !== 'function') { return false; } if (typeof origSymbol('foo') !== 'symbol') { return false; } if (typeof Symbol('bar') !== 'symbol') { return false; } return hasSymbolSham(); }; return hasSymbols; } var Reflect_getPrototypeOf; var hasRequiredReflect_getPrototypeOf; function requireReflect_getPrototypeOf () { if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf; hasRequiredReflect_getPrototypeOf = 1; /** @type {import('./Reflect.getPrototypeOf')} */ Reflect_getPrototypeOf = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null; return Reflect_getPrototypeOf; } var Object_getPrototypeOf; var hasRequiredObject_getPrototypeOf; function requireObject_getPrototypeOf () { if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf; hasRequiredObject_getPrototypeOf = 1; var $Object = /*@__PURE__*/ requireEsObjectAtoms(); /** @type {import('./Object.getPrototypeOf')} */ Object_getPrototypeOf = $Object.getPrototypeOf || null; return Object_getPrototypeOf; } var implementation; var hasRequiredImplementation; function requireImplementation () { if (hasRequiredImplementation) return implementation; hasRequiredImplementation = 1; /* eslint no-invalid-this: 1 */ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; var toStr = Object.prototype.toString; var max = Math.max; var funcType = '[object Function]'; var concatty = function concatty(a, b) { var arr = []; for (var i = 0; i < a.length; i += 1) { arr[i] = a[i]; } for (var j = 0; j < b.length; j += 1) { arr[j + a.length] = b[j]; } return arr; }; var slicy = function slicy(arrLike, offset) { var arr = []; for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) { arr[j] = arrLike[i]; } return arr; }; var joiny = function (arr, joiner) { var str = ''; for (var i = 0; i < arr.length; i += 1) { str += arr[i]; if (i + 1 < arr.length) { str += joiner; } } return str; }; implementation = function bind(that) { var target = this; if (typeof target !== 'function' || toStr.apply(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } var args = slicy(arguments, 1); var bound; var binder = function () { if (this instanceof bound) { var result = target.apply( this, concatty(args, arguments) ); if (Object(result) === result) { return result; } return this; } return target.apply( that, concatty(args, arguments) ); }; var boundLength = max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs[i] = '$' + i; } bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); if (target.prototype) { var Empty = function Empty() {}; Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; return implementation; } var functionBind; var hasRequiredFunctionBind; function requireFunctionBind () { if (hasRequiredFunctionBind) return functionBind; hasRequiredFunctionBind = 1; var implementation = requireImplementation(); functionBind = Function.prototype.bind || implementation; return functionBind; } var functionCall; var hasRequiredFunctionCall; function requireFunctionCall () { if (hasRequiredFunctionCall) return functionCall; hasRequiredFunctionCall = 1; /** @type {import('./functionCall')} */ functionCall = Function.prototype.call; return functionCall; } var functionApply; var hasRequiredFunctionApply; function requireFunctionApply () { if (hasRequiredFunctionApply) return functionApply; hasRequiredFunctionApply = 1; /** @type {import('./functionApply')} */ functionApply = Function.prototype.apply; return functionApply; } var reflectApply; var hasRequiredReflectApply; function requireReflectApply () { if (hasRequiredReflectApply) return reflectApply; hasRequiredReflectApply = 1; /** @type {import('./reflectApply')} */ reflectApply = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; return reflectApply; } var actualApply; var hasRequiredActualApply; function requireActualApply () { if (hasRequiredActualApply) return actualApply; hasRequiredActualApply = 1; var bind = requireFunctionBind(); var $apply = requireFunctionApply(); var $call = requireFunctionCall(); var $reflectApply = requireReflectApply(); /** @type {import('./actualApply')} */ actualApply = $reflectApply || bind.call($call, $apply); return actualApply; } var callBindApplyHelpers; var hasRequiredCallBindApplyHelpers; function requireCallBindApplyHelpers () { if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers; hasRequiredCallBindApplyHelpers = 1; var bind = requireFunctionBind(); var $TypeError = /*@__PURE__*/ requireType(); var $call = requireFunctionCall(); var $actualApply = requireActualApply(); /** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ callBindApplyHelpers = function callBindBasic(args) { if (args.length < 1 || typeof args[0] !== 'function') { throw new $TypeError('a function is required'); } return $actualApply(bind, $call, args); }; return callBindApplyHelpers; } var get; var hasRequiredGet; function requireGet () { if (hasRequiredGet) return get; hasRequiredGet = 1; var callBind = requireCallBindApplyHelpers(); var gOPD = /*@__PURE__*/ requireGopd(); var hasProtoAccessor; try { // eslint-disable-next-line no-extra-parens, no-proto hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype; } catch (e) { if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') { throw e; } } // eslint-disable-next-line no-extra-parens var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__')); var $Object = Object; var $getPrototypeOf = $Object.getPrototypeOf; /** @type {import('./get')} */ get = desc && typeof desc.get === 'function' ? callBind([desc.get]) : typeof $getPrototypeOf === 'function' ? /** @type {import('./get')} */ function getDunder(value) { // eslint-disable-next-line eqeqeq return $getPrototypeOf(value == null ? value : $Object(value)); } : false; return get; } var getProto; var hasRequiredGetProto; function requireGetProto () { if (hasRequiredGetProto) return getProto; hasRequiredGetProto = 1; var reflectGetProto = requireReflect_getPrototypeOf(); var originalGetProto = requireObject_getPrototypeOf(); var getDunderProto = /*@__PURE__*/ requireGet(); /** @type {import('.')} */ getProto = reflectGetProto ? function getProto(O) { // @ts-expect-error TS can't narrow inside a closure, for some reason return reflectGetProto(O); } : originalGetProto ? function getProto(O) { if (!O || (typeof O !== 'object' && typeof O !== 'function')) { throw new TypeError('getProto: not an object'); } // @ts-expect-error TS can't narrow inside a closure, for some reason return originalGetProto(O); } : getDunderProto ? function getProto(O) { // @ts-expect-error TS can't narrow inside a closure, for some reason return getDunderProto(O); } : null; return getProto; } var hasown; var hasRequiredHasown; function requireHasown () { if (hasRequiredHasown) return hasown; hasRequiredHasown = 1; var call = Function.prototype.call; var $hasOwn = Object.prototype.hasOwnProperty; var bind = requireFunctionBind(); /** @type {import('.')} */ hasown = bind.call(call, $hasOwn); return hasown; } var getIntrinsic; var hasRequiredGetIntrinsic; function requireGetIntrinsic () { if (hasRequiredGetIntrinsic) return getIntrinsic; hasRequiredGetIntrinsic = 1; var undefined$1; var $Object = /*@__PURE__*/ requireEsObjectAtoms(); var $Error = /*@__PURE__*/ requireEsErrors(); var $EvalError = /*@__PURE__*/ require_eval(); var $RangeError = /*@__PURE__*/ requireRange(); var $ReferenceError = /*@__PURE__*/ requireRef(); var $SyntaxError = /*@__PURE__*/ requireSyntax(); var $TypeError = /*@__PURE__*/ requireType(); var $URIError = /*@__PURE__*/ requireUri(); var abs = /*@__PURE__*/ requireAbs(); var floor = /*@__PURE__*/ requireFloor(); var max = /*@__PURE__*/ requireMax(); var min = /*@__PURE__*/ requireMin(); var pow = /*@__PURE__*/ requirePow(); var round = /*@__PURE__*/ requireRound(); var sign = /*@__PURE__*/ requireSign(); var $Function = Function; // eslint-disable-next-line consistent-return var getEvalledConstructor = function (expressionSyntax) { try { return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); } catch (e) {} }; var $gOPD = /*@__PURE__*/ requireGopd(); var $defineProperty = /*@__PURE__*/ requireEsDefineProperty(); var throwTypeError = function () { throw new $TypeError(); }; var ThrowTypeError = $gOPD ? (function () { try { // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties arguments.callee; // IE 8 does not throw here return throwTypeError; } catch (calleeThrows) { try { // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') return $gOPD(arguments, 'callee').get; } catch (gOPDthrows) { return throwTypeError; } } }()) : throwTypeError; var hasSymbols = requireHasSymbols()(); var getProto = requireGetProto(); var $ObjectGPO = requireObject_getPrototypeOf(); var $ReflectGPO = requireReflect_getPrototypeOf(); var $apply = requireFunctionApply(); var $call = requireFunctionCall(); var needsEval = {}; var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array); var INTRINSICS = { __proto__: null, '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer, '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1, '%AsyncFromSyncIteratorPrototype%': undefined$1, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, '%AsyncGeneratorFunction%': needsEval, '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt, '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array, '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView, '%Date%': Date, '%decodeURI%': decodeURI, '%decodeURIComponent%': decodeURIComponent, '%encodeURI%': encodeURI, '%encodeURIComponent%': encodeURIComponent, '%Error%': $Error, '%eval%': eval, // eslint-disable-line no-eval '%EvalError%': $EvalError, '%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array, '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array, '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array, '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry, '%Function%': $Function, '%GeneratorFunction%': needsEval, '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array, '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array, '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1, '%JSON%': typeof JSON === 'object' ? JSON : undefined$1, '%Map%': typeof Map === 'undefined' ? undefined$1 : Map, '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': $Object, '%Object.getOwnPropertyDescriptor%': $gOPD, '%parseFloat%': parseFloat, '%parseInt%': parseInt, '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise, '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy, '%RangeError%': $RangeError, '%ReferenceError%': $ReferenceError, '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined$1 : Set, '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer, '%String%': String, '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1, '%Symbol%': hasSymbols ? Symbol : undefined$1, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, '%TypedArray%': TypedArray, '%TypeError%': $TypeError, '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array, '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray, '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array, '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array, '%URIError%': $URIError, '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap, '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef, '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet, '%Function.prototype.call%': $call, '%Function.prototype.apply%': $apply, '%Object.defineProperty%': $defineProperty, '%Object.getPrototypeOf%': $ObjectGPO, '%Math.abs%': abs, '%Math.floor%': floor, '%Math.max%': max, '%Math.min%': min, '%Math.pow%': pow, '%Math.round%': round, '%Math.sign%': sign, '%Reflect.getPrototypeOf%': $ReflectGPO }; if (getProto) { try { null.error; // eslint-disable-line no-unused-expressions } catch (e) { // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 var errorProto = getProto(getProto(e)); INTRINSICS['%Error.prototype%'] = errorProto; } } var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { value = getEvalledConstructor('async function () {}'); } else if (name === '%GeneratorFunction%') { value = getEvalledConstructor('function* () {}'); } else if (name === '%AsyncGeneratorFunction%') { value = getEvalledConstructor('async function* () {}'); } else if (name === '%AsyncGenerator%') { var fn = doEval('%AsyncGeneratorFunction%'); if (fn) { value = fn.prototype; } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); if (gen && getProto) { value = getProto(gen.prototype); } } INTRINSICS[name] = value; return value; }; var LEGACY_ALIASES = { __proto__: null, '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], '%ArrayPrototype%': ['Array', 'prototype'], '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], '%ArrayProto_values%': ['Array', 'prototype', 'values'], '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], '%BooleanPrototype%': ['Boolean', 'prototype'], '%DataViewPrototype%': ['DataView', 'prototype'], '%DatePrototype%': ['Date', 'prototype'], '%ErrorPrototype%': ['Error', 'prototype'], '%EvalErrorPrototype%': ['EvalError', 'prototype'], '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], '%FunctionPrototype%': ['Function', 'prototype'], '%Generator%': ['GeneratorFunction', 'prototype'], '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], '%JSONParse%': ['JSON', 'parse'], '%JSONStringify%': ['JSON', 'stringify'], '%MapPrototype%': ['Map', 'prototype'], '%NumberPrototype%': ['Number', 'prototype'], '%ObjectPrototype%': ['Object', 'prototype'], '%ObjProto_toString%': ['Object', 'prototype', 'toString'], '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], '%PromisePrototype%': ['Promise', 'prototype'], '%PromiseProto_then%': ['Promise', 'prototype', 'then'], '%Promise_all%': ['Promise', 'all'], '%Promise_reject%': ['Promise', 'reject'], '%Promise_resolve%': ['Promise', 'resolve'], '%RangeErrorPrototype%': ['RangeError', 'prototype'], '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], '%RegExpPrototype%': ['RegExp', 'prototype'], '%SetPrototype%': ['Set', 'prototype'], '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], '%StringPrototype%': ['String', 'prototype'], '%SymbolPrototype%': ['Symbol', 'prototype'], '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], '%TypedArrayPrototype%': ['TypedArray', 'prototype'], '%TypeErrorPrototype%': ['TypeError', 'prototype'], '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], '%URIErrorPrototype%': ['URIError', 'prototype'], '%WeakMapPrototype%': ['WeakMap', 'prototype'], '%WeakSetPrototype%': ['WeakSet', 'prototype'] }; var bind = requireFunctionBind(); var hasOwn = /*@__PURE__*/ requireHasown(); var $concat = bind.call($call, Array.prototype.concat); var $spliceApply = bind.call($apply, Array.prototype.splice); var $replace = bind.call($call, String.prototype.replace); var $strSlice = bind.call($call, String.prototype.slice); var $exec = bind.call($call, RegExp.prototype.exec); /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ var stringToPath = function stringToPath(string) { var first = $strSlice(string, 0, 1); var last = $strSlice(string, -1); if (first === '%' && last !== '%') { throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); } else if (last === '%' && first !== '%') { throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); } var result = []; $replace(string, rePropName, function (match, number, quote, subString) { result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; }); return result; }; /* end adaptation */ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { var intrinsicName = name; var alias; if (hasOwn(LEGACY_ALIASES, intrinsicName)) { alias = LEGACY_ALIASES[intrinsicName]; intrinsicName = '%' + alias[0] + '%'; } if (hasOwn(INTRINSICS, intrinsicName)) { var value = INTRINSICS[intrinsicName]; if (value === needsEval) { value = doEval(intrinsicName); } if (typeof value === 'undefined' && !allowMissing) { throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); } return { alias: alias, name: intrinsicName, value: value }; } throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); }; getIntrinsic = function GetIntrinsic(name, allowMissing) { if (typeof name !== 'string' || name.length === 0) { throw new $TypeError('intrinsic name must be a non-empty string'); } if (arguments.length > 1 && typeof allowMissing !== 'boolean') { throw new $TypeError('"allowMissing" argument must be a boolean'); } if ($exec(/^%?[^%]*%?$/, name) === null) { throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); var intrinsicRealName = intrinsic.name; var value = intrinsic.value; var skipFurtherCaching = false; var alias = intrinsic.alias; if (alias) { intrinsicBaseName = alias[0]; $spliceApply(parts, $concat([0, 1], alias)); } for (var i = 1, isOwn = true; i < parts.length; i += 1) { var part = parts[i]; var first = $strSlice(part, 0, 1); var last = $strSlice(part, -1); if ( ( (first === '"' || first === "'" || first === '`') || (last === '"' || last === "'" || last === '`') ) && first !== last ) { throw new $SyntaxError('property names with quotes must have matching quotes'); } if (part === 'constructor' || !isOwn) { skipFurtherCaching = true; } intrinsicBaseName += '.' + part; intrinsicRealName = '%' + intrinsicBaseName + '%'; if (hasOwn(INTRINSICS, intrinsicRealName)) { value = INTRINSICS[intrinsicRealName]; } else if (value != null) { if (!(part in value)) { if (!allowMissing) { throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); } return void undefined$1; } if ($gOPD && (i + 1) >= parts.length) { var desc = $gOPD(value, part); isOwn = !!desc; // By convention, when a data property is converted to an accessor // property to emulate a data property that does not suffer from // the override mistake, that accessor's getter is marked with // an `originalValue` property. Here, when we detect this, we // uphold the illusion by pretending to see that original data // property, i.e., returning the value rather than the getter // itself. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { value = desc.get; } else { value = value[part]; } } else { isOwn = hasOwn(value, part); value = value[part]; } if (isOwn && !skipFurtherCaching) { INTRINSICS[intrinsicRealName] = value; } } } return value; }; return getIntrinsic; } var callBound; var hasRequiredCallBound; function requireCallBound () { if (hasRequiredCallBound) return callBound; hasRequiredCallBound = 1; var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic(); var callBindBasic = requireCallBindApplyHelpers(); /** @type {(thisArg: string, searchString: string, position?: number) => number} */ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); /** @type {import('.')} */ callBound = function callBoundIntrinsic(name, allowMissing) { /* eslint no-extra-parens: 0 */ var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { return callBindBasic(/** @type {const} */ ([intrinsic])); } return intrinsic; }; return callBound; } var isArguments; var hasRequiredIsArguments; function requireIsArguments () { if (hasRequiredIsArguments) return isArguments; hasRequiredIsArguments = 1; var hasToStringTag = requireShams()(); var callBound = /*@__PURE__*/ requireCallBound(); var $toString = callBound('Object.prototype.toString'); /** @type {import('.')} */ var isStandardArguments = function isArguments(value) { if ( hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value ) { return false; } return $toString(value) === '[object Arguments]'; }; /** @type {import('.')} */ var isLegacyArguments = function isArguments(value) { if (isStandardArguments(value)) { return true; } return value !== null && typeof value === 'object' && 'length' in value && typeof value.length === 'number' && value.length >= 0 && $toString(value) !== '[object Array]' && 'callee' in value && $toString(value.callee) === '[object Function]'; }; var supportsStandardArguments = (function () { return isStandardArguments(arguments); }()); // @ts-expect-error TODO make this not error isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests /** @type {import('.')} */ isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments; return isArguments; } var isRegex; var hasRequiredIsRegex; function requireIsRegex () { if (hasRequiredIsRegex) return isRegex; hasRequiredIsRegex = 1; var callBound = /*@__PURE__*/ requireCallBound(); var hasToStringTag = requireShams()(); var hasOwn = /*@__PURE__*/ requireHasown(); var gOPD = /*@__PURE__*/ requireGopd(); /** @type {import('.')} */ var fn; if (hasToStringTag) { /** @type {(receiver: ThisParameterType<typeof RegExp.prototype.exec>, ...args: Parameters<typeof RegExp.prototype.exec>) => ReturnType<typeof RegExp.prototype.exec>} */ var $exec = callBound('RegExp.prototype.exec'); /** @type {object} */ var isRegexMarker = {}; var throwRegexMarker = function () { throw isRegexMarker; }; /** @type {{ toString(): never, valueOf(): never, [Symbol.toPrimitive]?(): never }} */ var badStringifier = { toString: throwRegexMarker, valueOf: throwRegexMarker }; if (typeof Symbol.toPrimitive === 'symbol') { badStringifier[Symbol.toPrimitive] = throwRegexMarker; } /** @type {import('.')} */ // @ts-expect-error TS can't figure out that the $exec call always throws // eslint-disable-next-line consistent-return fn = function isRegex(value) { if (!value || typeof value !== 'object') { return false; } // eslint-disable-next-line no-extra-parens var descriptor = /** @type {NonNullable<typeof gOPD>} */ (gOPD)(/** @type {{ lastIndex?: unknown }} */ (value), 'lastIndex'); var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, 'value'); if (!hasLastIndexDataProperty) { return false; } try { // eslint-disable-next-line no-extra-parens $exec(value, /** @type {string} */ (/** @type {unknown} */ (badStringifier))); } catch (e) { return e === isRegexMarker; } }; } else { /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */ var $toString = callBound('Object.prototype.toString'); /** @const @type {'[object RegExp]'} */ var regexClass = '[object RegExp]'; /** @type {import('.')} */ fn = function isRegex(value) { // In older browsers, typeof regex incorrectly returns 'function' if (!value || (typeof value !== 'object' && typeof value !== 'function')) { return false; } return $toString(value) === regexClass; }; } isRegex = fn; return isRegex; } var safeRegexTest; var hasRequiredSafeRegexTest; function requireSafeRegexTest () { if (hasRequiredSafeRegexTest) return safeRegexTest; hasRequiredSafeRegexTest = 1; var callBound = /*@__PURE__*/ requireCallBound(); var isRegex = requireIsRegex(); var $exec = callBound('RegExp.prototype.exec'); var $TypeError = /*@__PURE__*/ requireType(); /** @type {import('.')} */ safeRegexTest = function regexTester(regex) { if (!isRegex(regex)) { throw new $TypeError('`regex` must be a RegExp'); } return function test(s) { return $exec(regex, s) !== null; }; }; return safeRegexTest; } var generatorFunction; var hasRequiredGeneratorFunction; function requireGeneratorFunction () { if (hasRequiredGeneratorFunction) return generatorFunction; hasRequiredGeneratorFunction = 1; // eslint-disable-next-line no-extra-parens, no-empty-function const cached = /** @type {GeneratorFunctionConstructor} */ (function* () {}.constructor); /** @type {import('.')} */ generatorFunction = () => cached; return generatorFunction; } var isGeneratorFunction; var hasRequiredIsGeneratorFunction; function requireIsGeneratorFunction () { if (hasRequiredIsGeneratorFunction) return isGeneratorFunction; hasRequiredIsGeneratorFunction = 1; var callBound = /*@__PURE__*/ requireCallBound(); var safeRegexTest = /*@__PURE__*/ requireSafeRegexTest(); var isFnRegex = safeRegexTest(/^\s*(?:function)?\*/); var hasToStringTag = requireShams()(); var getProto = requireGetProto(); var toStr = callBound('Object.prototype.toString'); var fnToStr = callBound('Function.prototype.toString'); var getGeneratorFunction = /*@__PURE__*/ requireGeneratorFunction(); /** @type {import('.')} */ isGeneratorFunction = function isGeneratorFunction(fn) { if (typeof fn !== 'function') { return false; } if (isFnRegex(fnToStr(fn))) { return true; } if (!hasToStringTag) { var str = toStr(fn); return str === '[object GeneratorFunction]'; } if (!getProto) { return false; } var GeneratorFunction = getGeneratorFunction(); return GeneratorFunction && getProto(fn) === GeneratorFunction.prototype; }; return isGeneratorFunction; } var isCallable; var hasRequiredIsCallable; function requireIsCallable () { if (hasRequiredIsCallable) return isCallable; hasRequiredIsCallable = 1; var fnToStr = Function.prototype.toString; var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; var badArrayLike; var isCallableMarker; if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { try { badArrayLike = Object.defineProperty({}, 'length', { get: function () { throw isCallableMarker; } }); isCallableMarker = {}; // eslint-disable-next-line no-throw-literal reflectApply(function () { throw 42; }, null, badArrayLike); } catch (_) { if (_ !== isCallableMarker) { reflectApply = null; } } } else { reflectApply = null; } var constructorRegex = /^\s*class\b/; var isES6ClassFn = function isES6ClassFunction(value) { try { var fnStr = fnToStr.call(value); return constructorRegex.test(fnStr); } catch (e) { return false; // not a function } }; var tryFunctionObject = function tryFunctionToStr(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var objectClass = '[object Object]'; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; var ddaClass = '[object HTMLAllCollection]'; // IE 11 var ddaClass2 = '[object HTML document.all class]'; var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing var isDDA = function isDocumentDotAll() { return false; }; if (typeof document === 'object') { // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly var all = document.all; if (toStr.call(all) === toStr.call(document.all)) { isDDA = function isDocumentDotAll(value) { /* globals document: false */ // in IE 6-8, typeof document.all is "object" and it's truthy if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { try { var str = toStr.call(value); return ( str === ddaClass || str === ddaClass2 || str === ddaClass3 // opera 12.16 || str === objectClass // IE 6-8 ) && value('') == null; // eslint-disable-line eqeqeq } catch (e) { /**/ } } return false; }; } } isCallable = reflectApply ? function isCallable(value) { if (isDDA(value)) { return true; } if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } try { reflectApply(value, null, badArrayLike); } catch (e) { if (e !== isCallableMarker) { return false; } } return !isES6ClassFn(value) && tryFunctionObject(value); } : function isCallable(value) { if (isDDA(value)) { return true; } if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = toStr.call(value); if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } return tryFunctionObject(value); }; return isCallable; } var forEach; var hasRequiredForEach; function requireForEach () { if (hasRequiredForEach) return forEach; hasRequiredForEach = 1; var isCallable = requireIsCallable(); var toStr = Object.prototype.toString; var hasOwnProperty = Object.prototype.hasOwnProperty; /** @type {<This, A extends readonly unknown[]>(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */ var forEachArray = function forEachArray(array, iterator, receiver) { for (var i = 0, len = array.length; i < len; i++) { if (hasOwnProperty.call(array, i)) { if (receiver == null) { iterator(array[i], i, array); } else { iterator.call(receiver, array[i], i, array); } } } }; /** @type {<This, S extends string>(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */ var forEachString = function forEachString(string, iterator, receiver) { for (var i = 0, len = string.length; i < len; i++) { // no such thing as a sparse string. if (receiver == null) { iterator(string.charAt(i), i, string); } else { iterator.call(receiver, string.charAt(i), i, string); } } }; /** @type {<This, O>(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */ var forEachObject = function forEachObject(object, iterator, receiver) { for (var k in object) { if (hasOwnProperty.call(object, k)) { if (receiver == null) { iterator(object[k], k, object); } else { iterator.call(receiver, object[k], k, object); } } } }; /** @type {(x: unknown) => x is readonly unknown[]} */ function isArray(x) { return toStr.call(x) === '[object Array]'; } /** @type {import('.')._internal} */ forEach = function forEach(list, iterator, thisArg) { if (!isCallable(iterator)) { throw new TypeError('iterator must be a function'); } var receiver; if (arguments.length >= 3) { receiver = thisArg; } if (isArray(list)) { forEachArray(list, iterator, receiver); } else if (typeof list === 'string') { forEachString(list, iterator, receiver); } else { forEachObject(list, iterator, receiver); } }; return forEach; } var possibleTypedArrayNames; var hasRequiredPossibleTypedArrayNames; function requirePossibleTypedArrayNames () { if (hasRequiredPossibleTypedArrayNames) return possibleTypedArrayNames; hasRequiredPossibleTypedArrayNames = 1; /** @type {import('.')} */ possibleTypedArrayNames = [ 'Float16Array', 'Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array' ]; return possibleTypedArrayNames; } var availableTypedArrays; var hasRequiredAvailableTypedArrays; function requireAvailableTypedArrays () { if (hasRequiredAvailableTypedArrays) return availableTypedArrays; hasRequiredAvailableTypedArrays = 1; var possibleNames = /*@__PURE__*/ requirePossibleTypedArrayNames(); var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis; /** @type {import('.')} */ availableTypedArrays = function availableTypedArrays() { var /** @type {ReturnType<typeof availableTypedArrays>} */ out = []; for (var i = 0; i < possibleNames.length; i++) { if (typeof g[possibleNames[i]] === 'function') { // @ts-expect-error out[out.length] = possibleNames[i]; } } return out; }; return availableTypedArrays; } var callBind = {exports: {}}; var defineDataProperty; var hasRequiredDefineDataProperty; function requireDefineDataProperty () { if (hasRequiredDefineDataProperty) return defineDataProperty; hasRequiredDefineDataProperty = 1; var $defineProperty = /*@__PURE__*/ requireEsDefineProperty(); var $SyntaxError = /*@__PURE__*/ requireSyntax(); var $TypeError = /*@__PURE__*/ requireType(); var gopd = /*@__PURE__*/ requireGopd(); /** @type {import('.')} */ defineDataProperty = function defineDataProperty( obj, property, value ) { if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { throw new $TypeError('`obj` must be an object or a function`'); } if (typeof property !== 'string' && typeof property !== 'symbol') { throw new $TypeError('`property` must be a string or a symbol`'); } if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); } if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); } if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); } if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { throw new $TypeError('`loose`, if provided, must be a boolean'); } var nonEnumerable = arguments.length > 3 ? arguments[3] : null; var nonWritable = arguments.length > 4 ? arguments[4] : null; var nonConfigurable = arguments.length > 5 ? arguments[5] : null; var loose = arguments.length > 6 ? arguments[6] : false; /* @type {false | TypedPropertyDescriptor<unknown>} */ var desc = !!gopd && gopd(obj, property); if ($defineProperty) { $defineProperty(obj, property, { configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, value: value, writable: nonWritable === null && desc ? desc.writable : !nonWritable }); } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable obj[property] = value; // eslint-disable-line no-param-reassign } else { throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); } }; return defineDataProperty; } var hasPropertyDescriptors_1; var hasRequiredHasPropertyDescriptors; function requireHasPropertyDescriptors () { if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1; hasRequiredHasPropertyDescriptors = 1; var $defineProperty = /*@__PURE__*/ requireEsDefineProperty(); var hasPropertyDescriptors = function hasPropertyDescriptors() { return !!$defineProperty; }; hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { // node v0.6 has a bug where array lengths can be Set but not Defined if (!$defineProperty) { return null; } try { return $defineProperty([], 'length', { value: 1 }).length !== 1; } catch (e) { // In Firefox 4-22, defining length on an array throws an exception. return true; } }; hasPropertyDescriptors_1 = hasPropertyDescriptors; return hasPropertyDescriptors_1; } var setFunctionLength; var hasRequiredSetFunctionLength; function requireSetFunctionLength () { if (hasRequiredSetFunctionLength) return setFunctionLength; hasRequiredSetFunctionLength = 1; var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic(); var define = /*@__PURE__*/ requireDefineDataProperty(); var hasDescriptors = /*@__PURE__*/ requireHasPropertyDescriptors()(); var gOPD = /*@__PURE__*/ requireGopd(); var $TypeError = /*@__PURE__*/ requireType(); var $floor = GetIntrinsic('%Math.floor%'); /** @type {import('.')} */ setFunctionLength = function setFunctionLength(fn, length) { if (typeof fn !== 'function') { throw new $TypeError('`fn` is not a function'); } if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { throw new $TypeError('`length` must be a positive 32-bit integer'); } var loose = arguments.length > 2 && !!arguments[2]; var functionLengthIsConfigurable = true; var functionLengthIsWritable = true; if ('length' in fn && gOPD) { var desc = gOPD(fn, 'length'); if (desc && !desc.configurable) { functionLengthIsConfigurable = false; } if (desc && !desc.writable) { functionLengthIsWritable = false; } } if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { if (hasDescriptors) { define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true); } else { define(/** @type {Parameters<define>[0]} */ (fn), 'length', length); } } return fn; }; return setFunctionLength; } var applyBind; var hasRequiredApplyBind; function requireApplyBind () { if (hasRequiredApplyBind) return applyBind; hasRequiredApplyBind = 1; var bind = requireFunctionBind(); var $apply = requireFunctionApply()