@jspm/core
Version:
This package contains the core libraries used in jspm 2.
1,346 lines (1,295 loc) • 45.7 kB
JavaScript
import { d as dew$c, a as dew$d, e as dew$e, f as dew$f } from './chunk-DtcTpLWz.js';
import { d as dew$g } from './chunk-CkFCi-G1.js';
import { p as process } from './chunk-DEMDiNwt.js';
var exports$c = {},
_dewExec$b = false;
function dew$b() {
if (_dewExec$b) return exports$c;
_dewExec$b = true;
var hasSymbols = dew$c();
/** @type {import('.')} */
exports$c = function hasToStringTagShams() {
return hasSymbols() && !!Symbol.toStringTag;
};
return exports$c;
}
var exports$b = {},
_dewExec$a = false;
function dew$a() {
if (_dewExec$a) return exports$b;
_dewExec$a = true;
var hasToStringTag = dew$b()();
var callBound = dew$d();
var $toString = callBound("Object.prototype.toString");
var isStandardArguments = function isArguments(value) {
if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) {
return false;
}
return $toString(value) === "[object Arguments]";
};
var isLegacyArguments = function isArguments(value) {
if (isStandardArguments(value)) {
return true;
}
return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]";
};
var supportsStandardArguments = function () {
return isStandardArguments(arguments);
}();
isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
exports$b = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
return exports$b;
}
var exports$a = {},
_dewExec$9 = false;
function dew$9() {
if (_dewExec$9) return exports$a;
_dewExec$9 = true;
var toStr = Object.prototype.toString;
var fnToStr = Function.prototype.toString;
var isFnRegex = /^\s*(?:function)?\*/;
var hasToStringTag = dew$b()();
var getProto = Object.getPrototypeOf;
var getGeneratorFunc = function () {
// eslint-disable-line consistent-return
if (!hasToStringTag) {
return false;
}
try {
return Function("return function*() {}")();
} catch (e) {}
};
var GeneratorFunction;
exports$a = function isGeneratorFunction(fn) {
if (typeof fn !== "function") {
return false;
}
if (isFnRegex.test(fnToStr.call(fn))) {
return true;
}
if (!hasToStringTag) {
var str = toStr.call(fn);
return str === "[object GeneratorFunction]";
}
if (!getProto) {
return false;
}
if (typeof GeneratorFunction === "undefined") {
var generatorFunc = getGeneratorFunc();
GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
}
return getProto(fn) === GeneratorFunction;
};
return exports$a;
}
var exports$9 = {},
_dewExec$8 = false;
function dew$8() {
if (_dewExec$8) return exports$9;
_dewExec$8 = true;
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;
};
}
}
exports$9 = 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 exports$9;
}
var exports$8 = {},
_dewExec$7 = false;
function dew$7() {
if (_dewExec$7) return exports$8;
_dewExec$7 = true;
var isCallable = dew$8();
var toStr = Object.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
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);
}
}
}
};
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);
}
}
};
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);
}
}
}
};
var 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 (toStr.call(list) === "[object Array]") {
forEachArray(list, iterator, receiver);
} else if (typeof list === "string") {
forEachString(list, iterator, receiver);
} else {
forEachObject(list, iterator, receiver);
}
};
exports$8 = forEach;
return exports$8;
}
var exports$7 = {},
_dewExec$6 = false;
function dew$6() {
if (_dewExec$6) return exports$7;
_dewExec$6 = true;
/** @type {import('.')} */
exports$7 = ["Float32Array", "Float64Array", "Int8Array", "Int16Array", "Int32Array", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "BigInt64Array", "BigUint64Array"];
return exports$7;
}
var exports$6 = {},
_dewExec$5 = false;
var _global$2 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
function dew$5() {
if (_dewExec$5) return exports$6;
_dewExec$5 = true;
var possibleNames = dew$6();
var g = typeof globalThis === "undefined" ? _global$2 : globalThis;
/** @type {import('.')} */
exports$6 = 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 exports$6;
}
var exports$5 = {},
_dewExec$4 = false;
var _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
function dew$4() {
if (_dewExec$4) return exports$5;
_dewExec$4 = true;
var forEach = dew$7();
var availableTypedArrays = dew$5();
var callBind = dew$e();
var callBound = dew$d();
var gOPD = dew$f();
/** @type {(O: object) => string} */
var $toString = callBound("Object.prototype.toString");
var hasToStringTag = dew$b()();
var g = typeof globalThis === "undefined" ? _global$1 : globalThis;
var typedArrays = availableTypedArrays();
var $slice = callBound("String.prototype.slice");
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) {
for (var i = 0; i < array.length; i += 1) {
if (array[i] === value) {
return i;
}
}
return -1;
};
/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */
/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */
var cache = {
__proto__: null
};
if (hasToStringTag && gOPD && getPrototypeOf) {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
if (Symbol.toStringTag in arr) {
var proto = getPrototypeOf(arr);
// @ts-expect-error TS won't narrow inside a closure
var descriptor = gOPD(proto, Symbol.toStringTag);
if (!descriptor) {
var superProto = getPrototypeOf(proto);
// @ts-expect-error TS won't narrow inside a closure
descriptor = gOPD(superProto, Symbol.toStringTag);
}
// @ts-expect-error TODO: fix
cache["$" + typedArray] = callBind(descriptor.get);
}
});
} else {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
var fn = arr.slice || arr.set;
if (fn) {
// @ts-expect-error TODO: fix
cache["$" + typedArray] = callBind(fn);
}
});
}
/** @type {(value: object) => false | import('.').TypedArrayName} */
var tryTypedArrays = function tryAllTypedArrays(value) {
/** @type {ReturnType<typeof tryAllTypedArrays>} */var found = false;
forEach(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */
cache, /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function (getter, typedArray) {
if (!found) {
try {
// @ts-expect-error TODO: fix
if ("$" + getter(value) === typedArray) {
found = $slice(typedArray, 1);
}
} catch (e) {/**/}
}
});
return found;
};
/** @type {(value: object) => false | import('.').TypedArrayName} */
var trySlices = function tryAllSlices(value) {
/** @type {ReturnType<typeof tryAllSlices>} */var found = false;
forEach(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */
cache, /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */function (getter, name) {
if (!found) {
try {
// @ts-expect-error TODO: fix
getter(value);
found = $slice(name, 1);
} catch (e) {/**/}
}
});
return found;
};
/** @type {import('.')} */
exports$5 = function whichTypedArray(value) {
if (!value || typeof value !== "object") {
return false;
}
if (!hasToStringTag) {
/** @type {string} */
var tag = $slice($toString(value), 8, -1);
if ($indexOf(typedArrays, tag) > -1) {
return tag;
}
if (tag !== "Object") {
return false;
}
// node < 0.6 hits here on real Typed Arrays
return trySlices(value);
}
if (!gOPD) {
return null;
} // unknown engine
return tryTypedArrays(value);
};
return exports$5;
}
var exports$4 = {},
_dewExec$3 = false;
function dew$3() {
if (_dewExec$3) return exports$4;
_dewExec$3 = true;
var whichTypedArray = dew$4();
/** @type {import('.')} */
exports$4 = function isTypedArray(value) {
return !!whichTypedArray(value);
};
return exports$4;
}
var exports$3 = {},
_dewExec$2 = false;
function dew$2() {
if (_dewExec$2) return exports$3;
_dewExec$2 = true;
var isArgumentsObject = dew$a();
var isGeneratorFunction = dew$9();
var whichTypedArray = dew$4();
var isTypedArray = dew$3();
function uncurryThis(f) {
return f.call.bind(f);
}
var BigIntSupported = typeof BigInt !== "undefined";
var SymbolSupported = typeof Symbol !== "undefined";
var ObjectToString = uncurryThis(Object.prototype.toString);
var numberValue = uncurryThis(Number.prototype.valueOf);
var stringValue = uncurryThis(String.prototype.valueOf);
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
if (BigIntSupported) {
var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
}
if (SymbolSupported) {
var symbolValue = uncurryThis(Symbol.prototype.valueOf);
}
function checkBoxedPrimitive(value, prototypeValueOf) {
if (typeof value !== "object") {
return false;
}
try {
prototypeValueOf(value);
return true;
} catch (e) {
return false;
}
}
exports$3.isArgumentsObject = isArgumentsObject;
exports$3.isGeneratorFunction = isGeneratorFunction;
exports$3.isTypedArray = isTypedArray;
// Taken from here and modified for better browser support
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
function isPromise(input) {
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
}
exports$3.isPromise = isPromise;
function isArrayBufferView(value) {
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
return ArrayBuffer.isView(value);
}
return isTypedArray(value) || isDataView(value);
}
exports$3.isArrayBufferView = isArrayBufferView;
function isUint8Array(value) {
return whichTypedArray(value) === "Uint8Array";
}
exports$3.isUint8Array = isUint8Array;
function isUint8ClampedArray(value) {
return whichTypedArray(value) === "Uint8ClampedArray";
}
exports$3.isUint8ClampedArray = isUint8ClampedArray;
function isUint16Array(value) {
return whichTypedArray(value) === "Uint16Array";
}
exports$3.isUint16Array = isUint16Array;
function isUint32Array(value) {
return whichTypedArray(value) === "Uint32Array";
}
exports$3.isUint32Array = isUint32Array;
function isInt8Array(value) {
return whichTypedArray(value) === "Int8Array";
}
exports$3.isInt8Array = isInt8Array;
function isInt16Array(value) {
return whichTypedArray(value) === "Int16Array";
}
exports$3.isInt16Array = isInt16Array;
function isInt32Array(value) {
return whichTypedArray(value) === "Int32Array";
}
exports$3.isInt32Array = isInt32Array;
function isFloat32Array(value) {
return whichTypedArray(value) === "Float32Array";
}
exports$3.isFloat32Array = isFloat32Array;
function isFloat64Array(value) {
return whichTypedArray(value) === "Float64Array";
}
exports$3.isFloat64Array = isFloat64Array;
function isBigInt64Array(value) {
return whichTypedArray(value) === "BigInt64Array";
}
exports$3.isBigInt64Array = isBigInt64Array;
function isBigUint64Array(value) {
return whichTypedArray(value) === "BigUint64Array";
}
exports$3.isBigUint64Array = isBigUint64Array;
function isMapToString(value) {
return ObjectToString(value) === "[object Map]";
}
isMapToString.working = typeof Map !== "undefined" && isMapToString(new Map());
function isMap(value) {
if (typeof Map === "undefined") {
return false;
}
return isMapToString.working ? isMapToString(value) : value instanceof Map;
}
exports$3.isMap = isMap;
function isSetToString(value) {
return ObjectToString(value) === "[object Set]";
}
isSetToString.working = typeof Set !== "undefined" && isSetToString(new Set());
function isSet(value) {
if (typeof Set === "undefined") {
return false;
}
return isSetToString.working ? isSetToString(value) : value instanceof Set;
}
exports$3.isSet = isSet;
function isWeakMapToString(value) {
return ObjectToString(value) === "[object WeakMap]";
}
isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(new WeakMap());
function isWeakMap(value) {
if (typeof WeakMap === "undefined") {
return false;
}
return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
}
exports$3.isWeakMap = isWeakMap;
function isWeakSetToString(value) {
return ObjectToString(value) === "[object WeakSet]";
}
isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(new WeakSet());
function isWeakSet(value) {
return isWeakSetToString(value);
}
exports$3.isWeakSet = isWeakSet;
function isArrayBufferToString(value) {
return ObjectToString(value) === "[object ArrayBuffer]";
}
isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer());
function isArrayBuffer(value) {
if (typeof ArrayBuffer === "undefined") {
return false;
}
return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
}
exports$3.isArrayBuffer = isArrayBuffer;
function isDataViewToString(value) {
return ObjectToString(value) === "[object DataView]";
}
isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1));
function isDataView(value) {
if (typeof DataView === "undefined") {
return false;
}
return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
}
exports$3.isDataView = isDataView;
// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : undefined;
function isSharedArrayBufferToString(value) {
return ObjectToString(value) === "[object SharedArrayBuffer]";
}
function isSharedArrayBuffer(value) {
if (typeof SharedArrayBufferCopy === "undefined") {
return false;
}
if (typeof isSharedArrayBufferToString.working === "undefined") {
isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
}
return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
}
exports$3.isSharedArrayBuffer = isSharedArrayBuffer;
function isAsyncFunction(value) {
return ObjectToString(value) === "[object AsyncFunction]";
}
exports$3.isAsyncFunction = isAsyncFunction;
function isMapIterator(value) {
return ObjectToString(value) === "[object Map Iterator]";
}
exports$3.isMapIterator = isMapIterator;
function isSetIterator(value) {
return ObjectToString(value) === "[object Set Iterator]";
}
exports$3.isSetIterator = isSetIterator;
function isGeneratorObject(value) {
return ObjectToString(value) === "[object Generator]";
}
exports$3.isGeneratorObject = isGeneratorObject;
function isWebAssemblyCompiledModule(value) {
return ObjectToString(value) === "[object WebAssembly.Module]";
}
exports$3.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
function isNumberObject(value) {
return checkBoxedPrimitive(value, numberValue);
}
exports$3.isNumberObject = isNumberObject;
function isStringObject(value) {
return checkBoxedPrimitive(value, stringValue);
}
exports$3.isStringObject = isStringObject;
function isBooleanObject(value) {
return checkBoxedPrimitive(value, booleanValue);
}
exports$3.isBooleanObject = isBooleanObject;
function isBigIntObject(value) {
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
}
exports$3.isBigIntObject = isBigIntObject;
function isSymbolObject(value) {
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
}
exports$3.isSymbolObject = isSymbolObject;
function isBoxedPrimitive(value) {
return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
}
exports$3.isBoxedPrimitive = isBoxedPrimitive;
function isAnyArrayBuffer(value) {
return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
}
exports$3.isAnyArrayBuffer = isAnyArrayBuffer;
["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function (method) {
Object.defineProperty(exports$3, method, {
enumerable: false,
value: function () {
throw new Error(method + " is not supported in userland");
}
});
});
return exports$3;
}
var exports$2 = {},
_dewExec$1 = false;
function dew$1() {
if (_dewExec$1) return exports$2;
_dewExec$1 = true;
exports$2 = function isBuffer(arg) {
return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
};
return exports$2;
}
var exports$1 = {},
_dewExec = false;
var _global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
function dew() {
if (_dewExec) return exports$1;
_dewExec = true;
var process$1 = process;
// 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 getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
var keys = Object.keys(obj);
var descriptors = {};
for (var i = 0; i < keys.length; i++) {
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
}
return descriptors;
};
var formatRegExp = /%[sdj%]/g;
exports$1.format = function (f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(" ");
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function (x) {
if (x === "%%") return "%";
if (i >= len) return x;
switch (x) {
case "%s":
return String(args[i++]);
case "%d":
return Number(args[i++]);
case "%j":
try {
return JSON.stringify(args[i++]);
} catch (_) {
return "[Circular]";
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += " " + x;
} else {
str += " " + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports$1.deprecate = function (fn, msg) {
if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) {
return fn;
}
// Allow for deprecating things in the process of starting up.
if (typeof process$1 === "undefined") {
return function () {
return exports$1.deprecate(fn, msg).apply(this || _global, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
if (process$1.throwDeprecation) {
throw new Error(msg);
} else if (process$1.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this || _global, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnvRegex = /^$/;
if (process$1.env.NODE_DEBUG) {
var debugEnv = process$1.env.NODE_DEBUG;
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
}
exports$1.debuglog = function (set) {
set = set.toUpperCase();
if (!debugs[set]) {
if (debugEnvRegex.test(set)) {
var pid = process$1.pid;
debugs[set] = function () {
var msg = exports$1.format.apply(exports$1, arguments);
console.error("%s %d: %s", set, pid, msg);
};
} else {
debugs[set] = function () {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports$1._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports$1.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
"bold": [1, 22],
"italic": [3, 23],
"underline": [4, 24],
"inverse": [7, 27],
"white": [37, 39],
"grey": [90, 39],
"black": [30, 39],
"blue": [34, 39],
"cyan": [36, 39],
"green": [32, 39],
"magenta": [35, 39],
"red": [31, 39],
"yellow": [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
"special": "cyan",
"number": "yellow",
"boolean": "yellow",
"undefined": "grey",
"null": "bold",
"string": "green",
"date": "magenta",
// "name": intentionally not styling
"regexp": "red"
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function (val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect && value && isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports$1.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ": " + value.name : "";
return ctx.stylize("[Function" + name + "]", "special");
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), "date");
}
if (isError(value)) {
return formatError(value);
}
}
var base = "",
array = false,
braces = ["{", "}"];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ["[", "]"];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ": " + value.name : "";
base = " [Function" + n + "]";
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = " " + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = " " + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = " " + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
} else {
return ctx.stylize("[Object]", "special");
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function (key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
if (isString(value)) {
var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, "\"") + "'";
return ctx.stylize(simple, "string");
}
if (isNumber(value)) return ctx.stylize("" + value, "number");
if (isBoolean(value)) return ctx.stylize("" + value, "boolean");
// For some reason typeof null is "object", so special case here.
if (isNull(value)) return ctx.stylize("null", "null");
}
function formatError(value) {
return "[" + Error.prototype.toString.call(value) + "]";
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
} else {
output.push("");
}
}
keys.forEach(function (key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || {
value: value[key]
};
if (desc.get) {
if (desc.set) {
str = ctx.stylize("[Getter/Setter]", "special");
} else {
str = ctx.stylize("[Getter]", "special");
}
} else {
if (desc.set) {
str = ctx.stylize("[Setter]", "special");
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = "[" + key + "]";
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf("\n") > -1) {
if (array) {
str = str.split("\n").map(function (line) {
return " " + line;
}).join("\n").slice(2);
} else {
str = "\n" + str.split("\n").map(function (line) {
return " " + line;
}).join("\n");
}
}
} else {
str = ctx.stylize("[Circular]", "special");
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify("" + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.slice(1, -1);
name = ctx.stylize(name, "name");
} else {
name = name.replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, "string");
}
}
return name + ": " + str;
}
function reduceToSingleString(output, base, braces) {
var length = output.reduce(function (prev, cur) {
if (cur.indexOf("\n") >= 0) ;
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
if (length > 60) {
return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
}
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
exports$1.types = dew$2();
function isArray(ar) {
return Array.isArray(ar);
}
exports$1.isArray = isArray;
function isBoolean(arg) {
return typeof arg === "boolean";
}
exports$1.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports$1.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports$1.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === "number";
}
exports$1.isNumber = isNumber;
function isString(arg) {
return typeof arg === "string";
}
exports$1.isString = isString;
function isSymbol(arg) {
return typeof arg === "symbol";
}
exports$1.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports$1.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === "[object RegExp]";
}
exports$1.isRegExp = isRegExp;
exports$1.types.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === "object" && arg !== null;
}
exports$1.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === "[object Date]";
}
exports$1.isDate = isDate;
exports$1.types.isDate = isDate;
function isError(e) {
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
}
exports$1.isError = isError;
exports$1.types.isNativeError = isError;
function isFunction(arg) {
return typeof arg === "function";
}
exports$1.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$1.isPrimitive = isPrimitive;
exports$1.isBuffer = dew$1();
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? "0" + n.toString(10) : n.toString(10);
}
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
return [d.getDate(), months[d.getMonth()], time].join(" ");
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports$1.log = function () {
console.log("%s - %s", timestamp(), exports$1.format.apply(exports$1, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports$1.inherits = dew$g();
exports$1._extend = function (origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : undefined;
exports$1.promisify = function promisify(original) {
if (typeof original !== "function") throw new TypeError("The \"original\" argument must be of type Function");
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== "function") {
throw new TypeError("The \"util.promisify.custom\" argument must be of type Function");
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return fn;
}
function fn() {
var promiseResolve, promiseReject;
var promise = new Promise(function (resolve, reject) {
promiseResolve = resolve;
promiseReject = reject;
});
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
args.push(function (err, value) {
if (err) {
promiseReject(err);
} else {
promiseResolve(value);
}
});
try {
original.apply(this || _global, args);
} catch (err) {
promiseReject(err);
}
return promise;
}
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
};
exports$1.promisify.custom = kCustomPromisifiedSymbol;
function callbackifyOnRejected(reason, cb) {
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
// Because `null` is a special error value in callbacks which means "no error
// occurred", we error-wrap so the callback consumer can distinguish between
// "the promise rejected with null" or "the promise fulfilled with undefined".
if (!reason) {
var newReason = new Error("Promise was rejected with a falsy value");
newReason.reason = reason;
reason = newReason;
}
return cb(reason);
}
function callbackify(original) {
if (typeof original !== "function") {
throw new TypeError("The \"original\" argument must be of type Function");
}
// We DO NOT return the promise as it gives the user a false sense that
// the promise is actually somehow related to the callback's execution
// and that the callback throwing will reject the promise.
function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== "function") {
throw new TypeError("The last argument must be of type Function");
}
var self = this || _global;
var cb = function () {
return maybeCb.apply(self, arguments);
};
// In true node style we process the callback on `nextTick` with all the
// implications (stack, `uncaughtException`, `async_hooks`)
original.apply(this || _global, args).then(function (ret) {
process$1.nextTick(cb.bind(null, null, ret));
}, function (rej) {
process$1.nextTick(callbackifyOnRejected.bind(null, rej, cb));
});
}
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
return callbackified;
}
exports$1.callbackify = callbackify;
return exports$1;
}
const exports = dew();
exports['format']; exports['deprecate']; exports['debuglog']; exports['inspect']; exports['types']; exports['isArray']; exports['isBoolean']; exports['isNull']; exports['isNullOrUndefined']; exports['isNumber']; exports['isString']; exports['isSymbol']; exports['isUndefined']; exports['isRegExp']; exports['isObject']; exports['isDate']; exports['isError']; exports['isFunction']; exports['isPrimitive']; exports['isBuffer']; exports['log']; exports['inherits']; exports['_extend']; exports['promisify']; exports['callbackify'];
var _extend = exports._extend;
var callbackify = exports.callbackify;
var debuglog = exports.debuglog;
var deprecate = exports.deprecate;
var format = exports.format;
var inherits = exports.inherits;
var inspect = exports.inspect;
var isArray = exports.isArray;
var isBoolean = exports.isBoolean;
var isBuffer = exports.isBuffer;
var isDate = exports.isDate;
var isError = exports.isError;
var isFunction = exports.isFunction;
var isNull = exports.isNull;
var isNullOrUndefined = exports.isNullOrUndefined;
var isNumber = exports.isNumber;
var isObject = exports.isObject;
var isPrimitive = exports.isPrimitive;
var isRegExp = exports.isRegExp;
var isString = exports.isString;
var isSymbol = exports.isSymbol;
var isUndefined = exports.isUndefined;
var log = exports.log;
var promisify = exports.promisify;
var types = exports.types;
const TextEncoder = exports.TextEncoder = globalThis.TextEncoder;
const TextDecoder = exports.TextDecoder = globalThis.TextDecoder;
export { TextDecoder, TextEncoder, _extend, callbackify, debuglog, exports as default, deprecate, format, inherits, inspect, isArray, isBoolean, isBuffer, isDate, isError, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, log, promisify, types };