UNPKG

auth0-js

Version:

Auth0 headless browser sdk

1,674 lines (1,458 loc) 121 kB
/** * auth0-js v10.2.0 * Author: Auth0 * Date: 2026-06-25 * License: MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.CordovaAuth0Plugin = factory()); })(this, (function () { 'use strict'; 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; } function getAugmentedNamespace(n) { if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n; var f = n.default; if (typeof f == "function") { var a = function a () { var isInstance = false; try { isInstance = this instanceof a; } catch (e) {} if (isInstance) { return Reflect.construct(f, arguments, this.constructor); } return f.apply(this, arguments); }; a.prototype = f.prototype; } else a = {}; Object.defineProperty(a, '__esModule', {value: true}); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function () { return n[k]; } }); }); return a; } var version$1; var hasRequiredVersion; function requireVersion() { if (hasRequiredVersion) return version$1; hasRequiredVersion = 1; version$1 = { raw: '10.2.0' }; return version$1; } var versionExports = requireVersion(); var version = /*@__PURE__*/getDefaultExportFromCjs(versionExports); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var toString = Object.prototype.toString; function attribute(o, attr, type, text) { type = type === 'array' ? 'object' : type; if (o && _typeof(o[attr]) !== type) { throw new Error(text); } } function variable(o, type, text) { if (_typeof(o) !== type) { throw new Error(text); } } function value(o, values, text) { if (values.indexOf(o) === -1) { throw new Error(text); } } function check(o, config, attributes) { if (!config.optional || o) { variable(o, config.type, config.message); } if (config.type === 'object' && attributes) { var keys = Object.keys(attributes); for (var index = 0; index < keys.length; index++) { var a = keys[index]; if (!attributes[a].optional || o[a]) { if (!attributes[a].condition || attributes[a].condition(o)) { attribute(o, a, attributes[a].type, attributes[a].message); if (attributes[a].values) { value(o[a], attributes[a].values, attributes[a].value_message); } } } } } } /** * Wrap `Array.isArray` Polyfill for IE9 * source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray * * @param {Array} array * @private */ function isArray(array) { if (this.supportsIsArray()) { return Array.isArray(array); } return toString.call(array) === '[object Array]'; } function supportsIsArray() { return Array.isArray != null; } var assert = { check: check, attribute: attribute, variable: variable, value: value, isArray: isArray, supportsIsArray: supportsIsArray }; /* eslint-disable no-continue */ function get$1() { if (!Object.assign) { return objectAssignPolyfill; } return Object.assign; } function objectAssignPolyfill(target) { if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); for (var i = 1; i < arguments.length; i++) { var nextSource = arguments[i]; if (nextSource === undefined || nextSource === null) { continue; } var keysArray = Object.keys(Object(nextSource)); for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { var nextKey = keysArray[nextIndex]; var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { to[nextKey] = nextSource[nextKey]; } } } return to; } var objectAssign = { get: get$1, objectAssignPolyfill: objectAssignPolyfill }; function pick(object, keys) { return keys.reduce(function (prev, key) { if (object[key]) { prev[key] = object[key]; } return prev; }, {}); } function getKeysNotIn(obj, allowedKeys) { var notAllowed = []; for (var key in obj) { if (allowedKeys.indexOf(key) === -1) { notAllowed.push(key); } } return notAllowed; } function objectValues(obj) { var values = []; for (var key in obj) { values.push(obj[key]); } return values; } function extend() { var params = objectValues(arguments); params.unshift({}); return objectAssign.get().apply(undefined, params); } function merge(object, keys) { return { base: keys ? pick(object, keys) : object, with: function _with(object2, keys2) { object2 = keys2 ? pick(object2, keys2) : object2; return extend(this.base, object2); } }; } function blacklist(object, blacklistedKeys) { return Object.keys(object).reduce(function (p, key) { if (blacklistedKeys.indexOf(key) === -1) { p[key] = object[key]; } return p; }, {}); } function camelToSnake(str) { var newKey = ''; var index = 0; var code; var wasPrevNumber = true; var wasPrevUppercase = true; while (index < str.length) { code = str.charCodeAt(index); if (!wasPrevUppercase && code >= 65 && code <= 90 || !wasPrevNumber && code >= 48 && code <= 57) { newKey += '_'; newKey += str[index].toLowerCase(); } else { newKey += str[index].toLowerCase(); } wasPrevNumber = code >= 48 && code <= 57; wasPrevUppercase = code >= 65 && code <= 90; index++; } return newKey; } function snakeToCamel(str) { var parts = str.split('_'); return parts.reduce(function (p, c) { return p + c.charAt(0).toUpperCase() + c.slice(1); }, parts.shift()); } function toSnakeCase(object, exceptions) { if (_typeof(object) !== 'object' || assert.isArray(object) || object === null) { return object; } exceptions = exceptions || []; return Object.keys(object).reduce(function (p, key) { var newKey = exceptions.indexOf(key) === -1 ? camelToSnake(key) : key; p[newKey] = toSnakeCase(object[key]); return p; }, {}); } function toCamelCase(object, exceptions, options) { if (_typeof(object) !== 'object' || assert.isArray(object) || object === null) { return object; } exceptions = exceptions || []; options = options || {}; return Object.keys(object).reduce(function (p, key) { var newKey = exceptions.indexOf(key) === -1 ? snakeToCamel(key) : key; p[newKey] = toCamelCase(object[newKey] || object[key], [], options); if (options.keepOriginal) { p[key] = toCamelCase(object[key], [], options); } return p; }, {}); } function getLocationFromUrl(href) { var match = href.match(/^(https?:|file:|chrome-extension:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/); return match && { href: href, protocol: match[1], host: match[2], hostname: match[3], port: match[4], pathname: match[5], search: match[6], hash: match[7] }; } function getOriginFromUrl(url) { if (!url) { return undefined; } var parsed = getLocationFromUrl(url); if (!parsed) { return null; } var origin = parsed.protocol + '//' + parsed.hostname; if (parsed.port) { origin += ':' + parsed.port; } return origin; } function trim(options, key) { var trimmed = extend(options); if (options[key]) { trimmed[key] = options[key].trim(); } return trimmed; } function trimMultiple(options, keys) { return keys.reduce(trim, options); } function trimUserDetails(options) { return trimMultiple(options, ['username', 'email', 'phoneNumber']); } /** * Updates the value of a property on the given object, using a deep path selector. * @param {object} obj The object to set the property value on * @param {string|array} path The path to the property that should have its value updated. e.g. 'prop1.prop2.prop3' or ['prop1', 'prop2', 'prop3'] * @param {any} value The value to set * @ignore */ function updatePropertyOn(obj, path, value) { if (typeof path === 'string') { path = path.split('.'); } var next = path[0]; if (obj.hasOwnProperty(next)) { if (path.length === 1) { obj[next] = value; } else { updatePropertyOn(obj[next], path.slice(1), value); } } } var objectHelper = { toSnakeCase: toSnakeCase, toCamelCase: toCamelCase, blacklist: blacklist, merge: merge, pick: pick, getKeysNotIn: getKeysNotIn, extend: extend, getOriginFromUrl: getOriginFromUrl, getLocationFromUrl: getLocationFromUrl, trimUserDetails: trimUserDetails, updatePropertyOn: updatePropertyOn }; function redirect(url) { getWindow().location = url; } function getDocument() { return getWindow().document; } function getWindow() { return window; } function getOrigin() { var location = getWindow().location; var origin = location.origin; if (!origin) { origin = objectHelper.getOriginFromUrl(location.href); } return origin; } var windowHandler = { redirect: redirect, getDocument: getDocument, getWindow: getWindow, getOrigin: getOrigin }; var urlJoin$1 = {exports: {}}; var urlJoin = urlJoin$1.exports; var hasRequiredUrlJoin; function requireUrlJoin () { if (hasRequiredUrlJoin) return urlJoin$1.exports; hasRequiredUrlJoin = 1; (function (module) { (function (name, context, definition) { if (module.exports) module.exports = definition(); else context[name] = definition(); })('urljoin', urlJoin, function () { function normalize (strArray) { var resultArray = []; if (strArray.length === 0) { return ''; } if (typeof strArray[0] !== 'string') { throw new TypeError('Url must be a string. Received ' + strArray[0]); } // If the first part is a plain protocol, we combine it with the next part. if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) { var first = strArray.shift(); strArray[0] = first + strArray[0]; } // There must be two or three slashes in the file protocol, two slashes in anything else. if (strArray[0].match(/^file:\/\/\//)) { strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///'); } else { strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://'); } for (var i = 0; i < strArray.length; i++) { var component = strArray[i]; if (typeof component !== 'string') { throw new TypeError('Url must be a string. Received ' + component); } if (component === '') { continue; } if (i > 0) { // Removing the starting slashes for each component but the first. component = component.replace(/^[\/]+/, ''); } if (i < strArray.length - 1) { // Removing the ending slashes for each component but the last. component = component.replace(/[\/]+$/, ''); } else { // For the last component we will combine multiple slashes to a single one. component = component.replace(/[\/]+$/, '/'); } resultArray.push(component); } var str = resultArray.join('/'); // Each input component is now separated by a single slash except the possible first plain protocol part. // remove trailing slash before parameters or hash str = str.replace(/\/(\?|&|#[^!])/g, '$1'); // replace ? in parameters with & var parts = str.split('?'); str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&'); return str; } return function () { var input; if (typeof arguments[0] === 'object') { input = arguments[0]; } else { input = [].slice.call(arguments); } return normalize(input); }; }); } (urlJoin$1)); return urlJoin$1.exports; } var urlJoinExports = requireUrlJoin(); var urljoin = /*@__PURE__*/getDefaultExportFromCjs(urlJoinExports); var type; var hasRequiredType; function requireType () { if (hasRequiredType) return type; hasRequiredType = 1; /** @type {import('./type')} */ type = TypeError; return type; } var _nodeResolve_empty = {}; var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({ __proto__: null, default: _nodeResolve_empty }); var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1); var objectInspect; var hasRequiredObjectInspect; function requireObjectInspect () { if (hasRequiredObjectInspect) return objectInspect; hasRequiredObjectInspect = 1; var hasMap = typeof Map === 'function' && Map.prototype; var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; var mapForEach = hasMap && Map.prototype.forEach; var hasSet = typeof Set === 'function' && Set.prototype; var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; var setForEach = hasSet && Set.prototype.forEach; var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; var booleanValueOf = Boolean.prototype.valueOf; var objectToString = Object.prototype.toString; var functionToString = Function.prototype.toString; var $match = String.prototype.match; var $slice = String.prototype.slice; var $replace = String.prototype.replace; var $toUpperCase = String.prototype.toUpperCase; var $toLowerCase = String.prototype.toLowerCase; var $test = RegExp.prototype.test; var $concat = Array.prototype.concat; var $join = Array.prototype.join; var $arrSlice = Array.prototype.slice; var $floor = Math.floor; var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; var gOPS = Object.getOwnPropertySymbols; var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; // ie, `has-tostringtag/shams var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null; var isEnumerable = Object.prototype.propertyIsEnumerable; var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ( [].__proto__ === Array.prototype // eslint-disable-line no-proto ? function (O) { return O.__proto__; // eslint-disable-line no-proto } : null ); function addNumericSeparator(num, str) { if ( num === Infinity || num === -Infinity || num !== num || (num && num > -1e3 && num < 1000) || $test.call(/e/, str) ) { return str; } var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; if (typeof num === 'number') { var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) if (int !== num) { var intStr = String(int); var dec = $slice.call(str, intStr.length + 1); return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); } } return $replace.call(str, sepRegex, '$&_'); } var utilInspect = require$$0; var inspectCustom = utilInspect.custom; var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; var quotes = { __proto__: null, 'double': '"', single: "'" }; var quoteREs = { __proto__: null, 'double': /(["\\])/g, single: /(['\\])/g }; objectInspect = function inspect_(obj, options, depth, seen) { var opts = options || {}; if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) { throw new TypeError('option "quoteStyle" must be "single" or "double"'); } if ( has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null ) ) { throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); } var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); } if ( has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0) ) { throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); } if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); } var numericSeparator = opts.numericSeparator; if (typeof obj === 'undefined') { return 'undefined'; } if (obj === null) { return 'null'; } if (typeof obj === 'boolean') { return obj ? 'true' : 'false'; } if (typeof obj === 'string') { return inspectString(obj, opts); } if (typeof obj === 'number') { if (obj === 0) { return Infinity / obj > 0 ? '0' : '-0'; } var str = String(obj); return numericSeparator ? addNumericSeparator(obj, str) : str; } if (typeof obj === 'bigint') { var bigIntStr = String(obj) + 'n'; return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; } var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; if (typeof depth === 'undefined') { depth = 0; } if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { return isArray(obj) ? '[Array]' : '[Object]'; } var indent = getIndent(opts, depth); if (typeof seen === 'undefined') { seen = []; } else if (indexOf(seen, obj) >= 0) { return '[Circular]'; } function inspect(value, from, noIndent) { if (from) { seen = $arrSlice.call(seen); seen.push(from); } if (noIndent) { var newOpts = { depth: opts.depth }; if (has(opts, 'quoteStyle')) { newOpts.quoteStyle = opts.quoteStyle; } return inspect_(value, newOpts, depth + 1, seen); } return inspect_(value, opts, depth + 1, seen); } if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable var name = nameOf(obj); var keys = arrObjKeys(obj, inspect); return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); } if (isSymbol(obj)) { var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; } if (isElement(obj)) { var s = '<' + $toLowerCase.call(String(obj.nodeName)); var attrs = obj.attributes || []; for (var i = 0; i < attrs.length; i++) { s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); } s += '>'; if (obj.childNodes && obj.childNodes.length) { s += '...'; } s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>'; return s; } if (isArray(obj)) { if (obj.length === 0) { return '[]'; } var xs = arrObjKeys(obj, inspect); if (indent && !singleLineValues(xs)) { return '[' + indentedJoin(xs, indent) + ']'; } return '[ ' + $join.call(xs, ', ') + ' ]'; } if (isError(obj)) { var parts = arrObjKeys(obj, inspect); if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) { return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; } if (parts.length === 0) { return '[' + String(obj) + ']'; } return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; } if (typeof obj === 'object' && customInspect) { if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) { return utilInspect(obj, { depth: maxDepth - depth }); } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { return obj.inspect(); } } if (isMap(obj)) { var mapParts = []; if (mapForEach) { mapForEach.call(obj, function (value, key) { mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); }); } return collectionOf('Map', mapSize.call(obj), mapParts, indent); } if (isSet(obj)) { var setParts = []; if (setForEach) { setForEach.call(obj, function (value) { setParts.push(inspect(value, obj)); }); } return collectionOf('Set', setSize.call(obj), setParts, indent); } if (isWeakMap(obj)) { return weakCollectionOf('WeakMap'); } if (isWeakSet(obj)) { return weakCollectionOf('WeakSet'); } if (isWeakRef(obj)) { return weakCollectionOf('WeakRef'); } if (isNumber(obj)) { return markBoxed(inspect(Number(obj))); } if (isBigInt(obj)) { return markBoxed(inspect(bigIntValueOf.call(obj))); } if (isBoolean(obj)) { return markBoxed(booleanValueOf.call(obj)); } if (isString(obj)) { return markBoxed(inspect(String(obj))); } // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other /* eslint-env browser */ if (typeof window !== 'undefined' && obj === window) { return '{ [object Window] }'; } if ( (typeof globalThis !== 'undefined' && obj === globalThis) || (typeof commonjsGlobal !== 'undefined' && obj === commonjsGlobal) ) { return '{ [object globalThis] }'; } if (!isDate(obj) && !isRegExp(obj)) { var ys = arrObjKeys(obj, inspect); var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; var protoTag = obj instanceof Object ? '' : 'null prototype'; var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); if (ys.length === 0) { return tag + '{}'; } if (indent) { return tag + '{' + indentedJoin(ys, indent) + '}'; } return tag + '{ ' + $join.call(ys, ', ') + ' }'; } return String(obj); }; function wrapQuotes(s, defaultStyle, opts) { var style = opts.quoteStyle || defaultStyle; var quoteChar = quotes[style]; return quoteChar + s + quoteChar; } function quote(s) { return $replace.call(String(s), /"/g, '&quot;'); } function canTrustToString(obj) { return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined')); } function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); } function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); } function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); } function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); } function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); } function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); } function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); } // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives function isSymbol(obj) { if (hasShammedSymbols) { return obj && typeof obj === 'object' && obj instanceof Symbol; } if (typeof obj === 'symbol') { return true; } if (!obj || typeof obj !== 'object' || !symToString) { return false; } try { symToString.call(obj); return true; } catch (e) {} return false; } function isBigInt(obj) { if (!obj || typeof obj !== 'object' || !bigIntValueOf) { return false; } try { bigIntValueOf.call(obj); return true; } catch (e) {} return false; } var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; function has(obj, key) { return hasOwn.call(obj, key); } function toStr(obj) { return objectToString.call(obj); } function nameOf(f) { if (f.name) { return f.name; } var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); if (m) { return m[1]; } return null; } function indexOf(xs, x) { if (xs.indexOf) { return xs.indexOf(x); } for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) { return i; } } return -1; } function isMap(x) { if (!mapSize || !x || typeof x !== 'object') { return false; } try { mapSize.call(x); try { setSize.call(x); } catch (s) { return true; } return x instanceof Map; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakMap(x) { if (!weakMapHas || !x || typeof x !== 'object') { return false; } try { weakMapHas.call(x, weakMapHas); try { weakSetHas.call(x, weakSetHas); } catch (s) { return true; } return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakRef(x) { if (!weakRefDeref || !x || typeof x !== 'object') { return false; } try { weakRefDeref.call(x); return true; } catch (e) {} return false; } function isSet(x) { if (!setSize || !x || typeof x !== 'object') { return false; } try { setSize.call(x); try { mapSize.call(x); } catch (m) { return true; } return x instanceof Set; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakSet(x) { if (!weakSetHas || !x || typeof x !== 'object') { return false; } try { weakSetHas.call(x, weakSetHas); try { weakMapHas.call(x, weakMapHas); } catch (s) { return true; } return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isElement(x) { if (!x || typeof x !== 'object') { return false; } if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { return true; } return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; } function inspectString(str, opts) { if (str.length > opts.maxStringLength) { var remaining = str.length - opts.maxStringLength; var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; } var quoteRE = quoteREs[opts.quoteStyle || 'single']; quoteRE.lastIndex = 0; // eslint-disable-next-line no-control-regex var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte); return wrapQuotes(s, 'single', opts); } function lowbyte(c) { var n = c.charCodeAt(0); var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; if (x) { return '\\' + x; } return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); } function markBoxed(str) { return 'Object(' + str + ')'; } function weakCollectionOf(type) { return type + ' { ? }'; } function collectionOf(type, size, entries, indent) { var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); return type + ' (' + size + ') {' + joinedEntries + '}'; } function singleLineValues(xs) { for (var i = 0; i < xs.length; i++) { if (indexOf(xs[i], '\n') >= 0) { return false; } } return true; } function getIndent(opts, depth) { var baseIndent; if (opts.indent === '\t') { baseIndent = '\t'; } else if (typeof opts.indent === 'number' && opts.indent > 0) { baseIndent = $join.call(Array(opts.indent + 1), ' '); } else { return null; } return { base: baseIndent, prev: $join.call(Array(depth + 1), baseIndent) }; } function indentedJoin(xs, indent) { if (xs.length === 0) { return ''; } var lineJoiner = '\n' + indent.prev + indent.base; return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; } function arrObjKeys(obj, inspect) { var isArr = isArray(obj); var xs = []; if (isArr) { xs.length = obj.length; for (var i = 0; i < obj.length; i++) { xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; } } var syms = typeof gOPS === 'function' ? gOPS(obj) : []; var symMap; if (hasShammedSymbols) { symMap = {}; for (var k = 0; k < syms.length; k++) { symMap['$' + syms[k]] = syms[k]; } } for (var key in obj) { // eslint-disable-line no-restricted-syntax if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section continue; // eslint-disable-line no-restricted-syntax, no-continue } else if ($test.call(/[^\w$]/, key)) { xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); } else { xs.push(key + ': ' + inspect(obj[key], obj)); } } if (typeof gOPS === 'function') { for (var j = 0; j < syms.length; j++) { if (isEnumerable.call(obj, syms[j])) { xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); } } } return xs; } return objectInspect; } var sideChannelList; var hasRequiredSideChannelList; function requireSideChannelList () { if (hasRequiredSideChannelList) return sideChannelList; hasRequiredSideChannelList = 1; var inspect = /*@__PURE__*/ requireObjectInspect(); var $TypeError = /*@__PURE__*/ requireType(); /* * This function traverses the list returning the node corresponding to the given key. * * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. * By doing so, all the recently used nodes can be accessed relatively quickly. */ /** @type {import('./list.d.ts').listGetNode} */ // eslint-disable-next-line consistent-return var listGetNode = function (list, key, isDelete) { /** @type {typeof list | NonNullable<(typeof list)['next']>} */ var prev = list; /** @type {(typeof list)['next']} */ var curr; // eslint-disable-next-line eqeqeq for (; (curr = prev.next) != null; prev = curr) { if (curr.key === key) { prev.next = curr.next; if (!isDelete) { // eslint-disable-next-line no-extra-parens curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next); list.next = curr; // eslint-disable-line no-param-reassign } return curr; } } }; /** @type {import('./list.d.ts').listGet} */ var listGet = function (objects, key) { if (!objects) { return void undefined; } var node = listGetNode(objects, key); return node && node.value; }; /** @type {import('./list.d.ts').listSet} */ var listSet = function (objects, key, value) { var node = listGetNode(objects, key); if (node) { node.value = value; } else { // Prepend the new node to the beginning of the list objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens key: key, next: objects.next, value: value }); } }; /** @type {import('./list.d.ts').listHas} */ var listHas = function (objects, key) { if (!objects) { return false; } return !!listGetNode(objects, key); }; /** @type {import('./list.d.ts').listDelete} */ // eslint-disable-next-line consistent-return var listDelete = function (objects, key) { if (objects) { return listGetNode(objects, key, true); } }; /** @type {import('.')} */ sideChannelList = function getSideChannelList() { /** @typedef {ReturnType<typeof getSideChannelList>} Channel */ /** @typedef {Parameters<Channel['get']>[0]} K */ /** @typedef {Parameters<Channel['set']>[1]} V */ /** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { var root = $o && $o.next; var deletedNode = listDelete($o, key); if (deletedNode && root && root === deletedNode) { $o = void undefined; } return !!deletedNode; }, get: function (key) { return listGet($o, key); }, has: function (key) { return listHas($o, key); }, set: function (key, value) { if (!$o) { // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head $o = { next: void undefined }; } // eslint-disable-next-line no-extra-parens listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value); } }; // @ts-expect-error TODO: figure out why this is erroring return channel; }; return sideChannelList; } 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 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 shams; var hasRequiredShams; function requireShams () { if (hasRequiredShams) return shams; hasRequiredShams = 1; /** @type {import('./shams')} */ /* eslint complexity: [2, 18], max-statements: [2, 33] */ shams = 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; } var hasSymbols; var hasRequiredHasSymbols; function requireHasSymbols () { if (hasRequiredHasSymbols) return hasSymbols; hasRequiredHasSymbols = 1; var origSymbol = typeof Symbol !== 'undefined' && Symbol; var hasSymbolSham = requireShams(); /** @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('